diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_count_with_no_group_by__plan0.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_count_with_no_group_by__plan0.sql
index f2c62d3757..0282f8a446 100644
--- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_count_with_no_group_by__plan0.sql
+++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_count_with_no_group_by__plan0.sql
@@ -1,343 +1,343 @@
-- Compute Metrics via Expressions
SELECT
- subq_14.buys AS visit_buy_conversions
+ subq_23.buys AS visit_buy_conversions
FROM (
-- Combine Aggregated Outputs
SELECT
- MAX(subq_3.visits) AS visits
- , COALESCE(MAX(subq_13.buys), 0) AS buys
+ MAX(subq_12.visits) AS visits
+ , COALESCE(MAX(subq_22.buys), 0) AS buys
FROM (
-- Aggregate Measures
SELECT
- SUM(subq_2.visits) AS visits
+ SUM(subq_11.visits) AS visits
FROM (
-- Pass Only Elements: ['visits',]
SELECT
- subq_1.visits
+ subq_10.visits
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.visit__ds__day
- , subq_0.visit__ds__week
- , subq_0.visit__ds__month
- , subq_0.visit__ds__quarter
- , subq_0.visit__ds__year
- , subq_0.visit__ds__extract_year
- , subq_0.visit__ds__extract_quarter
- , subq_0.visit__ds__extract_month
- , subq_0.visit__ds__extract_day
- , subq_0.visit__ds__extract_dow
- , subq_0.visit__ds__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.user
- , subq_0.session
- , subq_0.visit__user
- , subq_0.visit__session
- , subq_0.referrer_id
- , subq_0.visit__referrer_id
- , subq_0.visits
- , subq_0.visitors
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.visit__ds__day
+ , subq_9.visit__ds__week
+ , subq_9.visit__ds__month
+ , subq_9.visit__ds__quarter
+ , subq_9.visit__ds__year
+ , subq_9.visit__ds__extract_year
+ , subq_9.visit__ds__extract_quarter
+ , subq_9.visit__ds__extract_month
+ , subq_9.visit__ds__extract_day
+ , subq_9.visit__ds__extract_dow
+ , subq_9.visit__ds__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.user
+ , subq_9.session
+ , subq_9.visit__user
+ , subq_9.visit__session
+ , subq_9.referrer_id
+ , subq_9.visit__referrer_id
+ , subq_9.visits
+ , subq_9.visitors
FROM (
-- Read Elements From Semantic Model 'visits_source'
SELECT
1 AS visits
- , visits_source_src_28011.user_id AS visitors
- , DATE_TRUNC(visits_source_src_28011.ds, day) AS ds__day
- , DATE_TRUNC(visits_source_src_28011.ds, isoweek) AS ds__week
- , DATE_TRUNC(visits_source_src_28011.ds, month) AS ds__month
- , DATE_TRUNC(visits_source_src_28011.ds, quarter) AS ds__quarter
- , DATE_TRUNC(visits_source_src_28011.ds, year) AS ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM visits_source_src_28011.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_28011.ds) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM visits_source_src_28011.ds) AS ds__extract_doy
- , visits_source_src_28011.referrer_id
- , DATE_TRUNC(visits_source_src_28011.ds, day) AS visit__ds__day
- , DATE_TRUNC(visits_source_src_28011.ds, isoweek) AS visit__ds__week
- , DATE_TRUNC(visits_source_src_28011.ds, month) AS visit__ds__month
- , DATE_TRUNC(visits_source_src_28011.ds, quarter) AS visit__ds__quarter
- , DATE_TRUNC(visits_source_src_28011.ds, year) AS visit__ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day
- , IF(EXTRACT(dayofweek FROM visits_source_src_28011.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_28011.ds) - 1) AS visit__ds__extract_dow
- , EXTRACT(dayofyear FROM visits_source_src_28011.ds) AS visit__ds__extract_doy
- , visits_source_src_28011.referrer_id AS visit__referrer_id
- , visits_source_src_28011.user_id AS user
- , visits_source_src_28011.session_id AS session
- , visits_source_src_28011.user_id AS visit__user
- , visits_source_src_28011.session_id AS visit__session
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_0
- ) subq_1
- ) subq_2
- ) subq_3
+ , 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
+ , 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS ds__extract_day
+ , 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
+ , 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS visit__ds__extract_day
+ , IF(EXTRACT(dayofweek FROM visits_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_28000.ds) - 1) AS visit__ds__extract_dow
+ , EXTRACT(dayofyear FROM visits_source_src_28000.ds) AS visit__ds__extract_doy
+ , visits_source_src_28000.referrer_id AS visit__referrer_id
+ , visits_source_src_28000.user_id AS user
+ , visits_source_src_28000.session_id AS session
+ , visits_source_src_28000.user_id AS visit__user
+ , visits_source_src_28000.session_id AS visit__session
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
+ ) subq_12
CROSS JOIN (
-- Aggregate Measures
SELECT
- SUM(subq_12.buys) AS buys
+ SUM(subq_21.buys) AS buys
FROM (
-- Pass Only Elements: ['buys',]
SELECT
- subq_11.buys
+ subq_20.buys
FROM (
-- Find conversions for user within the range of 7 day
SELECT
- subq_10.ds__day
- , subq_10.user
- , subq_10.buys
- , subq_10.visits
+ subq_19.ds__day
+ , subq_19.user
+ , subq_19.buys
+ , subq_19.visits
FROM (
-- Dedupe the fanout with mf_internal_uuid in the conversion data set
SELECT DISTINCT
- first_value(subq_6.visits) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
- , first_value(subq_6.ds__day) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
- , first_value(subq_6.user) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
- , subq_9.mf_internal_uuid AS mf_internal_uuid
- , subq_9.buys AS buys
+ first_value(subq_15.visits) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
+ , first_value(subq_15.ds__day) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
+ , first_value(subq_15.user) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
+ , subq_18.mf_internal_uuid AS mf_internal_uuid
+ , subq_18.buys AS buys
FROM (
-- Pass Only Elements: ['visits', 'ds__day', 'user']
SELECT
- subq_5.ds__day
- , subq_5.user
- , subq_5.visits
+ subq_14.ds__day
+ , subq_14.user
+ , subq_14.visits
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_4.ds__day
- , subq_4.ds__week
- , subq_4.ds__month
- , subq_4.ds__quarter
- , subq_4.ds__year
- , subq_4.ds__extract_year
- , subq_4.ds__extract_quarter
- , subq_4.ds__extract_month
- , subq_4.ds__extract_day
- , subq_4.ds__extract_dow
- , subq_4.ds__extract_doy
- , subq_4.visit__ds__day
- , subq_4.visit__ds__week
- , subq_4.visit__ds__month
- , subq_4.visit__ds__quarter
- , subq_4.visit__ds__year
- , subq_4.visit__ds__extract_year
- , subq_4.visit__ds__extract_quarter
- , subq_4.visit__ds__extract_month
- , subq_4.visit__ds__extract_day
- , subq_4.visit__ds__extract_dow
- , subq_4.visit__ds__extract_doy
- , subq_4.ds__day AS metric_time__day
- , subq_4.ds__week AS metric_time__week
- , subq_4.ds__month AS metric_time__month
- , subq_4.ds__quarter AS metric_time__quarter
- , subq_4.ds__year AS metric_time__year
- , subq_4.ds__extract_year AS metric_time__extract_year
- , subq_4.ds__extract_quarter AS metric_time__extract_quarter
- , subq_4.ds__extract_month AS metric_time__extract_month
- , subq_4.ds__extract_day AS metric_time__extract_day
- , subq_4.ds__extract_dow AS metric_time__extract_dow
- , subq_4.ds__extract_doy AS metric_time__extract_doy
- , subq_4.user
- , subq_4.session
- , subq_4.visit__user
- , subq_4.visit__session
- , subq_4.referrer_id
- , subq_4.visit__referrer_id
- , subq_4.visits
- , subq_4.visitors
+ subq_13.ds__day
+ , subq_13.ds__week
+ , subq_13.ds__month
+ , subq_13.ds__quarter
+ , subq_13.ds__year
+ , subq_13.ds__extract_year
+ , subq_13.ds__extract_quarter
+ , subq_13.ds__extract_month
+ , subq_13.ds__extract_day
+ , subq_13.ds__extract_dow
+ , subq_13.ds__extract_doy
+ , subq_13.visit__ds__day
+ , subq_13.visit__ds__week
+ , subq_13.visit__ds__month
+ , subq_13.visit__ds__quarter
+ , subq_13.visit__ds__year
+ , subq_13.visit__ds__extract_year
+ , subq_13.visit__ds__extract_quarter
+ , subq_13.visit__ds__extract_month
+ , subq_13.visit__ds__extract_day
+ , subq_13.visit__ds__extract_dow
+ , subq_13.visit__ds__extract_doy
+ , subq_13.ds__day AS metric_time__day
+ , subq_13.ds__week AS metric_time__week
+ , subq_13.ds__month AS metric_time__month
+ , subq_13.ds__quarter AS metric_time__quarter
+ , subq_13.ds__year AS metric_time__year
+ , subq_13.ds__extract_year AS metric_time__extract_year
+ , subq_13.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_13.ds__extract_month AS metric_time__extract_month
+ , subq_13.ds__extract_day AS metric_time__extract_day
+ , subq_13.ds__extract_dow AS metric_time__extract_dow
+ , subq_13.ds__extract_doy AS metric_time__extract_doy
+ , subq_13.user
+ , subq_13.session
+ , subq_13.visit__user
+ , subq_13.visit__session
+ , subq_13.referrer_id
+ , subq_13.visit__referrer_id
+ , subq_13.visits
+ , subq_13.visitors
FROM (
-- Read Elements From Semantic Model 'visits_source'
SELECT
1 AS visits
- , visits_source_src_28011.user_id AS visitors
- , DATE_TRUNC(visits_source_src_28011.ds, day) AS ds__day
- , DATE_TRUNC(visits_source_src_28011.ds, isoweek) AS ds__week
- , DATE_TRUNC(visits_source_src_28011.ds, month) AS ds__month
- , DATE_TRUNC(visits_source_src_28011.ds, quarter) AS ds__quarter
- , DATE_TRUNC(visits_source_src_28011.ds, year) AS ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM visits_source_src_28011.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_28011.ds) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM visits_source_src_28011.ds) AS ds__extract_doy
- , visits_source_src_28011.referrer_id
- , DATE_TRUNC(visits_source_src_28011.ds, day) AS visit__ds__day
- , DATE_TRUNC(visits_source_src_28011.ds, isoweek) AS visit__ds__week
- , DATE_TRUNC(visits_source_src_28011.ds, month) AS visit__ds__month
- , DATE_TRUNC(visits_source_src_28011.ds, quarter) AS visit__ds__quarter
- , DATE_TRUNC(visits_source_src_28011.ds, year) AS visit__ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day
- , IF(EXTRACT(dayofweek FROM visits_source_src_28011.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_28011.ds) - 1) AS visit__ds__extract_dow
- , EXTRACT(dayofyear FROM visits_source_src_28011.ds) AS visit__ds__extract_doy
- , visits_source_src_28011.referrer_id AS visit__referrer_id
- , visits_source_src_28011.user_id AS user
- , visits_source_src_28011.session_id AS session
- , visits_source_src_28011.user_id AS visit__user
- , visits_source_src_28011.session_id AS visit__session
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_4
- ) subq_5
- ) subq_6
+ , 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
+ , 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS ds__extract_day
+ , 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
+ , 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS visit__ds__extract_day
+ , IF(EXTRACT(dayofweek FROM visits_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_28000.ds) - 1) AS visit__ds__extract_dow
+ , EXTRACT(dayofyear FROM visits_source_src_28000.ds) AS visit__ds__extract_doy
+ , visits_source_src_28000.referrer_id AS visit__referrer_id
+ , visits_source_src_28000.user_id AS user
+ , visits_source_src_28000.session_id AS session
+ , visits_source_src_28000.user_id AS visit__user
+ , visits_source_src_28000.session_id AS visit__session
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_13
+ ) subq_14
+ ) subq_15
INNER JOIN (
-- Add column with generated UUID
SELECT
- subq_8.ds__day
- , subq_8.ds__week
- , subq_8.ds__month
- , subq_8.ds__quarter
- , subq_8.ds__year
- , subq_8.ds__extract_year
- , subq_8.ds__extract_quarter
- , subq_8.ds__extract_month
- , subq_8.ds__extract_day
- , subq_8.ds__extract_dow
- , subq_8.ds__extract_doy
- , subq_8.buy__ds__day
- , subq_8.buy__ds__week
- , subq_8.buy__ds__month
- , subq_8.buy__ds__quarter
- , subq_8.buy__ds__year
- , subq_8.buy__ds__extract_year
- , subq_8.buy__ds__extract_quarter
- , subq_8.buy__ds__extract_month
- , subq_8.buy__ds__extract_day
- , subq_8.buy__ds__extract_dow
- , subq_8.buy__ds__extract_doy
- , subq_8.metric_time__day
- , subq_8.metric_time__week
- , subq_8.metric_time__month
- , subq_8.metric_time__quarter
- , subq_8.metric_time__year
- , subq_8.metric_time__extract_year
- , subq_8.metric_time__extract_quarter
- , subq_8.metric_time__extract_month
- , subq_8.metric_time__extract_day
- , subq_8.metric_time__extract_dow
- , subq_8.metric_time__extract_doy
- , subq_8.user
- , subq_8.session_id
- , subq_8.buy__user
- , subq_8.buy__session_id
- , subq_8.buys
- , subq_8.buyers
+ subq_17.ds__day
+ , subq_17.ds__week
+ , subq_17.ds__month
+ , subq_17.ds__quarter
+ , subq_17.ds__year
+ , subq_17.ds__extract_year
+ , subq_17.ds__extract_quarter
+ , subq_17.ds__extract_month
+ , subq_17.ds__extract_day
+ , subq_17.ds__extract_dow
+ , subq_17.ds__extract_doy
+ , subq_17.buy__ds__day
+ , subq_17.buy__ds__week
+ , subq_17.buy__ds__month
+ , subq_17.buy__ds__quarter
+ , subq_17.buy__ds__year
+ , subq_17.buy__ds__extract_year
+ , subq_17.buy__ds__extract_quarter
+ , subq_17.buy__ds__extract_month
+ , subq_17.buy__ds__extract_day
+ , subq_17.buy__ds__extract_dow
+ , subq_17.buy__ds__extract_doy
+ , subq_17.metric_time__day
+ , subq_17.metric_time__week
+ , subq_17.metric_time__month
+ , subq_17.metric_time__quarter
+ , subq_17.metric_time__year
+ , subq_17.metric_time__extract_year
+ , subq_17.metric_time__extract_quarter
+ , subq_17.metric_time__extract_month
+ , subq_17.metric_time__extract_day
+ , subq_17.metric_time__extract_dow
+ , subq_17.metric_time__extract_doy
+ , subq_17.user
+ , subq_17.session_id
+ , subq_17.buy__user
+ , subq_17.buy__session_id
+ , subq_17.buys
+ , subq_17.buyers
, GENERATE_UUID() AS mf_internal_uuid
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_7.ds__day
- , subq_7.ds__week
- , subq_7.ds__month
- , subq_7.ds__quarter
- , subq_7.ds__year
- , subq_7.ds__extract_year
- , subq_7.ds__extract_quarter
- , subq_7.ds__extract_month
- , subq_7.ds__extract_day
- , subq_7.ds__extract_dow
- , subq_7.ds__extract_doy
- , subq_7.buy__ds__day
- , subq_7.buy__ds__week
- , subq_7.buy__ds__month
- , subq_7.buy__ds__quarter
- , subq_7.buy__ds__year
- , subq_7.buy__ds__extract_year
- , subq_7.buy__ds__extract_quarter
- , subq_7.buy__ds__extract_month
- , subq_7.buy__ds__extract_day
- , subq_7.buy__ds__extract_dow
- , subq_7.buy__ds__extract_doy
- , subq_7.ds__day AS metric_time__day
- , subq_7.ds__week AS metric_time__week
- , subq_7.ds__month AS metric_time__month
- , subq_7.ds__quarter AS metric_time__quarter
- , subq_7.ds__year AS metric_time__year
- , subq_7.ds__extract_year AS metric_time__extract_year
- , subq_7.ds__extract_quarter AS metric_time__extract_quarter
- , subq_7.ds__extract_month AS metric_time__extract_month
- , subq_7.ds__extract_day AS metric_time__extract_day
- , subq_7.ds__extract_dow AS metric_time__extract_dow
- , subq_7.ds__extract_doy AS metric_time__extract_doy
- , subq_7.user
- , subq_7.session_id
- , subq_7.buy__user
- , subq_7.buy__session_id
- , subq_7.buys
- , subq_7.buyers
+ subq_16.ds__day
+ , subq_16.ds__week
+ , subq_16.ds__month
+ , subq_16.ds__quarter
+ , subq_16.ds__year
+ , subq_16.ds__extract_year
+ , subq_16.ds__extract_quarter
+ , subq_16.ds__extract_month
+ , subq_16.ds__extract_day
+ , subq_16.ds__extract_dow
+ , subq_16.ds__extract_doy
+ , subq_16.buy__ds__day
+ , subq_16.buy__ds__week
+ , subq_16.buy__ds__month
+ , subq_16.buy__ds__quarter
+ , subq_16.buy__ds__year
+ , subq_16.buy__ds__extract_year
+ , subq_16.buy__ds__extract_quarter
+ , subq_16.buy__ds__extract_month
+ , subq_16.buy__ds__extract_day
+ , subq_16.buy__ds__extract_dow
+ , subq_16.buy__ds__extract_doy
+ , subq_16.ds__day AS metric_time__day
+ , subq_16.ds__week AS metric_time__week
+ , subq_16.ds__month AS metric_time__month
+ , subq_16.ds__quarter AS metric_time__quarter
+ , subq_16.ds__year AS metric_time__year
+ , subq_16.ds__extract_year AS metric_time__extract_year
+ , subq_16.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_16.ds__extract_month AS metric_time__extract_month
+ , subq_16.ds__extract_day AS metric_time__extract_day
+ , subq_16.ds__extract_dow AS metric_time__extract_dow
+ , subq_16.ds__extract_doy AS metric_time__extract_doy
+ , subq_16.user
+ , subq_16.session_id
+ , subq_16.buy__user
+ , subq_16.buy__session_id
+ , subq_16.buys
+ , subq_16.buyers
FROM (
-- Read Elements From Semantic Model 'buys_source'
SELECT
1 AS buys
- , buys_source_src_28002.user_id AS buyers
- , DATE_TRUNC(buys_source_src_28002.ds, day) AS ds__day
- , DATE_TRUNC(buys_source_src_28002.ds, isoweek) AS ds__week
- , DATE_TRUNC(buys_source_src_28002.ds, month) AS ds__month
- , DATE_TRUNC(buys_source_src_28002.ds, quarter) AS ds__quarter
- , DATE_TRUNC(buys_source_src_28002.ds, year) AS ds__year
- , EXTRACT(year FROM buys_source_src_28002.ds) AS ds__extract_year
- , EXTRACT(quarter FROM buys_source_src_28002.ds) AS ds__extract_quarter
- , EXTRACT(month FROM buys_source_src_28002.ds) AS ds__extract_month
- , EXTRACT(day FROM buys_source_src_28002.ds) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM buys_source_src_28002.ds) = 1, 7, EXTRACT(dayofweek FROM buys_source_src_28002.ds) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM buys_source_src_28002.ds) AS ds__extract_doy
- , DATE_TRUNC(buys_source_src_28002.ds, day) AS buy__ds__day
- , DATE_TRUNC(buys_source_src_28002.ds, isoweek) AS buy__ds__week
- , DATE_TRUNC(buys_source_src_28002.ds, month) AS buy__ds__month
- , DATE_TRUNC(buys_source_src_28002.ds, quarter) AS buy__ds__quarter
- , DATE_TRUNC(buys_source_src_28002.ds, year) AS buy__ds__year
- , EXTRACT(year FROM buys_source_src_28002.ds) AS buy__ds__extract_year
- , EXTRACT(quarter FROM buys_source_src_28002.ds) AS buy__ds__extract_quarter
- , EXTRACT(month FROM buys_source_src_28002.ds) AS buy__ds__extract_month
- , EXTRACT(day FROM buys_source_src_28002.ds) AS buy__ds__extract_day
- , IF(EXTRACT(dayofweek FROM buys_source_src_28002.ds) = 1, 7, EXTRACT(dayofweek FROM buys_source_src_28002.ds) - 1) AS buy__ds__extract_dow
- , EXTRACT(dayofyear FROM buys_source_src_28002.ds) AS buy__ds__extract_doy
- , buys_source_src_28002.user_id AS user
- , buys_source_src_28002.session_id
- , buys_source_src_28002.user_id AS buy__user
- , buys_source_src_28002.session_id AS buy__session_id
- FROM ***************************.fct_buys buys_source_src_28002
- ) subq_7
- ) subq_8
- ) subq_9
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM buys_source_src_28000.ds) AS buy__ds__extract_day
+ , IF(EXTRACT(dayofweek FROM buys_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM buys_source_src_28000.ds) - 1) AS buy__ds__extract_dow
+ , EXTRACT(dayofyear FROM buys_source_src_28000.ds) AS buy__ds__extract_doy
+ , buys_source_src_28000.user_id AS user
+ , buys_source_src_28000.session_id
+ , buys_source_src_28000.user_id AS buy__user
+ , buys_source_src_28000.session_id AS buy__session_id
+ FROM ***************************.fct_buys buys_source_src_28000
+ ) subq_16
+ ) subq_17
+ ) subq_18
ON
(
- subq_6.user = subq_9.user
+ subq_15.user = subq_18.user
) AND (
(
- subq_6.ds__day <= subq_9.ds__day
+ subq_15.ds__day <= subq_18.ds__day
) AND (
- subq_6.ds__day > DATE_SUB(CAST(subq_9.ds__day AS DATETIME), INTERVAL 7 day)
+ subq_15.ds__day > DATE_SUB(CAST(subq_18.ds__day AS DATETIME), INTERVAL 7 day)
)
)
- ) subq_10
- ) subq_11
- ) subq_12
- ) subq_13
-) subq_14
+ ) subq_19
+ ) subq_20
+ ) subq_21
+ ) subq_22
+) subq_23
diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_count_with_no_group_by__plan0_optimized.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_count_with_no_group_by__plan0_optimized.sql
index cd16ddbf70..0e871003e2 100644
--- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_count_with_no_group_by__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_count_with_no_group_by__plan0_optimized.sql
@@ -1,7 +1,7 @@
-- Combine Aggregated Outputs
-- Compute Metrics via Expressions
SELECT
- COALESCE(MAX(subq_28.buys), 0) AS visit_buy_conversions
+ COALESCE(MAX(subq_37.buys), 0) AS visit_buy_conversions
FROM (
-- Read Elements From Semantic Model 'visits_source'
-- Metric Time Dimension 'ds'
@@ -9,8 +9,8 @@ FROM (
-- Aggregate Measures
SELECT
SUM(1) AS visits
- FROM ***************************.fct_visits visits_source_src_28011
-) subq_18
+ FROM ***************************.fct_visits visits_source_src_28000
+) subq_27
CROSS JOIN (
-- Find conversions for user within the range of 7 day
-- Pass Only Elements: ['buys',]
@@ -20,11 +20,11 @@ CROSS JOIN (
FROM (
-- Dedupe the fanout with mf_internal_uuid in the conversion data set
SELECT DISTINCT
- first_value(subq_21.visits) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
- , first_value(subq_21.ds__day) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
- , first_value(subq_21.user) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
- , subq_24.mf_internal_uuid AS mf_internal_uuid
- , subq_24.buys AS buys
+ first_value(subq_30.visits) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
+ , first_value(subq_30.ds__day) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
+ , first_value(subq_30.user) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
+ , subq_33.mf_internal_uuid AS mf_internal_uuid
+ , subq_33.buys AS buys
FROM (
-- Read Elements From Semantic Model 'visits_source'
-- Metric Time Dimension 'ds'
@@ -33,8 +33,8 @@ CROSS JOIN (
DATE_TRUNC(ds, day) AS ds__day
, user_id AS user
, 1 AS visits
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_21
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_30
INNER JOIN (
-- Read Elements From Semantic Model 'buys_source'
-- Metric Time Dimension 'ds'
@@ -44,17 +44,17 @@ CROSS JOIN (
, user_id AS user
, 1 AS buys
, GENERATE_UUID() AS mf_internal_uuid
- FROM ***************************.fct_buys buys_source_src_28002
- ) subq_24
+ FROM ***************************.fct_buys buys_source_src_28000
+ ) subq_33
ON
(
- subq_21.user = subq_24.user
+ subq_30.user = subq_33.user
) AND (
(
- subq_21.ds__day <= subq_24.ds__day
+ subq_30.ds__day <= subq_33.ds__day
) AND (
- subq_21.ds__day > DATE_SUB(CAST(subq_24.ds__day AS DATETIME), INTERVAL 7 day)
+ subq_30.ds__day > DATE_SUB(CAST(subq_33.ds__day AS DATETIME), INTERVAL 7 day)
)
)
- ) subq_25
-) subq_28
+ ) subq_34
+) subq_37
diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate__plan0.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate__plan0.sql
index 3a164d16c2..ce92108969 100644
--- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate__plan0.sql
+++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate__plan0.sql
@@ -1,352 +1,356 @@
-- Compute Metrics via Expressions
SELECT
- subq_14.visit__referrer_id
- , CAST(subq_14.buys AS FLOAT64) / CAST(NULLIF(subq_14.visits, 0) AS FLOAT64) AS visit_buy_conversion_rate
+ subq_23.visit__referrer_id
+ , CAST(subq_23.buys AS FLOAT64) / CAST(NULLIF(subq_23.visits, 0) AS FLOAT64) AS visit_buy_conversion_rate
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_3.visit__referrer_id, subq_13.visit__referrer_id) AS visit__referrer_id
- , MAX(subq_3.visits) AS visits
- , MAX(subq_13.buys) AS buys
+ COALESCE(subq_12.visit__referrer_id, subq_22.visit__referrer_id) AS visit__referrer_id
+ , MAX(subq_12.visits) AS visits
+ , MAX(subq_22.buys) AS buys
FROM (
-- Aggregate Measures
SELECT
- subq_2.visit__referrer_id
- , SUM(subq_2.visits) AS visits
+ subq_11.visit__referrer_id
+ , SUM(subq_11.visits) AS visits
FROM (
-- Pass Only Elements: ['visits', 'visit__referrer_id']
SELECT
- subq_1.visit__referrer_id
- , subq_1.visits
+ subq_10.visit__referrer_id
+ , subq_10.visits
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.visit__ds__day
- , subq_0.visit__ds__week
- , subq_0.visit__ds__month
- , subq_0.visit__ds__quarter
- , subq_0.visit__ds__year
- , subq_0.visit__ds__extract_year
- , subq_0.visit__ds__extract_quarter
- , subq_0.visit__ds__extract_month
- , subq_0.visit__ds__extract_day
- , subq_0.visit__ds__extract_dow
- , subq_0.visit__ds__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.user
- , subq_0.session
- , subq_0.visit__user
- , subq_0.visit__session
- , subq_0.referrer_id
- , subq_0.visit__referrer_id
- , subq_0.visits
- , subq_0.visitors
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.visit__ds__day
+ , subq_9.visit__ds__week
+ , subq_9.visit__ds__month
+ , subq_9.visit__ds__quarter
+ , subq_9.visit__ds__year
+ , subq_9.visit__ds__extract_year
+ , subq_9.visit__ds__extract_quarter
+ , subq_9.visit__ds__extract_month
+ , subq_9.visit__ds__extract_day
+ , subq_9.visit__ds__extract_dow
+ , subq_9.visit__ds__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.user
+ , subq_9.session
+ , subq_9.visit__user
+ , subq_9.visit__session
+ , subq_9.referrer_id
+ , subq_9.visit__referrer_id
+ , subq_9.visits
+ , subq_9.visitors
FROM (
-- Read Elements From Semantic Model 'visits_source'
SELECT
1 AS visits
- , visits_source_src_28011.user_id AS visitors
- , DATE_TRUNC(visits_source_src_28011.ds, day) AS ds__day
- , DATE_TRUNC(visits_source_src_28011.ds, isoweek) AS ds__week
- , DATE_TRUNC(visits_source_src_28011.ds, month) AS ds__month
- , DATE_TRUNC(visits_source_src_28011.ds, quarter) AS ds__quarter
- , DATE_TRUNC(visits_source_src_28011.ds, year) AS ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM visits_source_src_28011.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_28011.ds) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM visits_source_src_28011.ds) AS ds__extract_doy
- , visits_source_src_28011.referrer_id
- , DATE_TRUNC(visits_source_src_28011.ds, day) AS visit__ds__day
- , DATE_TRUNC(visits_source_src_28011.ds, isoweek) AS visit__ds__week
- , DATE_TRUNC(visits_source_src_28011.ds, month) AS visit__ds__month
- , DATE_TRUNC(visits_source_src_28011.ds, quarter) AS visit__ds__quarter
- , DATE_TRUNC(visits_source_src_28011.ds, year) AS visit__ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day
- , IF(EXTRACT(dayofweek FROM visits_source_src_28011.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_28011.ds) - 1) AS visit__ds__extract_dow
- , EXTRACT(dayofyear FROM visits_source_src_28011.ds) AS visit__ds__extract_doy
- , visits_source_src_28011.referrer_id AS visit__referrer_id
- , visits_source_src_28011.user_id AS user
- , visits_source_src_28011.session_id AS session
- , visits_source_src_28011.user_id AS visit__user
- , visits_source_src_28011.session_id AS visit__session
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_0
- ) subq_1
- ) subq_2
+ , 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
+ , 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS ds__extract_day
+ , 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
+ , 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS visit__ds__extract_day
+ , IF(EXTRACT(dayofweek FROM visits_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_28000.ds) - 1) AS visit__ds__extract_dow
+ , EXTRACT(dayofyear FROM visits_source_src_28000.ds) AS visit__ds__extract_doy
+ , visits_source_src_28000.referrer_id AS visit__referrer_id
+ , visits_source_src_28000.user_id AS user
+ , visits_source_src_28000.session_id AS session
+ , visits_source_src_28000.user_id AS visit__user
+ , visits_source_src_28000.session_id AS visit__session
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
GROUP BY
visit__referrer_id
- ) subq_3
+ ) subq_12
FULL OUTER JOIN (
-- Aggregate Measures
SELECT
- subq_12.visit__referrer_id
- , SUM(subq_12.buys) AS buys
+ subq_21.visit__referrer_id
+ , SUM(subq_21.buys) AS buys
FROM (
-- Pass Only Elements: ['buys', 'visit__referrer_id']
SELECT
- subq_11.visit__referrer_id
- , subq_11.buys
+ subq_20.visit__referrer_id
+ , subq_20.buys
FROM (
-- Find conversions for user within the range of INF
SELECT
- subq_10.ds__day
- , subq_10.user
- , subq_10.visit__referrer_id
- , subq_10.buys
- , subq_10.visits
+ subq_19.ds__day
+ , subq_19.user
+ , subq_19.visit__referrer_id
+ , subq_19.buys
+ , subq_19.visits
FROM (
-- Dedupe the fanout with mf_internal_uuid in the conversion data set
SELECT DISTINCT
- first_value(subq_6.visits) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
- , first_value(subq_6.visit__referrer_id) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visit__referrer_id
- , first_value(subq_6.ds__day) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
- , first_value(subq_6.user) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
- , subq_9.mf_internal_uuid AS mf_internal_uuid
- , subq_9.buys AS buys
+ first_value(subq_15.visits) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
+ , first_value(subq_15.visit__referrer_id) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visit__referrer_id
+ , first_value(subq_15.ds__day) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
+ , first_value(subq_15.user) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
+ , subq_18.mf_internal_uuid AS mf_internal_uuid
+ , subq_18.buys AS buys
FROM (
-- Pass Only Elements: ['visits', 'visit__referrer_id', 'ds__day', 'user']
SELECT
- subq_5.ds__day
- , subq_5.user
- , subq_5.visit__referrer_id
- , subq_5.visits
+ subq_14.ds__day
+ , subq_14.user
+ , subq_14.visit__referrer_id
+ , subq_14.visits
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_4.ds__day
- , subq_4.ds__week
- , subq_4.ds__month
- , subq_4.ds__quarter
- , subq_4.ds__year
- , subq_4.ds__extract_year
- , subq_4.ds__extract_quarter
- , subq_4.ds__extract_month
- , subq_4.ds__extract_day
- , subq_4.ds__extract_dow
- , subq_4.ds__extract_doy
- , subq_4.visit__ds__day
- , subq_4.visit__ds__week
- , subq_4.visit__ds__month
- , subq_4.visit__ds__quarter
- , subq_4.visit__ds__year
- , subq_4.visit__ds__extract_year
- , subq_4.visit__ds__extract_quarter
- , subq_4.visit__ds__extract_month
- , subq_4.visit__ds__extract_day
- , subq_4.visit__ds__extract_dow
- , subq_4.visit__ds__extract_doy
- , subq_4.ds__day AS metric_time__day
- , subq_4.ds__week AS metric_time__week
- , subq_4.ds__month AS metric_time__month
- , subq_4.ds__quarter AS metric_time__quarter
- , subq_4.ds__year AS metric_time__year
- , subq_4.ds__extract_year AS metric_time__extract_year
- , subq_4.ds__extract_quarter AS metric_time__extract_quarter
- , subq_4.ds__extract_month AS metric_time__extract_month
- , subq_4.ds__extract_day AS metric_time__extract_day
- , subq_4.ds__extract_dow AS metric_time__extract_dow
- , subq_4.ds__extract_doy AS metric_time__extract_doy
- , subq_4.user
- , subq_4.session
- , subq_4.visit__user
- , subq_4.visit__session
- , subq_4.referrer_id
- , subq_4.visit__referrer_id
- , subq_4.visits
- , subq_4.visitors
+ subq_13.ds__day
+ , subq_13.ds__week
+ , subq_13.ds__month
+ , subq_13.ds__quarter
+ , subq_13.ds__year
+ , subq_13.ds__extract_year
+ , subq_13.ds__extract_quarter
+ , subq_13.ds__extract_month
+ , subq_13.ds__extract_day
+ , subq_13.ds__extract_dow
+ , subq_13.ds__extract_doy
+ , subq_13.visit__ds__day
+ , subq_13.visit__ds__week
+ , subq_13.visit__ds__month
+ , subq_13.visit__ds__quarter
+ , subq_13.visit__ds__year
+ , subq_13.visit__ds__extract_year
+ , subq_13.visit__ds__extract_quarter
+ , subq_13.visit__ds__extract_month
+ , subq_13.visit__ds__extract_day
+ , subq_13.visit__ds__extract_dow
+ , subq_13.visit__ds__extract_doy
+ , subq_13.ds__day AS metric_time__day
+ , subq_13.ds__week AS metric_time__week
+ , subq_13.ds__month AS metric_time__month
+ , subq_13.ds__quarter AS metric_time__quarter
+ , subq_13.ds__year AS metric_time__year
+ , subq_13.ds__extract_year AS metric_time__extract_year
+ , subq_13.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_13.ds__extract_month AS metric_time__extract_month
+ , subq_13.ds__extract_day AS metric_time__extract_day
+ , subq_13.ds__extract_dow AS metric_time__extract_dow
+ , subq_13.ds__extract_doy AS metric_time__extract_doy
+ , subq_13.user
+ , subq_13.session
+ , subq_13.visit__user
+ , subq_13.visit__session
+ , subq_13.referrer_id
+ , subq_13.visit__referrer_id
+ , subq_13.visits
+ , subq_13.visitors
FROM (
-- Read Elements From Semantic Model 'visits_source'
SELECT
1 AS visits
- , visits_source_src_28011.user_id AS visitors
- , DATE_TRUNC(visits_source_src_28011.ds, day) AS ds__day
- , DATE_TRUNC(visits_source_src_28011.ds, isoweek) AS ds__week
- , DATE_TRUNC(visits_source_src_28011.ds, month) AS ds__month
- , DATE_TRUNC(visits_source_src_28011.ds, quarter) AS ds__quarter
- , DATE_TRUNC(visits_source_src_28011.ds, year) AS ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM visits_source_src_28011.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_28011.ds) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM visits_source_src_28011.ds) AS ds__extract_doy
- , visits_source_src_28011.referrer_id
- , DATE_TRUNC(visits_source_src_28011.ds, day) AS visit__ds__day
- , DATE_TRUNC(visits_source_src_28011.ds, isoweek) AS visit__ds__week
- , DATE_TRUNC(visits_source_src_28011.ds, month) AS visit__ds__month
- , DATE_TRUNC(visits_source_src_28011.ds, quarter) AS visit__ds__quarter
- , DATE_TRUNC(visits_source_src_28011.ds, year) AS visit__ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day
- , IF(EXTRACT(dayofweek FROM visits_source_src_28011.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_28011.ds) - 1) AS visit__ds__extract_dow
- , EXTRACT(dayofyear FROM visits_source_src_28011.ds) AS visit__ds__extract_doy
- , visits_source_src_28011.referrer_id AS visit__referrer_id
- , visits_source_src_28011.user_id AS user
- , visits_source_src_28011.session_id AS session
- , visits_source_src_28011.user_id AS visit__user
- , visits_source_src_28011.session_id AS visit__session
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_4
- ) subq_5
- ) subq_6
+ , 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
+ , 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS ds__extract_day
+ , 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
+ , 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS visit__ds__extract_day
+ , IF(EXTRACT(dayofweek FROM visits_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_28000.ds) - 1) AS visit__ds__extract_dow
+ , EXTRACT(dayofyear FROM visits_source_src_28000.ds) AS visit__ds__extract_doy
+ , visits_source_src_28000.referrer_id AS visit__referrer_id
+ , visits_source_src_28000.user_id AS user
+ , visits_source_src_28000.session_id AS session
+ , visits_source_src_28000.user_id AS visit__user
+ , visits_source_src_28000.session_id AS visit__session
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_13
+ ) subq_14
+ ) subq_15
INNER JOIN (
-- Add column with generated UUID
SELECT
- subq_8.ds__day
- , subq_8.ds__week
- , subq_8.ds__month
- , subq_8.ds__quarter
- , subq_8.ds__year
- , subq_8.ds__extract_year
- , subq_8.ds__extract_quarter
- , subq_8.ds__extract_month
- , subq_8.ds__extract_day
- , subq_8.ds__extract_dow
- , subq_8.ds__extract_doy
- , subq_8.buy__ds__day
- , subq_8.buy__ds__week
- , subq_8.buy__ds__month
- , subq_8.buy__ds__quarter
- , subq_8.buy__ds__year
- , subq_8.buy__ds__extract_year
- , subq_8.buy__ds__extract_quarter
- , subq_8.buy__ds__extract_month
- , subq_8.buy__ds__extract_day
- , subq_8.buy__ds__extract_dow
- , subq_8.buy__ds__extract_doy
- , subq_8.metric_time__day
- , subq_8.metric_time__week
- , subq_8.metric_time__month
- , subq_8.metric_time__quarter
- , subq_8.metric_time__year
- , subq_8.metric_time__extract_year
- , subq_8.metric_time__extract_quarter
- , subq_8.metric_time__extract_month
- , subq_8.metric_time__extract_day
- , subq_8.metric_time__extract_dow
- , subq_8.metric_time__extract_doy
- , subq_8.user
- , subq_8.session_id
- , subq_8.buy__user
- , subq_8.buy__session_id
- , subq_8.buys
- , subq_8.buyers
+ subq_17.ds__day
+ , subq_17.ds__week
+ , subq_17.ds__month
+ , subq_17.ds__quarter
+ , subq_17.ds__year
+ , subq_17.ds__extract_year
+ , subq_17.ds__extract_quarter
+ , subq_17.ds__extract_month
+ , subq_17.ds__extract_day
+ , subq_17.ds__extract_dow
+ , subq_17.ds__extract_doy
+ , subq_17.buy__ds__day
+ , subq_17.buy__ds__week
+ , subq_17.buy__ds__month
+ , subq_17.buy__ds__quarter
+ , subq_17.buy__ds__year
+ , subq_17.buy__ds__extract_year
+ , subq_17.buy__ds__extract_quarter
+ , subq_17.buy__ds__extract_month
+ , subq_17.buy__ds__extract_day
+ , subq_17.buy__ds__extract_dow
+ , subq_17.buy__ds__extract_doy
+ , subq_17.metric_time__day
+ , subq_17.metric_time__week
+ , subq_17.metric_time__month
+ , subq_17.metric_time__quarter
+ , subq_17.metric_time__year
+ , subq_17.metric_time__extract_year
+ , subq_17.metric_time__extract_quarter
+ , subq_17.metric_time__extract_month
+ , subq_17.metric_time__extract_day
+ , subq_17.metric_time__extract_dow
+ , subq_17.metric_time__extract_doy
+ , subq_17.user
+ , subq_17.session_id
+ , subq_17.buy__user
+ , subq_17.buy__session_id
+ , subq_17.buys
+ , subq_17.buyers
, GENERATE_UUID() AS mf_internal_uuid
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_7.ds__day
- , subq_7.ds__week
- , subq_7.ds__month
- , subq_7.ds__quarter
- , subq_7.ds__year
- , subq_7.ds__extract_year
- , subq_7.ds__extract_quarter
- , subq_7.ds__extract_month
- , subq_7.ds__extract_day
- , subq_7.ds__extract_dow
- , subq_7.ds__extract_doy
- , subq_7.buy__ds__day
- , subq_7.buy__ds__week
- , subq_7.buy__ds__month
- , subq_7.buy__ds__quarter
- , subq_7.buy__ds__year
- , subq_7.buy__ds__extract_year
- , subq_7.buy__ds__extract_quarter
- , subq_7.buy__ds__extract_month
- , subq_7.buy__ds__extract_day
- , subq_7.buy__ds__extract_dow
- , subq_7.buy__ds__extract_doy
- , subq_7.ds__day AS metric_time__day
- , subq_7.ds__week AS metric_time__week
- , subq_7.ds__month AS metric_time__month
- , subq_7.ds__quarter AS metric_time__quarter
- , subq_7.ds__year AS metric_time__year
- , subq_7.ds__extract_year AS metric_time__extract_year
- , subq_7.ds__extract_quarter AS metric_time__extract_quarter
- , subq_7.ds__extract_month AS metric_time__extract_month
- , subq_7.ds__extract_day AS metric_time__extract_day
- , subq_7.ds__extract_dow AS metric_time__extract_dow
- , subq_7.ds__extract_doy AS metric_time__extract_doy
- , subq_7.user
- , subq_7.session_id
- , subq_7.buy__user
- , subq_7.buy__session_id
- , subq_7.buys
- , subq_7.buyers
+ subq_16.ds__day
+ , subq_16.ds__week
+ , subq_16.ds__month
+ , subq_16.ds__quarter
+ , subq_16.ds__year
+ , subq_16.ds__extract_year
+ , subq_16.ds__extract_quarter
+ , subq_16.ds__extract_month
+ , subq_16.ds__extract_day
+ , subq_16.ds__extract_dow
+ , subq_16.ds__extract_doy
+ , subq_16.buy__ds__day
+ , subq_16.buy__ds__week
+ , subq_16.buy__ds__month
+ , subq_16.buy__ds__quarter
+ , subq_16.buy__ds__year
+ , subq_16.buy__ds__extract_year
+ , subq_16.buy__ds__extract_quarter
+ , subq_16.buy__ds__extract_month
+ , subq_16.buy__ds__extract_day
+ , subq_16.buy__ds__extract_dow
+ , subq_16.buy__ds__extract_doy
+ , subq_16.ds__day AS metric_time__day
+ , subq_16.ds__week AS metric_time__week
+ , subq_16.ds__month AS metric_time__month
+ , subq_16.ds__quarter AS metric_time__quarter
+ , subq_16.ds__year AS metric_time__year
+ , subq_16.ds__extract_year AS metric_time__extract_year
+ , subq_16.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_16.ds__extract_month AS metric_time__extract_month
+ , subq_16.ds__extract_day AS metric_time__extract_day
+ , subq_16.ds__extract_dow AS metric_time__extract_dow
+ , subq_16.ds__extract_doy AS metric_time__extract_doy
+ , subq_16.user
+ , subq_16.session_id
+ , subq_16.buy__user
+ , subq_16.buy__session_id
+ , subq_16.buys
+ , subq_16.buyers
FROM (
-- Read Elements From Semantic Model 'buys_source'
SELECT
1 AS buys
- , buys_source_src_28002.user_id AS buyers
- , DATE_TRUNC(buys_source_src_28002.ds, day) AS ds__day
- , DATE_TRUNC(buys_source_src_28002.ds, isoweek) AS ds__week
- , DATE_TRUNC(buys_source_src_28002.ds, month) AS ds__month
- , DATE_TRUNC(buys_source_src_28002.ds, quarter) AS ds__quarter
- , DATE_TRUNC(buys_source_src_28002.ds, year) AS ds__year
- , EXTRACT(year FROM buys_source_src_28002.ds) AS ds__extract_year
- , EXTRACT(quarter FROM buys_source_src_28002.ds) AS ds__extract_quarter
- , EXTRACT(month FROM buys_source_src_28002.ds) AS ds__extract_month
- , EXTRACT(day FROM buys_source_src_28002.ds) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM buys_source_src_28002.ds) = 1, 7, EXTRACT(dayofweek FROM buys_source_src_28002.ds) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM buys_source_src_28002.ds) AS ds__extract_doy
- , DATE_TRUNC(buys_source_src_28002.ds, day) AS buy__ds__day
- , DATE_TRUNC(buys_source_src_28002.ds, isoweek) AS buy__ds__week
- , DATE_TRUNC(buys_source_src_28002.ds, month) AS buy__ds__month
- , DATE_TRUNC(buys_source_src_28002.ds, quarter) AS buy__ds__quarter
- , DATE_TRUNC(buys_source_src_28002.ds, year) AS buy__ds__year
- , EXTRACT(year FROM buys_source_src_28002.ds) AS buy__ds__extract_year
- , EXTRACT(quarter FROM buys_source_src_28002.ds) AS buy__ds__extract_quarter
- , EXTRACT(month FROM buys_source_src_28002.ds) AS buy__ds__extract_month
- , EXTRACT(day FROM buys_source_src_28002.ds) AS buy__ds__extract_day
- , IF(EXTRACT(dayofweek FROM buys_source_src_28002.ds) = 1, 7, EXTRACT(dayofweek FROM buys_source_src_28002.ds) - 1) AS buy__ds__extract_dow
- , EXTRACT(dayofyear FROM buys_source_src_28002.ds) AS buy__ds__extract_doy
- , buys_source_src_28002.user_id AS user
- , buys_source_src_28002.session_id
- , buys_source_src_28002.user_id AS buy__user
- , buys_source_src_28002.session_id AS buy__session_id
- FROM ***************************.fct_buys buys_source_src_28002
- ) subq_7
- ) subq_8
- ) subq_9
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM buys_source_src_28000.ds) AS buy__ds__extract_day
+ , IF(EXTRACT(dayofweek FROM buys_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM buys_source_src_28000.ds) - 1) AS buy__ds__extract_dow
+ , EXTRACT(dayofyear FROM buys_source_src_28000.ds) AS buy__ds__extract_doy
+ , buys_source_src_28000.user_id AS user
+ , buys_source_src_28000.session_id
+ , buys_source_src_28000.user_id AS buy__user
+ , buys_source_src_28000.session_id AS buy__session_id
+ FROM ***************************.fct_buys buys_source_src_28000
+ ) subq_16
+ ) subq_17
+ ) subq_18
ON
- (subq_6.user = subq_9.user) AND ((subq_6.ds__day <= subq_9.ds__day))
- ) subq_10
- ) subq_11
- ) subq_12
+ (
+ subq_15.user = subq_18.user
+ ) AND (
+ (subq_15.ds__day <= subq_18.ds__day)
+ )
+ ) subq_19
+ ) subq_20
+ ) subq_21
GROUP BY
visit__referrer_id
- ) subq_13
+ ) subq_22
ON
- subq_3.visit__referrer_id = subq_13.visit__referrer_id
+ subq_12.visit__referrer_id = subq_22.visit__referrer_id
GROUP BY
visit__referrer_id
-) subq_14
+) subq_23
diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate__plan0_optimized.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate__plan0_optimized.sql
index a19a98472b..08b69fe9f1 100644
--- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate__plan0_optimized.sql
@@ -5,9 +5,9 @@ SELECT
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_18.visit__referrer_id, subq_28.visit__referrer_id) AS visit__referrer_id
- , MAX(subq_18.visits) AS visits
- , MAX(subq_28.buys) AS buys
+ COALESCE(subq_27.visit__referrer_id, subq_37.visit__referrer_id) AS visit__referrer_id
+ , MAX(subq_27.visits) AS visits
+ , MAX(subq_37.buys) AS buys
FROM (
-- Aggregate Measures
SELECT
@@ -20,11 +20,11 @@ FROM (
SELECT
referrer_id AS visit__referrer_id
, 1 AS visits
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_17
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_26
GROUP BY
visit__referrer_id
- ) subq_18
+ ) subq_27
FULL OUTER JOIN (
-- Find conversions for user within the range of INF
-- Pass Only Elements: ['buys', 'visit__referrer_id']
@@ -35,12 +35,12 @@ FROM (
FROM (
-- Dedupe the fanout with mf_internal_uuid in the conversion data set
SELECT DISTINCT
- first_value(subq_21.visits) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
- , first_value(subq_21.visit__referrer_id) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visit__referrer_id
- , first_value(subq_21.ds__day) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
- , first_value(subq_21.user) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
- , subq_24.mf_internal_uuid AS mf_internal_uuid
- , subq_24.buys AS buys
+ first_value(subq_30.visits) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
+ , first_value(subq_30.visit__referrer_id) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visit__referrer_id
+ , first_value(subq_30.ds__day) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
+ , first_value(subq_30.user) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
+ , subq_33.mf_internal_uuid AS mf_internal_uuid
+ , subq_33.buys AS buys
FROM (
-- Read Elements From Semantic Model 'visits_source'
-- Metric Time Dimension 'ds'
@@ -50,8 +50,8 @@ FROM (
, user_id AS user
, referrer_id AS visit__referrer_id
, 1 AS visits
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_21
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_30
INNER JOIN (
-- Read Elements From Semantic Model 'buys_source'
-- Metric Time Dimension 'ds'
@@ -61,20 +61,20 @@ FROM (
, user_id AS user
, 1 AS buys
, GENERATE_UUID() AS mf_internal_uuid
- FROM ***************************.fct_buys buys_source_src_28002
- ) subq_24
+ FROM ***************************.fct_buys buys_source_src_28000
+ ) subq_33
ON
(
- subq_21.user = subq_24.user
+ subq_30.user = subq_33.user
) AND (
- (subq_21.ds__day <= subq_24.ds__day)
+ (subq_30.ds__day <= subq_33.ds__day)
)
- ) subq_25
+ ) subq_34
GROUP BY
visit__referrer_id
- ) subq_28
+ ) subq_37
ON
- subq_18.visit__referrer_id = subq_28.visit__referrer_id
+ subq_27.visit__referrer_id = subq_37.visit__referrer_id
GROUP BY
visit__referrer_id
-) subq_29
+) subq_38
diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate_with_constant_properties__plan0.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate_with_constant_properties__plan0.sql
index 5b39c3a0b5..35167c4bac 100644
--- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate_with_constant_properties__plan0.sql
+++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate_with_constant_properties__plan0.sql
@@ -1,381 +1,381 @@
-- Compute Metrics via Expressions
SELECT
- subq_14.metric_time__day
- , subq_14.visit__referrer_id
- , CAST(subq_14.buys AS FLOAT64) / CAST(NULLIF(subq_14.visits, 0) AS FLOAT64) AS visit_buy_conversion_rate_by_session
+ subq_23.metric_time__day
+ , subq_23.visit__referrer_id
+ , CAST(subq_23.buys AS FLOAT64) / CAST(NULLIF(subq_23.visits, 0) AS FLOAT64) AS visit_buy_conversion_rate_by_session
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_3.metric_time__day, subq_13.metric_time__day) AS metric_time__day
- , COALESCE(subq_3.visit__referrer_id, subq_13.visit__referrer_id) AS visit__referrer_id
- , MAX(subq_3.visits) AS visits
- , MAX(subq_13.buys) AS buys
+ COALESCE(subq_12.metric_time__day, subq_22.metric_time__day) AS metric_time__day
+ , COALESCE(subq_12.visit__referrer_id, subq_22.visit__referrer_id) AS visit__referrer_id
+ , MAX(subq_12.visits) AS visits
+ , MAX(subq_22.buys) AS buys
FROM (
-- Aggregate Measures
SELECT
- subq_2.metric_time__day
- , subq_2.visit__referrer_id
- , SUM(subq_2.visits) AS visits
+ subq_11.metric_time__day
+ , subq_11.visit__referrer_id
+ , SUM(subq_11.visits) AS visits
FROM (
-- Pass Only Elements: ['visits', 'visit__referrer_id', 'metric_time__day']
SELECT
- subq_1.metric_time__day
- , subq_1.visit__referrer_id
- , subq_1.visits
+ subq_10.metric_time__day
+ , subq_10.visit__referrer_id
+ , subq_10.visits
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.visit__ds__day
- , subq_0.visit__ds__week
- , subq_0.visit__ds__month
- , subq_0.visit__ds__quarter
- , subq_0.visit__ds__year
- , subq_0.visit__ds__extract_year
- , subq_0.visit__ds__extract_quarter
- , subq_0.visit__ds__extract_month
- , subq_0.visit__ds__extract_day
- , subq_0.visit__ds__extract_dow
- , subq_0.visit__ds__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.user
- , subq_0.session
- , subq_0.visit__user
- , subq_0.visit__session
- , subq_0.referrer_id
- , subq_0.visit__referrer_id
- , subq_0.visits
- , subq_0.visitors
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.visit__ds__day
+ , subq_9.visit__ds__week
+ , subq_9.visit__ds__month
+ , subq_9.visit__ds__quarter
+ , subq_9.visit__ds__year
+ , subq_9.visit__ds__extract_year
+ , subq_9.visit__ds__extract_quarter
+ , subq_9.visit__ds__extract_month
+ , subq_9.visit__ds__extract_day
+ , subq_9.visit__ds__extract_dow
+ , subq_9.visit__ds__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.user
+ , subq_9.session
+ , subq_9.visit__user
+ , subq_9.visit__session
+ , subq_9.referrer_id
+ , subq_9.visit__referrer_id
+ , subq_9.visits
+ , subq_9.visitors
FROM (
-- Read Elements From Semantic Model 'visits_source'
SELECT
1 AS visits
- , visits_source_src_28011.user_id AS visitors
- , DATE_TRUNC(visits_source_src_28011.ds, day) AS ds__day
- , DATE_TRUNC(visits_source_src_28011.ds, isoweek) AS ds__week
- , DATE_TRUNC(visits_source_src_28011.ds, month) AS ds__month
- , DATE_TRUNC(visits_source_src_28011.ds, quarter) AS ds__quarter
- , DATE_TRUNC(visits_source_src_28011.ds, year) AS ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM visits_source_src_28011.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_28011.ds) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM visits_source_src_28011.ds) AS ds__extract_doy
- , visits_source_src_28011.referrer_id
- , DATE_TRUNC(visits_source_src_28011.ds, day) AS visit__ds__day
- , DATE_TRUNC(visits_source_src_28011.ds, isoweek) AS visit__ds__week
- , DATE_TRUNC(visits_source_src_28011.ds, month) AS visit__ds__month
- , DATE_TRUNC(visits_source_src_28011.ds, quarter) AS visit__ds__quarter
- , DATE_TRUNC(visits_source_src_28011.ds, year) AS visit__ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day
- , IF(EXTRACT(dayofweek FROM visits_source_src_28011.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_28011.ds) - 1) AS visit__ds__extract_dow
- , EXTRACT(dayofyear FROM visits_source_src_28011.ds) AS visit__ds__extract_doy
- , visits_source_src_28011.referrer_id AS visit__referrer_id
- , visits_source_src_28011.user_id AS user
- , visits_source_src_28011.session_id AS session
- , visits_source_src_28011.user_id AS visit__user
- , visits_source_src_28011.session_id AS visit__session
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_0
- ) subq_1
- ) subq_2
+ , 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
+ , 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS ds__extract_day
+ , 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
+ , 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS visit__ds__extract_day
+ , IF(EXTRACT(dayofweek FROM visits_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_28000.ds) - 1) AS visit__ds__extract_dow
+ , EXTRACT(dayofyear FROM visits_source_src_28000.ds) AS visit__ds__extract_doy
+ , visits_source_src_28000.referrer_id AS visit__referrer_id
+ , visits_source_src_28000.user_id AS user
+ , visits_source_src_28000.session_id AS session
+ , visits_source_src_28000.user_id AS visit__user
+ , visits_source_src_28000.session_id AS visit__session
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
GROUP BY
metric_time__day
, visit__referrer_id
- ) subq_3
+ ) subq_12
FULL OUTER JOIN (
-- Aggregate Measures
SELECT
- subq_12.metric_time__day
- , subq_12.visit__referrer_id
- , SUM(subq_12.buys) AS buys
+ subq_21.metric_time__day
+ , subq_21.visit__referrer_id
+ , SUM(subq_21.buys) AS buys
FROM (
-- Pass Only Elements: ['buys', 'visit__referrer_id', 'metric_time__day']
SELECT
- subq_11.metric_time__day
- , subq_11.visit__referrer_id
- , subq_11.buys
+ subq_20.metric_time__day
+ , subq_20.visit__referrer_id
+ , subq_20.buys
FROM (
-- Find conversions for user within the range of 7 day
SELECT
- subq_10.ds__day
- , subq_10.metric_time__day
- , subq_10.user
- , subq_10.session
- , subq_10.visit__referrer_id
- , subq_10.buys
- , subq_10.visits
+ subq_19.ds__day
+ , subq_19.metric_time__day
+ , subq_19.user
+ , subq_19.session
+ , subq_19.visit__referrer_id
+ , subq_19.buys
+ , subq_19.visits
FROM (
-- Dedupe the fanout with mf_internal_uuid in the conversion data set
SELECT DISTINCT
- first_value(subq_6.visits) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid, subq_9.session_id ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
- , first_value(subq_6.visit__referrer_id) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid, subq_9.session_id ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visit__referrer_id
- , first_value(subq_6.ds__day) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid, subq_9.session_id ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
- , first_value(subq_6.metric_time__day) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid, subq_9.session_id ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS metric_time__day
- , first_value(subq_6.user) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid, subq_9.session_id ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
- , first_value(subq_6.session) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid, subq_9.session_id ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS session
- , subq_9.mf_internal_uuid AS mf_internal_uuid
- , subq_9.buys AS buys
+ first_value(subq_15.visits) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid, subq_18.session_id ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
+ , first_value(subq_15.visit__referrer_id) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid, subq_18.session_id ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visit__referrer_id
+ , first_value(subq_15.ds__day) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid, subq_18.session_id ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
+ , first_value(subq_15.metric_time__day) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid, subq_18.session_id ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS metric_time__day
+ , first_value(subq_15.user) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid, subq_18.session_id ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
+ , first_value(subq_15.session) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid, subq_18.session_id ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS session
+ , subq_18.mf_internal_uuid AS mf_internal_uuid
+ , subq_18.buys AS buys
FROM (
-- Pass Only Elements: ['visits', 'visit__referrer_id', 'ds__day', 'metric_time__day', 'user', 'session']
SELECT
- subq_5.ds__day
- , subq_5.metric_time__day
- , subq_5.user
- , subq_5.session
- , subq_5.visit__referrer_id
- , subq_5.visits
+ subq_14.ds__day
+ , subq_14.metric_time__day
+ , subq_14.user
+ , subq_14.session
+ , subq_14.visit__referrer_id
+ , subq_14.visits
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_4.ds__day
- , subq_4.ds__week
- , subq_4.ds__month
- , subq_4.ds__quarter
- , subq_4.ds__year
- , subq_4.ds__extract_year
- , subq_4.ds__extract_quarter
- , subq_4.ds__extract_month
- , subq_4.ds__extract_day
- , subq_4.ds__extract_dow
- , subq_4.ds__extract_doy
- , subq_4.visit__ds__day
- , subq_4.visit__ds__week
- , subq_4.visit__ds__month
- , subq_4.visit__ds__quarter
- , subq_4.visit__ds__year
- , subq_4.visit__ds__extract_year
- , subq_4.visit__ds__extract_quarter
- , subq_4.visit__ds__extract_month
- , subq_4.visit__ds__extract_day
- , subq_4.visit__ds__extract_dow
- , subq_4.visit__ds__extract_doy
- , subq_4.ds__day AS metric_time__day
- , subq_4.ds__week AS metric_time__week
- , subq_4.ds__month AS metric_time__month
- , subq_4.ds__quarter AS metric_time__quarter
- , subq_4.ds__year AS metric_time__year
- , subq_4.ds__extract_year AS metric_time__extract_year
- , subq_4.ds__extract_quarter AS metric_time__extract_quarter
- , subq_4.ds__extract_month AS metric_time__extract_month
- , subq_4.ds__extract_day AS metric_time__extract_day
- , subq_4.ds__extract_dow AS metric_time__extract_dow
- , subq_4.ds__extract_doy AS metric_time__extract_doy
- , subq_4.user
- , subq_4.session
- , subq_4.visit__user
- , subq_4.visit__session
- , subq_4.referrer_id
- , subq_4.visit__referrer_id
- , subq_4.visits
- , subq_4.visitors
+ subq_13.ds__day
+ , subq_13.ds__week
+ , subq_13.ds__month
+ , subq_13.ds__quarter
+ , subq_13.ds__year
+ , subq_13.ds__extract_year
+ , subq_13.ds__extract_quarter
+ , subq_13.ds__extract_month
+ , subq_13.ds__extract_day
+ , subq_13.ds__extract_dow
+ , subq_13.ds__extract_doy
+ , subq_13.visit__ds__day
+ , subq_13.visit__ds__week
+ , subq_13.visit__ds__month
+ , subq_13.visit__ds__quarter
+ , subq_13.visit__ds__year
+ , subq_13.visit__ds__extract_year
+ , subq_13.visit__ds__extract_quarter
+ , subq_13.visit__ds__extract_month
+ , subq_13.visit__ds__extract_day
+ , subq_13.visit__ds__extract_dow
+ , subq_13.visit__ds__extract_doy
+ , subq_13.ds__day AS metric_time__day
+ , subq_13.ds__week AS metric_time__week
+ , subq_13.ds__month AS metric_time__month
+ , subq_13.ds__quarter AS metric_time__quarter
+ , subq_13.ds__year AS metric_time__year
+ , subq_13.ds__extract_year AS metric_time__extract_year
+ , subq_13.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_13.ds__extract_month AS metric_time__extract_month
+ , subq_13.ds__extract_day AS metric_time__extract_day
+ , subq_13.ds__extract_dow AS metric_time__extract_dow
+ , subq_13.ds__extract_doy AS metric_time__extract_doy
+ , subq_13.user
+ , subq_13.session
+ , subq_13.visit__user
+ , subq_13.visit__session
+ , subq_13.referrer_id
+ , subq_13.visit__referrer_id
+ , subq_13.visits
+ , subq_13.visitors
FROM (
-- Read Elements From Semantic Model 'visits_source'
SELECT
1 AS visits
- , visits_source_src_28011.user_id AS visitors
- , DATE_TRUNC(visits_source_src_28011.ds, day) AS ds__day
- , DATE_TRUNC(visits_source_src_28011.ds, isoweek) AS ds__week
- , DATE_TRUNC(visits_source_src_28011.ds, month) AS ds__month
- , DATE_TRUNC(visits_source_src_28011.ds, quarter) AS ds__quarter
- , DATE_TRUNC(visits_source_src_28011.ds, year) AS ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM visits_source_src_28011.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_28011.ds) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM visits_source_src_28011.ds) AS ds__extract_doy
- , visits_source_src_28011.referrer_id
- , DATE_TRUNC(visits_source_src_28011.ds, day) AS visit__ds__day
- , DATE_TRUNC(visits_source_src_28011.ds, isoweek) AS visit__ds__week
- , DATE_TRUNC(visits_source_src_28011.ds, month) AS visit__ds__month
- , DATE_TRUNC(visits_source_src_28011.ds, quarter) AS visit__ds__quarter
- , DATE_TRUNC(visits_source_src_28011.ds, year) AS visit__ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day
- , IF(EXTRACT(dayofweek FROM visits_source_src_28011.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_28011.ds) - 1) AS visit__ds__extract_dow
- , EXTRACT(dayofyear FROM visits_source_src_28011.ds) AS visit__ds__extract_doy
- , visits_source_src_28011.referrer_id AS visit__referrer_id
- , visits_source_src_28011.user_id AS user
- , visits_source_src_28011.session_id AS session
- , visits_source_src_28011.user_id AS visit__user
- , visits_source_src_28011.session_id AS visit__session
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_4
- ) subq_5
- ) subq_6
+ , 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
+ , 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS ds__extract_day
+ , 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
+ , 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS visit__ds__extract_day
+ , IF(EXTRACT(dayofweek FROM visits_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_28000.ds) - 1) AS visit__ds__extract_dow
+ , EXTRACT(dayofyear FROM visits_source_src_28000.ds) AS visit__ds__extract_doy
+ , visits_source_src_28000.referrer_id AS visit__referrer_id
+ , visits_source_src_28000.user_id AS user
+ , visits_source_src_28000.session_id AS session
+ , visits_source_src_28000.user_id AS visit__user
+ , visits_source_src_28000.session_id AS visit__session
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_13
+ ) subq_14
+ ) subq_15
INNER JOIN (
-- Add column with generated UUID
SELECT
- subq_8.ds__day
- , subq_8.ds__week
- , subq_8.ds__month
- , subq_8.ds__quarter
- , subq_8.ds__year
- , subq_8.ds__extract_year
- , subq_8.ds__extract_quarter
- , subq_8.ds__extract_month
- , subq_8.ds__extract_day
- , subq_8.ds__extract_dow
- , subq_8.ds__extract_doy
- , subq_8.buy__ds__day
- , subq_8.buy__ds__week
- , subq_8.buy__ds__month
- , subq_8.buy__ds__quarter
- , subq_8.buy__ds__year
- , subq_8.buy__ds__extract_year
- , subq_8.buy__ds__extract_quarter
- , subq_8.buy__ds__extract_month
- , subq_8.buy__ds__extract_day
- , subq_8.buy__ds__extract_dow
- , subq_8.buy__ds__extract_doy
- , subq_8.metric_time__day
- , subq_8.metric_time__week
- , subq_8.metric_time__month
- , subq_8.metric_time__quarter
- , subq_8.metric_time__year
- , subq_8.metric_time__extract_year
- , subq_8.metric_time__extract_quarter
- , subq_8.metric_time__extract_month
- , subq_8.metric_time__extract_day
- , subq_8.metric_time__extract_dow
- , subq_8.metric_time__extract_doy
- , subq_8.user
- , subq_8.session_id
- , subq_8.buy__user
- , subq_8.buy__session_id
- , subq_8.buys
- , subq_8.buyers
+ subq_17.ds__day
+ , subq_17.ds__week
+ , subq_17.ds__month
+ , subq_17.ds__quarter
+ , subq_17.ds__year
+ , subq_17.ds__extract_year
+ , subq_17.ds__extract_quarter
+ , subq_17.ds__extract_month
+ , subq_17.ds__extract_day
+ , subq_17.ds__extract_dow
+ , subq_17.ds__extract_doy
+ , subq_17.buy__ds__day
+ , subq_17.buy__ds__week
+ , subq_17.buy__ds__month
+ , subq_17.buy__ds__quarter
+ , subq_17.buy__ds__year
+ , subq_17.buy__ds__extract_year
+ , subq_17.buy__ds__extract_quarter
+ , subq_17.buy__ds__extract_month
+ , subq_17.buy__ds__extract_day
+ , subq_17.buy__ds__extract_dow
+ , subq_17.buy__ds__extract_doy
+ , subq_17.metric_time__day
+ , subq_17.metric_time__week
+ , subq_17.metric_time__month
+ , subq_17.metric_time__quarter
+ , subq_17.metric_time__year
+ , subq_17.metric_time__extract_year
+ , subq_17.metric_time__extract_quarter
+ , subq_17.metric_time__extract_month
+ , subq_17.metric_time__extract_day
+ , subq_17.metric_time__extract_dow
+ , subq_17.metric_time__extract_doy
+ , subq_17.user
+ , subq_17.session_id
+ , subq_17.buy__user
+ , subq_17.buy__session_id
+ , subq_17.buys
+ , subq_17.buyers
, GENERATE_UUID() AS mf_internal_uuid
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_7.ds__day
- , subq_7.ds__week
- , subq_7.ds__month
- , subq_7.ds__quarter
- , subq_7.ds__year
- , subq_7.ds__extract_year
- , subq_7.ds__extract_quarter
- , subq_7.ds__extract_month
- , subq_7.ds__extract_day
- , subq_7.ds__extract_dow
- , subq_7.ds__extract_doy
- , subq_7.buy__ds__day
- , subq_7.buy__ds__week
- , subq_7.buy__ds__month
- , subq_7.buy__ds__quarter
- , subq_7.buy__ds__year
- , subq_7.buy__ds__extract_year
- , subq_7.buy__ds__extract_quarter
- , subq_7.buy__ds__extract_month
- , subq_7.buy__ds__extract_day
- , subq_7.buy__ds__extract_dow
- , subq_7.buy__ds__extract_doy
- , subq_7.ds__day AS metric_time__day
- , subq_7.ds__week AS metric_time__week
- , subq_7.ds__month AS metric_time__month
- , subq_7.ds__quarter AS metric_time__quarter
- , subq_7.ds__year AS metric_time__year
- , subq_7.ds__extract_year AS metric_time__extract_year
- , subq_7.ds__extract_quarter AS metric_time__extract_quarter
- , subq_7.ds__extract_month AS metric_time__extract_month
- , subq_7.ds__extract_day AS metric_time__extract_day
- , subq_7.ds__extract_dow AS metric_time__extract_dow
- , subq_7.ds__extract_doy AS metric_time__extract_doy
- , subq_7.user
- , subq_7.session_id
- , subq_7.buy__user
- , subq_7.buy__session_id
- , subq_7.buys
- , subq_7.buyers
+ subq_16.ds__day
+ , subq_16.ds__week
+ , subq_16.ds__month
+ , subq_16.ds__quarter
+ , subq_16.ds__year
+ , subq_16.ds__extract_year
+ , subq_16.ds__extract_quarter
+ , subq_16.ds__extract_month
+ , subq_16.ds__extract_day
+ , subq_16.ds__extract_dow
+ , subq_16.ds__extract_doy
+ , subq_16.buy__ds__day
+ , subq_16.buy__ds__week
+ , subq_16.buy__ds__month
+ , subq_16.buy__ds__quarter
+ , subq_16.buy__ds__year
+ , subq_16.buy__ds__extract_year
+ , subq_16.buy__ds__extract_quarter
+ , subq_16.buy__ds__extract_month
+ , subq_16.buy__ds__extract_day
+ , subq_16.buy__ds__extract_dow
+ , subq_16.buy__ds__extract_doy
+ , subq_16.ds__day AS metric_time__day
+ , subq_16.ds__week AS metric_time__week
+ , subq_16.ds__month AS metric_time__month
+ , subq_16.ds__quarter AS metric_time__quarter
+ , subq_16.ds__year AS metric_time__year
+ , subq_16.ds__extract_year AS metric_time__extract_year
+ , subq_16.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_16.ds__extract_month AS metric_time__extract_month
+ , subq_16.ds__extract_day AS metric_time__extract_day
+ , subq_16.ds__extract_dow AS metric_time__extract_dow
+ , subq_16.ds__extract_doy AS metric_time__extract_doy
+ , subq_16.user
+ , subq_16.session_id
+ , subq_16.buy__user
+ , subq_16.buy__session_id
+ , subq_16.buys
+ , subq_16.buyers
FROM (
-- Read Elements From Semantic Model 'buys_source'
SELECT
1 AS buys
- , buys_source_src_28002.user_id AS buyers
- , DATE_TRUNC(buys_source_src_28002.ds, day) AS ds__day
- , DATE_TRUNC(buys_source_src_28002.ds, isoweek) AS ds__week
- , DATE_TRUNC(buys_source_src_28002.ds, month) AS ds__month
- , DATE_TRUNC(buys_source_src_28002.ds, quarter) AS ds__quarter
- , DATE_TRUNC(buys_source_src_28002.ds, year) AS ds__year
- , EXTRACT(year FROM buys_source_src_28002.ds) AS ds__extract_year
- , EXTRACT(quarter FROM buys_source_src_28002.ds) AS ds__extract_quarter
- , EXTRACT(month FROM buys_source_src_28002.ds) AS ds__extract_month
- , EXTRACT(day FROM buys_source_src_28002.ds) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM buys_source_src_28002.ds) = 1, 7, EXTRACT(dayofweek FROM buys_source_src_28002.ds) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM buys_source_src_28002.ds) AS ds__extract_doy
- , DATE_TRUNC(buys_source_src_28002.ds, day) AS buy__ds__day
- , DATE_TRUNC(buys_source_src_28002.ds, isoweek) AS buy__ds__week
- , DATE_TRUNC(buys_source_src_28002.ds, month) AS buy__ds__month
- , DATE_TRUNC(buys_source_src_28002.ds, quarter) AS buy__ds__quarter
- , DATE_TRUNC(buys_source_src_28002.ds, year) AS buy__ds__year
- , EXTRACT(year FROM buys_source_src_28002.ds) AS buy__ds__extract_year
- , EXTRACT(quarter FROM buys_source_src_28002.ds) AS buy__ds__extract_quarter
- , EXTRACT(month FROM buys_source_src_28002.ds) AS buy__ds__extract_month
- , EXTRACT(day FROM buys_source_src_28002.ds) AS buy__ds__extract_day
- , IF(EXTRACT(dayofweek FROM buys_source_src_28002.ds) = 1, 7, EXTRACT(dayofweek FROM buys_source_src_28002.ds) - 1) AS buy__ds__extract_dow
- , EXTRACT(dayofyear FROM buys_source_src_28002.ds) AS buy__ds__extract_doy
- , buys_source_src_28002.user_id AS user
- , buys_source_src_28002.session_id
- , buys_source_src_28002.user_id AS buy__user
- , buys_source_src_28002.session_id AS buy__session_id
- FROM ***************************.fct_buys buys_source_src_28002
- ) subq_7
- ) subq_8
- ) subq_9
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM buys_source_src_28000.ds) AS buy__ds__extract_day
+ , IF(EXTRACT(dayofweek FROM buys_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM buys_source_src_28000.ds) - 1) AS buy__ds__extract_dow
+ , EXTRACT(dayofyear FROM buys_source_src_28000.ds) AS buy__ds__extract_doy
+ , buys_source_src_28000.user_id AS user
+ , buys_source_src_28000.session_id
+ , buys_source_src_28000.user_id AS buy__user
+ , buys_source_src_28000.session_id AS buy__session_id
+ FROM ***************************.fct_buys buys_source_src_28000
+ ) subq_16
+ ) subq_17
+ ) subq_18
ON
(
- subq_6.user = subq_9.user
+ subq_15.user = subq_18.user
) AND (
- subq_6.session = subq_9.session_id
+ subq_15.session = subq_18.session_id
) AND (
(
- subq_6.ds__day <= subq_9.ds__day
+ subq_15.ds__day <= subq_18.ds__day
) AND (
- subq_6.ds__day > DATE_SUB(CAST(subq_9.ds__day AS DATETIME), INTERVAL 7 day)
+ subq_15.ds__day > DATE_SUB(CAST(subq_18.ds__day AS DATETIME), INTERVAL 7 day)
)
)
- ) subq_10
- ) subq_11
- ) subq_12
+ ) subq_19
+ ) subq_20
+ ) subq_21
GROUP BY
metric_time__day
, visit__referrer_id
- ) subq_13
+ ) subq_22
ON
(
- subq_3.visit__referrer_id = subq_13.visit__referrer_id
+ subq_12.visit__referrer_id = subq_22.visit__referrer_id
) AND (
- subq_3.metric_time__day = subq_13.metric_time__day
+ subq_12.metric_time__day = subq_22.metric_time__day
)
GROUP BY
metric_time__day
, visit__referrer_id
-) subq_14
+) subq_23
diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate_with_constant_properties__plan0_optimized.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate_with_constant_properties__plan0_optimized.sql
index d6c6f149cc..99468f5ed2 100644
--- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate_with_constant_properties__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate_with_constant_properties__plan0_optimized.sql
@@ -6,10 +6,10 @@ SELECT
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_18.metric_time__day, subq_28.metric_time__day) AS metric_time__day
- , COALESCE(subq_18.visit__referrer_id, subq_28.visit__referrer_id) AS visit__referrer_id
- , MAX(subq_18.visits) AS visits
- , MAX(subq_28.buys) AS buys
+ COALESCE(subq_27.metric_time__day, subq_37.metric_time__day) AS metric_time__day
+ , COALESCE(subq_27.visit__referrer_id, subq_37.visit__referrer_id) AS visit__referrer_id
+ , MAX(subq_27.visits) AS visits
+ , MAX(subq_37.buys) AS buys
FROM (
-- Aggregate Measures
SELECT
@@ -24,12 +24,12 @@ FROM (
DATE_TRUNC(ds, day) AS metric_time__day
, referrer_id AS visit__referrer_id
, 1 AS visits
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_17
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_26
GROUP BY
metric_time__day
, visit__referrer_id
- ) subq_18
+ ) subq_27
FULL OUTER JOIN (
-- Find conversions for user within the range of 7 day
-- Pass Only Elements: ['buys', 'visit__referrer_id', 'metric_time__day']
@@ -41,14 +41,14 @@ FROM (
FROM (
-- Dedupe the fanout with mf_internal_uuid in the conversion data set
SELECT DISTINCT
- first_value(subq_21.visits) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid, subq_24.session_id ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
- , first_value(subq_21.visit__referrer_id) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid, subq_24.session_id ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visit__referrer_id
- , first_value(subq_21.ds__day) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid, subq_24.session_id ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
- , first_value(subq_21.metric_time__day) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid, subq_24.session_id ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS metric_time__day
- , first_value(subq_21.user) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid, subq_24.session_id ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
- , first_value(subq_21.session) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid, subq_24.session_id ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS session
- , subq_24.mf_internal_uuid AS mf_internal_uuid
- , subq_24.buys AS buys
+ first_value(subq_30.visits) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid, subq_33.session_id ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
+ , first_value(subq_30.visit__referrer_id) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid, subq_33.session_id ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visit__referrer_id
+ , first_value(subq_30.ds__day) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid, subq_33.session_id ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
+ , first_value(subq_30.metric_time__day) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid, subq_33.session_id ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS metric_time__day
+ , first_value(subq_30.user) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid, subq_33.session_id ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
+ , first_value(subq_30.session) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid, subq_33.session_id ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS session
+ , subq_33.mf_internal_uuid AS mf_internal_uuid
+ , subq_33.buys AS buys
FROM (
-- Read Elements From Semantic Model 'visits_source'
-- Metric Time Dimension 'ds'
@@ -60,8 +60,8 @@ FROM (
, session_id AS session
, referrer_id AS visit__referrer_id
, 1 AS visits
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_21
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_30
INNER JOIN (
-- Read Elements From Semantic Model 'buys_source'
-- Metric Time Dimension 'ds'
@@ -72,32 +72,32 @@ FROM (
, session_id
, 1 AS buys
, GENERATE_UUID() AS mf_internal_uuid
- FROM ***************************.fct_buys buys_source_src_28002
- ) subq_24
+ FROM ***************************.fct_buys buys_source_src_28000
+ ) subq_33
ON
(
- subq_21.user = subq_24.user
+ subq_30.user = subq_33.user
) AND (
- subq_21.session = subq_24.session_id
+ subq_30.session = subq_33.session_id
) AND (
(
- subq_21.ds__day <= subq_24.ds__day
+ subq_30.ds__day <= subq_33.ds__day
) AND (
- subq_21.ds__day > DATE_SUB(CAST(subq_24.ds__day AS DATETIME), INTERVAL 7 day)
+ subq_30.ds__day > DATE_SUB(CAST(subq_33.ds__day AS DATETIME), INTERVAL 7 day)
)
)
- ) subq_25
+ ) subq_34
GROUP BY
metric_time__day
, visit__referrer_id
- ) subq_28
+ ) subq_37
ON
(
- subq_18.visit__referrer_id = subq_28.visit__referrer_id
+ subq_27.visit__referrer_id = subq_37.visit__referrer_id
) AND (
- subq_18.metric_time__day = subq_28.metric_time__day
+ subq_27.metric_time__day = subq_37.metric_time__day
)
GROUP BY
metric_time__day
, visit__referrer_id
-) subq_29
+) subq_38
diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate_with_no_group_by__plan0.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate_with_no_group_by__plan0.sql
index 9c335f3958..b9c4a3c9c5 100644
--- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate_with_no_group_by__plan0.sql
+++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate_with_no_group_by__plan0.sql
@@ -1,343 +1,343 @@
-- Compute Metrics via Expressions
SELECT
- CAST(subq_14.buys AS FLOAT64) / CAST(NULLIF(subq_14.visits, 0) AS FLOAT64) AS visit_buy_conversion_rate_7days
+ CAST(subq_23.buys AS FLOAT64) / CAST(NULLIF(subq_23.visits, 0) AS FLOAT64) AS visit_buy_conversion_rate_7days
FROM (
-- Combine Aggregated Outputs
SELECT
- MAX(subq_3.visits) AS visits
- , MAX(subq_13.buys) AS buys
+ MAX(subq_12.visits) AS visits
+ , MAX(subq_22.buys) AS buys
FROM (
-- Aggregate Measures
SELECT
- SUM(subq_2.visits) AS visits
+ SUM(subq_11.visits) AS visits
FROM (
-- Pass Only Elements: ['visits',]
SELECT
- subq_1.visits
+ subq_10.visits
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.visit__ds__day
- , subq_0.visit__ds__week
- , subq_0.visit__ds__month
- , subq_0.visit__ds__quarter
- , subq_0.visit__ds__year
- , subq_0.visit__ds__extract_year
- , subq_0.visit__ds__extract_quarter
- , subq_0.visit__ds__extract_month
- , subq_0.visit__ds__extract_day
- , subq_0.visit__ds__extract_dow
- , subq_0.visit__ds__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.user
- , subq_0.session
- , subq_0.visit__user
- , subq_0.visit__session
- , subq_0.referrer_id
- , subq_0.visit__referrer_id
- , subq_0.visits
- , subq_0.visitors
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.visit__ds__day
+ , subq_9.visit__ds__week
+ , subq_9.visit__ds__month
+ , subq_9.visit__ds__quarter
+ , subq_9.visit__ds__year
+ , subq_9.visit__ds__extract_year
+ , subq_9.visit__ds__extract_quarter
+ , subq_9.visit__ds__extract_month
+ , subq_9.visit__ds__extract_day
+ , subq_9.visit__ds__extract_dow
+ , subq_9.visit__ds__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.user
+ , subq_9.session
+ , subq_9.visit__user
+ , subq_9.visit__session
+ , subq_9.referrer_id
+ , subq_9.visit__referrer_id
+ , subq_9.visits
+ , subq_9.visitors
FROM (
-- Read Elements From Semantic Model 'visits_source'
SELECT
1 AS visits
- , visits_source_src_28011.user_id AS visitors
- , DATE_TRUNC(visits_source_src_28011.ds, day) AS ds__day
- , DATE_TRUNC(visits_source_src_28011.ds, isoweek) AS ds__week
- , DATE_TRUNC(visits_source_src_28011.ds, month) AS ds__month
- , DATE_TRUNC(visits_source_src_28011.ds, quarter) AS ds__quarter
- , DATE_TRUNC(visits_source_src_28011.ds, year) AS ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM visits_source_src_28011.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_28011.ds) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM visits_source_src_28011.ds) AS ds__extract_doy
- , visits_source_src_28011.referrer_id
- , DATE_TRUNC(visits_source_src_28011.ds, day) AS visit__ds__day
- , DATE_TRUNC(visits_source_src_28011.ds, isoweek) AS visit__ds__week
- , DATE_TRUNC(visits_source_src_28011.ds, month) AS visit__ds__month
- , DATE_TRUNC(visits_source_src_28011.ds, quarter) AS visit__ds__quarter
- , DATE_TRUNC(visits_source_src_28011.ds, year) AS visit__ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day
- , IF(EXTRACT(dayofweek FROM visits_source_src_28011.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_28011.ds) - 1) AS visit__ds__extract_dow
- , EXTRACT(dayofyear FROM visits_source_src_28011.ds) AS visit__ds__extract_doy
- , visits_source_src_28011.referrer_id AS visit__referrer_id
- , visits_source_src_28011.user_id AS user
- , visits_source_src_28011.session_id AS session
- , visits_source_src_28011.user_id AS visit__user
- , visits_source_src_28011.session_id AS visit__session
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_0
- ) subq_1
- ) subq_2
- ) subq_3
+ , 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
+ , 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS ds__extract_day
+ , 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
+ , 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS visit__ds__extract_day
+ , IF(EXTRACT(dayofweek FROM visits_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_28000.ds) - 1) AS visit__ds__extract_dow
+ , EXTRACT(dayofyear FROM visits_source_src_28000.ds) AS visit__ds__extract_doy
+ , visits_source_src_28000.referrer_id AS visit__referrer_id
+ , visits_source_src_28000.user_id AS user
+ , visits_source_src_28000.session_id AS session
+ , visits_source_src_28000.user_id AS visit__user
+ , visits_source_src_28000.session_id AS visit__session
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
+ ) subq_12
CROSS JOIN (
-- Aggregate Measures
SELECT
- SUM(subq_12.buys) AS buys
+ SUM(subq_21.buys) AS buys
FROM (
-- Pass Only Elements: ['buys',]
SELECT
- subq_11.buys
+ subq_20.buys
FROM (
-- Find conversions for user within the range of 7 day
SELECT
- subq_10.ds__day
- , subq_10.user
- , subq_10.buys
- , subq_10.visits
+ subq_19.ds__day
+ , subq_19.user
+ , subq_19.buys
+ , subq_19.visits
FROM (
-- Dedupe the fanout with mf_internal_uuid in the conversion data set
SELECT DISTINCT
- first_value(subq_6.visits) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
- , first_value(subq_6.ds__day) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
- , first_value(subq_6.user) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
- , subq_9.mf_internal_uuid AS mf_internal_uuid
- , subq_9.buys AS buys
+ first_value(subq_15.visits) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
+ , first_value(subq_15.ds__day) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
+ , first_value(subq_15.user) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
+ , subq_18.mf_internal_uuid AS mf_internal_uuid
+ , subq_18.buys AS buys
FROM (
-- Pass Only Elements: ['visits', 'ds__day', 'user']
SELECT
- subq_5.ds__day
- , subq_5.user
- , subq_5.visits
+ subq_14.ds__day
+ , subq_14.user
+ , subq_14.visits
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_4.ds__day
- , subq_4.ds__week
- , subq_4.ds__month
- , subq_4.ds__quarter
- , subq_4.ds__year
- , subq_4.ds__extract_year
- , subq_4.ds__extract_quarter
- , subq_4.ds__extract_month
- , subq_4.ds__extract_day
- , subq_4.ds__extract_dow
- , subq_4.ds__extract_doy
- , subq_4.visit__ds__day
- , subq_4.visit__ds__week
- , subq_4.visit__ds__month
- , subq_4.visit__ds__quarter
- , subq_4.visit__ds__year
- , subq_4.visit__ds__extract_year
- , subq_4.visit__ds__extract_quarter
- , subq_4.visit__ds__extract_month
- , subq_4.visit__ds__extract_day
- , subq_4.visit__ds__extract_dow
- , subq_4.visit__ds__extract_doy
- , subq_4.ds__day AS metric_time__day
- , subq_4.ds__week AS metric_time__week
- , subq_4.ds__month AS metric_time__month
- , subq_4.ds__quarter AS metric_time__quarter
- , subq_4.ds__year AS metric_time__year
- , subq_4.ds__extract_year AS metric_time__extract_year
- , subq_4.ds__extract_quarter AS metric_time__extract_quarter
- , subq_4.ds__extract_month AS metric_time__extract_month
- , subq_4.ds__extract_day AS metric_time__extract_day
- , subq_4.ds__extract_dow AS metric_time__extract_dow
- , subq_4.ds__extract_doy AS metric_time__extract_doy
- , subq_4.user
- , subq_4.session
- , subq_4.visit__user
- , subq_4.visit__session
- , subq_4.referrer_id
- , subq_4.visit__referrer_id
- , subq_4.visits
- , subq_4.visitors
+ subq_13.ds__day
+ , subq_13.ds__week
+ , subq_13.ds__month
+ , subq_13.ds__quarter
+ , subq_13.ds__year
+ , subq_13.ds__extract_year
+ , subq_13.ds__extract_quarter
+ , subq_13.ds__extract_month
+ , subq_13.ds__extract_day
+ , subq_13.ds__extract_dow
+ , subq_13.ds__extract_doy
+ , subq_13.visit__ds__day
+ , subq_13.visit__ds__week
+ , subq_13.visit__ds__month
+ , subq_13.visit__ds__quarter
+ , subq_13.visit__ds__year
+ , subq_13.visit__ds__extract_year
+ , subq_13.visit__ds__extract_quarter
+ , subq_13.visit__ds__extract_month
+ , subq_13.visit__ds__extract_day
+ , subq_13.visit__ds__extract_dow
+ , subq_13.visit__ds__extract_doy
+ , subq_13.ds__day AS metric_time__day
+ , subq_13.ds__week AS metric_time__week
+ , subq_13.ds__month AS metric_time__month
+ , subq_13.ds__quarter AS metric_time__quarter
+ , subq_13.ds__year AS metric_time__year
+ , subq_13.ds__extract_year AS metric_time__extract_year
+ , subq_13.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_13.ds__extract_month AS metric_time__extract_month
+ , subq_13.ds__extract_day AS metric_time__extract_day
+ , subq_13.ds__extract_dow AS metric_time__extract_dow
+ , subq_13.ds__extract_doy AS metric_time__extract_doy
+ , subq_13.user
+ , subq_13.session
+ , subq_13.visit__user
+ , subq_13.visit__session
+ , subq_13.referrer_id
+ , subq_13.visit__referrer_id
+ , subq_13.visits
+ , subq_13.visitors
FROM (
-- Read Elements From Semantic Model 'visits_source'
SELECT
1 AS visits
- , visits_source_src_28011.user_id AS visitors
- , DATE_TRUNC(visits_source_src_28011.ds, day) AS ds__day
- , DATE_TRUNC(visits_source_src_28011.ds, isoweek) AS ds__week
- , DATE_TRUNC(visits_source_src_28011.ds, month) AS ds__month
- , DATE_TRUNC(visits_source_src_28011.ds, quarter) AS ds__quarter
- , DATE_TRUNC(visits_source_src_28011.ds, year) AS ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM visits_source_src_28011.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_28011.ds) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM visits_source_src_28011.ds) AS ds__extract_doy
- , visits_source_src_28011.referrer_id
- , DATE_TRUNC(visits_source_src_28011.ds, day) AS visit__ds__day
- , DATE_TRUNC(visits_source_src_28011.ds, isoweek) AS visit__ds__week
- , DATE_TRUNC(visits_source_src_28011.ds, month) AS visit__ds__month
- , DATE_TRUNC(visits_source_src_28011.ds, quarter) AS visit__ds__quarter
- , DATE_TRUNC(visits_source_src_28011.ds, year) AS visit__ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day
- , IF(EXTRACT(dayofweek FROM visits_source_src_28011.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_28011.ds) - 1) AS visit__ds__extract_dow
- , EXTRACT(dayofyear FROM visits_source_src_28011.ds) AS visit__ds__extract_doy
- , visits_source_src_28011.referrer_id AS visit__referrer_id
- , visits_source_src_28011.user_id AS user
- , visits_source_src_28011.session_id AS session
- , visits_source_src_28011.user_id AS visit__user
- , visits_source_src_28011.session_id AS visit__session
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_4
- ) subq_5
- ) subq_6
+ , 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
+ , 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS ds__extract_day
+ , 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
+ , 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS visit__ds__extract_day
+ , IF(EXTRACT(dayofweek FROM visits_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_28000.ds) - 1) AS visit__ds__extract_dow
+ , EXTRACT(dayofyear FROM visits_source_src_28000.ds) AS visit__ds__extract_doy
+ , visits_source_src_28000.referrer_id AS visit__referrer_id
+ , visits_source_src_28000.user_id AS user
+ , visits_source_src_28000.session_id AS session
+ , visits_source_src_28000.user_id AS visit__user
+ , visits_source_src_28000.session_id AS visit__session
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_13
+ ) subq_14
+ ) subq_15
INNER JOIN (
-- Add column with generated UUID
SELECT
- subq_8.ds__day
- , subq_8.ds__week
- , subq_8.ds__month
- , subq_8.ds__quarter
- , subq_8.ds__year
- , subq_8.ds__extract_year
- , subq_8.ds__extract_quarter
- , subq_8.ds__extract_month
- , subq_8.ds__extract_day
- , subq_8.ds__extract_dow
- , subq_8.ds__extract_doy
- , subq_8.buy__ds__day
- , subq_8.buy__ds__week
- , subq_8.buy__ds__month
- , subq_8.buy__ds__quarter
- , subq_8.buy__ds__year
- , subq_8.buy__ds__extract_year
- , subq_8.buy__ds__extract_quarter
- , subq_8.buy__ds__extract_month
- , subq_8.buy__ds__extract_day
- , subq_8.buy__ds__extract_dow
- , subq_8.buy__ds__extract_doy
- , subq_8.metric_time__day
- , subq_8.metric_time__week
- , subq_8.metric_time__month
- , subq_8.metric_time__quarter
- , subq_8.metric_time__year
- , subq_8.metric_time__extract_year
- , subq_8.metric_time__extract_quarter
- , subq_8.metric_time__extract_month
- , subq_8.metric_time__extract_day
- , subq_8.metric_time__extract_dow
- , subq_8.metric_time__extract_doy
- , subq_8.user
- , subq_8.session_id
- , subq_8.buy__user
- , subq_8.buy__session_id
- , subq_8.buys
- , subq_8.buyers
+ subq_17.ds__day
+ , subq_17.ds__week
+ , subq_17.ds__month
+ , subq_17.ds__quarter
+ , subq_17.ds__year
+ , subq_17.ds__extract_year
+ , subq_17.ds__extract_quarter
+ , subq_17.ds__extract_month
+ , subq_17.ds__extract_day
+ , subq_17.ds__extract_dow
+ , subq_17.ds__extract_doy
+ , subq_17.buy__ds__day
+ , subq_17.buy__ds__week
+ , subq_17.buy__ds__month
+ , subq_17.buy__ds__quarter
+ , subq_17.buy__ds__year
+ , subq_17.buy__ds__extract_year
+ , subq_17.buy__ds__extract_quarter
+ , subq_17.buy__ds__extract_month
+ , subq_17.buy__ds__extract_day
+ , subq_17.buy__ds__extract_dow
+ , subq_17.buy__ds__extract_doy
+ , subq_17.metric_time__day
+ , subq_17.metric_time__week
+ , subq_17.metric_time__month
+ , subq_17.metric_time__quarter
+ , subq_17.metric_time__year
+ , subq_17.metric_time__extract_year
+ , subq_17.metric_time__extract_quarter
+ , subq_17.metric_time__extract_month
+ , subq_17.metric_time__extract_day
+ , subq_17.metric_time__extract_dow
+ , subq_17.metric_time__extract_doy
+ , subq_17.user
+ , subq_17.session_id
+ , subq_17.buy__user
+ , subq_17.buy__session_id
+ , subq_17.buys
+ , subq_17.buyers
, GENERATE_UUID() AS mf_internal_uuid
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_7.ds__day
- , subq_7.ds__week
- , subq_7.ds__month
- , subq_7.ds__quarter
- , subq_7.ds__year
- , subq_7.ds__extract_year
- , subq_7.ds__extract_quarter
- , subq_7.ds__extract_month
- , subq_7.ds__extract_day
- , subq_7.ds__extract_dow
- , subq_7.ds__extract_doy
- , subq_7.buy__ds__day
- , subq_7.buy__ds__week
- , subq_7.buy__ds__month
- , subq_7.buy__ds__quarter
- , subq_7.buy__ds__year
- , subq_7.buy__ds__extract_year
- , subq_7.buy__ds__extract_quarter
- , subq_7.buy__ds__extract_month
- , subq_7.buy__ds__extract_day
- , subq_7.buy__ds__extract_dow
- , subq_7.buy__ds__extract_doy
- , subq_7.ds__day AS metric_time__day
- , subq_7.ds__week AS metric_time__week
- , subq_7.ds__month AS metric_time__month
- , subq_7.ds__quarter AS metric_time__quarter
- , subq_7.ds__year AS metric_time__year
- , subq_7.ds__extract_year AS metric_time__extract_year
- , subq_7.ds__extract_quarter AS metric_time__extract_quarter
- , subq_7.ds__extract_month AS metric_time__extract_month
- , subq_7.ds__extract_day AS metric_time__extract_day
- , subq_7.ds__extract_dow AS metric_time__extract_dow
- , subq_7.ds__extract_doy AS metric_time__extract_doy
- , subq_7.user
- , subq_7.session_id
- , subq_7.buy__user
- , subq_7.buy__session_id
- , subq_7.buys
- , subq_7.buyers
+ subq_16.ds__day
+ , subq_16.ds__week
+ , subq_16.ds__month
+ , subq_16.ds__quarter
+ , subq_16.ds__year
+ , subq_16.ds__extract_year
+ , subq_16.ds__extract_quarter
+ , subq_16.ds__extract_month
+ , subq_16.ds__extract_day
+ , subq_16.ds__extract_dow
+ , subq_16.ds__extract_doy
+ , subq_16.buy__ds__day
+ , subq_16.buy__ds__week
+ , subq_16.buy__ds__month
+ , subq_16.buy__ds__quarter
+ , subq_16.buy__ds__year
+ , subq_16.buy__ds__extract_year
+ , subq_16.buy__ds__extract_quarter
+ , subq_16.buy__ds__extract_month
+ , subq_16.buy__ds__extract_day
+ , subq_16.buy__ds__extract_dow
+ , subq_16.buy__ds__extract_doy
+ , subq_16.ds__day AS metric_time__day
+ , subq_16.ds__week AS metric_time__week
+ , subq_16.ds__month AS metric_time__month
+ , subq_16.ds__quarter AS metric_time__quarter
+ , subq_16.ds__year AS metric_time__year
+ , subq_16.ds__extract_year AS metric_time__extract_year
+ , subq_16.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_16.ds__extract_month AS metric_time__extract_month
+ , subq_16.ds__extract_day AS metric_time__extract_day
+ , subq_16.ds__extract_dow AS metric_time__extract_dow
+ , subq_16.ds__extract_doy AS metric_time__extract_doy
+ , subq_16.user
+ , subq_16.session_id
+ , subq_16.buy__user
+ , subq_16.buy__session_id
+ , subq_16.buys
+ , subq_16.buyers
FROM (
-- Read Elements From Semantic Model 'buys_source'
SELECT
1 AS buys
- , buys_source_src_28002.user_id AS buyers
- , DATE_TRUNC(buys_source_src_28002.ds, day) AS ds__day
- , DATE_TRUNC(buys_source_src_28002.ds, isoweek) AS ds__week
- , DATE_TRUNC(buys_source_src_28002.ds, month) AS ds__month
- , DATE_TRUNC(buys_source_src_28002.ds, quarter) AS ds__quarter
- , DATE_TRUNC(buys_source_src_28002.ds, year) AS ds__year
- , EXTRACT(year FROM buys_source_src_28002.ds) AS ds__extract_year
- , EXTRACT(quarter FROM buys_source_src_28002.ds) AS ds__extract_quarter
- , EXTRACT(month FROM buys_source_src_28002.ds) AS ds__extract_month
- , EXTRACT(day FROM buys_source_src_28002.ds) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM buys_source_src_28002.ds) = 1, 7, EXTRACT(dayofweek FROM buys_source_src_28002.ds) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM buys_source_src_28002.ds) AS ds__extract_doy
- , DATE_TRUNC(buys_source_src_28002.ds, day) AS buy__ds__day
- , DATE_TRUNC(buys_source_src_28002.ds, isoweek) AS buy__ds__week
- , DATE_TRUNC(buys_source_src_28002.ds, month) AS buy__ds__month
- , DATE_TRUNC(buys_source_src_28002.ds, quarter) AS buy__ds__quarter
- , DATE_TRUNC(buys_source_src_28002.ds, year) AS buy__ds__year
- , EXTRACT(year FROM buys_source_src_28002.ds) AS buy__ds__extract_year
- , EXTRACT(quarter FROM buys_source_src_28002.ds) AS buy__ds__extract_quarter
- , EXTRACT(month FROM buys_source_src_28002.ds) AS buy__ds__extract_month
- , EXTRACT(day FROM buys_source_src_28002.ds) AS buy__ds__extract_day
- , IF(EXTRACT(dayofweek FROM buys_source_src_28002.ds) = 1, 7, EXTRACT(dayofweek FROM buys_source_src_28002.ds) - 1) AS buy__ds__extract_dow
- , EXTRACT(dayofyear FROM buys_source_src_28002.ds) AS buy__ds__extract_doy
- , buys_source_src_28002.user_id AS user
- , buys_source_src_28002.session_id
- , buys_source_src_28002.user_id AS buy__user
- , buys_source_src_28002.session_id AS buy__session_id
- FROM ***************************.fct_buys buys_source_src_28002
- ) subq_7
- ) subq_8
- ) subq_9
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM buys_source_src_28000.ds) AS buy__ds__extract_day
+ , IF(EXTRACT(dayofweek FROM buys_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM buys_source_src_28000.ds) - 1) AS buy__ds__extract_dow
+ , EXTRACT(dayofyear FROM buys_source_src_28000.ds) AS buy__ds__extract_doy
+ , buys_source_src_28000.user_id AS user
+ , buys_source_src_28000.session_id
+ , buys_source_src_28000.user_id AS buy__user
+ , buys_source_src_28000.session_id AS buy__session_id
+ FROM ***************************.fct_buys buys_source_src_28000
+ ) subq_16
+ ) subq_17
+ ) subq_18
ON
(
- subq_6.user = subq_9.user
+ subq_15.user = subq_18.user
) AND (
(
- subq_6.ds__day <= subq_9.ds__day
+ subq_15.ds__day <= subq_18.ds__day
) AND (
- subq_6.ds__day > DATE_SUB(CAST(subq_9.ds__day AS DATETIME), INTERVAL 7 day)
+ subq_15.ds__day > DATE_SUB(CAST(subq_18.ds__day AS DATETIME), INTERVAL 7 day)
)
)
- ) subq_10
- ) subq_11
- ) subq_12
- ) subq_13
-) subq_14
+ ) subq_19
+ ) subq_20
+ ) subq_21
+ ) subq_22
+) subq_23
diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate_with_no_group_by__plan0_optimized.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate_with_no_group_by__plan0_optimized.sql
index e527a79a88..33962562bf 100644
--- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate_with_no_group_by__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate_with_no_group_by__plan0_optimized.sql
@@ -1,7 +1,7 @@
-- Combine Aggregated Outputs
-- Compute Metrics via Expressions
SELECT
- CAST(MAX(subq_28.buys) AS FLOAT64) / CAST(NULLIF(MAX(subq_18.visits), 0) AS FLOAT64) AS visit_buy_conversion_rate_7days
+ CAST(MAX(subq_37.buys) AS FLOAT64) / CAST(NULLIF(MAX(subq_27.visits), 0) AS FLOAT64) AS visit_buy_conversion_rate_7days
FROM (
-- Read Elements From Semantic Model 'visits_source'
-- Metric Time Dimension 'ds'
@@ -9,8 +9,8 @@ FROM (
-- Aggregate Measures
SELECT
SUM(1) AS visits
- FROM ***************************.fct_visits visits_source_src_28011
-) subq_18
+ FROM ***************************.fct_visits visits_source_src_28000
+) subq_27
CROSS JOIN (
-- Find conversions for user within the range of 7 day
-- Pass Only Elements: ['buys',]
@@ -20,11 +20,11 @@ CROSS JOIN (
FROM (
-- Dedupe the fanout with mf_internal_uuid in the conversion data set
SELECT DISTINCT
- first_value(subq_21.visits) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
- , first_value(subq_21.ds__day) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
- , first_value(subq_21.user) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
- , subq_24.mf_internal_uuid AS mf_internal_uuid
- , subq_24.buys AS buys
+ first_value(subq_30.visits) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
+ , first_value(subq_30.ds__day) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
+ , first_value(subq_30.user) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
+ , subq_33.mf_internal_uuid AS mf_internal_uuid
+ , subq_33.buys AS buys
FROM (
-- Read Elements From Semantic Model 'visits_source'
-- Metric Time Dimension 'ds'
@@ -33,8 +33,8 @@ CROSS JOIN (
DATE_TRUNC(ds, day) AS ds__day
, user_id AS user
, 1 AS visits
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_21
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_30
INNER JOIN (
-- Read Elements From Semantic Model 'buys_source'
-- Metric Time Dimension 'ds'
@@ -44,17 +44,17 @@ CROSS JOIN (
, user_id AS user
, 1 AS buys
, GENERATE_UUID() AS mf_internal_uuid
- FROM ***************************.fct_buys buys_source_src_28002
- ) subq_24
+ FROM ***************************.fct_buys buys_source_src_28000
+ ) subq_33
ON
(
- subq_21.user = subq_24.user
+ subq_30.user = subq_33.user
) AND (
(
- subq_21.ds__day <= subq_24.ds__day
+ subq_30.ds__day <= subq_33.ds__day
) AND (
- subq_21.ds__day > DATE_SUB(CAST(subq_24.ds__day AS DATETIME), INTERVAL 7 day)
+ subq_30.ds__day > DATE_SUB(CAST(subq_33.ds__day AS DATETIME), INTERVAL 7 day)
)
)
- ) subq_25
-) subq_28
+ ) subq_34
+) subq_37
diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate_with_window__plan0.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate_with_window__plan0.sql
index 50bc6e6fef..a560ec423d 100644
--- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate_with_window__plan0.sql
+++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate_with_window__plan0.sql
@@ -1,376 +1,376 @@
-- Compute Metrics via Expressions
SELECT
- subq_14.metric_time__day
- , subq_14.visit__referrer_id
- , CAST(subq_14.buys AS FLOAT64) / CAST(NULLIF(subq_14.visits, 0) AS FLOAT64) AS visit_buy_conversion_rate_7days
+ subq_23.metric_time__day
+ , subq_23.visit__referrer_id
+ , CAST(subq_23.buys AS FLOAT64) / CAST(NULLIF(subq_23.visits, 0) AS FLOAT64) AS visit_buy_conversion_rate_7days
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_3.metric_time__day, subq_13.metric_time__day) AS metric_time__day
- , COALESCE(subq_3.visit__referrer_id, subq_13.visit__referrer_id) AS visit__referrer_id
- , MAX(subq_3.visits) AS visits
- , MAX(subq_13.buys) AS buys
+ COALESCE(subq_12.metric_time__day, subq_22.metric_time__day) AS metric_time__day
+ , COALESCE(subq_12.visit__referrer_id, subq_22.visit__referrer_id) AS visit__referrer_id
+ , MAX(subq_12.visits) AS visits
+ , MAX(subq_22.buys) AS buys
FROM (
-- Aggregate Measures
SELECT
- subq_2.metric_time__day
- , subq_2.visit__referrer_id
- , SUM(subq_2.visits) AS visits
+ subq_11.metric_time__day
+ , subq_11.visit__referrer_id
+ , SUM(subq_11.visits) AS visits
FROM (
-- Pass Only Elements: ['visits', 'visit__referrer_id', 'metric_time__day']
SELECT
- subq_1.metric_time__day
- , subq_1.visit__referrer_id
- , subq_1.visits
+ subq_10.metric_time__day
+ , subq_10.visit__referrer_id
+ , subq_10.visits
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.visit__ds__day
- , subq_0.visit__ds__week
- , subq_0.visit__ds__month
- , subq_0.visit__ds__quarter
- , subq_0.visit__ds__year
- , subq_0.visit__ds__extract_year
- , subq_0.visit__ds__extract_quarter
- , subq_0.visit__ds__extract_month
- , subq_0.visit__ds__extract_day
- , subq_0.visit__ds__extract_dow
- , subq_0.visit__ds__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.user
- , subq_0.session
- , subq_0.visit__user
- , subq_0.visit__session
- , subq_0.referrer_id
- , subq_0.visit__referrer_id
- , subq_0.visits
- , subq_0.visitors
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.visit__ds__day
+ , subq_9.visit__ds__week
+ , subq_9.visit__ds__month
+ , subq_9.visit__ds__quarter
+ , subq_9.visit__ds__year
+ , subq_9.visit__ds__extract_year
+ , subq_9.visit__ds__extract_quarter
+ , subq_9.visit__ds__extract_month
+ , subq_9.visit__ds__extract_day
+ , subq_9.visit__ds__extract_dow
+ , subq_9.visit__ds__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.user
+ , subq_9.session
+ , subq_9.visit__user
+ , subq_9.visit__session
+ , subq_9.referrer_id
+ , subq_9.visit__referrer_id
+ , subq_9.visits
+ , subq_9.visitors
FROM (
-- Read Elements From Semantic Model 'visits_source'
SELECT
1 AS visits
- , visits_source_src_28011.user_id AS visitors
- , DATE_TRUNC(visits_source_src_28011.ds, day) AS ds__day
- , DATE_TRUNC(visits_source_src_28011.ds, isoweek) AS ds__week
- , DATE_TRUNC(visits_source_src_28011.ds, month) AS ds__month
- , DATE_TRUNC(visits_source_src_28011.ds, quarter) AS ds__quarter
- , DATE_TRUNC(visits_source_src_28011.ds, year) AS ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM visits_source_src_28011.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_28011.ds) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM visits_source_src_28011.ds) AS ds__extract_doy
- , visits_source_src_28011.referrer_id
- , DATE_TRUNC(visits_source_src_28011.ds, day) AS visit__ds__day
- , DATE_TRUNC(visits_source_src_28011.ds, isoweek) AS visit__ds__week
- , DATE_TRUNC(visits_source_src_28011.ds, month) AS visit__ds__month
- , DATE_TRUNC(visits_source_src_28011.ds, quarter) AS visit__ds__quarter
- , DATE_TRUNC(visits_source_src_28011.ds, year) AS visit__ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day
- , IF(EXTRACT(dayofweek FROM visits_source_src_28011.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_28011.ds) - 1) AS visit__ds__extract_dow
- , EXTRACT(dayofyear FROM visits_source_src_28011.ds) AS visit__ds__extract_doy
- , visits_source_src_28011.referrer_id AS visit__referrer_id
- , visits_source_src_28011.user_id AS user
- , visits_source_src_28011.session_id AS session
- , visits_source_src_28011.user_id AS visit__user
- , visits_source_src_28011.session_id AS visit__session
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_0
- ) subq_1
- ) subq_2
+ , 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
+ , 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS ds__extract_day
+ , 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
+ , 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS visit__ds__extract_day
+ , IF(EXTRACT(dayofweek FROM visits_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_28000.ds) - 1) AS visit__ds__extract_dow
+ , EXTRACT(dayofyear FROM visits_source_src_28000.ds) AS visit__ds__extract_doy
+ , visits_source_src_28000.referrer_id AS visit__referrer_id
+ , visits_source_src_28000.user_id AS user
+ , visits_source_src_28000.session_id AS session
+ , visits_source_src_28000.user_id AS visit__user
+ , visits_source_src_28000.session_id AS visit__session
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
GROUP BY
metric_time__day
, visit__referrer_id
- ) subq_3
+ ) subq_12
FULL OUTER JOIN (
-- Aggregate Measures
SELECT
- subq_12.metric_time__day
- , subq_12.visit__referrer_id
- , SUM(subq_12.buys) AS buys
+ subq_21.metric_time__day
+ , subq_21.visit__referrer_id
+ , SUM(subq_21.buys) AS buys
FROM (
-- Pass Only Elements: ['buys', 'visit__referrer_id', 'metric_time__day']
SELECT
- subq_11.metric_time__day
- , subq_11.visit__referrer_id
- , subq_11.buys
+ subq_20.metric_time__day
+ , subq_20.visit__referrer_id
+ , subq_20.buys
FROM (
-- Find conversions for user within the range of 7 day
SELECT
- subq_10.ds__day
- , subq_10.metric_time__day
- , subq_10.user
- , subq_10.visit__referrer_id
- , subq_10.buys
- , subq_10.visits
+ subq_19.ds__day
+ , subq_19.metric_time__day
+ , subq_19.user
+ , subq_19.visit__referrer_id
+ , subq_19.buys
+ , subq_19.visits
FROM (
-- Dedupe the fanout with mf_internal_uuid in the conversion data set
SELECT DISTINCT
- first_value(subq_6.visits) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
- , first_value(subq_6.visit__referrer_id) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visit__referrer_id
- , first_value(subq_6.ds__day) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
- , first_value(subq_6.metric_time__day) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS metric_time__day
- , first_value(subq_6.user) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
- , subq_9.mf_internal_uuid AS mf_internal_uuid
- , subq_9.buys AS buys
+ first_value(subq_15.visits) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
+ , first_value(subq_15.visit__referrer_id) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visit__referrer_id
+ , first_value(subq_15.ds__day) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
+ , first_value(subq_15.metric_time__day) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS metric_time__day
+ , first_value(subq_15.user) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
+ , subq_18.mf_internal_uuid AS mf_internal_uuid
+ , subq_18.buys AS buys
FROM (
-- Pass Only Elements: ['visits', 'visit__referrer_id', 'ds__day', 'metric_time__day', 'user']
SELECT
- subq_5.ds__day
- , subq_5.metric_time__day
- , subq_5.user
- , subq_5.visit__referrer_id
- , subq_5.visits
+ subq_14.ds__day
+ , subq_14.metric_time__day
+ , subq_14.user
+ , subq_14.visit__referrer_id
+ , subq_14.visits
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_4.ds__day
- , subq_4.ds__week
- , subq_4.ds__month
- , subq_4.ds__quarter
- , subq_4.ds__year
- , subq_4.ds__extract_year
- , subq_4.ds__extract_quarter
- , subq_4.ds__extract_month
- , subq_4.ds__extract_day
- , subq_4.ds__extract_dow
- , subq_4.ds__extract_doy
- , subq_4.visit__ds__day
- , subq_4.visit__ds__week
- , subq_4.visit__ds__month
- , subq_4.visit__ds__quarter
- , subq_4.visit__ds__year
- , subq_4.visit__ds__extract_year
- , subq_4.visit__ds__extract_quarter
- , subq_4.visit__ds__extract_month
- , subq_4.visit__ds__extract_day
- , subq_4.visit__ds__extract_dow
- , subq_4.visit__ds__extract_doy
- , subq_4.ds__day AS metric_time__day
- , subq_4.ds__week AS metric_time__week
- , subq_4.ds__month AS metric_time__month
- , subq_4.ds__quarter AS metric_time__quarter
- , subq_4.ds__year AS metric_time__year
- , subq_4.ds__extract_year AS metric_time__extract_year
- , subq_4.ds__extract_quarter AS metric_time__extract_quarter
- , subq_4.ds__extract_month AS metric_time__extract_month
- , subq_4.ds__extract_day AS metric_time__extract_day
- , subq_4.ds__extract_dow AS metric_time__extract_dow
- , subq_4.ds__extract_doy AS metric_time__extract_doy
- , subq_4.user
- , subq_4.session
- , subq_4.visit__user
- , subq_4.visit__session
- , subq_4.referrer_id
- , subq_4.visit__referrer_id
- , subq_4.visits
- , subq_4.visitors
+ subq_13.ds__day
+ , subq_13.ds__week
+ , subq_13.ds__month
+ , subq_13.ds__quarter
+ , subq_13.ds__year
+ , subq_13.ds__extract_year
+ , subq_13.ds__extract_quarter
+ , subq_13.ds__extract_month
+ , subq_13.ds__extract_day
+ , subq_13.ds__extract_dow
+ , subq_13.ds__extract_doy
+ , subq_13.visit__ds__day
+ , subq_13.visit__ds__week
+ , subq_13.visit__ds__month
+ , subq_13.visit__ds__quarter
+ , subq_13.visit__ds__year
+ , subq_13.visit__ds__extract_year
+ , subq_13.visit__ds__extract_quarter
+ , subq_13.visit__ds__extract_month
+ , subq_13.visit__ds__extract_day
+ , subq_13.visit__ds__extract_dow
+ , subq_13.visit__ds__extract_doy
+ , subq_13.ds__day AS metric_time__day
+ , subq_13.ds__week AS metric_time__week
+ , subq_13.ds__month AS metric_time__month
+ , subq_13.ds__quarter AS metric_time__quarter
+ , subq_13.ds__year AS metric_time__year
+ , subq_13.ds__extract_year AS metric_time__extract_year
+ , subq_13.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_13.ds__extract_month AS metric_time__extract_month
+ , subq_13.ds__extract_day AS metric_time__extract_day
+ , subq_13.ds__extract_dow AS metric_time__extract_dow
+ , subq_13.ds__extract_doy AS metric_time__extract_doy
+ , subq_13.user
+ , subq_13.session
+ , subq_13.visit__user
+ , subq_13.visit__session
+ , subq_13.referrer_id
+ , subq_13.visit__referrer_id
+ , subq_13.visits
+ , subq_13.visitors
FROM (
-- Read Elements From Semantic Model 'visits_source'
SELECT
1 AS visits
- , visits_source_src_28011.user_id AS visitors
- , DATE_TRUNC(visits_source_src_28011.ds, day) AS ds__day
- , DATE_TRUNC(visits_source_src_28011.ds, isoweek) AS ds__week
- , DATE_TRUNC(visits_source_src_28011.ds, month) AS ds__month
- , DATE_TRUNC(visits_source_src_28011.ds, quarter) AS ds__quarter
- , DATE_TRUNC(visits_source_src_28011.ds, year) AS ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM visits_source_src_28011.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_28011.ds) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM visits_source_src_28011.ds) AS ds__extract_doy
- , visits_source_src_28011.referrer_id
- , DATE_TRUNC(visits_source_src_28011.ds, day) AS visit__ds__day
- , DATE_TRUNC(visits_source_src_28011.ds, isoweek) AS visit__ds__week
- , DATE_TRUNC(visits_source_src_28011.ds, month) AS visit__ds__month
- , DATE_TRUNC(visits_source_src_28011.ds, quarter) AS visit__ds__quarter
- , DATE_TRUNC(visits_source_src_28011.ds, year) AS visit__ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day
- , IF(EXTRACT(dayofweek FROM visits_source_src_28011.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_28011.ds) - 1) AS visit__ds__extract_dow
- , EXTRACT(dayofyear FROM visits_source_src_28011.ds) AS visit__ds__extract_doy
- , visits_source_src_28011.referrer_id AS visit__referrer_id
- , visits_source_src_28011.user_id AS user
- , visits_source_src_28011.session_id AS session
- , visits_source_src_28011.user_id AS visit__user
- , visits_source_src_28011.session_id AS visit__session
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_4
- ) subq_5
- ) subq_6
+ , 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
+ , 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS ds__extract_day
+ , 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
+ , 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS visit__ds__extract_day
+ , IF(EXTRACT(dayofweek FROM visits_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM visits_source_src_28000.ds) - 1) AS visit__ds__extract_dow
+ , EXTRACT(dayofyear FROM visits_source_src_28000.ds) AS visit__ds__extract_doy
+ , visits_source_src_28000.referrer_id AS visit__referrer_id
+ , visits_source_src_28000.user_id AS user
+ , visits_source_src_28000.session_id AS session
+ , visits_source_src_28000.user_id AS visit__user
+ , visits_source_src_28000.session_id AS visit__session
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_13
+ ) subq_14
+ ) subq_15
INNER JOIN (
-- Add column with generated UUID
SELECT
- subq_8.ds__day
- , subq_8.ds__week
- , subq_8.ds__month
- , subq_8.ds__quarter
- , subq_8.ds__year
- , subq_8.ds__extract_year
- , subq_8.ds__extract_quarter
- , subq_8.ds__extract_month
- , subq_8.ds__extract_day
- , subq_8.ds__extract_dow
- , subq_8.ds__extract_doy
- , subq_8.buy__ds__day
- , subq_8.buy__ds__week
- , subq_8.buy__ds__month
- , subq_8.buy__ds__quarter
- , subq_8.buy__ds__year
- , subq_8.buy__ds__extract_year
- , subq_8.buy__ds__extract_quarter
- , subq_8.buy__ds__extract_month
- , subq_8.buy__ds__extract_day
- , subq_8.buy__ds__extract_dow
- , subq_8.buy__ds__extract_doy
- , subq_8.metric_time__day
- , subq_8.metric_time__week
- , subq_8.metric_time__month
- , subq_8.metric_time__quarter
- , subq_8.metric_time__year
- , subq_8.metric_time__extract_year
- , subq_8.metric_time__extract_quarter
- , subq_8.metric_time__extract_month
- , subq_8.metric_time__extract_day
- , subq_8.metric_time__extract_dow
- , subq_8.metric_time__extract_doy
- , subq_8.user
- , subq_8.session_id
- , subq_8.buy__user
- , subq_8.buy__session_id
- , subq_8.buys
- , subq_8.buyers
+ subq_17.ds__day
+ , subq_17.ds__week
+ , subq_17.ds__month
+ , subq_17.ds__quarter
+ , subq_17.ds__year
+ , subq_17.ds__extract_year
+ , subq_17.ds__extract_quarter
+ , subq_17.ds__extract_month
+ , subq_17.ds__extract_day
+ , subq_17.ds__extract_dow
+ , subq_17.ds__extract_doy
+ , subq_17.buy__ds__day
+ , subq_17.buy__ds__week
+ , subq_17.buy__ds__month
+ , subq_17.buy__ds__quarter
+ , subq_17.buy__ds__year
+ , subq_17.buy__ds__extract_year
+ , subq_17.buy__ds__extract_quarter
+ , subq_17.buy__ds__extract_month
+ , subq_17.buy__ds__extract_day
+ , subq_17.buy__ds__extract_dow
+ , subq_17.buy__ds__extract_doy
+ , subq_17.metric_time__day
+ , subq_17.metric_time__week
+ , subq_17.metric_time__month
+ , subq_17.metric_time__quarter
+ , subq_17.metric_time__year
+ , subq_17.metric_time__extract_year
+ , subq_17.metric_time__extract_quarter
+ , subq_17.metric_time__extract_month
+ , subq_17.metric_time__extract_day
+ , subq_17.metric_time__extract_dow
+ , subq_17.metric_time__extract_doy
+ , subq_17.user
+ , subq_17.session_id
+ , subq_17.buy__user
+ , subq_17.buy__session_id
+ , subq_17.buys
+ , subq_17.buyers
, GENERATE_UUID() AS mf_internal_uuid
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_7.ds__day
- , subq_7.ds__week
- , subq_7.ds__month
- , subq_7.ds__quarter
- , subq_7.ds__year
- , subq_7.ds__extract_year
- , subq_7.ds__extract_quarter
- , subq_7.ds__extract_month
- , subq_7.ds__extract_day
- , subq_7.ds__extract_dow
- , subq_7.ds__extract_doy
- , subq_7.buy__ds__day
- , subq_7.buy__ds__week
- , subq_7.buy__ds__month
- , subq_7.buy__ds__quarter
- , subq_7.buy__ds__year
- , subq_7.buy__ds__extract_year
- , subq_7.buy__ds__extract_quarter
- , subq_7.buy__ds__extract_month
- , subq_7.buy__ds__extract_day
- , subq_7.buy__ds__extract_dow
- , subq_7.buy__ds__extract_doy
- , subq_7.ds__day AS metric_time__day
- , subq_7.ds__week AS metric_time__week
- , subq_7.ds__month AS metric_time__month
- , subq_7.ds__quarter AS metric_time__quarter
- , subq_7.ds__year AS metric_time__year
- , subq_7.ds__extract_year AS metric_time__extract_year
- , subq_7.ds__extract_quarter AS metric_time__extract_quarter
- , subq_7.ds__extract_month AS metric_time__extract_month
- , subq_7.ds__extract_day AS metric_time__extract_day
- , subq_7.ds__extract_dow AS metric_time__extract_dow
- , subq_7.ds__extract_doy AS metric_time__extract_doy
- , subq_7.user
- , subq_7.session_id
- , subq_7.buy__user
- , subq_7.buy__session_id
- , subq_7.buys
- , subq_7.buyers
+ subq_16.ds__day
+ , subq_16.ds__week
+ , subq_16.ds__month
+ , subq_16.ds__quarter
+ , subq_16.ds__year
+ , subq_16.ds__extract_year
+ , subq_16.ds__extract_quarter
+ , subq_16.ds__extract_month
+ , subq_16.ds__extract_day
+ , subq_16.ds__extract_dow
+ , subq_16.ds__extract_doy
+ , subq_16.buy__ds__day
+ , subq_16.buy__ds__week
+ , subq_16.buy__ds__month
+ , subq_16.buy__ds__quarter
+ , subq_16.buy__ds__year
+ , subq_16.buy__ds__extract_year
+ , subq_16.buy__ds__extract_quarter
+ , subq_16.buy__ds__extract_month
+ , subq_16.buy__ds__extract_day
+ , subq_16.buy__ds__extract_dow
+ , subq_16.buy__ds__extract_doy
+ , subq_16.ds__day AS metric_time__day
+ , subq_16.ds__week AS metric_time__week
+ , subq_16.ds__month AS metric_time__month
+ , subq_16.ds__quarter AS metric_time__quarter
+ , subq_16.ds__year AS metric_time__year
+ , subq_16.ds__extract_year AS metric_time__extract_year
+ , subq_16.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_16.ds__extract_month AS metric_time__extract_month
+ , subq_16.ds__extract_day AS metric_time__extract_day
+ , subq_16.ds__extract_dow AS metric_time__extract_dow
+ , subq_16.ds__extract_doy AS metric_time__extract_doy
+ , subq_16.user
+ , subq_16.session_id
+ , subq_16.buy__user
+ , subq_16.buy__session_id
+ , subq_16.buys
+ , subq_16.buyers
FROM (
-- Read Elements From Semantic Model 'buys_source'
SELECT
1 AS buys
- , buys_source_src_28002.user_id AS buyers
- , DATE_TRUNC(buys_source_src_28002.ds, day) AS ds__day
- , DATE_TRUNC(buys_source_src_28002.ds, isoweek) AS ds__week
- , DATE_TRUNC(buys_source_src_28002.ds, month) AS ds__month
- , DATE_TRUNC(buys_source_src_28002.ds, quarter) AS ds__quarter
- , DATE_TRUNC(buys_source_src_28002.ds, year) AS ds__year
- , EXTRACT(year FROM buys_source_src_28002.ds) AS ds__extract_year
- , EXTRACT(quarter FROM buys_source_src_28002.ds) AS ds__extract_quarter
- , EXTRACT(month FROM buys_source_src_28002.ds) AS ds__extract_month
- , EXTRACT(day FROM buys_source_src_28002.ds) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM buys_source_src_28002.ds) = 1, 7, EXTRACT(dayofweek FROM buys_source_src_28002.ds) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM buys_source_src_28002.ds) AS ds__extract_doy
- , DATE_TRUNC(buys_source_src_28002.ds, day) AS buy__ds__day
- , DATE_TRUNC(buys_source_src_28002.ds, isoweek) AS buy__ds__week
- , DATE_TRUNC(buys_source_src_28002.ds, month) AS buy__ds__month
- , DATE_TRUNC(buys_source_src_28002.ds, quarter) AS buy__ds__quarter
- , DATE_TRUNC(buys_source_src_28002.ds, year) AS buy__ds__year
- , EXTRACT(year FROM buys_source_src_28002.ds) AS buy__ds__extract_year
- , EXTRACT(quarter FROM buys_source_src_28002.ds) AS buy__ds__extract_quarter
- , EXTRACT(month FROM buys_source_src_28002.ds) AS buy__ds__extract_month
- , EXTRACT(day FROM buys_source_src_28002.ds) AS buy__ds__extract_day
- , IF(EXTRACT(dayofweek FROM buys_source_src_28002.ds) = 1, 7, EXTRACT(dayofweek FROM buys_source_src_28002.ds) - 1) AS buy__ds__extract_dow
- , EXTRACT(dayofyear FROM buys_source_src_28002.ds) AS buy__ds__extract_doy
- , buys_source_src_28002.user_id AS user
- , buys_source_src_28002.session_id
- , buys_source_src_28002.user_id AS buy__user
- , buys_source_src_28002.session_id AS buy__session_id
- FROM ***************************.fct_buys buys_source_src_28002
- ) subq_7
- ) subq_8
- ) subq_9
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM buys_source_src_28000.ds) AS buy__ds__extract_day
+ , IF(EXTRACT(dayofweek FROM buys_source_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM buys_source_src_28000.ds) - 1) AS buy__ds__extract_dow
+ , EXTRACT(dayofyear FROM buys_source_src_28000.ds) AS buy__ds__extract_doy
+ , buys_source_src_28000.user_id AS user
+ , buys_source_src_28000.session_id
+ , buys_source_src_28000.user_id AS buy__user
+ , buys_source_src_28000.session_id AS buy__session_id
+ FROM ***************************.fct_buys buys_source_src_28000
+ ) subq_16
+ ) subq_17
+ ) subq_18
ON
(
- subq_6.user = subq_9.user
+ subq_15.user = subq_18.user
) AND (
(
- subq_6.ds__day <= subq_9.ds__day
+ subq_15.ds__day <= subq_18.ds__day
) AND (
- subq_6.ds__day > DATE_SUB(CAST(subq_9.ds__day AS DATETIME), INTERVAL 7 day)
+ subq_15.ds__day > DATE_SUB(CAST(subq_18.ds__day AS DATETIME), INTERVAL 7 day)
)
)
- ) subq_10
- ) subq_11
- ) subq_12
+ ) subq_19
+ ) subq_20
+ ) subq_21
GROUP BY
metric_time__day
, visit__referrer_id
- ) subq_13
+ ) subq_22
ON
(
- subq_3.visit__referrer_id = subq_13.visit__referrer_id
+ subq_12.visit__referrer_id = subq_22.visit__referrer_id
) AND (
- subq_3.metric_time__day = subq_13.metric_time__day
+ subq_12.metric_time__day = subq_22.metric_time__day
)
GROUP BY
metric_time__day
, visit__referrer_id
-) subq_14
+) subq_23
diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate_with_window__plan0_optimized.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate_with_window__plan0_optimized.sql
index 2a140f4690..280fc0dc92 100644
--- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate_with_window__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/BigQuery/test_conversion_rate_with_window__plan0_optimized.sql
@@ -6,10 +6,10 @@ SELECT
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_18.metric_time__day, subq_28.metric_time__day) AS metric_time__day
- , COALESCE(subq_18.visit__referrer_id, subq_28.visit__referrer_id) AS visit__referrer_id
- , MAX(subq_18.visits) AS visits
- , MAX(subq_28.buys) AS buys
+ COALESCE(subq_27.metric_time__day, subq_37.metric_time__day) AS metric_time__day
+ , COALESCE(subq_27.visit__referrer_id, subq_37.visit__referrer_id) AS visit__referrer_id
+ , MAX(subq_27.visits) AS visits
+ , MAX(subq_37.buys) AS buys
FROM (
-- Aggregate Measures
SELECT
@@ -24,12 +24,12 @@ FROM (
DATE_TRUNC(ds, day) AS metric_time__day
, referrer_id AS visit__referrer_id
, 1 AS visits
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_17
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_26
GROUP BY
metric_time__day
, visit__referrer_id
- ) subq_18
+ ) subq_27
FULL OUTER JOIN (
-- Find conversions for user within the range of 7 day
-- Pass Only Elements: ['buys', 'visit__referrer_id', 'metric_time__day']
@@ -41,13 +41,13 @@ FROM (
FROM (
-- Dedupe the fanout with mf_internal_uuid in the conversion data set
SELECT DISTINCT
- first_value(subq_21.visits) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
- , first_value(subq_21.visit__referrer_id) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visit__referrer_id
- , first_value(subq_21.ds__day) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
- , first_value(subq_21.metric_time__day) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS metric_time__day
- , first_value(subq_21.user) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
- , subq_24.mf_internal_uuid AS mf_internal_uuid
- , subq_24.buys AS buys
+ first_value(subq_30.visits) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
+ , first_value(subq_30.visit__referrer_id) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visit__referrer_id
+ , first_value(subq_30.ds__day) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
+ , first_value(subq_30.metric_time__day) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS metric_time__day
+ , first_value(subq_30.user) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
+ , subq_33.mf_internal_uuid AS mf_internal_uuid
+ , subq_33.buys AS buys
FROM (
-- Read Elements From Semantic Model 'visits_source'
-- Metric Time Dimension 'ds'
@@ -58,8 +58,8 @@ FROM (
, user_id AS user
, referrer_id AS visit__referrer_id
, 1 AS visits
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_21
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_30
INNER JOIN (
-- Read Elements From Semantic Model 'buys_source'
-- Metric Time Dimension 'ds'
@@ -69,30 +69,30 @@ FROM (
, user_id AS user
, 1 AS buys
, GENERATE_UUID() AS mf_internal_uuid
- FROM ***************************.fct_buys buys_source_src_28002
- ) subq_24
+ FROM ***************************.fct_buys buys_source_src_28000
+ ) subq_33
ON
(
- subq_21.user = subq_24.user
+ subq_30.user = subq_33.user
) AND (
(
- subq_21.ds__day <= subq_24.ds__day
+ subq_30.ds__day <= subq_33.ds__day
) AND (
- subq_21.ds__day > DATE_SUB(CAST(subq_24.ds__day AS DATETIME), INTERVAL 7 day)
+ subq_30.ds__day > DATE_SUB(CAST(subq_33.ds__day AS DATETIME), INTERVAL 7 day)
)
)
- ) subq_25
+ ) subq_34
GROUP BY
metric_time__day
, visit__referrer_id
- ) subq_28
+ ) subq_37
ON
(
- subq_18.visit__referrer_id = subq_28.visit__referrer_id
+ subq_27.visit__referrer_id = subq_37.visit__referrer_id
) AND (
- subq_18.metric_time__day = subq_28.metric_time__day
+ subq_27.metric_time__day = subq_37.metric_time__day
)
GROUP BY
metric_time__day
, visit__referrer_id
-) subq_29
+) subq_38
diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Databricks/test_conversion_count_with_no_group_by__plan0.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Databricks/test_conversion_count_with_no_group_by__plan0.sql
index c61789e34d..ac7f0473ec 100644
--- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Databricks/test_conversion_count_with_no_group_by__plan0.sql
+++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Databricks/test_conversion_count_with_no_group_by__plan0.sql
@@ -1,343 +1,343 @@
-- Compute Metrics via Expressions
SELECT
- subq_14.buys AS visit_buy_conversions
+ subq_23.buys AS visit_buy_conversions
FROM (
-- Combine Aggregated Outputs
SELECT
- MAX(subq_3.visits) AS visits
- , COALESCE(MAX(subq_13.buys), 0) AS buys
+ MAX(subq_12.visits) AS visits
+ , COALESCE(MAX(subq_22.buys), 0) AS buys
FROM (
-- Aggregate Measures
SELECT
- SUM(subq_2.visits) AS visits
+ SUM(subq_11.visits) AS visits
FROM (
-- Pass Only Elements: ['visits',]
SELECT
- subq_1.visits
+ subq_10.visits
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.visit__ds__day
- , subq_0.visit__ds__week
- , subq_0.visit__ds__month
- , subq_0.visit__ds__quarter
- , subq_0.visit__ds__year
- , subq_0.visit__ds__extract_year
- , subq_0.visit__ds__extract_quarter
- , subq_0.visit__ds__extract_month
- , subq_0.visit__ds__extract_day
- , subq_0.visit__ds__extract_dow
- , subq_0.visit__ds__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.user
- , subq_0.session
- , subq_0.visit__user
- , subq_0.visit__session
- , subq_0.referrer_id
- , subq_0.visit__referrer_id
- , subq_0.visits
- , subq_0.visitors
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.visit__ds__day
+ , subq_9.visit__ds__week
+ , subq_9.visit__ds__month
+ , subq_9.visit__ds__quarter
+ , subq_9.visit__ds__year
+ , subq_9.visit__ds__extract_year
+ , subq_9.visit__ds__extract_quarter
+ , subq_9.visit__ds__extract_month
+ , subq_9.visit__ds__extract_day
+ , subq_9.visit__ds__extract_dow
+ , subq_9.visit__ds__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.user
+ , subq_9.session
+ , subq_9.visit__user
+ , subq_9.visit__session
+ , subq_9.referrer_id
+ , subq_9.visit__referrer_id
+ , subq_9.visits
+ , subq_9.visitors
FROM (
-- Read Elements From Semantic Model 'visits_source'
SELECT
1 AS visits
- , visits_source_src_28011.user_id AS visitors
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM visits_source_src_28011.ds) AS ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy
- , visits_source_src_28011.referrer_id
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM visits_source_src_28011.ds) AS visit__ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy
- , visits_source_src_28011.referrer_id AS visit__referrer_id
- , visits_source_src_28011.user_id AS user
- , visits_source_src_28011.session_id AS session
- , visits_source_src_28011.user_id AS visit__user
- , visits_source_src_28011.session_id AS visit__session
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_0
- ) subq_1
- ) subq_2
- ) subq_3
+ , visits_source_src_28000.user_id AS visitors
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS ds__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM visits_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS ds__extract_doy
+ , visits_source_src_28000.referrer_id
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS visit__ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS visit__ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS visit__ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS visit__ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS visit__ds__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM visits_source_src_28000.ds) AS visit__ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS visit__ds__extract_doy
+ , visits_source_src_28000.referrer_id AS visit__referrer_id
+ , visits_source_src_28000.user_id AS user
+ , visits_source_src_28000.session_id AS session
+ , visits_source_src_28000.user_id AS visit__user
+ , visits_source_src_28000.session_id AS visit__session
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
+ ) subq_12
CROSS JOIN (
-- Aggregate Measures
SELECT
- SUM(subq_12.buys) AS buys
+ SUM(subq_21.buys) AS buys
FROM (
-- Pass Only Elements: ['buys',]
SELECT
- subq_11.buys
+ subq_20.buys
FROM (
-- Find conversions for user within the range of 7 day
SELECT
- subq_10.ds__day
- , subq_10.user
- , subq_10.buys
- , subq_10.visits
+ subq_19.ds__day
+ , subq_19.user
+ , subq_19.buys
+ , subq_19.visits
FROM (
-- Dedupe the fanout with mf_internal_uuid in the conversion data set
SELECT DISTINCT
- first_value(subq_6.visits) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
- , first_value(subq_6.ds__day) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
- , first_value(subq_6.user) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
- , subq_9.mf_internal_uuid AS mf_internal_uuid
- , subq_9.buys AS buys
+ first_value(subq_15.visits) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
+ , first_value(subq_15.ds__day) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
+ , first_value(subq_15.user) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
+ , subq_18.mf_internal_uuid AS mf_internal_uuid
+ , subq_18.buys AS buys
FROM (
-- Pass Only Elements: ['visits', 'ds__day', 'user']
SELECT
- subq_5.ds__day
- , subq_5.user
- , subq_5.visits
+ subq_14.ds__day
+ , subq_14.user
+ , subq_14.visits
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_4.ds__day
- , subq_4.ds__week
- , subq_4.ds__month
- , subq_4.ds__quarter
- , subq_4.ds__year
- , subq_4.ds__extract_year
- , subq_4.ds__extract_quarter
- , subq_4.ds__extract_month
- , subq_4.ds__extract_day
- , subq_4.ds__extract_dow
- , subq_4.ds__extract_doy
- , subq_4.visit__ds__day
- , subq_4.visit__ds__week
- , subq_4.visit__ds__month
- , subq_4.visit__ds__quarter
- , subq_4.visit__ds__year
- , subq_4.visit__ds__extract_year
- , subq_4.visit__ds__extract_quarter
- , subq_4.visit__ds__extract_month
- , subq_4.visit__ds__extract_day
- , subq_4.visit__ds__extract_dow
- , subq_4.visit__ds__extract_doy
- , subq_4.ds__day AS metric_time__day
- , subq_4.ds__week AS metric_time__week
- , subq_4.ds__month AS metric_time__month
- , subq_4.ds__quarter AS metric_time__quarter
- , subq_4.ds__year AS metric_time__year
- , subq_4.ds__extract_year AS metric_time__extract_year
- , subq_4.ds__extract_quarter AS metric_time__extract_quarter
- , subq_4.ds__extract_month AS metric_time__extract_month
- , subq_4.ds__extract_day AS metric_time__extract_day
- , subq_4.ds__extract_dow AS metric_time__extract_dow
- , subq_4.ds__extract_doy AS metric_time__extract_doy
- , subq_4.user
- , subq_4.session
- , subq_4.visit__user
- , subq_4.visit__session
- , subq_4.referrer_id
- , subq_4.visit__referrer_id
- , subq_4.visits
- , subq_4.visitors
+ subq_13.ds__day
+ , subq_13.ds__week
+ , subq_13.ds__month
+ , subq_13.ds__quarter
+ , subq_13.ds__year
+ , subq_13.ds__extract_year
+ , subq_13.ds__extract_quarter
+ , subq_13.ds__extract_month
+ , subq_13.ds__extract_day
+ , subq_13.ds__extract_dow
+ , subq_13.ds__extract_doy
+ , subq_13.visit__ds__day
+ , subq_13.visit__ds__week
+ , subq_13.visit__ds__month
+ , subq_13.visit__ds__quarter
+ , subq_13.visit__ds__year
+ , subq_13.visit__ds__extract_year
+ , subq_13.visit__ds__extract_quarter
+ , subq_13.visit__ds__extract_month
+ , subq_13.visit__ds__extract_day
+ , subq_13.visit__ds__extract_dow
+ , subq_13.visit__ds__extract_doy
+ , subq_13.ds__day AS metric_time__day
+ , subq_13.ds__week AS metric_time__week
+ , subq_13.ds__month AS metric_time__month
+ , subq_13.ds__quarter AS metric_time__quarter
+ , subq_13.ds__year AS metric_time__year
+ , subq_13.ds__extract_year AS metric_time__extract_year
+ , subq_13.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_13.ds__extract_month AS metric_time__extract_month
+ , subq_13.ds__extract_day AS metric_time__extract_day
+ , subq_13.ds__extract_dow AS metric_time__extract_dow
+ , subq_13.ds__extract_doy AS metric_time__extract_doy
+ , subq_13.user
+ , subq_13.session
+ , subq_13.visit__user
+ , subq_13.visit__session
+ , subq_13.referrer_id
+ , subq_13.visit__referrer_id
+ , subq_13.visits
+ , subq_13.visitors
FROM (
-- Read Elements From Semantic Model 'visits_source'
SELECT
1 AS visits
- , visits_source_src_28011.user_id AS visitors
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM visits_source_src_28011.ds) AS ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy
- , visits_source_src_28011.referrer_id
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM visits_source_src_28011.ds) AS visit__ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy
- , visits_source_src_28011.referrer_id AS visit__referrer_id
- , visits_source_src_28011.user_id AS user
- , visits_source_src_28011.session_id AS session
- , visits_source_src_28011.user_id AS visit__user
- , visits_source_src_28011.session_id AS visit__session
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_4
- ) subq_5
- ) subq_6
+ , visits_source_src_28000.user_id AS visitors
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS ds__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM visits_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS ds__extract_doy
+ , visits_source_src_28000.referrer_id
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS visit__ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS visit__ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS visit__ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS visit__ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS visit__ds__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM visits_source_src_28000.ds) AS visit__ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS visit__ds__extract_doy
+ , visits_source_src_28000.referrer_id AS visit__referrer_id
+ , visits_source_src_28000.user_id AS user
+ , visits_source_src_28000.session_id AS session
+ , visits_source_src_28000.user_id AS visit__user
+ , visits_source_src_28000.session_id AS visit__session
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_13
+ ) subq_14
+ ) subq_15
INNER JOIN (
-- Add column with generated UUID
SELECT
- subq_8.ds__day
- , subq_8.ds__week
- , subq_8.ds__month
- , subq_8.ds__quarter
- , subq_8.ds__year
- , subq_8.ds__extract_year
- , subq_8.ds__extract_quarter
- , subq_8.ds__extract_month
- , subq_8.ds__extract_day
- , subq_8.ds__extract_dow
- , subq_8.ds__extract_doy
- , subq_8.buy__ds__day
- , subq_8.buy__ds__week
- , subq_8.buy__ds__month
- , subq_8.buy__ds__quarter
- , subq_8.buy__ds__year
- , subq_8.buy__ds__extract_year
- , subq_8.buy__ds__extract_quarter
- , subq_8.buy__ds__extract_month
- , subq_8.buy__ds__extract_day
- , subq_8.buy__ds__extract_dow
- , subq_8.buy__ds__extract_doy
- , subq_8.metric_time__day
- , subq_8.metric_time__week
- , subq_8.metric_time__month
- , subq_8.metric_time__quarter
- , subq_8.metric_time__year
- , subq_8.metric_time__extract_year
- , subq_8.metric_time__extract_quarter
- , subq_8.metric_time__extract_month
- , subq_8.metric_time__extract_day
- , subq_8.metric_time__extract_dow
- , subq_8.metric_time__extract_doy
- , subq_8.user
- , subq_8.session_id
- , subq_8.buy__user
- , subq_8.buy__session_id
- , subq_8.buys
- , subq_8.buyers
+ subq_17.ds__day
+ , subq_17.ds__week
+ , subq_17.ds__month
+ , subq_17.ds__quarter
+ , subq_17.ds__year
+ , subq_17.ds__extract_year
+ , subq_17.ds__extract_quarter
+ , subq_17.ds__extract_month
+ , subq_17.ds__extract_day
+ , subq_17.ds__extract_dow
+ , subq_17.ds__extract_doy
+ , subq_17.buy__ds__day
+ , subq_17.buy__ds__week
+ , subq_17.buy__ds__month
+ , subq_17.buy__ds__quarter
+ , subq_17.buy__ds__year
+ , subq_17.buy__ds__extract_year
+ , subq_17.buy__ds__extract_quarter
+ , subq_17.buy__ds__extract_month
+ , subq_17.buy__ds__extract_day
+ , subq_17.buy__ds__extract_dow
+ , subq_17.buy__ds__extract_doy
+ , subq_17.metric_time__day
+ , subq_17.metric_time__week
+ , subq_17.metric_time__month
+ , subq_17.metric_time__quarter
+ , subq_17.metric_time__year
+ , subq_17.metric_time__extract_year
+ , subq_17.metric_time__extract_quarter
+ , subq_17.metric_time__extract_month
+ , subq_17.metric_time__extract_day
+ , subq_17.metric_time__extract_dow
+ , subq_17.metric_time__extract_doy
+ , subq_17.user
+ , subq_17.session_id
+ , subq_17.buy__user
+ , subq_17.buy__session_id
+ , subq_17.buys
+ , subq_17.buyers
, UUID() AS mf_internal_uuid
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_7.ds__day
- , subq_7.ds__week
- , subq_7.ds__month
- , subq_7.ds__quarter
- , subq_7.ds__year
- , subq_7.ds__extract_year
- , subq_7.ds__extract_quarter
- , subq_7.ds__extract_month
- , subq_7.ds__extract_day
- , subq_7.ds__extract_dow
- , subq_7.ds__extract_doy
- , subq_7.buy__ds__day
- , subq_7.buy__ds__week
- , subq_7.buy__ds__month
- , subq_7.buy__ds__quarter
- , subq_7.buy__ds__year
- , subq_7.buy__ds__extract_year
- , subq_7.buy__ds__extract_quarter
- , subq_7.buy__ds__extract_month
- , subq_7.buy__ds__extract_day
- , subq_7.buy__ds__extract_dow
- , subq_7.buy__ds__extract_doy
- , subq_7.ds__day AS metric_time__day
- , subq_7.ds__week AS metric_time__week
- , subq_7.ds__month AS metric_time__month
- , subq_7.ds__quarter AS metric_time__quarter
- , subq_7.ds__year AS metric_time__year
- , subq_7.ds__extract_year AS metric_time__extract_year
- , subq_7.ds__extract_quarter AS metric_time__extract_quarter
- , subq_7.ds__extract_month AS metric_time__extract_month
- , subq_7.ds__extract_day AS metric_time__extract_day
- , subq_7.ds__extract_dow AS metric_time__extract_dow
- , subq_7.ds__extract_doy AS metric_time__extract_doy
- , subq_7.user
- , subq_7.session_id
- , subq_7.buy__user
- , subq_7.buy__session_id
- , subq_7.buys
- , subq_7.buyers
+ subq_16.ds__day
+ , subq_16.ds__week
+ , subq_16.ds__month
+ , subq_16.ds__quarter
+ , subq_16.ds__year
+ , subq_16.ds__extract_year
+ , subq_16.ds__extract_quarter
+ , subq_16.ds__extract_month
+ , subq_16.ds__extract_day
+ , subq_16.ds__extract_dow
+ , subq_16.ds__extract_doy
+ , subq_16.buy__ds__day
+ , subq_16.buy__ds__week
+ , subq_16.buy__ds__month
+ , subq_16.buy__ds__quarter
+ , subq_16.buy__ds__year
+ , subq_16.buy__ds__extract_year
+ , subq_16.buy__ds__extract_quarter
+ , subq_16.buy__ds__extract_month
+ , subq_16.buy__ds__extract_day
+ , subq_16.buy__ds__extract_dow
+ , subq_16.buy__ds__extract_doy
+ , subq_16.ds__day AS metric_time__day
+ , subq_16.ds__week AS metric_time__week
+ , subq_16.ds__month AS metric_time__month
+ , subq_16.ds__quarter AS metric_time__quarter
+ , subq_16.ds__year AS metric_time__year
+ , subq_16.ds__extract_year AS metric_time__extract_year
+ , subq_16.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_16.ds__extract_month AS metric_time__extract_month
+ , subq_16.ds__extract_day AS metric_time__extract_day
+ , subq_16.ds__extract_dow AS metric_time__extract_dow
+ , subq_16.ds__extract_doy AS metric_time__extract_doy
+ , subq_16.user
+ , subq_16.session_id
+ , subq_16.buy__user
+ , subq_16.buy__session_id
+ , subq_16.buys
+ , subq_16.buyers
FROM (
-- Read Elements From Semantic Model 'buys_source'
SELECT
1 AS buys
- , buys_source_src_28002.user_id AS buyers
- , DATE_TRUNC('day', buys_source_src_28002.ds) AS ds__day
- , DATE_TRUNC('week', buys_source_src_28002.ds) AS ds__week
- , DATE_TRUNC('month', buys_source_src_28002.ds) AS ds__month
- , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS ds__quarter
- , DATE_TRUNC('year', buys_source_src_28002.ds) AS ds__year
- , EXTRACT(year FROM buys_source_src_28002.ds) AS ds__extract_year
- , EXTRACT(quarter FROM buys_source_src_28002.ds) AS ds__extract_quarter
- , EXTRACT(month FROM buys_source_src_28002.ds) AS ds__extract_month
- , EXTRACT(day FROM buys_source_src_28002.ds) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM buys_source_src_28002.ds) AS ds__extract_dow
- , EXTRACT(doy FROM buys_source_src_28002.ds) AS ds__extract_doy
- , DATE_TRUNC('day', buys_source_src_28002.ds) AS buy__ds__day
- , DATE_TRUNC('week', buys_source_src_28002.ds) AS buy__ds__week
- , DATE_TRUNC('month', buys_source_src_28002.ds) AS buy__ds__month
- , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS buy__ds__quarter
- , DATE_TRUNC('year', buys_source_src_28002.ds) AS buy__ds__year
- , EXTRACT(year FROM buys_source_src_28002.ds) AS buy__ds__extract_year
- , EXTRACT(quarter FROM buys_source_src_28002.ds) AS buy__ds__extract_quarter
- , EXTRACT(month FROM buys_source_src_28002.ds) AS buy__ds__extract_month
- , EXTRACT(day FROM buys_source_src_28002.ds) AS buy__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM buys_source_src_28002.ds) AS buy__ds__extract_dow
- , EXTRACT(doy FROM buys_source_src_28002.ds) AS buy__ds__extract_doy
- , buys_source_src_28002.user_id AS user
- , buys_source_src_28002.session_id
- , buys_source_src_28002.user_id AS buy__user
- , buys_source_src_28002.session_id AS buy__session_id
- FROM ***************************.fct_buys buys_source_src_28002
- ) subq_7
- ) subq_8
- ) subq_9
+ , buys_source_src_28000.user_id AS buyers
+ , DATE_TRUNC('day', buys_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', buys_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', buys_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', buys_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', buys_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM buys_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM buys_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', buys_source_src_28000.ds) AS buy__ds__day
+ , DATE_TRUNC('week', buys_source_src_28000.ds) AS buy__ds__week
+ , DATE_TRUNC('month', buys_source_src_28000.ds) AS buy__ds__month
+ , DATE_TRUNC('quarter', buys_source_src_28000.ds) AS buy__ds__quarter
+ , DATE_TRUNC('year', buys_source_src_28000.ds) 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
+ , EXTRACT(day FROM buys_source_src_28000.ds) AS buy__ds__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM buys_source_src_28000.ds) AS buy__ds__extract_dow
+ , EXTRACT(doy FROM buys_source_src_28000.ds) AS buy__ds__extract_doy
+ , buys_source_src_28000.user_id AS user
+ , buys_source_src_28000.session_id
+ , buys_source_src_28000.user_id AS buy__user
+ , buys_source_src_28000.session_id AS buy__session_id
+ FROM ***************************.fct_buys buys_source_src_28000
+ ) subq_16
+ ) subq_17
+ ) subq_18
ON
(
- subq_6.user = subq_9.user
+ subq_15.user = subq_18.user
) AND (
(
- subq_6.ds__day <= subq_9.ds__day
+ subq_15.ds__day <= subq_18.ds__day
) AND (
- subq_6.ds__day > DATEADD(day, -7, subq_9.ds__day)
+ subq_15.ds__day > DATEADD(day, -7, subq_18.ds__day)
)
)
- ) subq_10
- ) subq_11
- ) subq_12
- ) subq_13
-) subq_14
+ ) subq_19
+ ) subq_20
+ ) subq_21
+ ) subq_22
+) subq_23
diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Databricks/test_conversion_count_with_no_group_by__plan0_optimized.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Databricks/test_conversion_count_with_no_group_by__plan0_optimized.sql
index fda19c9ba7..b7fdf5e3f1 100644
--- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Databricks/test_conversion_count_with_no_group_by__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Databricks/test_conversion_count_with_no_group_by__plan0_optimized.sql
@@ -1,7 +1,7 @@
-- Combine Aggregated Outputs
-- Compute Metrics via Expressions
SELECT
- COALESCE(MAX(subq_28.buys), 0) AS visit_buy_conversions
+ COALESCE(MAX(subq_37.buys), 0) AS visit_buy_conversions
FROM (
-- Read Elements From Semantic Model 'visits_source'
-- Metric Time Dimension 'ds'
@@ -9,8 +9,8 @@ FROM (
-- Aggregate Measures
SELECT
SUM(1) AS visits
- FROM ***************************.fct_visits visits_source_src_28011
-) subq_18
+ FROM ***************************.fct_visits visits_source_src_28000
+) subq_27
CROSS JOIN (
-- Find conversions for user within the range of 7 day
-- Pass Only Elements: ['buys',]
@@ -20,11 +20,11 @@ CROSS JOIN (
FROM (
-- Dedupe the fanout with mf_internal_uuid in the conversion data set
SELECT DISTINCT
- first_value(subq_21.visits) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
- , first_value(subq_21.ds__day) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
- , first_value(subq_21.user) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
- , subq_24.mf_internal_uuid AS mf_internal_uuid
- , subq_24.buys AS buys
+ first_value(subq_30.visits) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
+ , first_value(subq_30.ds__day) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
+ , first_value(subq_30.user) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
+ , subq_33.mf_internal_uuid AS mf_internal_uuid
+ , subq_33.buys AS buys
FROM (
-- Read Elements From Semantic Model 'visits_source'
-- Metric Time Dimension 'ds'
@@ -33,8 +33,8 @@ CROSS JOIN (
DATE_TRUNC('day', ds) AS ds__day
, user_id AS user
, 1 AS visits
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_21
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_30
INNER JOIN (
-- Read Elements From Semantic Model 'buys_source'
-- Metric Time Dimension 'ds'
@@ -44,17 +44,17 @@ CROSS JOIN (
, user_id AS user
, 1 AS buys
, UUID() AS mf_internal_uuid
- FROM ***************************.fct_buys buys_source_src_28002
- ) subq_24
+ FROM ***************************.fct_buys buys_source_src_28000
+ ) subq_33
ON
(
- subq_21.user = subq_24.user
+ subq_30.user = subq_33.user
) AND (
(
- subq_21.ds__day <= subq_24.ds__day
+ subq_30.ds__day <= subq_33.ds__day
) AND (
- subq_21.ds__day > DATEADD(day, -7, subq_24.ds__day)
+ subq_30.ds__day > DATEADD(day, -7, subq_33.ds__day)
)
)
- ) subq_25
-) subq_28
+ ) subq_34
+) subq_37
diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Databricks/test_conversion_rate__plan0.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Databricks/test_conversion_rate__plan0.sql
index c7538526cb..6cc0d20703 100644
--- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Databricks/test_conversion_rate__plan0.sql
+++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Databricks/test_conversion_rate__plan0.sql
@@ -1,352 +1,356 @@
-- Compute Metrics via Expressions
SELECT
- subq_14.visit__referrer_id
- , CAST(subq_14.buys AS DOUBLE) / CAST(NULLIF(subq_14.visits, 0) AS DOUBLE) AS visit_buy_conversion_rate
+ subq_23.visit__referrer_id
+ , CAST(subq_23.buys AS DOUBLE) / CAST(NULLIF(subq_23.visits, 0) AS DOUBLE) AS visit_buy_conversion_rate
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_3.visit__referrer_id, subq_13.visit__referrer_id) AS visit__referrer_id
- , MAX(subq_3.visits) AS visits
- , MAX(subq_13.buys) AS buys
+ COALESCE(subq_12.visit__referrer_id, subq_22.visit__referrer_id) AS visit__referrer_id
+ , MAX(subq_12.visits) AS visits
+ , MAX(subq_22.buys) AS buys
FROM (
-- Aggregate Measures
SELECT
- subq_2.visit__referrer_id
- , SUM(subq_2.visits) AS visits
+ subq_11.visit__referrer_id
+ , SUM(subq_11.visits) AS visits
FROM (
-- Pass Only Elements: ['visits', 'visit__referrer_id']
SELECT
- subq_1.visit__referrer_id
- , subq_1.visits
+ subq_10.visit__referrer_id
+ , subq_10.visits
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.visit__ds__day
- , subq_0.visit__ds__week
- , subq_0.visit__ds__month
- , subq_0.visit__ds__quarter
- , subq_0.visit__ds__year
- , subq_0.visit__ds__extract_year
- , subq_0.visit__ds__extract_quarter
- , subq_0.visit__ds__extract_month
- , subq_0.visit__ds__extract_day
- , subq_0.visit__ds__extract_dow
- , subq_0.visit__ds__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.user
- , subq_0.session
- , subq_0.visit__user
- , subq_0.visit__session
- , subq_0.referrer_id
- , subq_0.visit__referrer_id
- , subq_0.visits
- , subq_0.visitors
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.visit__ds__day
+ , subq_9.visit__ds__week
+ , subq_9.visit__ds__month
+ , subq_9.visit__ds__quarter
+ , subq_9.visit__ds__year
+ , subq_9.visit__ds__extract_year
+ , subq_9.visit__ds__extract_quarter
+ , subq_9.visit__ds__extract_month
+ , subq_9.visit__ds__extract_day
+ , subq_9.visit__ds__extract_dow
+ , subq_9.visit__ds__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.user
+ , subq_9.session
+ , subq_9.visit__user
+ , subq_9.visit__session
+ , subq_9.referrer_id
+ , subq_9.visit__referrer_id
+ , subq_9.visits
+ , subq_9.visitors
FROM (
-- Read Elements From Semantic Model 'visits_source'
SELECT
1 AS visits
- , visits_source_src_28011.user_id AS visitors
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM visits_source_src_28011.ds) AS ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy
- , visits_source_src_28011.referrer_id
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM visits_source_src_28011.ds) AS visit__ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy
- , visits_source_src_28011.referrer_id AS visit__referrer_id
- , visits_source_src_28011.user_id AS user
- , visits_source_src_28011.session_id AS session
- , visits_source_src_28011.user_id AS visit__user
- , visits_source_src_28011.session_id AS visit__session
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_0
- ) subq_1
- ) subq_2
+ , visits_source_src_28000.user_id AS visitors
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS ds__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM visits_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS ds__extract_doy
+ , visits_source_src_28000.referrer_id
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS visit__ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS visit__ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS visit__ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS visit__ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS visit__ds__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM visits_source_src_28000.ds) AS visit__ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS visit__ds__extract_doy
+ , visits_source_src_28000.referrer_id AS visit__referrer_id
+ , visits_source_src_28000.user_id AS user
+ , visits_source_src_28000.session_id AS session
+ , visits_source_src_28000.user_id AS visit__user
+ , visits_source_src_28000.session_id AS visit__session
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
GROUP BY
- subq_2.visit__referrer_id
- ) subq_3
+ subq_11.visit__referrer_id
+ ) subq_12
FULL OUTER JOIN (
-- Aggregate Measures
SELECT
- subq_12.visit__referrer_id
- , SUM(subq_12.buys) AS buys
+ subq_21.visit__referrer_id
+ , SUM(subq_21.buys) AS buys
FROM (
-- Pass Only Elements: ['buys', 'visit__referrer_id']
SELECT
- subq_11.visit__referrer_id
- , subq_11.buys
+ subq_20.visit__referrer_id
+ , subq_20.buys
FROM (
-- Find conversions for user within the range of INF
SELECT
- subq_10.ds__day
- , subq_10.user
- , subq_10.visit__referrer_id
- , subq_10.buys
- , subq_10.visits
+ subq_19.ds__day
+ , subq_19.user
+ , subq_19.visit__referrer_id
+ , subq_19.buys
+ , subq_19.visits
FROM (
-- Dedupe the fanout with mf_internal_uuid in the conversion data set
SELECT DISTINCT
- first_value(subq_6.visits) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
- , first_value(subq_6.visit__referrer_id) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visit__referrer_id
- , first_value(subq_6.ds__day) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
- , first_value(subq_6.user) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
- , subq_9.mf_internal_uuid AS mf_internal_uuid
- , subq_9.buys AS buys
+ first_value(subq_15.visits) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
+ , first_value(subq_15.visit__referrer_id) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visit__referrer_id
+ , first_value(subq_15.ds__day) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
+ , first_value(subq_15.user) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
+ , subq_18.mf_internal_uuid AS mf_internal_uuid
+ , subq_18.buys AS buys
FROM (
-- Pass Only Elements: ['visits', 'visit__referrer_id', 'ds__day', 'user']
SELECT
- subq_5.ds__day
- , subq_5.user
- , subq_5.visit__referrer_id
- , subq_5.visits
+ subq_14.ds__day
+ , subq_14.user
+ , subq_14.visit__referrer_id
+ , subq_14.visits
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_4.ds__day
- , subq_4.ds__week
- , subq_4.ds__month
- , subq_4.ds__quarter
- , subq_4.ds__year
- , subq_4.ds__extract_year
- , subq_4.ds__extract_quarter
- , subq_4.ds__extract_month
- , subq_4.ds__extract_day
- , subq_4.ds__extract_dow
- , subq_4.ds__extract_doy
- , subq_4.visit__ds__day
- , subq_4.visit__ds__week
- , subq_4.visit__ds__month
- , subq_4.visit__ds__quarter
- , subq_4.visit__ds__year
- , subq_4.visit__ds__extract_year
- , subq_4.visit__ds__extract_quarter
- , subq_4.visit__ds__extract_month
- , subq_4.visit__ds__extract_day
- , subq_4.visit__ds__extract_dow
- , subq_4.visit__ds__extract_doy
- , subq_4.ds__day AS metric_time__day
- , subq_4.ds__week AS metric_time__week
- , subq_4.ds__month AS metric_time__month
- , subq_4.ds__quarter AS metric_time__quarter
- , subq_4.ds__year AS metric_time__year
- , subq_4.ds__extract_year AS metric_time__extract_year
- , subq_4.ds__extract_quarter AS metric_time__extract_quarter
- , subq_4.ds__extract_month AS metric_time__extract_month
- , subq_4.ds__extract_day AS metric_time__extract_day
- , subq_4.ds__extract_dow AS metric_time__extract_dow
- , subq_4.ds__extract_doy AS metric_time__extract_doy
- , subq_4.user
- , subq_4.session
- , subq_4.visit__user
- , subq_4.visit__session
- , subq_4.referrer_id
- , subq_4.visit__referrer_id
- , subq_4.visits
- , subq_4.visitors
+ subq_13.ds__day
+ , subq_13.ds__week
+ , subq_13.ds__month
+ , subq_13.ds__quarter
+ , subq_13.ds__year
+ , subq_13.ds__extract_year
+ , subq_13.ds__extract_quarter
+ , subq_13.ds__extract_month
+ , subq_13.ds__extract_day
+ , subq_13.ds__extract_dow
+ , subq_13.ds__extract_doy
+ , subq_13.visit__ds__day
+ , subq_13.visit__ds__week
+ , subq_13.visit__ds__month
+ , subq_13.visit__ds__quarter
+ , subq_13.visit__ds__year
+ , subq_13.visit__ds__extract_year
+ , subq_13.visit__ds__extract_quarter
+ , subq_13.visit__ds__extract_month
+ , subq_13.visit__ds__extract_day
+ , subq_13.visit__ds__extract_dow
+ , subq_13.visit__ds__extract_doy
+ , subq_13.ds__day AS metric_time__day
+ , subq_13.ds__week AS metric_time__week
+ , subq_13.ds__month AS metric_time__month
+ , subq_13.ds__quarter AS metric_time__quarter
+ , subq_13.ds__year AS metric_time__year
+ , subq_13.ds__extract_year AS metric_time__extract_year
+ , subq_13.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_13.ds__extract_month AS metric_time__extract_month
+ , subq_13.ds__extract_day AS metric_time__extract_day
+ , subq_13.ds__extract_dow AS metric_time__extract_dow
+ , subq_13.ds__extract_doy AS metric_time__extract_doy
+ , subq_13.user
+ , subq_13.session
+ , subq_13.visit__user
+ , subq_13.visit__session
+ , subq_13.referrer_id
+ , subq_13.visit__referrer_id
+ , subq_13.visits
+ , subq_13.visitors
FROM (
-- Read Elements From Semantic Model 'visits_source'
SELECT
1 AS visits
- , visits_source_src_28011.user_id AS visitors
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM visits_source_src_28011.ds) AS ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy
- , visits_source_src_28011.referrer_id
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM visits_source_src_28011.ds) AS visit__ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy
- , visits_source_src_28011.referrer_id AS visit__referrer_id
- , visits_source_src_28011.user_id AS user
- , visits_source_src_28011.session_id AS session
- , visits_source_src_28011.user_id AS visit__user
- , visits_source_src_28011.session_id AS visit__session
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_4
- ) subq_5
- ) subq_6
+ , visits_source_src_28000.user_id AS visitors
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS ds__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM visits_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS ds__extract_doy
+ , visits_source_src_28000.referrer_id
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS visit__ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS visit__ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS visit__ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS visit__ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS visit__ds__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM visits_source_src_28000.ds) AS visit__ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS visit__ds__extract_doy
+ , visits_source_src_28000.referrer_id AS visit__referrer_id
+ , visits_source_src_28000.user_id AS user
+ , visits_source_src_28000.session_id AS session
+ , visits_source_src_28000.user_id AS visit__user
+ , visits_source_src_28000.session_id AS visit__session
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_13
+ ) subq_14
+ ) subq_15
INNER JOIN (
-- Add column with generated UUID
SELECT
- subq_8.ds__day
- , subq_8.ds__week
- , subq_8.ds__month
- , subq_8.ds__quarter
- , subq_8.ds__year
- , subq_8.ds__extract_year
- , subq_8.ds__extract_quarter
- , subq_8.ds__extract_month
- , subq_8.ds__extract_day
- , subq_8.ds__extract_dow
- , subq_8.ds__extract_doy
- , subq_8.buy__ds__day
- , subq_8.buy__ds__week
- , subq_8.buy__ds__month
- , subq_8.buy__ds__quarter
- , subq_8.buy__ds__year
- , subq_8.buy__ds__extract_year
- , subq_8.buy__ds__extract_quarter
- , subq_8.buy__ds__extract_month
- , subq_8.buy__ds__extract_day
- , subq_8.buy__ds__extract_dow
- , subq_8.buy__ds__extract_doy
- , subq_8.metric_time__day
- , subq_8.metric_time__week
- , subq_8.metric_time__month
- , subq_8.metric_time__quarter
- , subq_8.metric_time__year
- , subq_8.metric_time__extract_year
- , subq_8.metric_time__extract_quarter
- , subq_8.metric_time__extract_month
- , subq_8.metric_time__extract_day
- , subq_8.metric_time__extract_dow
- , subq_8.metric_time__extract_doy
- , subq_8.user
- , subq_8.session_id
- , subq_8.buy__user
- , subq_8.buy__session_id
- , subq_8.buys
- , subq_8.buyers
+ subq_17.ds__day
+ , subq_17.ds__week
+ , subq_17.ds__month
+ , subq_17.ds__quarter
+ , subq_17.ds__year
+ , subq_17.ds__extract_year
+ , subq_17.ds__extract_quarter
+ , subq_17.ds__extract_month
+ , subq_17.ds__extract_day
+ , subq_17.ds__extract_dow
+ , subq_17.ds__extract_doy
+ , subq_17.buy__ds__day
+ , subq_17.buy__ds__week
+ , subq_17.buy__ds__month
+ , subq_17.buy__ds__quarter
+ , subq_17.buy__ds__year
+ , subq_17.buy__ds__extract_year
+ , subq_17.buy__ds__extract_quarter
+ , subq_17.buy__ds__extract_month
+ , subq_17.buy__ds__extract_day
+ , subq_17.buy__ds__extract_dow
+ , subq_17.buy__ds__extract_doy
+ , subq_17.metric_time__day
+ , subq_17.metric_time__week
+ , subq_17.metric_time__month
+ , subq_17.metric_time__quarter
+ , subq_17.metric_time__year
+ , subq_17.metric_time__extract_year
+ , subq_17.metric_time__extract_quarter
+ , subq_17.metric_time__extract_month
+ , subq_17.metric_time__extract_day
+ , subq_17.metric_time__extract_dow
+ , subq_17.metric_time__extract_doy
+ , subq_17.user
+ , subq_17.session_id
+ , subq_17.buy__user
+ , subq_17.buy__session_id
+ , subq_17.buys
+ , subq_17.buyers
, UUID() AS mf_internal_uuid
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_7.ds__day
- , subq_7.ds__week
- , subq_7.ds__month
- , subq_7.ds__quarter
- , subq_7.ds__year
- , subq_7.ds__extract_year
- , subq_7.ds__extract_quarter
- , subq_7.ds__extract_month
- , subq_7.ds__extract_day
- , subq_7.ds__extract_dow
- , subq_7.ds__extract_doy
- , subq_7.buy__ds__day
- , subq_7.buy__ds__week
- , subq_7.buy__ds__month
- , subq_7.buy__ds__quarter
- , subq_7.buy__ds__year
- , subq_7.buy__ds__extract_year
- , subq_7.buy__ds__extract_quarter
- , subq_7.buy__ds__extract_month
- , subq_7.buy__ds__extract_day
- , subq_7.buy__ds__extract_dow
- , subq_7.buy__ds__extract_doy
- , subq_7.ds__day AS metric_time__day
- , subq_7.ds__week AS metric_time__week
- , subq_7.ds__month AS metric_time__month
- , subq_7.ds__quarter AS metric_time__quarter
- , subq_7.ds__year AS metric_time__year
- , subq_7.ds__extract_year AS metric_time__extract_year
- , subq_7.ds__extract_quarter AS metric_time__extract_quarter
- , subq_7.ds__extract_month AS metric_time__extract_month
- , subq_7.ds__extract_day AS metric_time__extract_day
- , subq_7.ds__extract_dow AS metric_time__extract_dow
- , subq_7.ds__extract_doy AS metric_time__extract_doy
- , subq_7.user
- , subq_7.session_id
- , subq_7.buy__user
- , subq_7.buy__session_id
- , subq_7.buys
- , subq_7.buyers
+ subq_16.ds__day
+ , subq_16.ds__week
+ , subq_16.ds__month
+ , subq_16.ds__quarter
+ , subq_16.ds__year
+ , subq_16.ds__extract_year
+ , subq_16.ds__extract_quarter
+ , subq_16.ds__extract_month
+ , subq_16.ds__extract_day
+ , subq_16.ds__extract_dow
+ , subq_16.ds__extract_doy
+ , subq_16.buy__ds__day
+ , subq_16.buy__ds__week
+ , subq_16.buy__ds__month
+ , subq_16.buy__ds__quarter
+ , subq_16.buy__ds__year
+ , subq_16.buy__ds__extract_year
+ , subq_16.buy__ds__extract_quarter
+ , subq_16.buy__ds__extract_month
+ , subq_16.buy__ds__extract_day
+ , subq_16.buy__ds__extract_dow
+ , subq_16.buy__ds__extract_doy
+ , subq_16.ds__day AS metric_time__day
+ , subq_16.ds__week AS metric_time__week
+ , subq_16.ds__month AS metric_time__month
+ , subq_16.ds__quarter AS metric_time__quarter
+ , subq_16.ds__year AS metric_time__year
+ , subq_16.ds__extract_year AS metric_time__extract_year
+ , subq_16.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_16.ds__extract_month AS metric_time__extract_month
+ , subq_16.ds__extract_day AS metric_time__extract_day
+ , subq_16.ds__extract_dow AS metric_time__extract_dow
+ , subq_16.ds__extract_doy AS metric_time__extract_doy
+ , subq_16.user
+ , subq_16.session_id
+ , subq_16.buy__user
+ , subq_16.buy__session_id
+ , subq_16.buys
+ , subq_16.buyers
FROM (
-- Read Elements From Semantic Model 'buys_source'
SELECT
1 AS buys
- , buys_source_src_28002.user_id AS buyers
- , DATE_TRUNC('day', buys_source_src_28002.ds) AS ds__day
- , DATE_TRUNC('week', buys_source_src_28002.ds) AS ds__week
- , DATE_TRUNC('month', buys_source_src_28002.ds) AS ds__month
- , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS ds__quarter
- , DATE_TRUNC('year', buys_source_src_28002.ds) AS ds__year
- , EXTRACT(year FROM buys_source_src_28002.ds) AS ds__extract_year
- , EXTRACT(quarter FROM buys_source_src_28002.ds) AS ds__extract_quarter
- , EXTRACT(month FROM buys_source_src_28002.ds) AS ds__extract_month
- , EXTRACT(day FROM buys_source_src_28002.ds) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM buys_source_src_28002.ds) AS ds__extract_dow
- , EXTRACT(doy FROM buys_source_src_28002.ds) AS ds__extract_doy
- , DATE_TRUNC('day', buys_source_src_28002.ds) AS buy__ds__day
- , DATE_TRUNC('week', buys_source_src_28002.ds) AS buy__ds__week
- , DATE_TRUNC('month', buys_source_src_28002.ds) AS buy__ds__month
- , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS buy__ds__quarter
- , DATE_TRUNC('year', buys_source_src_28002.ds) AS buy__ds__year
- , EXTRACT(year FROM buys_source_src_28002.ds) AS buy__ds__extract_year
- , EXTRACT(quarter FROM buys_source_src_28002.ds) AS buy__ds__extract_quarter
- , EXTRACT(month FROM buys_source_src_28002.ds) AS buy__ds__extract_month
- , EXTRACT(day FROM buys_source_src_28002.ds) AS buy__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM buys_source_src_28002.ds) AS buy__ds__extract_dow
- , EXTRACT(doy FROM buys_source_src_28002.ds) AS buy__ds__extract_doy
- , buys_source_src_28002.user_id AS user
- , buys_source_src_28002.session_id
- , buys_source_src_28002.user_id AS buy__user
- , buys_source_src_28002.session_id AS buy__session_id
- FROM ***************************.fct_buys buys_source_src_28002
- ) subq_7
- ) subq_8
- ) subq_9
+ , buys_source_src_28000.user_id AS buyers
+ , DATE_TRUNC('day', buys_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', buys_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', buys_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', buys_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', buys_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM buys_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM buys_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', buys_source_src_28000.ds) AS buy__ds__day
+ , DATE_TRUNC('week', buys_source_src_28000.ds) AS buy__ds__week
+ , DATE_TRUNC('month', buys_source_src_28000.ds) AS buy__ds__month
+ , DATE_TRUNC('quarter', buys_source_src_28000.ds) AS buy__ds__quarter
+ , DATE_TRUNC('year', buys_source_src_28000.ds) 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
+ , EXTRACT(day FROM buys_source_src_28000.ds) AS buy__ds__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM buys_source_src_28000.ds) AS buy__ds__extract_dow
+ , EXTRACT(doy FROM buys_source_src_28000.ds) AS buy__ds__extract_doy
+ , buys_source_src_28000.user_id AS user
+ , buys_source_src_28000.session_id
+ , buys_source_src_28000.user_id AS buy__user
+ , buys_source_src_28000.session_id AS buy__session_id
+ FROM ***************************.fct_buys buys_source_src_28000
+ ) subq_16
+ ) subq_17
+ ) subq_18
ON
- (subq_6.user = subq_9.user) AND ((subq_6.ds__day <= subq_9.ds__day))
- ) subq_10
- ) subq_11
- ) subq_12
+ (
+ subq_15.user = subq_18.user
+ ) AND (
+ (subq_15.ds__day <= subq_18.ds__day)
+ )
+ ) subq_19
+ ) subq_20
+ ) subq_21
GROUP BY
- subq_12.visit__referrer_id
- ) subq_13
+ subq_21.visit__referrer_id
+ ) subq_22
ON
- subq_3.visit__referrer_id = subq_13.visit__referrer_id
+ subq_12.visit__referrer_id = subq_22.visit__referrer_id
GROUP BY
- COALESCE(subq_3.visit__referrer_id, subq_13.visit__referrer_id)
-) subq_14
+ COALESCE(subq_12.visit__referrer_id, subq_22.visit__referrer_id)
+) subq_23
diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Databricks/test_conversion_rate__plan0_optimized.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Databricks/test_conversion_rate__plan0_optimized.sql
index 931728e510..ff5e5accc4 100644
--- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Databricks/test_conversion_rate__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Databricks/test_conversion_rate__plan0_optimized.sql
@@ -5,9 +5,9 @@ SELECT
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_18.visit__referrer_id, subq_28.visit__referrer_id) AS visit__referrer_id
- , MAX(subq_18.visits) AS visits
- , MAX(subq_28.buys) AS buys
+ COALESCE(subq_27.visit__referrer_id, subq_37.visit__referrer_id) AS visit__referrer_id
+ , MAX(subq_27.visits) AS visits
+ , MAX(subq_37.buys) AS buys
FROM (
-- Aggregate Measures
SELECT
@@ -20,11 +20,11 @@ FROM (
SELECT
referrer_id AS visit__referrer_id
, 1 AS visits
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_17
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_26
GROUP BY
visit__referrer_id
- ) subq_18
+ ) subq_27
FULL OUTER JOIN (
-- Find conversions for user within the range of INF
-- Pass Only Elements: ['buys', 'visit__referrer_id']
@@ -35,12 +35,12 @@ FROM (
FROM (
-- Dedupe the fanout with mf_internal_uuid in the conversion data set
SELECT DISTINCT
- first_value(subq_21.visits) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
- , first_value(subq_21.visit__referrer_id) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visit__referrer_id
- , first_value(subq_21.ds__day) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
- , first_value(subq_21.user) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
- , subq_24.mf_internal_uuid AS mf_internal_uuid
- , subq_24.buys AS buys
+ first_value(subq_30.visits) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
+ , first_value(subq_30.visit__referrer_id) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visit__referrer_id
+ , first_value(subq_30.ds__day) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
+ , first_value(subq_30.user) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
+ , subq_33.mf_internal_uuid AS mf_internal_uuid
+ , subq_33.buys AS buys
FROM (
-- Read Elements From Semantic Model 'visits_source'
-- Metric Time Dimension 'ds'
@@ -50,8 +50,8 @@ FROM (
, user_id AS user
, referrer_id AS visit__referrer_id
, 1 AS visits
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_21
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_30
INNER JOIN (
-- Read Elements From Semantic Model 'buys_source'
-- Metric Time Dimension 'ds'
@@ -61,20 +61,20 @@ FROM (
, user_id AS user
, 1 AS buys
, UUID() AS mf_internal_uuid
- FROM ***************************.fct_buys buys_source_src_28002
- ) subq_24
+ FROM ***************************.fct_buys buys_source_src_28000
+ ) subq_33
ON
(
- subq_21.user = subq_24.user
+ subq_30.user = subq_33.user
) AND (
- (subq_21.ds__day <= subq_24.ds__day)
+ (subq_30.ds__day <= subq_33.ds__day)
)
- ) subq_25
+ ) subq_34
GROUP BY
visit__referrer_id
- ) subq_28
+ ) subq_37
ON
- subq_18.visit__referrer_id = subq_28.visit__referrer_id
+ subq_27.visit__referrer_id = subq_37.visit__referrer_id
GROUP BY
- COALESCE(subq_18.visit__referrer_id, subq_28.visit__referrer_id)
-) subq_29
+ COALESCE(subq_27.visit__referrer_id, subq_37.visit__referrer_id)
+) subq_38
diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Databricks/test_conversion_rate_with_constant_properties__plan0.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Databricks/test_conversion_rate_with_constant_properties__plan0.sql
index ebca9b9a90..1532003d05 100644
--- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Databricks/test_conversion_rate_with_constant_properties__plan0.sql
+++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Databricks/test_conversion_rate_with_constant_properties__plan0.sql
@@ -1,381 +1,381 @@
-- Compute Metrics via Expressions
SELECT
- subq_14.metric_time__day
- , subq_14.visit__referrer_id
- , CAST(subq_14.buys AS DOUBLE) / CAST(NULLIF(subq_14.visits, 0) AS DOUBLE) AS visit_buy_conversion_rate_by_session
+ subq_23.metric_time__day
+ , subq_23.visit__referrer_id
+ , CAST(subq_23.buys AS DOUBLE) / CAST(NULLIF(subq_23.visits, 0) AS DOUBLE) AS visit_buy_conversion_rate_by_session
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_3.metric_time__day, subq_13.metric_time__day) AS metric_time__day
- , COALESCE(subq_3.visit__referrer_id, subq_13.visit__referrer_id) AS visit__referrer_id
- , MAX(subq_3.visits) AS visits
- , MAX(subq_13.buys) AS buys
+ COALESCE(subq_12.metric_time__day, subq_22.metric_time__day) AS metric_time__day
+ , COALESCE(subq_12.visit__referrer_id, subq_22.visit__referrer_id) AS visit__referrer_id
+ , MAX(subq_12.visits) AS visits
+ , MAX(subq_22.buys) AS buys
FROM (
-- Aggregate Measures
SELECT
- subq_2.metric_time__day
- , subq_2.visit__referrer_id
- , SUM(subq_2.visits) AS visits
+ subq_11.metric_time__day
+ , subq_11.visit__referrer_id
+ , SUM(subq_11.visits) AS visits
FROM (
-- Pass Only Elements: ['visits', 'visit__referrer_id', 'metric_time__day']
SELECT
- subq_1.metric_time__day
- , subq_1.visit__referrer_id
- , subq_1.visits
+ subq_10.metric_time__day
+ , subq_10.visit__referrer_id
+ , subq_10.visits
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.visit__ds__day
- , subq_0.visit__ds__week
- , subq_0.visit__ds__month
- , subq_0.visit__ds__quarter
- , subq_0.visit__ds__year
- , subq_0.visit__ds__extract_year
- , subq_0.visit__ds__extract_quarter
- , subq_0.visit__ds__extract_month
- , subq_0.visit__ds__extract_day
- , subq_0.visit__ds__extract_dow
- , subq_0.visit__ds__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.user
- , subq_0.session
- , subq_0.visit__user
- , subq_0.visit__session
- , subq_0.referrer_id
- , subq_0.visit__referrer_id
- , subq_0.visits
- , subq_0.visitors
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.visit__ds__day
+ , subq_9.visit__ds__week
+ , subq_9.visit__ds__month
+ , subq_9.visit__ds__quarter
+ , subq_9.visit__ds__year
+ , subq_9.visit__ds__extract_year
+ , subq_9.visit__ds__extract_quarter
+ , subq_9.visit__ds__extract_month
+ , subq_9.visit__ds__extract_day
+ , subq_9.visit__ds__extract_dow
+ , subq_9.visit__ds__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.user
+ , subq_9.session
+ , subq_9.visit__user
+ , subq_9.visit__session
+ , subq_9.referrer_id
+ , subq_9.visit__referrer_id
+ , subq_9.visits
+ , subq_9.visitors
FROM (
-- Read Elements From Semantic Model 'visits_source'
SELECT
1 AS visits
- , visits_source_src_28011.user_id AS visitors
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM visits_source_src_28011.ds) AS ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy
- , visits_source_src_28011.referrer_id
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM visits_source_src_28011.ds) AS visit__ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy
- , visits_source_src_28011.referrer_id AS visit__referrer_id
- , visits_source_src_28011.user_id AS user
- , visits_source_src_28011.session_id AS session
- , visits_source_src_28011.user_id AS visit__user
- , visits_source_src_28011.session_id AS visit__session
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_0
- ) subq_1
- ) subq_2
+ , visits_source_src_28000.user_id AS visitors
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS ds__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM visits_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS ds__extract_doy
+ , visits_source_src_28000.referrer_id
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS visit__ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS visit__ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS visit__ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS visit__ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS visit__ds__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM visits_source_src_28000.ds) AS visit__ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS visit__ds__extract_doy
+ , visits_source_src_28000.referrer_id AS visit__referrer_id
+ , visits_source_src_28000.user_id AS user
+ , visits_source_src_28000.session_id AS session
+ , visits_source_src_28000.user_id AS visit__user
+ , visits_source_src_28000.session_id AS visit__session
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
GROUP BY
- subq_2.metric_time__day
- , subq_2.visit__referrer_id
- ) subq_3
+ subq_11.metric_time__day
+ , subq_11.visit__referrer_id
+ ) subq_12
FULL OUTER JOIN (
-- Aggregate Measures
SELECT
- subq_12.metric_time__day
- , subq_12.visit__referrer_id
- , SUM(subq_12.buys) AS buys
+ subq_21.metric_time__day
+ , subq_21.visit__referrer_id
+ , SUM(subq_21.buys) AS buys
FROM (
-- Pass Only Elements: ['buys', 'visit__referrer_id', 'metric_time__day']
SELECT
- subq_11.metric_time__day
- , subq_11.visit__referrer_id
- , subq_11.buys
+ subq_20.metric_time__day
+ , subq_20.visit__referrer_id
+ , subq_20.buys
FROM (
-- Find conversions for user within the range of 7 day
SELECT
- subq_10.ds__day
- , subq_10.metric_time__day
- , subq_10.user
- , subq_10.session
- , subq_10.visit__referrer_id
- , subq_10.buys
- , subq_10.visits
+ subq_19.ds__day
+ , subq_19.metric_time__day
+ , subq_19.user
+ , subq_19.session
+ , subq_19.visit__referrer_id
+ , subq_19.buys
+ , subq_19.visits
FROM (
-- Dedupe the fanout with mf_internal_uuid in the conversion data set
SELECT DISTINCT
- first_value(subq_6.visits) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid, subq_9.session_id ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
- , first_value(subq_6.visit__referrer_id) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid, subq_9.session_id ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visit__referrer_id
- , first_value(subq_6.ds__day) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid, subq_9.session_id ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
- , first_value(subq_6.metric_time__day) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid, subq_9.session_id ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS metric_time__day
- , first_value(subq_6.user) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid, subq_9.session_id ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
- , first_value(subq_6.session) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid, subq_9.session_id ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS session
- , subq_9.mf_internal_uuid AS mf_internal_uuid
- , subq_9.buys AS buys
+ first_value(subq_15.visits) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid, subq_18.session_id ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
+ , first_value(subq_15.visit__referrer_id) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid, subq_18.session_id ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visit__referrer_id
+ , first_value(subq_15.ds__day) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid, subq_18.session_id ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
+ , first_value(subq_15.metric_time__day) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid, subq_18.session_id ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS metric_time__day
+ , first_value(subq_15.user) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid, subq_18.session_id ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
+ , first_value(subq_15.session) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid, subq_18.session_id ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS session
+ , subq_18.mf_internal_uuid AS mf_internal_uuid
+ , subq_18.buys AS buys
FROM (
-- Pass Only Elements: ['visits', 'visit__referrer_id', 'ds__day', 'metric_time__day', 'user', 'session']
SELECT
- subq_5.ds__day
- , subq_5.metric_time__day
- , subq_5.user
- , subq_5.session
- , subq_5.visit__referrer_id
- , subq_5.visits
+ subq_14.ds__day
+ , subq_14.metric_time__day
+ , subq_14.user
+ , subq_14.session
+ , subq_14.visit__referrer_id
+ , subq_14.visits
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_4.ds__day
- , subq_4.ds__week
- , subq_4.ds__month
- , subq_4.ds__quarter
- , subq_4.ds__year
- , subq_4.ds__extract_year
- , subq_4.ds__extract_quarter
- , subq_4.ds__extract_month
- , subq_4.ds__extract_day
- , subq_4.ds__extract_dow
- , subq_4.ds__extract_doy
- , subq_4.visit__ds__day
- , subq_4.visit__ds__week
- , subq_4.visit__ds__month
- , subq_4.visit__ds__quarter
- , subq_4.visit__ds__year
- , subq_4.visit__ds__extract_year
- , subq_4.visit__ds__extract_quarter
- , subq_4.visit__ds__extract_month
- , subq_4.visit__ds__extract_day
- , subq_4.visit__ds__extract_dow
- , subq_4.visit__ds__extract_doy
- , subq_4.ds__day AS metric_time__day
- , subq_4.ds__week AS metric_time__week
- , subq_4.ds__month AS metric_time__month
- , subq_4.ds__quarter AS metric_time__quarter
- , subq_4.ds__year AS metric_time__year
- , subq_4.ds__extract_year AS metric_time__extract_year
- , subq_4.ds__extract_quarter AS metric_time__extract_quarter
- , subq_4.ds__extract_month AS metric_time__extract_month
- , subq_4.ds__extract_day AS metric_time__extract_day
- , subq_4.ds__extract_dow AS metric_time__extract_dow
- , subq_4.ds__extract_doy AS metric_time__extract_doy
- , subq_4.user
- , subq_4.session
- , subq_4.visit__user
- , subq_4.visit__session
- , subq_4.referrer_id
- , subq_4.visit__referrer_id
- , subq_4.visits
- , subq_4.visitors
+ subq_13.ds__day
+ , subq_13.ds__week
+ , subq_13.ds__month
+ , subq_13.ds__quarter
+ , subq_13.ds__year
+ , subq_13.ds__extract_year
+ , subq_13.ds__extract_quarter
+ , subq_13.ds__extract_month
+ , subq_13.ds__extract_day
+ , subq_13.ds__extract_dow
+ , subq_13.ds__extract_doy
+ , subq_13.visit__ds__day
+ , subq_13.visit__ds__week
+ , subq_13.visit__ds__month
+ , subq_13.visit__ds__quarter
+ , subq_13.visit__ds__year
+ , subq_13.visit__ds__extract_year
+ , subq_13.visit__ds__extract_quarter
+ , subq_13.visit__ds__extract_month
+ , subq_13.visit__ds__extract_day
+ , subq_13.visit__ds__extract_dow
+ , subq_13.visit__ds__extract_doy
+ , subq_13.ds__day AS metric_time__day
+ , subq_13.ds__week AS metric_time__week
+ , subq_13.ds__month AS metric_time__month
+ , subq_13.ds__quarter AS metric_time__quarter
+ , subq_13.ds__year AS metric_time__year
+ , subq_13.ds__extract_year AS metric_time__extract_year
+ , subq_13.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_13.ds__extract_month AS metric_time__extract_month
+ , subq_13.ds__extract_day AS metric_time__extract_day
+ , subq_13.ds__extract_dow AS metric_time__extract_dow
+ , subq_13.ds__extract_doy AS metric_time__extract_doy
+ , subq_13.user
+ , subq_13.session
+ , subq_13.visit__user
+ , subq_13.visit__session
+ , subq_13.referrer_id
+ , subq_13.visit__referrer_id
+ , subq_13.visits
+ , subq_13.visitors
FROM (
-- Read Elements From Semantic Model 'visits_source'
SELECT
1 AS visits
- , visits_source_src_28011.user_id AS visitors
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM visits_source_src_28011.ds) AS ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy
- , visits_source_src_28011.referrer_id
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM visits_source_src_28011.ds) AS visit__ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy
- , visits_source_src_28011.referrer_id AS visit__referrer_id
- , visits_source_src_28011.user_id AS user
- , visits_source_src_28011.session_id AS session
- , visits_source_src_28011.user_id AS visit__user
- , visits_source_src_28011.session_id AS visit__session
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_4
- ) subq_5
- ) subq_6
+ , visits_source_src_28000.user_id AS visitors
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS ds__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM visits_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS ds__extract_doy
+ , visits_source_src_28000.referrer_id
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS visit__ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS visit__ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS visit__ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS visit__ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS visit__ds__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM visits_source_src_28000.ds) AS visit__ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS visit__ds__extract_doy
+ , visits_source_src_28000.referrer_id AS visit__referrer_id
+ , visits_source_src_28000.user_id AS user
+ , visits_source_src_28000.session_id AS session
+ , visits_source_src_28000.user_id AS visit__user
+ , visits_source_src_28000.session_id AS visit__session
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_13
+ ) subq_14
+ ) subq_15
INNER JOIN (
-- Add column with generated UUID
SELECT
- subq_8.ds__day
- , subq_8.ds__week
- , subq_8.ds__month
- , subq_8.ds__quarter
- , subq_8.ds__year
- , subq_8.ds__extract_year
- , subq_8.ds__extract_quarter
- , subq_8.ds__extract_month
- , subq_8.ds__extract_day
- , subq_8.ds__extract_dow
- , subq_8.ds__extract_doy
- , subq_8.buy__ds__day
- , subq_8.buy__ds__week
- , subq_8.buy__ds__month
- , subq_8.buy__ds__quarter
- , subq_8.buy__ds__year
- , subq_8.buy__ds__extract_year
- , subq_8.buy__ds__extract_quarter
- , subq_8.buy__ds__extract_month
- , subq_8.buy__ds__extract_day
- , subq_8.buy__ds__extract_dow
- , subq_8.buy__ds__extract_doy
- , subq_8.metric_time__day
- , subq_8.metric_time__week
- , subq_8.metric_time__month
- , subq_8.metric_time__quarter
- , subq_8.metric_time__year
- , subq_8.metric_time__extract_year
- , subq_8.metric_time__extract_quarter
- , subq_8.metric_time__extract_month
- , subq_8.metric_time__extract_day
- , subq_8.metric_time__extract_dow
- , subq_8.metric_time__extract_doy
- , subq_8.user
- , subq_8.session_id
- , subq_8.buy__user
- , subq_8.buy__session_id
- , subq_8.buys
- , subq_8.buyers
+ subq_17.ds__day
+ , subq_17.ds__week
+ , subq_17.ds__month
+ , subq_17.ds__quarter
+ , subq_17.ds__year
+ , subq_17.ds__extract_year
+ , subq_17.ds__extract_quarter
+ , subq_17.ds__extract_month
+ , subq_17.ds__extract_day
+ , subq_17.ds__extract_dow
+ , subq_17.ds__extract_doy
+ , subq_17.buy__ds__day
+ , subq_17.buy__ds__week
+ , subq_17.buy__ds__month
+ , subq_17.buy__ds__quarter
+ , subq_17.buy__ds__year
+ , subq_17.buy__ds__extract_year
+ , subq_17.buy__ds__extract_quarter
+ , subq_17.buy__ds__extract_month
+ , subq_17.buy__ds__extract_day
+ , subq_17.buy__ds__extract_dow
+ , subq_17.buy__ds__extract_doy
+ , subq_17.metric_time__day
+ , subq_17.metric_time__week
+ , subq_17.metric_time__month
+ , subq_17.metric_time__quarter
+ , subq_17.metric_time__year
+ , subq_17.metric_time__extract_year
+ , subq_17.metric_time__extract_quarter
+ , subq_17.metric_time__extract_month
+ , subq_17.metric_time__extract_day
+ , subq_17.metric_time__extract_dow
+ , subq_17.metric_time__extract_doy
+ , subq_17.user
+ , subq_17.session_id
+ , subq_17.buy__user
+ , subq_17.buy__session_id
+ , subq_17.buys
+ , subq_17.buyers
, UUID() AS mf_internal_uuid
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_7.ds__day
- , subq_7.ds__week
- , subq_7.ds__month
- , subq_7.ds__quarter
- , subq_7.ds__year
- , subq_7.ds__extract_year
- , subq_7.ds__extract_quarter
- , subq_7.ds__extract_month
- , subq_7.ds__extract_day
- , subq_7.ds__extract_dow
- , subq_7.ds__extract_doy
- , subq_7.buy__ds__day
- , subq_7.buy__ds__week
- , subq_7.buy__ds__month
- , subq_7.buy__ds__quarter
- , subq_7.buy__ds__year
- , subq_7.buy__ds__extract_year
- , subq_7.buy__ds__extract_quarter
- , subq_7.buy__ds__extract_month
- , subq_7.buy__ds__extract_day
- , subq_7.buy__ds__extract_dow
- , subq_7.buy__ds__extract_doy
- , subq_7.ds__day AS metric_time__day
- , subq_7.ds__week AS metric_time__week
- , subq_7.ds__month AS metric_time__month
- , subq_7.ds__quarter AS metric_time__quarter
- , subq_7.ds__year AS metric_time__year
- , subq_7.ds__extract_year AS metric_time__extract_year
- , subq_7.ds__extract_quarter AS metric_time__extract_quarter
- , subq_7.ds__extract_month AS metric_time__extract_month
- , subq_7.ds__extract_day AS metric_time__extract_day
- , subq_7.ds__extract_dow AS metric_time__extract_dow
- , subq_7.ds__extract_doy AS metric_time__extract_doy
- , subq_7.user
- , subq_7.session_id
- , subq_7.buy__user
- , subq_7.buy__session_id
- , subq_7.buys
- , subq_7.buyers
+ subq_16.ds__day
+ , subq_16.ds__week
+ , subq_16.ds__month
+ , subq_16.ds__quarter
+ , subq_16.ds__year
+ , subq_16.ds__extract_year
+ , subq_16.ds__extract_quarter
+ , subq_16.ds__extract_month
+ , subq_16.ds__extract_day
+ , subq_16.ds__extract_dow
+ , subq_16.ds__extract_doy
+ , subq_16.buy__ds__day
+ , subq_16.buy__ds__week
+ , subq_16.buy__ds__month
+ , subq_16.buy__ds__quarter
+ , subq_16.buy__ds__year
+ , subq_16.buy__ds__extract_year
+ , subq_16.buy__ds__extract_quarter
+ , subq_16.buy__ds__extract_month
+ , subq_16.buy__ds__extract_day
+ , subq_16.buy__ds__extract_dow
+ , subq_16.buy__ds__extract_doy
+ , subq_16.ds__day AS metric_time__day
+ , subq_16.ds__week AS metric_time__week
+ , subq_16.ds__month AS metric_time__month
+ , subq_16.ds__quarter AS metric_time__quarter
+ , subq_16.ds__year AS metric_time__year
+ , subq_16.ds__extract_year AS metric_time__extract_year
+ , subq_16.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_16.ds__extract_month AS metric_time__extract_month
+ , subq_16.ds__extract_day AS metric_time__extract_day
+ , subq_16.ds__extract_dow AS metric_time__extract_dow
+ , subq_16.ds__extract_doy AS metric_time__extract_doy
+ , subq_16.user
+ , subq_16.session_id
+ , subq_16.buy__user
+ , subq_16.buy__session_id
+ , subq_16.buys
+ , subq_16.buyers
FROM (
-- Read Elements From Semantic Model 'buys_source'
SELECT
1 AS buys
- , buys_source_src_28002.user_id AS buyers
- , DATE_TRUNC('day', buys_source_src_28002.ds) AS ds__day
- , DATE_TRUNC('week', buys_source_src_28002.ds) AS ds__week
- , DATE_TRUNC('month', buys_source_src_28002.ds) AS ds__month
- , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS ds__quarter
- , DATE_TRUNC('year', buys_source_src_28002.ds) AS ds__year
- , EXTRACT(year FROM buys_source_src_28002.ds) AS ds__extract_year
- , EXTRACT(quarter FROM buys_source_src_28002.ds) AS ds__extract_quarter
- , EXTRACT(month FROM buys_source_src_28002.ds) AS ds__extract_month
- , EXTRACT(day FROM buys_source_src_28002.ds) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM buys_source_src_28002.ds) AS ds__extract_dow
- , EXTRACT(doy FROM buys_source_src_28002.ds) AS ds__extract_doy
- , DATE_TRUNC('day', buys_source_src_28002.ds) AS buy__ds__day
- , DATE_TRUNC('week', buys_source_src_28002.ds) AS buy__ds__week
- , DATE_TRUNC('month', buys_source_src_28002.ds) AS buy__ds__month
- , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS buy__ds__quarter
- , DATE_TRUNC('year', buys_source_src_28002.ds) AS buy__ds__year
- , EXTRACT(year FROM buys_source_src_28002.ds) AS buy__ds__extract_year
- , EXTRACT(quarter FROM buys_source_src_28002.ds) AS buy__ds__extract_quarter
- , EXTRACT(month FROM buys_source_src_28002.ds) AS buy__ds__extract_month
- , EXTRACT(day FROM buys_source_src_28002.ds) AS buy__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM buys_source_src_28002.ds) AS buy__ds__extract_dow
- , EXTRACT(doy FROM buys_source_src_28002.ds) AS buy__ds__extract_doy
- , buys_source_src_28002.user_id AS user
- , buys_source_src_28002.session_id
- , buys_source_src_28002.user_id AS buy__user
- , buys_source_src_28002.session_id AS buy__session_id
- FROM ***************************.fct_buys buys_source_src_28002
- ) subq_7
- ) subq_8
- ) subq_9
+ , buys_source_src_28000.user_id AS buyers
+ , DATE_TRUNC('day', buys_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', buys_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', buys_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', buys_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', buys_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM buys_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM buys_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', buys_source_src_28000.ds) AS buy__ds__day
+ , DATE_TRUNC('week', buys_source_src_28000.ds) AS buy__ds__week
+ , DATE_TRUNC('month', buys_source_src_28000.ds) AS buy__ds__month
+ , DATE_TRUNC('quarter', buys_source_src_28000.ds) AS buy__ds__quarter
+ , DATE_TRUNC('year', buys_source_src_28000.ds) 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
+ , EXTRACT(day FROM buys_source_src_28000.ds) AS buy__ds__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM buys_source_src_28000.ds) AS buy__ds__extract_dow
+ , EXTRACT(doy FROM buys_source_src_28000.ds) AS buy__ds__extract_doy
+ , buys_source_src_28000.user_id AS user
+ , buys_source_src_28000.session_id
+ , buys_source_src_28000.user_id AS buy__user
+ , buys_source_src_28000.session_id AS buy__session_id
+ FROM ***************************.fct_buys buys_source_src_28000
+ ) subq_16
+ ) subq_17
+ ) subq_18
ON
(
- subq_6.user = subq_9.user
+ subq_15.user = subq_18.user
) AND (
- subq_6.session = subq_9.session_id
+ subq_15.session = subq_18.session_id
) AND (
(
- subq_6.ds__day <= subq_9.ds__day
+ subq_15.ds__day <= subq_18.ds__day
) AND (
- subq_6.ds__day > DATEADD(day, -7, subq_9.ds__day)
+ subq_15.ds__day > DATEADD(day, -7, subq_18.ds__day)
)
)
- ) subq_10
- ) subq_11
- ) subq_12
+ ) subq_19
+ ) subq_20
+ ) subq_21
GROUP BY
- subq_12.metric_time__day
- , subq_12.visit__referrer_id
- ) subq_13
+ subq_21.metric_time__day
+ , subq_21.visit__referrer_id
+ ) subq_22
ON
(
- subq_3.visit__referrer_id = subq_13.visit__referrer_id
+ subq_12.visit__referrer_id = subq_22.visit__referrer_id
) AND (
- subq_3.metric_time__day = subq_13.metric_time__day
+ subq_12.metric_time__day = subq_22.metric_time__day
)
GROUP BY
- COALESCE(subq_3.metric_time__day, subq_13.metric_time__day)
- , COALESCE(subq_3.visit__referrer_id, subq_13.visit__referrer_id)
-) subq_14
+ COALESCE(subq_12.metric_time__day, subq_22.metric_time__day)
+ , COALESCE(subq_12.visit__referrer_id, subq_22.visit__referrer_id)
+) subq_23
diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Databricks/test_conversion_rate_with_constant_properties__plan0_optimized.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Databricks/test_conversion_rate_with_constant_properties__plan0_optimized.sql
index 2a50be7d76..717d7995dc 100644
--- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Databricks/test_conversion_rate_with_constant_properties__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Databricks/test_conversion_rate_with_constant_properties__plan0_optimized.sql
@@ -6,10 +6,10 @@ SELECT
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_18.metric_time__day, subq_28.metric_time__day) AS metric_time__day
- , COALESCE(subq_18.visit__referrer_id, subq_28.visit__referrer_id) AS visit__referrer_id
- , MAX(subq_18.visits) AS visits
- , MAX(subq_28.buys) AS buys
+ COALESCE(subq_27.metric_time__day, subq_37.metric_time__day) AS metric_time__day
+ , COALESCE(subq_27.visit__referrer_id, subq_37.visit__referrer_id) AS visit__referrer_id
+ , MAX(subq_27.visits) AS visits
+ , MAX(subq_37.buys) AS buys
FROM (
-- Aggregate Measures
SELECT
@@ -24,12 +24,12 @@ FROM (
DATE_TRUNC('day', ds) AS metric_time__day
, referrer_id AS visit__referrer_id
, 1 AS visits
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_17
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_26
GROUP BY
metric_time__day
, visit__referrer_id
- ) subq_18
+ ) subq_27
FULL OUTER JOIN (
-- Find conversions for user within the range of 7 day
-- Pass Only Elements: ['buys', 'visit__referrer_id', 'metric_time__day']
@@ -41,14 +41,14 @@ FROM (
FROM (
-- Dedupe the fanout with mf_internal_uuid in the conversion data set
SELECT DISTINCT
- first_value(subq_21.visits) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid, subq_24.session_id ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
- , first_value(subq_21.visit__referrer_id) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid, subq_24.session_id ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visit__referrer_id
- , first_value(subq_21.ds__day) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid, subq_24.session_id ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
- , first_value(subq_21.metric_time__day) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid, subq_24.session_id ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS metric_time__day
- , first_value(subq_21.user) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid, subq_24.session_id ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
- , first_value(subq_21.session) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid, subq_24.session_id ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS session
- , subq_24.mf_internal_uuid AS mf_internal_uuid
- , subq_24.buys AS buys
+ first_value(subq_30.visits) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid, subq_33.session_id ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
+ , first_value(subq_30.visit__referrer_id) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid, subq_33.session_id ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visit__referrer_id
+ , first_value(subq_30.ds__day) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid, subq_33.session_id ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
+ , first_value(subq_30.metric_time__day) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid, subq_33.session_id ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS metric_time__day
+ , first_value(subq_30.user) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid, subq_33.session_id ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
+ , first_value(subq_30.session) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid, subq_33.session_id ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS session
+ , subq_33.mf_internal_uuid AS mf_internal_uuid
+ , subq_33.buys AS buys
FROM (
-- Read Elements From Semantic Model 'visits_source'
-- Metric Time Dimension 'ds'
@@ -60,8 +60,8 @@ FROM (
, session_id AS session
, referrer_id AS visit__referrer_id
, 1 AS visits
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_21
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_30
INNER JOIN (
-- Read Elements From Semantic Model 'buys_source'
-- Metric Time Dimension 'ds'
@@ -72,32 +72,32 @@ FROM (
, session_id
, 1 AS buys
, UUID() AS mf_internal_uuid
- FROM ***************************.fct_buys buys_source_src_28002
- ) subq_24
+ FROM ***************************.fct_buys buys_source_src_28000
+ ) subq_33
ON
(
- subq_21.user = subq_24.user
+ subq_30.user = subq_33.user
) AND (
- subq_21.session = subq_24.session_id
+ subq_30.session = subq_33.session_id
) AND (
(
- subq_21.ds__day <= subq_24.ds__day
+ subq_30.ds__day <= subq_33.ds__day
) AND (
- subq_21.ds__day > DATEADD(day, -7, subq_24.ds__day)
+ subq_30.ds__day > DATEADD(day, -7, subq_33.ds__day)
)
)
- ) subq_25
+ ) subq_34
GROUP BY
metric_time__day
, visit__referrer_id
- ) subq_28
+ ) subq_37
ON
(
- subq_18.visit__referrer_id = subq_28.visit__referrer_id
+ subq_27.visit__referrer_id = subq_37.visit__referrer_id
) AND (
- subq_18.metric_time__day = subq_28.metric_time__day
+ subq_27.metric_time__day = subq_37.metric_time__day
)
GROUP BY
- COALESCE(subq_18.metric_time__day, subq_28.metric_time__day)
- , COALESCE(subq_18.visit__referrer_id, subq_28.visit__referrer_id)
-) subq_29
+ COALESCE(subq_27.metric_time__day, subq_37.metric_time__day)
+ , COALESCE(subq_27.visit__referrer_id, subq_37.visit__referrer_id)
+) subq_38
diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Databricks/test_conversion_rate_with_no_group_by__plan0.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Databricks/test_conversion_rate_with_no_group_by__plan0.sql
index 157d1418c3..ab7a3bcc96 100644
--- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Databricks/test_conversion_rate_with_no_group_by__plan0.sql
+++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Databricks/test_conversion_rate_with_no_group_by__plan0.sql
@@ -1,343 +1,343 @@
-- Compute Metrics via Expressions
SELECT
- CAST(subq_14.buys AS DOUBLE) / CAST(NULLIF(subq_14.visits, 0) AS DOUBLE) AS visit_buy_conversion_rate_7days
+ CAST(subq_23.buys AS DOUBLE) / CAST(NULLIF(subq_23.visits, 0) AS DOUBLE) AS visit_buy_conversion_rate_7days
FROM (
-- Combine Aggregated Outputs
SELECT
- MAX(subq_3.visits) AS visits
- , MAX(subq_13.buys) AS buys
+ MAX(subq_12.visits) AS visits
+ , MAX(subq_22.buys) AS buys
FROM (
-- Aggregate Measures
SELECT
- SUM(subq_2.visits) AS visits
+ SUM(subq_11.visits) AS visits
FROM (
-- Pass Only Elements: ['visits',]
SELECT
- subq_1.visits
+ subq_10.visits
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.visit__ds__day
- , subq_0.visit__ds__week
- , subq_0.visit__ds__month
- , subq_0.visit__ds__quarter
- , subq_0.visit__ds__year
- , subq_0.visit__ds__extract_year
- , subq_0.visit__ds__extract_quarter
- , subq_0.visit__ds__extract_month
- , subq_0.visit__ds__extract_day
- , subq_0.visit__ds__extract_dow
- , subq_0.visit__ds__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.user
- , subq_0.session
- , subq_0.visit__user
- , subq_0.visit__session
- , subq_0.referrer_id
- , subq_0.visit__referrer_id
- , subq_0.visits
- , subq_0.visitors
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.visit__ds__day
+ , subq_9.visit__ds__week
+ , subq_9.visit__ds__month
+ , subq_9.visit__ds__quarter
+ , subq_9.visit__ds__year
+ , subq_9.visit__ds__extract_year
+ , subq_9.visit__ds__extract_quarter
+ , subq_9.visit__ds__extract_month
+ , subq_9.visit__ds__extract_day
+ , subq_9.visit__ds__extract_dow
+ , subq_9.visit__ds__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.user
+ , subq_9.session
+ , subq_9.visit__user
+ , subq_9.visit__session
+ , subq_9.referrer_id
+ , subq_9.visit__referrer_id
+ , subq_9.visits
+ , subq_9.visitors
FROM (
-- Read Elements From Semantic Model 'visits_source'
SELECT
1 AS visits
- , visits_source_src_28011.user_id AS visitors
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM visits_source_src_28011.ds) AS ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy
- , visits_source_src_28011.referrer_id
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM visits_source_src_28011.ds) AS visit__ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy
- , visits_source_src_28011.referrer_id AS visit__referrer_id
- , visits_source_src_28011.user_id AS user
- , visits_source_src_28011.session_id AS session
- , visits_source_src_28011.user_id AS visit__user
- , visits_source_src_28011.session_id AS visit__session
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_0
- ) subq_1
- ) subq_2
- ) subq_3
+ , visits_source_src_28000.user_id AS visitors
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS ds__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM visits_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS ds__extract_doy
+ , visits_source_src_28000.referrer_id
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS visit__ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS visit__ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS visit__ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS visit__ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS visit__ds__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM visits_source_src_28000.ds) AS visit__ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS visit__ds__extract_doy
+ , visits_source_src_28000.referrer_id AS visit__referrer_id
+ , visits_source_src_28000.user_id AS user
+ , visits_source_src_28000.session_id AS session
+ , visits_source_src_28000.user_id AS visit__user
+ , visits_source_src_28000.session_id AS visit__session
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
+ ) subq_12
CROSS JOIN (
-- Aggregate Measures
SELECT
- SUM(subq_12.buys) AS buys
+ SUM(subq_21.buys) AS buys
FROM (
-- Pass Only Elements: ['buys',]
SELECT
- subq_11.buys
+ subq_20.buys
FROM (
-- Find conversions for user within the range of 7 day
SELECT
- subq_10.ds__day
- , subq_10.user
- , subq_10.buys
- , subq_10.visits
+ subq_19.ds__day
+ , subq_19.user
+ , subq_19.buys
+ , subq_19.visits
FROM (
-- Dedupe the fanout with mf_internal_uuid in the conversion data set
SELECT DISTINCT
- first_value(subq_6.visits) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
- , first_value(subq_6.ds__day) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
- , first_value(subq_6.user) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
- , subq_9.mf_internal_uuid AS mf_internal_uuid
- , subq_9.buys AS buys
+ first_value(subq_15.visits) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
+ , first_value(subq_15.ds__day) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
+ , first_value(subq_15.user) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
+ , subq_18.mf_internal_uuid AS mf_internal_uuid
+ , subq_18.buys AS buys
FROM (
-- Pass Only Elements: ['visits', 'ds__day', 'user']
SELECT
- subq_5.ds__day
- , subq_5.user
- , subq_5.visits
+ subq_14.ds__day
+ , subq_14.user
+ , subq_14.visits
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_4.ds__day
- , subq_4.ds__week
- , subq_4.ds__month
- , subq_4.ds__quarter
- , subq_4.ds__year
- , subq_4.ds__extract_year
- , subq_4.ds__extract_quarter
- , subq_4.ds__extract_month
- , subq_4.ds__extract_day
- , subq_4.ds__extract_dow
- , subq_4.ds__extract_doy
- , subq_4.visit__ds__day
- , subq_4.visit__ds__week
- , subq_4.visit__ds__month
- , subq_4.visit__ds__quarter
- , subq_4.visit__ds__year
- , subq_4.visit__ds__extract_year
- , subq_4.visit__ds__extract_quarter
- , subq_4.visit__ds__extract_month
- , subq_4.visit__ds__extract_day
- , subq_4.visit__ds__extract_dow
- , subq_4.visit__ds__extract_doy
- , subq_4.ds__day AS metric_time__day
- , subq_4.ds__week AS metric_time__week
- , subq_4.ds__month AS metric_time__month
- , subq_4.ds__quarter AS metric_time__quarter
- , subq_4.ds__year AS metric_time__year
- , subq_4.ds__extract_year AS metric_time__extract_year
- , subq_4.ds__extract_quarter AS metric_time__extract_quarter
- , subq_4.ds__extract_month AS metric_time__extract_month
- , subq_4.ds__extract_day AS metric_time__extract_day
- , subq_4.ds__extract_dow AS metric_time__extract_dow
- , subq_4.ds__extract_doy AS metric_time__extract_doy
- , subq_4.user
- , subq_4.session
- , subq_4.visit__user
- , subq_4.visit__session
- , subq_4.referrer_id
- , subq_4.visit__referrer_id
- , subq_4.visits
- , subq_4.visitors
+ subq_13.ds__day
+ , subq_13.ds__week
+ , subq_13.ds__month
+ , subq_13.ds__quarter
+ , subq_13.ds__year
+ , subq_13.ds__extract_year
+ , subq_13.ds__extract_quarter
+ , subq_13.ds__extract_month
+ , subq_13.ds__extract_day
+ , subq_13.ds__extract_dow
+ , subq_13.ds__extract_doy
+ , subq_13.visit__ds__day
+ , subq_13.visit__ds__week
+ , subq_13.visit__ds__month
+ , subq_13.visit__ds__quarter
+ , subq_13.visit__ds__year
+ , subq_13.visit__ds__extract_year
+ , subq_13.visit__ds__extract_quarter
+ , subq_13.visit__ds__extract_month
+ , subq_13.visit__ds__extract_day
+ , subq_13.visit__ds__extract_dow
+ , subq_13.visit__ds__extract_doy
+ , subq_13.ds__day AS metric_time__day
+ , subq_13.ds__week AS metric_time__week
+ , subq_13.ds__month AS metric_time__month
+ , subq_13.ds__quarter AS metric_time__quarter
+ , subq_13.ds__year AS metric_time__year
+ , subq_13.ds__extract_year AS metric_time__extract_year
+ , subq_13.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_13.ds__extract_month AS metric_time__extract_month
+ , subq_13.ds__extract_day AS metric_time__extract_day
+ , subq_13.ds__extract_dow AS metric_time__extract_dow
+ , subq_13.ds__extract_doy AS metric_time__extract_doy
+ , subq_13.user
+ , subq_13.session
+ , subq_13.visit__user
+ , subq_13.visit__session
+ , subq_13.referrer_id
+ , subq_13.visit__referrer_id
+ , subq_13.visits
+ , subq_13.visitors
FROM (
-- Read Elements From Semantic Model 'visits_source'
SELECT
1 AS visits
- , visits_source_src_28011.user_id AS visitors
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM visits_source_src_28011.ds) AS ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy
- , visits_source_src_28011.referrer_id
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM visits_source_src_28011.ds) AS visit__ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy
- , visits_source_src_28011.referrer_id AS visit__referrer_id
- , visits_source_src_28011.user_id AS user
- , visits_source_src_28011.session_id AS session
- , visits_source_src_28011.user_id AS visit__user
- , visits_source_src_28011.session_id AS visit__session
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_4
- ) subq_5
- ) subq_6
+ , visits_source_src_28000.user_id AS visitors
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS ds__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM visits_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS ds__extract_doy
+ , visits_source_src_28000.referrer_id
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS visit__ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS visit__ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS visit__ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS visit__ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS visit__ds__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM visits_source_src_28000.ds) AS visit__ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS visit__ds__extract_doy
+ , visits_source_src_28000.referrer_id AS visit__referrer_id
+ , visits_source_src_28000.user_id AS user
+ , visits_source_src_28000.session_id AS session
+ , visits_source_src_28000.user_id AS visit__user
+ , visits_source_src_28000.session_id AS visit__session
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_13
+ ) subq_14
+ ) subq_15
INNER JOIN (
-- Add column with generated UUID
SELECT
- subq_8.ds__day
- , subq_8.ds__week
- , subq_8.ds__month
- , subq_8.ds__quarter
- , subq_8.ds__year
- , subq_8.ds__extract_year
- , subq_8.ds__extract_quarter
- , subq_8.ds__extract_month
- , subq_8.ds__extract_day
- , subq_8.ds__extract_dow
- , subq_8.ds__extract_doy
- , subq_8.buy__ds__day
- , subq_8.buy__ds__week
- , subq_8.buy__ds__month
- , subq_8.buy__ds__quarter
- , subq_8.buy__ds__year
- , subq_8.buy__ds__extract_year
- , subq_8.buy__ds__extract_quarter
- , subq_8.buy__ds__extract_month
- , subq_8.buy__ds__extract_day
- , subq_8.buy__ds__extract_dow
- , subq_8.buy__ds__extract_doy
- , subq_8.metric_time__day
- , subq_8.metric_time__week
- , subq_8.metric_time__month
- , subq_8.metric_time__quarter
- , subq_8.metric_time__year
- , subq_8.metric_time__extract_year
- , subq_8.metric_time__extract_quarter
- , subq_8.metric_time__extract_month
- , subq_8.metric_time__extract_day
- , subq_8.metric_time__extract_dow
- , subq_8.metric_time__extract_doy
- , subq_8.user
- , subq_8.session_id
- , subq_8.buy__user
- , subq_8.buy__session_id
- , subq_8.buys
- , subq_8.buyers
+ subq_17.ds__day
+ , subq_17.ds__week
+ , subq_17.ds__month
+ , subq_17.ds__quarter
+ , subq_17.ds__year
+ , subq_17.ds__extract_year
+ , subq_17.ds__extract_quarter
+ , subq_17.ds__extract_month
+ , subq_17.ds__extract_day
+ , subq_17.ds__extract_dow
+ , subq_17.ds__extract_doy
+ , subq_17.buy__ds__day
+ , subq_17.buy__ds__week
+ , subq_17.buy__ds__month
+ , subq_17.buy__ds__quarter
+ , subq_17.buy__ds__year
+ , subq_17.buy__ds__extract_year
+ , subq_17.buy__ds__extract_quarter
+ , subq_17.buy__ds__extract_month
+ , subq_17.buy__ds__extract_day
+ , subq_17.buy__ds__extract_dow
+ , subq_17.buy__ds__extract_doy
+ , subq_17.metric_time__day
+ , subq_17.metric_time__week
+ , subq_17.metric_time__month
+ , subq_17.metric_time__quarter
+ , subq_17.metric_time__year
+ , subq_17.metric_time__extract_year
+ , subq_17.metric_time__extract_quarter
+ , subq_17.metric_time__extract_month
+ , subq_17.metric_time__extract_day
+ , subq_17.metric_time__extract_dow
+ , subq_17.metric_time__extract_doy
+ , subq_17.user
+ , subq_17.session_id
+ , subq_17.buy__user
+ , subq_17.buy__session_id
+ , subq_17.buys
+ , subq_17.buyers
, UUID() AS mf_internal_uuid
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_7.ds__day
- , subq_7.ds__week
- , subq_7.ds__month
- , subq_7.ds__quarter
- , subq_7.ds__year
- , subq_7.ds__extract_year
- , subq_7.ds__extract_quarter
- , subq_7.ds__extract_month
- , subq_7.ds__extract_day
- , subq_7.ds__extract_dow
- , subq_7.ds__extract_doy
- , subq_7.buy__ds__day
- , subq_7.buy__ds__week
- , subq_7.buy__ds__month
- , subq_7.buy__ds__quarter
- , subq_7.buy__ds__year
- , subq_7.buy__ds__extract_year
- , subq_7.buy__ds__extract_quarter
- , subq_7.buy__ds__extract_month
- , subq_7.buy__ds__extract_day
- , subq_7.buy__ds__extract_dow
- , subq_7.buy__ds__extract_doy
- , subq_7.ds__day AS metric_time__day
- , subq_7.ds__week AS metric_time__week
- , subq_7.ds__month AS metric_time__month
- , subq_7.ds__quarter AS metric_time__quarter
- , subq_7.ds__year AS metric_time__year
- , subq_7.ds__extract_year AS metric_time__extract_year
- , subq_7.ds__extract_quarter AS metric_time__extract_quarter
- , subq_7.ds__extract_month AS metric_time__extract_month
- , subq_7.ds__extract_day AS metric_time__extract_day
- , subq_7.ds__extract_dow AS metric_time__extract_dow
- , subq_7.ds__extract_doy AS metric_time__extract_doy
- , subq_7.user
- , subq_7.session_id
- , subq_7.buy__user
- , subq_7.buy__session_id
- , subq_7.buys
- , subq_7.buyers
+ subq_16.ds__day
+ , subq_16.ds__week
+ , subq_16.ds__month
+ , subq_16.ds__quarter
+ , subq_16.ds__year
+ , subq_16.ds__extract_year
+ , subq_16.ds__extract_quarter
+ , subq_16.ds__extract_month
+ , subq_16.ds__extract_day
+ , subq_16.ds__extract_dow
+ , subq_16.ds__extract_doy
+ , subq_16.buy__ds__day
+ , subq_16.buy__ds__week
+ , subq_16.buy__ds__month
+ , subq_16.buy__ds__quarter
+ , subq_16.buy__ds__year
+ , subq_16.buy__ds__extract_year
+ , subq_16.buy__ds__extract_quarter
+ , subq_16.buy__ds__extract_month
+ , subq_16.buy__ds__extract_day
+ , subq_16.buy__ds__extract_dow
+ , subq_16.buy__ds__extract_doy
+ , subq_16.ds__day AS metric_time__day
+ , subq_16.ds__week AS metric_time__week
+ , subq_16.ds__month AS metric_time__month
+ , subq_16.ds__quarter AS metric_time__quarter
+ , subq_16.ds__year AS metric_time__year
+ , subq_16.ds__extract_year AS metric_time__extract_year
+ , subq_16.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_16.ds__extract_month AS metric_time__extract_month
+ , subq_16.ds__extract_day AS metric_time__extract_day
+ , subq_16.ds__extract_dow AS metric_time__extract_dow
+ , subq_16.ds__extract_doy AS metric_time__extract_doy
+ , subq_16.user
+ , subq_16.session_id
+ , subq_16.buy__user
+ , subq_16.buy__session_id
+ , subq_16.buys
+ , subq_16.buyers
FROM (
-- Read Elements From Semantic Model 'buys_source'
SELECT
1 AS buys
- , buys_source_src_28002.user_id AS buyers
- , DATE_TRUNC('day', buys_source_src_28002.ds) AS ds__day
- , DATE_TRUNC('week', buys_source_src_28002.ds) AS ds__week
- , DATE_TRUNC('month', buys_source_src_28002.ds) AS ds__month
- , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS ds__quarter
- , DATE_TRUNC('year', buys_source_src_28002.ds) AS ds__year
- , EXTRACT(year FROM buys_source_src_28002.ds) AS ds__extract_year
- , EXTRACT(quarter FROM buys_source_src_28002.ds) AS ds__extract_quarter
- , EXTRACT(month FROM buys_source_src_28002.ds) AS ds__extract_month
- , EXTRACT(day FROM buys_source_src_28002.ds) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM buys_source_src_28002.ds) AS ds__extract_dow
- , EXTRACT(doy FROM buys_source_src_28002.ds) AS ds__extract_doy
- , DATE_TRUNC('day', buys_source_src_28002.ds) AS buy__ds__day
- , DATE_TRUNC('week', buys_source_src_28002.ds) AS buy__ds__week
- , DATE_TRUNC('month', buys_source_src_28002.ds) AS buy__ds__month
- , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS buy__ds__quarter
- , DATE_TRUNC('year', buys_source_src_28002.ds) AS buy__ds__year
- , EXTRACT(year FROM buys_source_src_28002.ds) AS buy__ds__extract_year
- , EXTRACT(quarter FROM buys_source_src_28002.ds) AS buy__ds__extract_quarter
- , EXTRACT(month FROM buys_source_src_28002.ds) AS buy__ds__extract_month
- , EXTRACT(day FROM buys_source_src_28002.ds) AS buy__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM buys_source_src_28002.ds) AS buy__ds__extract_dow
- , EXTRACT(doy FROM buys_source_src_28002.ds) AS buy__ds__extract_doy
- , buys_source_src_28002.user_id AS user
- , buys_source_src_28002.session_id
- , buys_source_src_28002.user_id AS buy__user
- , buys_source_src_28002.session_id AS buy__session_id
- FROM ***************************.fct_buys buys_source_src_28002
- ) subq_7
- ) subq_8
- ) subq_9
+ , buys_source_src_28000.user_id AS buyers
+ , DATE_TRUNC('day', buys_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', buys_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', buys_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', buys_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', buys_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM buys_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM buys_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', buys_source_src_28000.ds) AS buy__ds__day
+ , DATE_TRUNC('week', buys_source_src_28000.ds) AS buy__ds__week
+ , DATE_TRUNC('month', buys_source_src_28000.ds) AS buy__ds__month
+ , DATE_TRUNC('quarter', buys_source_src_28000.ds) AS buy__ds__quarter
+ , DATE_TRUNC('year', buys_source_src_28000.ds) 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
+ , EXTRACT(day FROM buys_source_src_28000.ds) AS buy__ds__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM buys_source_src_28000.ds) AS buy__ds__extract_dow
+ , EXTRACT(doy FROM buys_source_src_28000.ds) AS buy__ds__extract_doy
+ , buys_source_src_28000.user_id AS user
+ , buys_source_src_28000.session_id
+ , buys_source_src_28000.user_id AS buy__user
+ , buys_source_src_28000.session_id AS buy__session_id
+ FROM ***************************.fct_buys buys_source_src_28000
+ ) subq_16
+ ) subq_17
+ ) subq_18
ON
(
- subq_6.user = subq_9.user
+ subq_15.user = subq_18.user
) AND (
(
- subq_6.ds__day <= subq_9.ds__day
+ subq_15.ds__day <= subq_18.ds__day
) AND (
- subq_6.ds__day > DATEADD(day, -7, subq_9.ds__day)
+ subq_15.ds__day > DATEADD(day, -7, subq_18.ds__day)
)
)
- ) subq_10
- ) subq_11
- ) subq_12
- ) subq_13
-) subq_14
+ ) subq_19
+ ) subq_20
+ ) subq_21
+ ) subq_22
+) subq_23
diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Databricks/test_conversion_rate_with_no_group_by__plan0_optimized.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Databricks/test_conversion_rate_with_no_group_by__plan0_optimized.sql
index 9ada7cb337..a9778bf3d2 100644
--- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Databricks/test_conversion_rate_with_no_group_by__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Databricks/test_conversion_rate_with_no_group_by__plan0_optimized.sql
@@ -1,7 +1,7 @@
-- Combine Aggregated Outputs
-- Compute Metrics via Expressions
SELECT
- CAST(MAX(subq_28.buys) AS DOUBLE) / CAST(NULLIF(MAX(subq_18.visits), 0) AS DOUBLE) AS visit_buy_conversion_rate_7days
+ CAST(MAX(subq_37.buys) AS DOUBLE) / CAST(NULLIF(MAX(subq_27.visits), 0) AS DOUBLE) AS visit_buy_conversion_rate_7days
FROM (
-- Read Elements From Semantic Model 'visits_source'
-- Metric Time Dimension 'ds'
@@ -9,8 +9,8 @@ FROM (
-- Aggregate Measures
SELECT
SUM(1) AS visits
- FROM ***************************.fct_visits visits_source_src_28011
-) subq_18
+ FROM ***************************.fct_visits visits_source_src_28000
+) subq_27
CROSS JOIN (
-- Find conversions for user within the range of 7 day
-- Pass Only Elements: ['buys',]
@@ -20,11 +20,11 @@ CROSS JOIN (
FROM (
-- Dedupe the fanout with mf_internal_uuid in the conversion data set
SELECT DISTINCT
- first_value(subq_21.visits) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
- , first_value(subq_21.ds__day) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
- , first_value(subq_21.user) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
- , subq_24.mf_internal_uuid AS mf_internal_uuid
- , subq_24.buys AS buys
+ first_value(subq_30.visits) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
+ , first_value(subq_30.ds__day) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
+ , first_value(subq_30.user) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
+ , subq_33.mf_internal_uuid AS mf_internal_uuid
+ , subq_33.buys AS buys
FROM (
-- Read Elements From Semantic Model 'visits_source'
-- Metric Time Dimension 'ds'
@@ -33,8 +33,8 @@ CROSS JOIN (
DATE_TRUNC('day', ds) AS ds__day
, user_id AS user
, 1 AS visits
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_21
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_30
INNER JOIN (
-- Read Elements From Semantic Model 'buys_source'
-- Metric Time Dimension 'ds'
@@ -44,17 +44,17 @@ CROSS JOIN (
, user_id AS user
, 1 AS buys
, UUID() AS mf_internal_uuid
- FROM ***************************.fct_buys buys_source_src_28002
- ) subq_24
+ FROM ***************************.fct_buys buys_source_src_28000
+ ) subq_33
ON
(
- subq_21.user = subq_24.user
+ subq_30.user = subq_33.user
) AND (
(
- subq_21.ds__day <= subq_24.ds__day
+ subq_30.ds__day <= subq_33.ds__day
) AND (
- subq_21.ds__day > DATEADD(day, -7, subq_24.ds__day)
+ subq_30.ds__day > DATEADD(day, -7, subq_33.ds__day)
)
)
- ) subq_25
-) subq_28
+ ) subq_34
+) subq_37
diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Databricks/test_conversion_rate_with_window__plan0.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Databricks/test_conversion_rate_with_window__plan0.sql
index f666d7f15d..0a64ca57d0 100644
--- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Databricks/test_conversion_rate_with_window__plan0.sql
+++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Databricks/test_conversion_rate_with_window__plan0.sql
@@ -1,376 +1,376 @@
-- Compute Metrics via Expressions
SELECT
- subq_14.metric_time__day
- , subq_14.visit__referrer_id
- , CAST(subq_14.buys AS DOUBLE) / CAST(NULLIF(subq_14.visits, 0) AS DOUBLE) AS visit_buy_conversion_rate_7days
+ subq_23.metric_time__day
+ , subq_23.visit__referrer_id
+ , CAST(subq_23.buys AS DOUBLE) / CAST(NULLIF(subq_23.visits, 0) AS DOUBLE) AS visit_buy_conversion_rate_7days
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_3.metric_time__day, subq_13.metric_time__day) AS metric_time__day
- , COALESCE(subq_3.visit__referrer_id, subq_13.visit__referrer_id) AS visit__referrer_id
- , MAX(subq_3.visits) AS visits
- , MAX(subq_13.buys) AS buys
+ COALESCE(subq_12.metric_time__day, subq_22.metric_time__day) AS metric_time__day
+ , COALESCE(subq_12.visit__referrer_id, subq_22.visit__referrer_id) AS visit__referrer_id
+ , MAX(subq_12.visits) AS visits
+ , MAX(subq_22.buys) AS buys
FROM (
-- Aggregate Measures
SELECT
- subq_2.metric_time__day
- , subq_2.visit__referrer_id
- , SUM(subq_2.visits) AS visits
+ subq_11.metric_time__day
+ , subq_11.visit__referrer_id
+ , SUM(subq_11.visits) AS visits
FROM (
-- Pass Only Elements: ['visits', 'visit__referrer_id', 'metric_time__day']
SELECT
- subq_1.metric_time__day
- , subq_1.visit__referrer_id
- , subq_1.visits
+ subq_10.metric_time__day
+ , subq_10.visit__referrer_id
+ , subq_10.visits
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.visit__ds__day
- , subq_0.visit__ds__week
- , subq_0.visit__ds__month
- , subq_0.visit__ds__quarter
- , subq_0.visit__ds__year
- , subq_0.visit__ds__extract_year
- , subq_0.visit__ds__extract_quarter
- , subq_0.visit__ds__extract_month
- , subq_0.visit__ds__extract_day
- , subq_0.visit__ds__extract_dow
- , subq_0.visit__ds__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.user
- , subq_0.session
- , subq_0.visit__user
- , subq_0.visit__session
- , subq_0.referrer_id
- , subq_0.visit__referrer_id
- , subq_0.visits
- , subq_0.visitors
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.visit__ds__day
+ , subq_9.visit__ds__week
+ , subq_9.visit__ds__month
+ , subq_9.visit__ds__quarter
+ , subq_9.visit__ds__year
+ , subq_9.visit__ds__extract_year
+ , subq_9.visit__ds__extract_quarter
+ , subq_9.visit__ds__extract_month
+ , subq_9.visit__ds__extract_day
+ , subq_9.visit__ds__extract_dow
+ , subq_9.visit__ds__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.user
+ , subq_9.session
+ , subq_9.visit__user
+ , subq_9.visit__session
+ , subq_9.referrer_id
+ , subq_9.visit__referrer_id
+ , subq_9.visits
+ , subq_9.visitors
FROM (
-- Read Elements From Semantic Model 'visits_source'
SELECT
1 AS visits
- , visits_source_src_28011.user_id AS visitors
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM visits_source_src_28011.ds) AS ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy
- , visits_source_src_28011.referrer_id
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM visits_source_src_28011.ds) AS visit__ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy
- , visits_source_src_28011.referrer_id AS visit__referrer_id
- , visits_source_src_28011.user_id AS user
- , visits_source_src_28011.session_id AS session
- , visits_source_src_28011.user_id AS visit__user
- , visits_source_src_28011.session_id AS visit__session
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_0
- ) subq_1
- ) subq_2
+ , visits_source_src_28000.user_id AS visitors
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS ds__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM visits_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS ds__extract_doy
+ , visits_source_src_28000.referrer_id
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS visit__ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS visit__ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS visit__ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS visit__ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS visit__ds__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM visits_source_src_28000.ds) AS visit__ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS visit__ds__extract_doy
+ , visits_source_src_28000.referrer_id AS visit__referrer_id
+ , visits_source_src_28000.user_id AS user
+ , visits_source_src_28000.session_id AS session
+ , visits_source_src_28000.user_id AS visit__user
+ , visits_source_src_28000.session_id AS visit__session
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
GROUP BY
- subq_2.metric_time__day
- , subq_2.visit__referrer_id
- ) subq_3
+ subq_11.metric_time__day
+ , subq_11.visit__referrer_id
+ ) subq_12
FULL OUTER JOIN (
-- Aggregate Measures
SELECT
- subq_12.metric_time__day
- , subq_12.visit__referrer_id
- , SUM(subq_12.buys) AS buys
+ subq_21.metric_time__day
+ , subq_21.visit__referrer_id
+ , SUM(subq_21.buys) AS buys
FROM (
-- Pass Only Elements: ['buys', 'visit__referrer_id', 'metric_time__day']
SELECT
- subq_11.metric_time__day
- , subq_11.visit__referrer_id
- , subq_11.buys
+ subq_20.metric_time__day
+ , subq_20.visit__referrer_id
+ , subq_20.buys
FROM (
-- Find conversions for user within the range of 7 day
SELECT
- subq_10.ds__day
- , subq_10.metric_time__day
- , subq_10.user
- , subq_10.visit__referrer_id
- , subq_10.buys
- , subq_10.visits
+ subq_19.ds__day
+ , subq_19.metric_time__day
+ , subq_19.user
+ , subq_19.visit__referrer_id
+ , subq_19.buys
+ , subq_19.visits
FROM (
-- Dedupe the fanout with mf_internal_uuid in the conversion data set
SELECT DISTINCT
- first_value(subq_6.visits) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
- , first_value(subq_6.visit__referrer_id) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visit__referrer_id
- , first_value(subq_6.ds__day) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
- , first_value(subq_6.metric_time__day) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS metric_time__day
- , first_value(subq_6.user) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
- , subq_9.mf_internal_uuid AS mf_internal_uuid
- , subq_9.buys AS buys
+ first_value(subq_15.visits) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
+ , first_value(subq_15.visit__referrer_id) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visit__referrer_id
+ , first_value(subq_15.ds__day) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
+ , first_value(subq_15.metric_time__day) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS metric_time__day
+ , first_value(subq_15.user) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
+ , subq_18.mf_internal_uuid AS mf_internal_uuid
+ , subq_18.buys AS buys
FROM (
-- Pass Only Elements: ['visits', 'visit__referrer_id', 'ds__day', 'metric_time__day', 'user']
SELECT
- subq_5.ds__day
- , subq_5.metric_time__day
- , subq_5.user
- , subq_5.visit__referrer_id
- , subq_5.visits
+ subq_14.ds__day
+ , subq_14.metric_time__day
+ , subq_14.user
+ , subq_14.visit__referrer_id
+ , subq_14.visits
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_4.ds__day
- , subq_4.ds__week
- , subq_4.ds__month
- , subq_4.ds__quarter
- , subq_4.ds__year
- , subq_4.ds__extract_year
- , subq_4.ds__extract_quarter
- , subq_4.ds__extract_month
- , subq_4.ds__extract_day
- , subq_4.ds__extract_dow
- , subq_4.ds__extract_doy
- , subq_4.visit__ds__day
- , subq_4.visit__ds__week
- , subq_4.visit__ds__month
- , subq_4.visit__ds__quarter
- , subq_4.visit__ds__year
- , subq_4.visit__ds__extract_year
- , subq_4.visit__ds__extract_quarter
- , subq_4.visit__ds__extract_month
- , subq_4.visit__ds__extract_day
- , subq_4.visit__ds__extract_dow
- , subq_4.visit__ds__extract_doy
- , subq_4.ds__day AS metric_time__day
- , subq_4.ds__week AS metric_time__week
- , subq_4.ds__month AS metric_time__month
- , subq_4.ds__quarter AS metric_time__quarter
- , subq_4.ds__year AS metric_time__year
- , subq_4.ds__extract_year AS metric_time__extract_year
- , subq_4.ds__extract_quarter AS metric_time__extract_quarter
- , subq_4.ds__extract_month AS metric_time__extract_month
- , subq_4.ds__extract_day AS metric_time__extract_day
- , subq_4.ds__extract_dow AS metric_time__extract_dow
- , subq_4.ds__extract_doy AS metric_time__extract_doy
- , subq_4.user
- , subq_4.session
- , subq_4.visit__user
- , subq_4.visit__session
- , subq_4.referrer_id
- , subq_4.visit__referrer_id
- , subq_4.visits
- , subq_4.visitors
+ subq_13.ds__day
+ , subq_13.ds__week
+ , subq_13.ds__month
+ , subq_13.ds__quarter
+ , subq_13.ds__year
+ , subq_13.ds__extract_year
+ , subq_13.ds__extract_quarter
+ , subq_13.ds__extract_month
+ , subq_13.ds__extract_day
+ , subq_13.ds__extract_dow
+ , subq_13.ds__extract_doy
+ , subq_13.visit__ds__day
+ , subq_13.visit__ds__week
+ , subq_13.visit__ds__month
+ , subq_13.visit__ds__quarter
+ , subq_13.visit__ds__year
+ , subq_13.visit__ds__extract_year
+ , subq_13.visit__ds__extract_quarter
+ , subq_13.visit__ds__extract_month
+ , subq_13.visit__ds__extract_day
+ , subq_13.visit__ds__extract_dow
+ , subq_13.visit__ds__extract_doy
+ , subq_13.ds__day AS metric_time__day
+ , subq_13.ds__week AS metric_time__week
+ , subq_13.ds__month AS metric_time__month
+ , subq_13.ds__quarter AS metric_time__quarter
+ , subq_13.ds__year AS metric_time__year
+ , subq_13.ds__extract_year AS metric_time__extract_year
+ , subq_13.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_13.ds__extract_month AS metric_time__extract_month
+ , subq_13.ds__extract_day AS metric_time__extract_day
+ , subq_13.ds__extract_dow AS metric_time__extract_dow
+ , subq_13.ds__extract_doy AS metric_time__extract_doy
+ , subq_13.user
+ , subq_13.session
+ , subq_13.visit__user
+ , subq_13.visit__session
+ , subq_13.referrer_id
+ , subq_13.visit__referrer_id
+ , subq_13.visits
+ , subq_13.visitors
FROM (
-- Read Elements From Semantic Model 'visits_source'
SELECT
1 AS visits
- , visits_source_src_28011.user_id AS visitors
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM visits_source_src_28011.ds) AS ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy
- , visits_source_src_28011.referrer_id
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM visits_source_src_28011.ds) AS visit__ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy
- , visits_source_src_28011.referrer_id AS visit__referrer_id
- , visits_source_src_28011.user_id AS user
- , visits_source_src_28011.session_id AS session
- , visits_source_src_28011.user_id AS visit__user
- , visits_source_src_28011.session_id AS visit__session
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_4
- ) subq_5
- ) subq_6
+ , visits_source_src_28000.user_id AS visitors
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS ds__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM visits_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS ds__extract_doy
+ , visits_source_src_28000.referrer_id
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS visit__ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS visit__ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS visit__ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS visit__ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS visit__ds__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM visits_source_src_28000.ds) AS visit__ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS visit__ds__extract_doy
+ , visits_source_src_28000.referrer_id AS visit__referrer_id
+ , visits_source_src_28000.user_id AS user
+ , visits_source_src_28000.session_id AS session
+ , visits_source_src_28000.user_id AS visit__user
+ , visits_source_src_28000.session_id AS visit__session
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_13
+ ) subq_14
+ ) subq_15
INNER JOIN (
-- Add column with generated UUID
SELECT
- subq_8.ds__day
- , subq_8.ds__week
- , subq_8.ds__month
- , subq_8.ds__quarter
- , subq_8.ds__year
- , subq_8.ds__extract_year
- , subq_8.ds__extract_quarter
- , subq_8.ds__extract_month
- , subq_8.ds__extract_day
- , subq_8.ds__extract_dow
- , subq_8.ds__extract_doy
- , subq_8.buy__ds__day
- , subq_8.buy__ds__week
- , subq_8.buy__ds__month
- , subq_8.buy__ds__quarter
- , subq_8.buy__ds__year
- , subq_8.buy__ds__extract_year
- , subq_8.buy__ds__extract_quarter
- , subq_8.buy__ds__extract_month
- , subq_8.buy__ds__extract_day
- , subq_8.buy__ds__extract_dow
- , subq_8.buy__ds__extract_doy
- , subq_8.metric_time__day
- , subq_8.metric_time__week
- , subq_8.metric_time__month
- , subq_8.metric_time__quarter
- , subq_8.metric_time__year
- , subq_8.metric_time__extract_year
- , subq_8.metric_time__extract_quarter
- , subq_8.metric_time__extract_month
- , subq_8.metric_time__extract_day
- , subq_8.metric_time__extract_dow
- , subq_8.metric_time__extract_doy
- , subq_8.user
- , subq_8.session_id
- , subq_8.buy__user
- , subq_8.buy__session_id
- , subq_8.buys
- , subq_8.buyers
+ subq_17.ds__day
+ , subq_17.ds__week
+ , subq_17.ds__month
+ , subq_17.ds__quarter
+ , subq_17.ds__year
+ , subq_17.ds__extract_year
+ , subq_17.ds__extract_quarter
+ , subq_17.ds__extract_month
+ , subq_17.ds__extract_day
+ , subq_17.ds__extract_dow
+ , subq_17.ds__extract_doy
+ , subq_17.buy__ds__day
+ , subq_17.buy__ds__week
+ , subq_17.buy__ds__month
+ , subq_17.buy__ds__quarter
+ , subq_17.buy__ds__year
+ , subq_17.buy__ds__extract_year
+ , subq_17.buy__ds__extract_quarter
+ , subq_17.buy__ds__extract_month
+ , subq_17.buy__ds__extract_day
+ , subq_17.buy__ds__extract_dow
+ , subq_17.buy__ds__extract_doy
+ , subq_17.metric_time__day
+ , subq_17.metric_time__week
+ , subq_17.metric_time__month
+ , subq_17.metric_time__quarter
+ , subq_17.metric_time__year
+ , subq_17.metric_time__extract_year
+ , subq_17.metric_time__extract_quarter
+ , subq_17.metric_time__extract_month
+ , subq_17.metric_time__extract_day
+ , subq_17.metric_time__extract_dow
+ , subq_17.metric_time__extract_doy
+ , subq_17.user
+ , subq_17.session_id
+ , subq_17.buy__user
+ , subq_17.buy__session_id
+ , subq_17.buys
+ , subq_17.buyers
, UUID() AS mf_internal_uuid
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_7.ds__day
- , subq_7.ds__week
- , subq_7.ds__month
- , subq_7.ds__quarter
- , subq_7.ds__year
- , subq_7.ds__extract_year
- , subq_7.ds__extract_quarter
- , subq_7.ds__extract_month
- , subq_7.ds__extract_day
- , subq_7.ds__extract_dow
- , subq_7.ds__extract_doy
- , subq_7.buy__ds__day
- , subq_7.buy__ds__week
- , subq_7.buy__ds__month
- , subq_7.buy__ds__quarter
- , subq_7.buy__ds__year
- , subq_7.buy__ds__extract_year
- , subq_7.buy__ds__extract_quarter
- , subq_7.buy__ds__extract_month
- , subq_7.buy__ds__extract_day
- , subq_7.buy__ds__extract_dow
- , subq_7.buy__ds__extract_doy
- , subq_7.ds__day AS metric_time__day
- , subq_7.ds__week AS metric_time__week
- , subq_7.ds__month AS metric_time__month
- , subq_7.ds__quarter AS metric_time__quarter
- , subq_7.ds__year AS metric_time__year
- , subq_7.ds__extract_year AS metric_time__extract_year
- , subq_7.ds__extract_quarter AS metric_time__extract_quarter
- , subq_7.ds__extract_month AS metric_time__extract_month
- , subq_7.ds__extract_day AS metric_time__extract_day
- , subq_7.ds__extract_dow AS metric_time__extract_dow
- , subq_7.ds__extract_doy AS metric_time__extract_doy
- , subq_7.user
- , subq_7.session_id
- , subq_7.buy__user
- , subq_7.buy__session_id
- , subq_7.buys
- , subq_7.buyers
+ subq_16.ds__day
+ , subq_16.ds__week
+ , subq_16.ds__month
+ , subq_16.ds__quarter
+ , subq_16.ds__year
+ , subq_16.ds__extract_year
+ , subq_16.ds__extract_quarter
+ , subq_16.ds__extract_month
+ , subq_16.ds__extract_day
+ , subq_16.ds__extract_dow
+ , subq_16.ds__extract_doy
+ , subq_16.buy__ds__day
+ , subq_16.buy__ds__week
+ , subq_16.buy__ds__month
+ , subq_16.buy__ds__quarter
+ , subq_16.buy__ds__year
+ , subq_16.buy__ds__extract_year
+ , subq_16.buy__ds__extract_quarter
+ , subq_16.buy__ds__extract_month
+ , subq_16.buy__ds__extract_day
+ , subq_16.buy__ds__extract_dow
+ , subq_16.buy__ds__extract_doy
+ , subq_16.ds__day AS metric_time__day
+ , subq_16.ds__week AS metric_time__week
+ , subq_16.ds__month AS metric_time__month
+ , subq_16.ds__quarter AS metric_time__quarter
+ , subq_16.ds__year AS metric_time__year
+ , subq_16.ds__extract_year AS metric_time__extract_year
+ , subq_16.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_16.ds__extract_month AS metric_time__extract_month
+ , subq_16.ds__extract_day AS metric_time__extract_day
+ , subq_16.ds__extract_dow AS metric_time__extract_dow
+ , subq_16.ds__extract_doy AS metric_time__extract_doy
+ , subq_16.user
+ , subq_16.session_id
+ , subq_16.buy__user
+ , subq_16.buy__session_id
+ , subq_16.buys
+ , subq_16.buyers
FROM (
-- Read Elements From Semantic Model 'buys_source'
SELECT
1 AS buys
- , buys_source_src_28002.user_id AS buyers
- , DATE_TRUNC('day', buys_source_src_28002.ds) AS ds__day
- , DATE_TRUNC('week', buys_source_src_28002.ds) AS ds__week
- , DATE_TRUNC('month', buys_source_src_28002.ds) AS ds__month
- , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS ds__quarter
- , DATE_TRUNC('year', buys_source_src_28002.ds) AS ds__year
- , EXTRACT(year FROM buys_source_src_28002.ds) AS ds__extract_year
- , EXTRACT(quarter FROM buys_source_src_28002.ds) AS ds__extract_quarter
- , EXTRACT(month FROM buys_source_src_28002.ds) AS ds__extract_month
- , EXTRACT(day FROM buys_source_src_28002.ds) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM buys_source_src_28002.ds) AS ds__extract_dow
- , EXTRACT(doy FROM buys_source_src_28002.ds) AS ds__extract_doy
- , DATE_TRUNC('day', buys_source_src_28002.ds) AS buy__ds__day
- , DATE_TRUNC('week', buys_source_src_28002.ds) AS buy__ds__week
- , DATE_TRUNC('month', buys_source_src_28002.ds) AS buy__ds__month
- , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS buy__ds__quarter
- , DATE_TRUNC('year', buys_source_src_28002.ds) AS buy__ds__year
- , EXTRACT(year FROM buys_source_src_28002.ds) AS buy__ds__extract_year
- , EXTRACT(quarter FROM buys_source_src_28002.ds) AS buy__ds__extract_quarter
- , EXTRACT(month FROM buys_source_src_28002.ds) AS buy__ds__extract_month
- , EXTRACT(day FROM buys_source_src_28002.ds) AS buy__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM buys_source_src_28002.ds) AS buy__ds__extract_dow
- , EXTRACT(doy FROM buys_source_src_28002.ds) AS buy__ds__extract_doy
- , buys_source_src_28002.user_id AS user
- , buys_source_src_28002.session_id
- , buys_source_src_28002.user_id AS buy__user
- , buys_source_src_28002.session_id AS buy__session_id
- FROM ***************************.fct_buys buys_source_src_28002
- ) subq_7
- ) subq_8
- ) subq_9
+ , buys_source_src_28000.user_id AS buyers
+ , DATE_TRUNC('day', buys_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', buys_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', buys_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', buys_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', buys_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM buys_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM buys_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', buys_source_src_28000.ds) AS buy__ds__day
+ , DATE_TRUNC('week', buys_source_src_28000.ds) AS buy__ds__week
+ , DATE_TRUNC('month', buys_source_src_28000.ds) AS buy__ds__month
+ , DATE_TRUNC('quarter', buys_source_src_28000.ds) AS buy__ds__quarter
+ , DATE_TRUNC('year', buys_source_src_28000.ds) 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
+ , EXTRACT(day FROM buys_source_src_28000.ds) AS buy__ds__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM buys_source_src_28000.ds) AS buy__ds__extract_dow
+ , EXTRACT(doy FROM buys_source_src_28000.ds) AS buy__ds__extract_doy
+ , buys_source_src_28000.user_id AS user
+ , buys_source_src_28000.session_id
+ , buys_source_src_28000.user_id AS buy__user
+ , buys_source_src_28000.session_id AS buy__session_id
+ FROM ***************************.fct_buys buys_source_src_28000
+ ) subq_16
+ ) subq_17
+ ) subq_18
ON
(
- subq_6.user = subq_9.user
+ subq_15.user = subq_18.user
) AND (
(
- subq_6.ds__day <= subq_9.ds__day
+ subq_15.ds__day <= subq_18.ds__day
) AND (
- subq_6.ds__day > DATEADD(day, -7, subq_9.ds__day)
+ subq_15.ds__day > DATEADD(day, -7, subq_18.ds__day)
)
)
- ) subq_10
- ) subq_11
- ) subq_12
+ ) subq_19
+ ) subq_20
+ ) subq_21
GROUP BY
- subq_12.metric_time__day
- , subq_12.visit__referrer_id
- ) subq_13
+ subq_21.metric_time__day
+ , subq_21.visit__referrer_id
+ ) subq_22
ON
(
- subq_3.visit__referrer_id = subq_13.visit__referrer_id
+ subq_12.visit__referrer_id = subq_22.visit__referrer_id
) AND (
- subq_3.metric_time__day = subq_13.metric_time__day
+ subq_12.metric_time__day = subq_22.metric_time__day
)
GROUP BY
- COALESCE(subq_3.metric_time__day, subq_13.metric_time__day)
- , COALESCE(subq_3.visit__referrer_id, subq_13.visit__referrer_id)
-) subq_14
+ COALESCE(subq_12.metric_time__day, subq_22.metric_time__day)
+ , COALESCE(subq_12.visit__referrer_id, subq_22.visit__referrer_id)
+) subq_23
diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Databricks/test_conversion_rate_with_window__plan0_optimized.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Databricks/test_conversion_rate_with_window__plan0_optimized.sql
index a6f6baac27..b468242a66 100644
--- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Databricks/test_conversion_rate_with_window__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Databricks/test_conversion_rate_with_window__plan0_optimized.sql
@@ -6,10 +6,10 @@ SELECT
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_18.metric_time__day, subq_28.metric_time__day) AS metric_time__day
- , COALESCE(subq_18.visit__referrer_id, subq_28.visit__referrer_id) AS visit__referrer_id
- , MAX(subq_18.visits) AS visits
- , MAX(subq_28.buys) AS buys
+ COALESCE(subq_27.metric_time__day, subq_37.metric_time__day) AS metric_time__day
+ , COALESCE(subq_27.visit__referrer_id, subq_37.visit__referrer_id) AS visit__referrer_id
+ , MAX(subq_27.visits) AS visits
+ , MAX(subq_37.buys) AS buys
FROM (
-- Aggregate Measures
SELECT
@@ -24,12 +24,12 @@ FROM (
DATE_TRUNC('day', ds) AS metric_time__day
, referrer_id AS visit__referrer_id
, 1 AS visits
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_17
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_26
GROUP BY
metric_time__day
, visit__referrer_id
- ) subq_18
+ ) subq_27
FULL OUTER JOIN (
-- Find conversions for user within the range of 7 day
-- Pass Only Elements: ['buys', 'visit__referrer_id', 'metric_time__day']
@@ -41,13 +41,13 @@ FROM (
FROM (
-- Dedupe the fanout with mf_internal_uuid in the conversion data set
SELECT DISTINCT
- first_value(subq_21.visits) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
- , first_value(subq_21.visit__referrer_id) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visit__referrer_id
- , first_value(subq_21.ds__day) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
- , first_value(subq_21.metric_time__day) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS metric_time__day
- , first_value(subq_21.user) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
- , subq_24.mf_internal_uuid AS mf_internal_uuid
- , subq_24.buys AS buys
+ first_value(subq_30.visits) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
+ , first_value(subq_30.visit__referrer_id) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visit__referrer_id
+ , first_value(subq_30.ds__day) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
+ , first_value(subq_30.metric_time__day) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS metric_time__day
+ , first_value(subq_30.user) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
+ , subq_33.mf_internal_uuid AS mf_internal_uuid
+ , subq_33.buys AS buys
FROM (
-- Read Elements From Semantic Model 'visits_source'
-- Metric Time Dimension 'ds'
@@ -58,8 +58,8 @@ FROM (
, user_id AS user
, referrer_id AS visit__referrer_id
, 1 AS visits
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_21
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_30
INNER JOIN (
-- Read Elements From Semantic Model 'buys_source'
-- Metric Time Dimension 'ds'
@@ -69,30 +69,30 @@ FROM (
, user_id AS user
, 1 AS buys
, UUID() AS mf_internal_uuid
- FROM ***************************.fct_buys buys_source_src_28002
- ) subq_24
+ FROM ***************************.fct_buys buys_source_src_28000
+ ) subq_33
ON
(
- subq_21.user = subq_24.user
+ subq_30.user = subq_33.user
) AND (
(
- subq_21.ds__day <= subq_24.ds__day
+ subq_30.ds__day <= subq_33.ds__day
) AND (
- subq_21.ds__day > DATEADD(day, -7, subq_24.ds__day)
+ subq_30.ds__day > DATEADD(day, -7, subq_33.ds__day)
)
)
- ) subq_25
+ ) subq_34
GROUP BY
metric_time__day
, visit__referrer_id
- ) subq_28
+ ) subq_37
ON
(
- subq_18.visit__referrer_id = subq_28.visit__referrer_id
+ subq_27.visit__referrer_id = subq_37.visit__referrer_id
) AND (
- subq_18.metric_time__day = subq_28.metric_time__day
+ subq_27.metric_time__day = subq_37.metric_time__day
)
GROUP BY
- COALESCE(subq_18.metric_time__day, subq_28.metric_time__day)
- , COALESCE(subq_18.visit__referrer_id, subq_28.visit__referrer_id)
-) subq_29
+ COALESCE(subq_27.metric_time__day, subq_37.metric_time__day)
+ , COALESCE(subq_27.visit__referrer_id, subq_37.visit__referrer_id)
+) subq_38
diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/DuckDB/test_conversion_count_with_no_group_by__plan0.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/DuckDB/test_conversion_count_with_no_group_by__plan0.sql
index 540e2a2ff7..0c97a6245d 100644
--- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/DuckDB/test_conversion_count_with_no_group_by__plan0.sql
+++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/DuckDB/test_conversion_count_with_no_group_by__plan0.sql
@@ -1,343 +1,343 @@
-- Compute Metrics via Expressions
SELECT
- subq_14.buys AS visit_buy_conversions
+ subq_23.buys AS visit_buy_conversions
FROM (
-- Combine Aggregated Outputs
SELECT
- MAX(subq_3.visits) AS visits
- , COALESCE(MAX(subq_13.buys), 0) AS buys
+ MAX(subq_12.visits) AS visits
+ , COALESCE(MAX(subq_22.buys), 0) AS buys
FROM (
-- Aggregate Measures
SELECT
- SUM(subq_2.visits) AS visits
+ SUM(subq_11.visits) AS visits
FROM (
-- Pass Only Elements: ['visits',]
SELECT
- subq_1.visits
+ subq_10.visits
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.visit__ds__day
- , subq_0.visit__ds__week
- , subq_0.visit__ds__month
- , subq_0.visit__ds__quarter
- , subq_0.visit__ds__year
- , subq_0.visit__ds__extract_year
- , subq_0.visit__ds__extract_quarter
- , subq_0.visit__ds__extract_month
- , subq_0.visit__ds__extract_day
- , subq_0.visit__ds__extract_dow
- , subq_0.visit__ds__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.user
- , subq_0.session
- , subq_0.visit__user
- , subq_0.visit__session
- , subq_0.referrer_id
- , subq_0.visit__referrer_id
- , subq_0.visits
- , subq_0.visitors
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.visit__ds__day
+ , subq_9.visit__ds__week
+ , subq_9.visit__ds__month
+ , subq_9.visit__ds__quarter
+ , subq_9.visit__ds__year
+ , subq_9.visit__ds__extract_year
+ , subq_9.visit__ds__extract_quarter
+ , subq_9.visit__ds__extract_month
+ , subq_9.visit__ds__extract_day
+ , subq_9.visit__ds__extract_dow
+ , subq_9.visit__ds__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.user
+ , subq_9.session
+ , subq_9.visit__user
+ , subq_9.visit__session
+ , subq_9.referrer_id
+ , subq_9.visit__referrer_id
+ , subq_9.visits
+ , subq_9.visitors
FROM (
-- Read Elements From Semantic Model 'visits_source'
SELECT
1 AS visits
- , visits_source_src_28011.user_id AS visitors
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day
- , EXTRACT(isodow FROM visits_source_src_28011.ds) AS ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy
- , visits_source_src_28011.referrer_id
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day
- , EXTRACT(isodow FROM visits_source_src_28011.ds) AS visit__ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy
- , visits_source_src_28011.referrer_id AS visit__referrer_id
- , visits_source_src_28011.user_id AS user
- , visits_source_src_28011.session_id AS session
- , visits_source_src_28011.user_id AS visit__user
- , visits_source_src_28011.session_id AS visit__session
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_0
- ) subq_1
- ) subq_2
- ) subq_3
+ , visits_source_src_28000.user_id AS visitors
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS ds__extract_day
+ , EXTRACT(isodow FROM visits_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS ds__extract_doy
+ , visits_source_src_28000.referrer_id
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS visit__ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS visit__ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS visit__ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS visit__ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS visit__ds__extract_day
+ , EXTRACT(isodow FROM visits_source_src_28000.ds) AS visit__ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS visit__ds__extract_doy
+ , visits_source_src_28000.referrer_id AS visit__referrer_id
+ , visits_source_src_28000.user_id AS user
+ , visits_source_src_28000.session_id AS session
+ , visits_source_src_28000.user_id AS visit__user
+ , visits_source_src_28000.session_id AS visit__session
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
+ ) subq_12
CROSS JOIN (
-- Aggregate Measures
SELECT
- SUM(subq_12.buys) AS buys
+ SUM(subq_21.buys) AS buys
FROM (
-- Pass Only Elements: ['buys',]
SELECT
- subq_11.buys
+ subq_20.buys
FROM (
-- Find conversions for user within the range of 7 day
SELECT
- subq_10.ds__day
- , subq_10.user
- , subq_10.buys
- , subq_10.visits
+ subq_19.ds__day
+ , subq_19.user
+ , subq_19.buys
+ , subq_19.visits
FROM (
-- Dedupe the fanout with mf_internal_uuid in the conversion data set
SELECT DISTINCT
- first_value(subq_6.visits) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
- , first_value(subq_6.ds__day) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
- , first_value(subq_6.user) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
- , subq_9.mf_internal_uuid AS mf_internal_uuid
- , subq_9.buys AS buys
+ first_value(subq_15.visits) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
+ , first_value(subq_15.ds__day) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
+ , first_value(subq_15.user) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
+ , subq_18.mf_internal_uuid AS mf_internal_uuid
+ , subq_18.buys AS buys
FROM (
-- Pass Only Elements: ['visits', 'ds__day', 'user']
SELECT
- subq_5.ds__day
- , subq_5.user
- , subq_5.visits
+ subq_14.ds__day
+ , subq_14.user
+ , subq_14.visits
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_4.ds__day
- , subq_4.ds__week
- , subq_4.ds__month
- , subq_4.ds__quarter
- , subq_4.ds__year
- , subq_4.ds__extract_year
- , subq_4.ds__extract_quarter
- , subq_4.ds__extract_month
- , subq_4.ds__extract_day
- , subq_4.ds__extract_dow
- , subq_4.ds__extract_doy
- , subq_4.visit__ds__day
- , subq_4.visit__ds__week
- , subq_4.visit__ds__month
- , subq_4.visit__ds__quarter
- , subq_4.visit__ds__year
- , subq_4.visit__ds__extract_year
- , subq_4.visit__ds__extract_quarter
- , subq_4.visit__ds__extract_month
- , subq_4.visit__ds__extract_day
- , subq_4.visit__ds__extract_dow
- , subq_4.visit__ds__extract_doy
- , subq_4.ds__day AS metric_time__day
- , subq_4.ds__week AS metric_time__week
- , subq_4.ds__month AS metric_time__month
- , subq_4.ds__quarter AS metric_time__quarter
- , subq_4.ds__year AS metric_time__year
- , subq_4.ds__extract_year AS metric_time__extract_year
- , subq_4.ds__extract_quarter AS metric_time__extract_quarter
- , subq_4.ds__extract_month AS metric_time__extract_month
- , subq_4.ds__extract_day AS metric_time__extract_day
- , subq_4.ds__extract_dow AS metric_time__extract_dow
- , subq_4.ds__extract_doy AS metric_time__extract_doy
- , subq_4.user
- , subq_4.session
- , subq_4.visit__user
- , subq_4.visit__session
- , subq_4.referrer_id
- , subq_4.visit__referrer_id
- , subq_4.visits
- , subq_4.visitors
+ subq_13.ds__day
+ , subq_13.ds__week
+ , subq_13.ds__month
+ , subq_13.ds__quarter
+ , subq_13.ds__year
+ , subq_13.ds__extract_year
+ , subq_13.ds__extract_quarter
+ , subq_13.ds__extract_month
+ , subq_13.ds__extract_day
+ , subq_13.ds__extract_dow
+ , subq_13.ds__extract_doy
+ , subq_13.visit__ds__day
+ , subq_13.visit__ds__week
+ , subq_13.visit__ds__month
+ , subq_13.visit__ds__quarter
+ , subq_13.visit__ds__year
+ , subq_13.visit__ds__extract_year
+ , subq_13.visit__ds__extract_quarter
+ , subq_13.visit__ds__extract_month
+ , subq_13.visit__ds__extract_day
+ , subq_13.visit__ds__extract_dow
+ , subq_13.visit__ds__extract_doy
+ , subq_13.ds__day AS metric_time__day
+ , subq_13.ds__week AS metric_time__week
+ , subq_13.ds__month AS metric_time__month
+ , subq_13.ds__quarter AS metric_time__quarter
+ , subq_13.ds__year AS metric_time__year
+ , subq_13.ds__extract_year AS metric_time__extract_year
+ , subq_13.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_13.ds__extract_month AS metric_time__extract_month
+ , subq_13.ds__extract_day AS metric_time__extract_day
+ , subq_13.ds__extract_dow AS metric_time__extract_dow
+ , subq_13.ds__extract_doy AS metric_time__extract_doy
+ , subq_13.user
+ , subq_13.session
+ , subq_13.visit__user
+ , subq_13.visit__session
+ , subq_13.referrer_id
+ , subq_13.visit__referrer_id
+ , subq_13.visits
+ , subq_13.visitors
FROM (
-- Read Elements From Semantic Model 'visits_source'
SELECT
1 AS visits
- , visits_source_src_28011.user_id AS visitors
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day
- , EXTRACT(isodow FROM visits_source_src_28011.ds) AS ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy
- , visits_source_src_28011.referrer_id
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day
- , EXTRACT(isodow FROM visits_source_src_28011.ds) AS visit__ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy
- , visits_source_src_28011.referrer_id AS visit__referrer_id
- , visits_source_src_28011.user_id AS user
- , visits_source_src_28011.session_id AS session
- , visits_source_src_28011.user_id AS visit__user
- , visits_source_src_28011.session_id AS visit__session
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_4
- ) subq_5
- ) subq_6
+ , visits_source_src_28000.user_id AS visitors
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS ds__extract_day
+ , EXTRACT(isodow FROM visits_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS ds__extract_doy
+ , visits_source_src_28000.referrer_id
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS visit__ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS visit__ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS visit__ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS visit__ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS visit__ds__extract_day
+ , EXTRACT(isodow FROM visits_source_src_28000.ds) AS visit__ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS visit__ds__extract_doy
+ , visits_source_src_28000.referrer_id AS visit__referrer_id
+ , visits_source_src_28000.user_id AS user
+ , visits_source_src_28000.session_id AS session
+ , visits_source_src_28000.user_id AS visit__user
+ , visits_source_src_28000.session_id AS visit__session
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_13
+ ) subq_14
+ ) subq_15
INNER JOIN (
-- Add column with generated UUID
SELECT
- subq_8.ds__day
- , subq_8.ds__week
- , subq_8.ds__month
- , subq_8.ds__quarter
- , subq_8.ds__year
- , subq_8.ds__extract_year
- , subq_8.ds__extract_quarter
- , subq_8.ds__extract_month
- , subq_8.ds__extract_day
- , subq_8.ds__extract_dow
- , subq_8.ds__extract_doy
- , subq_8.buy__ds__day
- , subq_8.buy__ds__week
- , subq_8.buy__ds__month
- , subq_8.buy__ds__quarter
- , subq_8.buy__ds__year
- , subq_8.buy__ds__extract_year
- , subq_8.buy__ds__extract_quarter
- , subq_8.buy__ds__extract_month
- , subq_8.buy__ds__extract_day
- , subq_8.buy__ds__extract_dow
- , subq_8.buy__ds__extract_doy
- , subq_8.metric_time__day
- , subq_8.metric_time__week
- , subq_8.metric_time__month
- , subq_8.metric_time__quarter
- , subq_8.metric_time__year
- , subq_8.metric_time__extract_year
- , subq_8.metric_time__extract_quarter
- , subq_8.metric_time__extract_month
- , subq_8.metric_time__extract_day
- , subq_8.metric_time__extract_dow
- , subq_8.metric_time__extract_doy
- , subq_8.user
- , subq_8.session_id
- , subq_8.buy__user
- , subq_8.buy__session_id
- , subq_8.buys
- , subq_8.buyers
+ subq_17.ds__day
+ , subq_17.ds__week
+ , subq_17.ds__month
+ , subq_17.ds__quarter
+ , subq_17.ds__year
+ , subq_17.ds__extract_year
+ , subq_17.ds__extract_quarter
+ , subq_17.ds__extract_month
+ , subq_17.ds__extract_day
+ , subq_17.ds__extract_dow
+ , subq_17.ds__extract_doy
+ , subq_17.buy__ds__day
+ , subq_17.buy__ds__week
+ , subq_17.buy__ds__month
+ , subq_17.buy__ds__quarter
+ , subq_17.buy__ds__year
+ , subq_17.buy__ds__extract_year
+ , subq_17.buy__ds__extract_quarter
+ , subq_17.buy__ds__extract_month
+ , subq_17.buy__ds__extract_day
+ , subq_17.buy__ds__extract_dow
+ , subq_17.buy__ds__extract_doy
+ , subq_17.metric_time__day
+ , subq_17.metric_time__week
+ , subq_17.metric_time__month
+ , subq_17.metric_time__quarter
+ , subq_17.metric_time__year
+ , subq_17.metric_time__extract_year
+ , subq_17.metric_time__extract_quarter
+ , subq_17.metric_time__extract_month
+ , subq_17.metric_time__extract_day
+ , subq_17.metric_time__extract_dow
+ , subq_17.metric_time__extract_doy
+ , subq_17.user
+ , subq_17.session_id
+ , subq_17.buy__user
+ , subq_17.buy__session_id
+ , subq_17.buys
+ , subq_17.buyers
, GEN_RANDOM_UUID() AS mf_internal_uuid
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_7.ds__day
- , subq_7.ds__week
- , subq_7.ds__month
- , subq_7.ds__quarter
- , subq_7.ds__year
- , subq_7.ds__extract_year
- , subq_7.ds__extract_quarter
- , subq_7.ds__extract_month
- , subq_7.ds__extract_day
- , subq_7.ds__extract_dow
- , subq_7.ds__extract_doy
- , subq_7.buy__ds__day
- , subq_7.buy__ds__week
- , subq_7.buy__ds__month
- , subq_7.buy__ds__quarter
- , subq_7.buy__ds__year
- , subq_7.buy__ds__extract_year
- , subq_7.buy__ds__extract_quarter
- , subq_7.buy__ds__extract_month
- , subq_7.buy__ds__extract_day
- , subq_7.buy__ds__extract_dow
- , subq_7.buy__ds__extract_doy
- , subq_7.ds__day AS metric_time__day
- , subq_7.ds__week AS metric_time__week
- , subq_7.ds__month AS metric_time__month
- , subq_7.ds__quarter AS metric_time__quarter
- , subq_7.ds__year AS metric_time__year
- , subq_7.ds__extract_year AS metric_time__extract_year
- , subq_7.ds__extract_quarter AS metric_time__extract_quarter
- , subq_7.ds__extract_month AS metric_time__extract_month
- , subq_7.ds__extract_day AS metric_time__extract_day
- , subq_7.ds__extract_dow AS metric_time__extract_dow
- , subq_7.ds__extract_doy AS metric_time__extract_doy
- , subq_7.user
- , subq_7.session_id
- , subq_7.buy__user
- , subq_7.buy__session_id
- , subq_7.buys
- , subq_7.buyers
+ subq_16.ds__day
+ , subq_16.ds__week
+ , subq_16.ds__month
+ , subq_16.ds__quarter
+ , subq_16.ds__year
+ , subq_16.ds__extract_year
+ , subq_16.ds__extract_quarter
+ , subq_16.ds__extract_month
+ , subq_16.ds__extract_day
+ , subq_16.ds__extract_dow
+ , subq_16.ds__extract_doy
+ , subq_16.buy__ds__day
+ , subq_16.buy__ds__week
+ , subq_16.buy__ds__month
+ , subq_16.buy__ds__quarter
+ , subq_16.buy__ds__year
+ , subq_16.buy__ds__extract_year
+ , subq_16.buy__ds__extract_quarter
+ , subq_16.buy__ds__extract_month
+ , subq_16.buy__ds__extract_day
+ , subq_16.buy__ds__extract_dow
+ , subq_16.buy__ds__extract_doy
+ , subq_16.ds__day AS metric_time__day
+ , subq_16.ds__week AS metric_time__week
+ , subq_16.ds__month AS metric_time__month
+ , subq_16.ds__quarter AS metric_time__quarter
+ , subq_16.ds__year AS metric_time__year
+ , subq_16.ds__extract_year AS metric_time__extract_year
+ , subq_16.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_16.ds__extract_month AS metric_time__extract_month
+ , subq_16.ds__extract_day AS metric_time__extract_day
+ , subq_16.ds__extract_dow AS metric_time__extract_dow
+ , subq_16.ds__extract_doy AS metric_time__extract_doy
+ , subq_16.user
+ , subq_16.session_id
+ , subq_16.buy__user
+ , subq_16.buy__session_id
+ , subq_16.buys
+ , subq_16.buyers
FROM (
-- Read Elements From Semantic Model 'buys_source'
SELECT
1 AS buys
- , buys_source_src_28002.user_id AS buyers
- , DATE_TRUNC('day', buys_source_src_28002.ds) AS ds__day
- , DATE_TRUNC('week', buys_source_src_28002.ds) AS ds__week
- , DATE_TRUNC('month', buys_source_src_28002.ds) AS ds__month
- , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS ds__quarter
- , DATE_TRUNC('year', buys_source_src_28002.ds) AS ds__year
- , EXTRACT(year FROM buys_source_src_28002.ds) AS ds__extract_year
- , EXTRACT(quarter FROM buys_source_src_28002.ds) AS ds__extract_quarter
- , EXTRACT(month FROM buys_source_src_28002.ds) AS ds__extract_month
- , EXTRACT(day FROM buys_source_src_28002.ds) AS ds__extract_day
- , EXTRACT(isodow FROM buys_source_src_28002.ds) AS ds__extract_dow
- , EXTRACT(doy FROM buys_source_src_28002.ds) AS ds__extract_doy
- , DATE_TRUNC('day', buys_source_src_28002.ds) AS buy__ds__day
- , DATE_TRUNC('week', buys_source_src_28002.ds) AS buy__ds__week
- , DATE_TRUNC('month', buys_source_src_28002.ds) AS buy__ds__month
- , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS buy__ds__quarter
- , DATE_TRUNC('year', buys_source_src_28002.ds) AS buy__ds__year
- , EXTRACT(year FROM buys_source_src_28002.ds) AS buy__ds__extract_year
- , EXTRACT(quarter FROM buys_source_src_28002.ds) AS buy__ds__extract_quarter
- , EXTRACT(month FROM buys_source_src_28002.ds) AS buy__ds__extract_month
- , EXTRACT(day FROM buys_source_src_28002.ds) AS buy__ds__extract_day
- , EXTRACT(isodow FROM buys_source_src_28002.ds) AS buy__ds__extract_dow
- , EXTRACT(doy FROM buys_source_src_28002.ds) AS buy__ds__extract_doy
- , buys_source_src_28002.user_id AS user
- , buys_source_src_28002.session_id
- , buys_source_src_28002.user_id AS buy__user
- , buys_source_src_28002.session_id AS buy__session_id
- FROM ***************************.fct_buys buys_source_src_28002
- ) subq_7
- ) subq_8
- ) subq_9
+ , buys_source_src_28000.user_id AS buyers
+ , DATE_TRUNC('day', buys_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', buys_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', buys_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', buys_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', buys_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM buys_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM buys_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', buys_source_src_28000.ds) AS buy__ds__day
+ , DATE_TRUNC('week', buys_source_src_28000.ds) AS buy__ds__week
+ , DATE_TRUNC('month', buys_source_src_28000.ds) AS buy__ds__month
+ , DATE_TRUNC('quarter', buys_source_src_28000.ds) AS buy__ds__quarter
+ , DATE_TRUNC('year', buys_source_src_28000.ds) 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
+ , EXTRACT(day FROM buys_source_src_28000.ds) AS buy__ds__extract_day
+ , EXTRACT(isodow FROM buys_source_src_28000.ds) AS buy__ds__extract_dow
+ , EXTRACT(doy FROM buys_source_src_28000.ds) AS buy__ds__extract_doy
+ , buys_source_src_28000.user_id AS user
+ , buys_source_src_28000.session_id
+ , buys_source_src_28000.user_id AS buy__user
+ , buys_source_src_28000.session_id AS buy__session_id
+ FROM ***************************.fct_buys buys_source_src_28000
+ ) subq_16
+ ) subq_17
+ ) subq_18
ON
(
- subq_6.user = subq_9.user
+ subq_15.user = subq_18.user
) AND (
(
- subq_6.ds__day <= subq_9.ds__day
+ subq_15.ds__day <= subq_18.ds__day
) AND (
- subq_6.ds__day > subq_9.ds__day - INTERVAL 7 day
+ subq_15.ds__day > subq_18.ds__day - INTERVAL 7 day
)
)
- ) subq_10
- ) subq_11
- ) subq_12
- ) subq_13
-) subq_14
+ ) subq_19
+ ) subq_20
+ ) subq_21
+ ) subq_22
+) subq_23
diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/DuckDB/test_conversion_count_with_no_group_by__plan0_optimized.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/DuckDB/test_conversion_count_with_no_group_by__plan0_optimized.sql
index 9d6d3dda85..b2a9a57124 100644
--- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/DuckDB/test_conversion_count_with_no_group_by__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/DuckDB/test_conversion_count_with_no_group_by__plan0_optimized.sql
@@ -1,7 +1,7 @@
-- Combine Aggregated Outputs
-- Compute Metrics via Expressions
SELECT
- COALESCE(MAX(subq_28.buys), 0) AS visit_buy_conversions
+ COALESCE(MAX(subq_37.buys), 0) AS visit_buy_conversions
FROM (
-- Read Elements From Semantic Model 'visits_source'
-- Metric Time Dimension 'ds'
@@ -9,8 +9,8 @@ FROM (
-- Aggregate Measures
SELECT
SUM(1) AS visits
- FROM ***************************.fct_visits visits_source_src_28011
-) subq_18
+ FROM ***************************.fct_visits visits_source_src_28000
+) subq_27
CROSS JOIN (
-- Find conversions for user within the range of 7 day
-- Pass Only Elements: ['buys',]
@@ -20,11 +20,11 @@ CROSS JOIN (
FROM (
-- Dedupe the fanout with mf_internal_uuid in the conversion data set
SELECT DISTINCT
- first_value(subq_21.visits) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
- , first_value(subq_21.ds__day) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
- , first_value(subq_21.user) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
- , subq_24.mf_internal_uuid AS mf_internal_uuid
- , subq_24.buys AS buys
+ first_value(subq_30.visits) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
+ , first_value(subq_30.ds__day) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
+ , first_value(subq_30.user) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
+ , subq_33.mf_internal_uuid AS mf_internal_uuid
+ , subq_33.buys AS buys
FROM (
-- Read Elements From Semantic Model 'visits_source'
-- Metric Time Dimension 'ds'
@@ -33,8 +33,8 @@ CROSS JOIN (
DATE_TRUNC('day', ds) AS ds__day
, user_id AS user
, 1 AS visits
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_21
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_30
INNER JOIN (
-- Read Elements From Semantic Model 'buys_source'
-- Metric Time Dimension 'ds'
@@ -44,17 +44,17 @@ CROSS JOIN (
, user_id AS user
, 1 AS buys
, GEN_RANDOM_UUID() AS mf_internal_uuid
- FROM ***************************.fct_buys buys_source_src_28002
- ) subq_24
+ FROM ***************************.fct_buys buys_source_src_28000
+ ) subq_33
ON
(
- subq_21.user = subq_24.user
+ subq_30.user = subq_33.user
) AND (
(
- subq_21.ds__day <= subq_24.ds__day
+ subq_30.ds__day <= subq_33.ds__day
) AND (
- subq_21.ds__day > subq_24.ds__day - INTERVAL 7 day
+ subq_30.ds__day > subq_33.ds__day - INTERVAL 7 day
)
)
- ) subq_25
-) subq_28
+ ) subq_34
+) subq_37
diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/DuckDB/test_conversion_rate__plan0.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/DuckDB/test_conversion_rate__plan0.sql
index 585c478f6e..e005899f09 100644
--- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/DuckDB/test_conversion_rate__plan0.sql
+++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/DuckDB/test_conversion_rate__plan0.sql
@@ -1,352 +1,356 @@
-- Compute Metrics via Expressions
SELECT
- subq_14.visit__referrer_id
- , CAST(subq_14.buys AS DOUBLE) / CAST(NULLIF(subq_14.visits, 0) AS DOUBLE) AS visit_buy_conversion_rate
+ subq_23.visit__referrer_id
+ , CAST(subq_23.buys AS DOUBLE) / CAST(NULLIF(subq_23.visits, 0) AS DOUBLE) AS visit_buy_conversion_rate
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_3.visit__referrer_id, subq_13.visit__referrer_id) AS visit__referrer_id
- , MAX(subq_3.visits) AS visits
- , MAX(subq_13.buys) AS buys
+ COALESCE(subq_12.visit__referrer_id, subq_22.visit__referrer_id) AS visit__referrer_id
+ , MAX(subq_12.visits) AS visits
+ , MAX(subq_22.buys) AS buys
FROM (
-- Aggregate Measures
SELECT
- subq_2.visit__referrer_id
- , SUM(subq_2.visits) AS visits
+ subq_11.visit__referrer_id
+ , SUM(subq_11.visits) AS visits
FROM (
-- Pass Only Elements: ['visits', 'visit__referrer_id']
SELECT
- subq_1.visit__referrer_id
- , subq_1.visits
+ subq_10.visit__referrer_id
+ , subq_10.visits
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.visit__ds__day
- , subq_0.visit__ds__week
- , subq_0.visit__ds__month
- , subq_0.visit__ds__quarter
- , subq_0.visit__ds__year
- , subq_0.visit__ds__extract_year
- , subq_0.visit__ds__extract_quarter
- , subq_0.visit__ds__extract_month
- , subq_0.visit__ds__extract_day
- , subq_0.visit__ds__extract_dow
- , subq_0.visit__ds__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.user
- , subq_0.session
- , subq_0.visit__user
- , subq_0.visit__session
- , subq_0.referrer_id
- , subq_0.visit__referrer_id
- , subq_0.visits
- , subq_0.visitors
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.visit__ds__day
+ , subq_9.visit__ds__week
+ , subq_9.visit__ds__month
+ , subq_9.visit__ds__quarter
+ , subq_9.visit__ds__year
+ , subq_9.visit__ds__extract_year
+ , subq_9.visit__ds__extract_quarter
+ , subq_9.visit__ds__extract_month
+ , subq_9.visit__ds__extract_day
+ , subq_9.visit__ds__extract_dow
+ , subq_9.visit__ds__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.user
+ , subq_9.session
+ , subq_9.visit__user
+ , subq_9.visit__session
+ , subq_9.referrer_id
+ , subq_9.visit__referrer_id
+ , subq_9.visits
+ , subq_9.visitors
FROM (
-- Read Elements From Semantic Model 'visits_source'
SELECT
1 AS visits
- , visits_source_src_28011.user_id AS visitors
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day
- , EXTRACT(isodow FROM visits_source_src_28011.ds) AS ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy
- , visits_source_src_28011.referrer_id
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day
- , EXTRACT(isodow FROM visits_source_src_28011.ds) AS visit__ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy
- , visits_source_src_28011.referrer_id AS visit__referrer_id
- , visits_source_src_28011.user_id AS user
- , visits_source_src_28011.session_id AS session
- , visits_source_src_28011.user_id AS visit__user
- , visits_source_src_28011.session_id AS visit__session
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_0
- ) subq_1
- ) subq_2
+ , visits_source_src_28000.user_id AS visitors
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS ds__extract_day
+ , EXTRACT(isodow FROM visits_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS ds__extract_doy
+ , visits_source_src_28000.referrer_id
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS visit__ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS visit__ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS visit__ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS visit__ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS visit__ds__extract_day
+ , EXTRACT(isodow FROM visits_source_src_28000.ds) AS visit__ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS visit__ds__extract_doy
+ , visits_source_src_28000.referrer_id AS visit__referrer_id
+ , visits_source_src_28000.user_id AS user
+ , visits_source_src_28000.session_id AS session
+ , visits_source_src_28000.user_id AS visit__user
+ , visits_source_src_28000.session_id AS visit__session
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
GROUP BY
- subq_2.visit__referrer_id
- ) subq_3
+ subq_11.visit__referrer_id
+ ) subq_12
FULL OUTER JOIN (
-- Aggregate Measures
SELECT
- subq_12.visit__referrer_id
- , SUM(subq_12.buys) AS buys
+ subq_21.visit__referrer_id
+ , SUM(subq_21.buys) AS buys
FROM (
-- Pass Only Elements: ['buys', 'visit__referrer_id']
SELECT
- subq_11.visit__referrer_id
- , subq_11.buys
+ subq_20.visit__referrer_id
+ , subq_20.buys
FROM (
-- Find conversions for user within the range of INF
SELECT
- subq_10.ds__day
- , subq_10.user
- , subq_10.visit__referrer_id
- , subq_10.buys
- , subq_10.visits
+ subq_19.ds__day
+ , subq_19.user
+ , subq_19.visit__referrer_id
+ , subq_19.buys
+ , subq_19.visits
FROM (
-- Dedupe the fanout with mf_internal_uuid in the conversion data set
SELECT DISTINCT
- first_value(subq_6.visits) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
- , first_value(subq_6.visit__referrer_id) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visit__referrer_id
- , first_value(subq_6.ds__day) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
- , first_value(subq_6.user) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
- , subq_9.mf_internal_uuid AS mf_internal_uuid
- , subq_9.buys AS buys
+ first_value(subq_15.visits) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
+ , first_value(subq_15.visit__referrer_id) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visit__referrer_id
+ , first_value(subq_15.ds__day) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
+ , first_value(subq_15.user) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
+ , subq_18.mf_internal_uuid AS mf_internal_uuid
+ , subq_18.buys AS buys
FROM (
-- Pass Only Elements: ['visits', 'visit__referrer_id', 'ds__day', 'user']
SELECT
- subq_5.ds__day
- , subq_5.user
- , subq_5.visit__referrer_id
- , subq_5.visits
+ subq_14.ds__day
+ , subq_14.user
+ , subq_14.visit__referrer_id
+ , subq_14.visits
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_4.ds__day
- , subq_4.ds__week
- , subq_4.ds__month
- , subq_4.ds__quarter
- , subq_4.ds__year
- , subq_4.ds__extract_year
- , subq_4.ds__extract_quarter
- , subq_4.ds__extract_month
- , subq_4.ds__extract_day
- , subq_4.ds__extract_dow
- , subq_4.ds__extract_doy
- , subq_4.visit__ds__day
- , subq_4.visit__ds__week
- , subq_4.visit__ds__month
- , subq_4.visit__ds__quarter
- , subq_4.visit__ds__year
- , subq_4.visit__ds__extract_year
- , subq_4.visit__ds__extract_quarter
- , subq_4.visit__ds__extract_month
- , subq_4.visit__ds__extract_day
- , subq_4.visit__ds__extract_dow
- , subq_4.visit__ds__extract_doy
- , subq_4.ds__day AS metric_time__day
- , subq_4.ds__week AS metric_time__week
- , subq_4.ds__month AS metric_time__month
- , subq_4.ds__quarter AS metric_time__quarter
- , subq_4.ds__year AS metric_time__year
- , subq_4.ds__extract_year AS metric_time__extract_year
- , subq_4.ds__extract_quarter AS metric_time__extract_quarter
- , subq_4.ds__extract_month AS metric_time__extract_month
- , subq_4.ds__extract_day AS metric_time__extract_day
- , subq_4.ds__extract_dow AS metric_time__extract_dow
- , subq_4.ds__extract_doy AS metric_time__extract_doy
- , subq_4.user
- , subq_4.session
- , subq_4.visit__user
- , subq_4.visit__session
- , subq_4.referrer_id
- , subq_4.visit__referrer_id
- , subq_4.visits
- , subq_4.visitors
+ subq_13.ds__day
+ , subq_13.ds__week
+ , subq_13.ds__month
+ , subq_13.ds__quarter
+ , subq_13.ds__year
+ , subq_13.ds__extract_year
+ , subq_13.ds__extract_quarter
+ , subq_13.ds__extract_month
+ , subq_13.ds__extract_day
+ , subq_13.ds__extract_dow
+ , subq_13.ds__extract_doy
+ , subq_13.visit__ds__day
+ , subq_13.visit__ds__week
+ , subq_13.visit__ds__month
+ , subq_13.visit__ds__quarter
+ , subq_13.visit__ds__year
+ , subq_13.visit__ds__extract_year
+ , subq_13.visit__ds__extract_quarter
+ , subq_13.visit__ds__extract_month
+ , subq_13.visit__ds__extract_day
+ , subq_13.visit__ds__extract_dow
+ , subq_13.visit__ds__extract_doy
+ , subq_13.ds__day AS metric_time__day
+ , subq_13.ds__week AS metric_time__week
+ , subq_13.ds__month AS metric_time__month
+ , subq_13.ds__quarter AS metric_time__quarter
+ , subq_13.ds__year AS metric_time__year
+ , subq_13.ds__extract_year AS metric_time__extract_year
+ , subq_13.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_13.ds__extract_month AS metric_time__extract_month
+ , subq_13.ds__extract_day AS metric_time__extract_day
+ , subq_13.ds__extract_dow AS metric_time__extract_dow
+ , subq_13.ds__extract_doy AS metric_time__extract_doy
+ , subq_13.user
+ , subq_13.session
+ , subq_13.visit__user
+ , subq_13.visit__session
+ , subq_13.referrer_id
+ , subq_13.visit__referrer_id
+ , subq_13.visits
+ , subq_13.visitors
FROM (
-- Read Elements From Semantic Model 'visits_source'
SELECT
1 AS visits
- , visits_source_src_28011.user_id AS visitors
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day
- , EXTRACT(isodow FROM visits_source_src_28011.ds) AS ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy
- , visits_source_src_28011.referrer_id
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day
- , EXTRACT(isodow FROM visits_source_src_28011.ds) AS visit__ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy
- , visits_source_src_28011.referrer_id AS visit__referrer_id
- , visits_source_src_28011.user_id AS user
- , visits_source_src_28011.session_id AS session
- , visits_source_src_28011.user_id AS visit__user
- , visits_source_src_28011.session_id AS visit__session
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_4
- ) subq_5
- ) subq_6
+ , visits_source_src_28000.user_id AS visitors
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS ds__extract_day
+ , EXTRACT(isodow FROM visits_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS ds__extract_doy
+ , visits_source_src_28000.referrer_id
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS visit__ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS visit__ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS visit__ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS visit__ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS visit__ds__extract_day
+ , EXTRACT(isodow FROM visits_source_src_28000.ds) AS visit__ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS visit__ds__extract_doy
+ , visits_source_src_28000.referrer_id AS visit__referrer_id
+ , visits_source_src_28000.user_id AS user
+ , visits_source_src_28000.session_id AS session
+ , visits_source_src_28000.user_id AS visit__user
+ , visits_source_src_28000.session_id AS visit__session
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_13
+ ) subq_14
+ ) subq_15
INNER JOIN (
-- Add column with generated UUID
SELECT
- subq_8.ds__day
- , subq_8.ds__week
- , subq_8.ds__month
- , subq_8.ds__quarter
- , subq_8.ds__year
- , subq_8.ds__extract_year
- , subq_8.ds__extract_quarter
- , subq_8.ds__extract_month
- , subq_8.ds__extract_day
- , subq_8.ds__extract_dow
- , subq_8.ds__extract_doy
- , subq_8.buy__ds__day
- , subq_8.buy__ds__week
- , subq_8.buy__ds__month
- , subq_8.buy__ds__quarter
- , subq_8.buy__ds__year
- , subq_8.buy__ds__extract_year
- , subq_8.buy__ds__extract_quarter
- , subq_8.buy__ds__extract_month
- , subq_8.buy__ds__extract_day
- , subq_8.buy__ds__extract_dow
- , subq_8.buy__ds__extract_doy
- , subq_8.metric_time__day
- , subq_8.metric_time__week
- , subq_8.metric_time__month
- , subq_8.metric_time__quarter
- , subq_8.metric_time__year
- , subq_8.metric_time__extract_year
- , subq_8.metric_time__extract_quarter
- , subq_8.metric_time__extract_month
- , subq_8.metric_time__extract_day
- , subq_8.metric_time__extract_dow
- , subq_8.metric_time__extract_doy
- , subq_8.user
- , subq_8.session_id
- , subq_8.buy__user
- , subq_8.buy__session_id
- , subq_8.buys
- , subq_8.buyers
+ subq_17.ds__day
+ , subq_17.ds__week
+ , subq_17.ds__month
+ , subq_17.ds__quarter
+ , subq_17.ds__year
+ , subq_17.ds__extract_year
+ , subq_17.ds__extract_quarter
+ , subq_17.ds__extract_month
+ , subq_17.ds__extract_day
+ , subq_17.ds__extract_dow
+ , subq_17.ds__extract_doy
+ , subq_17.buy__ds__day
+ , subq_17.buy__ds__week
+ , subq_17.buy__ds__month
+ , subq_17.buy__ds__quarter
+ , subq_17.buy__ds__year
+ , subq_17.buy__ds__extract_year
+ , subq_17.buy__ds__extract_quarter
+ , subq_17.buy__ds__extract_month
+ , subq_17.buy__ds__extract_day
+ , subq_17.buy__ds__extract_dow
+ , subq_17.buy__ds__extract_doy
+ , subq_17.metric_time__day
+ , subq_17.metric_time__week
+ , subq_17.metric_time__month
+ , subq_17.metric_time__quarter
+ , subq_17.metric_time__year
+ , subq_17.metric_time__extract_year
+ , subq_17.metric_time__extract_quarter
+ , subq_17.metric_time__extract_month
+ , subq_17.metric_time__extract_day
+ , subq_17.metric_time__extract_dow
+ , subq_17.metric_time__extract_doy
+ , subq_17.user
+ , subq_17.session_id
+ , subq_17.buy__user
+ , subq_17.buy__session_id
+ , subq_17.buys
+ , subq_17.buyers
, GEN_RANDOM_UUID() AS mf_internal_uuid
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_7.ds__day
- , subq_7.ds__week
- , subq_7.ds__month
- , subq_7.ds__quarter
- , subq_7.ds__year
- , subq_7.ds__extract_year
- , subq_7.ds__extract_quarter
- , subq_7.ds__extract_month
- , subq_7.ds__extract_day
- , subq_7.ds__extract_dow
- , subq_7.ds__extract_doy
- , subq_7.buy__ds__day
- , subq_7.buy__ds__week
- , subq_7.buy__ds__month
- , subq_7.buy__ds__quarter
- , subq_7.buy__ds__year
- , subq_7.buy__ds__extract_year
- , subq_7.buy__ds__extract_quarter
- , subq_7.buy__ds__extract_month
- , subq_7.buy__ds__extract_day
- , subq_7.buy__ds__extract_dow
- , subq_7.buy__ds__extract_doy
- , subq_7.ds__day AS metric_time__day
- , subq_7.ds__week AS metric_time__week
- , subq_7.ds__month AS metric_time__month
- , subq_7.ds__quarter AS metric_time__quarter
- , subq_7.ds__year AS metric_time__year
- , subq_7.ds__extract_year AS metric_time__extract_year
- , subq_7.ds__extract_quarter AS metric_time__extract_quarter
- , subq_7.ds__extract_month AS metric_time__extract_month
- , subq_7.ds__extract_day AS metric_time__extract_day
- , subq_7.ds__extract_dow AS metric_time__extract_dow
- , subq_7.ds__extract_doy AS metric_time__extract_doy
- , subq_7.user
- , subq_7.session_id
- , subq_7.buy__user
- , subq_7.buy__session_id
- , subq_7.buys
- , subq_7.buyers
+ subq_16.ds__day
+ , subq_16.ds__week
+ , subq_16.ds__month
+ , subq_16.ds__quarter
+ , subq_16.ds__year
+ , subq_16.ds__extract_year
+ , subq_16.ds__extract_quarter
+ , subq_16.ds__extract_month
+ , subq_16.ds__extract_day
+ , subq_16.ds__extract_dow
+ , subq_16.ds__extract_doy
+ , subq_16.buy__ds__day
+ , subq_16.buy__ds__week
+ , subq_16.buy__ds__month
+ , subq_16.buy__ds__quarter
+ , subq_16.buy__ds__year
+ , subq_16.buy__ds__extract_year
+ , subq_16.buy__ds__extract_quarter
+ , subq_16.buy__ds__extract_month
+ , subq_16.buy__ds__extract_day
+ , subq_16.buy__ds__extract_dow
+ , subq_16.buy__ds__extract_doy
+ , subq_16.ds__day AS metric_time__day
+ , subq_16.ds__week AS metric_time__week
+ , subq_16.ds__month AS metric_time__month
+ , subq_16.ds__quarter AS metric_time__quarter
+ , subq_16.ds__year AS metric_time__year
+ , subq_16.ds__extract_year AS metric_time__extract_year
+ , subq_16.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_16.ds__extract_month AS metric_time__extract_month
+ , subq_16.ds__extract_day AS metric_time__extract_day
+ , subq_16.ds__extract_dow AS metric_time__extract_dow
+ , subq_16.ds__extract_doy AS metric_time__extract_doy
+ , subq_16.user
+ , subq_16.session_id
+ , subq_16.buy__user
+ , subq_16.buy__session_id
+ , subq_16.buys
+ , subq_16.buyers
FROM (
-- Read Elements From Semantic Model 'buys_source'
SELECT
1 AS buys
- , buys_source_src_28002.user_id AS buyers
- , DATE_TRUNC('day', buys_source_src_28002.ds) AS ds__day
- , DATE_TRUNC('week', buys_source_src_28002.ds) AS ds__week
- , DATE_TRUNC('month', buys_source_src_28002.ds) AS ds__month
- , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS ds__quarter
- , DATE_TRUNC('year', buys_source_src_28002.ds) AS ds__year
- , EXTRACT(year FROM buys_source_src_28002.ds) AS ds__extract_year
- , EXTRACT(quarter FROM buys_source_src_28002.ds) AS ds__extract_quarter
- , EXTRACT(month FROM buys_source_src_28002.ds) AS ds__extract_month
- , EXTRACT(day FROM buys_source_src_28002.ds) AS ds__extract_day
- , EXTRACT(isodow FROM buys_source_src_28002.ds) AS ds__extract_dow
- , EXTRACT(doy FROM buys_source_src_28002.ds) AS ds__extract_doy
- , DATE_TRUNC('day', buys_source_src_28002.ds) AS buy__ds__day
- , DATE_TRUNC('week', buys_source_src_28002.ds) AS buy__ds__week
- , DATE_TRUNC('month', buys_source_src_28002.ds) AS buy__ds__month
- , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS buy__ds__quarter
- , DATE_TRUNC('year', buys_source_src_28002.ds) AS buy__ds__year
- , EXTRACT(year FROM buys_source_src_28002.ds) AS buy__ds__extract_year
- , EXTRACT(quarter FROM buys_source_src_28002.ds) AS buy__ds__extract_quarter
- , EXTRACT(month FROM buys_source_src_28002.ds) AS buy__ds__extract_month
- , EXTRACT(day FROM buys_source_src_28002.ds) AS buy__ds__extract_day
- , EXTRACT(isodow FROM buys_source_src_28002.ds) AS buy__ds__extract_dow
- , EXTRACT(doy FROM buys_source_src_28002.ds) AS buy__ds__extract_doy
- , buys_source_src_28002.user_id AS user
- , buys_source_src_28002.session_id
- , buys_source_src_28002.user_id AS buy__user
- , buys_source_src_28002.session_id AS buy__session_id
- FROM ***************************.fct_buys buys_source_src_28002
- ) subq_7
- ) subq_8
- ) subq_9
+ , buys_source_src_28000.user_id AS buyers
+ , DATE_TRUNC('day', buys_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', buys_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', buys_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', buys_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', buys_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM buys_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM buys_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', buys_source_src_28000.ds) AS buy__ds__day
+ , DATE_TRUNC('week', buys_source_src_28000.ds) AS buy__ds__week
+ , DATE_TRUNC('month', buys_source_src_28000.ds) AS buy__ds__month
+ , DATE_TRUNC('quarter', buys_source_src_28000.ds) AS buy__ds__quarter
+ , DATE_TRUNC('year', buys_source_src_28000.ds) 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
+ , EXTRACT(day FROM buys_source_src_28000.ds) AS buy__ds__extract_day
+ , EXTRACT(isodow FROM buys_source_src_28000.ds) AS buy__ds__extract_dow
+ , EXTRACT(doy FROM buys_source_src_28000.ds) AS buy__ds__extract_doy
+ , buys_source_src_28000.user_id AS user
+ , buys_source_src_28000.session_id
+ , buys_source_src_28000.user_id AS buy__user
+ , buys_source_src_28000.session_id AS buy__session_id
+ FROM ***************************.fct_buys buys_source_src_28000
+ ) subq_16
+ ) subq_17
+ ) subq_18
ON
- (subq_6.user = subq_9.user) AND ((subq_6.ds__day <= subq_9.ds__day))
- ) subq_10
- ) subq_11
- ) subq_12
+ (
+ subq_15.user = subq_18.user
+ ) AND (
+ (subq_15.ds__day <= subq_18.ds__day)
+ )
+ ) subq_19
+ ) subq_20
+ ) subq_21
GROUP BY
- subq_12.visit__referrer_id
- ) subq_13
+ subq_21.visit__referrer_id
+ ) subq_22
ON
- subq_3.visit__referrer_id = subq_13.visit__referrer_id
+ subq_12.visit__referrer_id = subq_22.visit__referrer_id
GROUP BY
- COALESCE(subq_3.visit__referrer_id, subq_13.visit__referrer_id)
-) subq_14
+ COALESCE(subq_12.visit__referrer_id, subq_22.visit__referrer_id)
+) subq_23
diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/DuckDB/test_conversion_rate__plan0_optimized.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/DuckDB/test_conversion_rate__plan0_optimized.sql
index ec4ac685fa..6b7ddcef57 100644
--- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/DuckDB/test_conversion_rate__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/DuckDB/test_conversion_rate__plan0_optimized.sql
@@ -5,9 +5,9 @@ SELECT
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_18.visit__referrer_id, subq_28.visit__referrer_id) AS visit__referrer_id
- , MAX(subq_18.visits) AS visits
- , MAX(subq_28.buys) AS buys
+ COALESCE(subq_27.visit__referrer_id, subq_37.visit__referrer_id) AS visit__referrer_id
+ , MAX(subq_27.visits) AS visits
+ , MAX(subq_37.buys) AS buys
FROM (
-- Aggregate Measures
SELECT
@@ -20,11 +20,11 @@ FROM (
SELECT
referrer_id AS visit__referrer_id
, 1 AS visits
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_17
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_26
GROUP BY
visit__referrer_id
- ) subq_18
+ ) subq_27
FULL OUTER JOIN (
-- Find conversions for user within the range of INF
-- Pass Only Elements: ['buys', 'visit__referrer_id']
@@ -35,12 +35,12 @@ FROM (
FROM (
-- Dedupe the fanout with mf_internal_uuid in the conversion data set
SELECT DISTINCT
- first_value(subq_21.visits) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
- , first_value(subq_21.visit__referrer_id) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visit__referrer_id
- , first_value(subq_21.ds__day) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
- , first_value(subq_21.user) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
- , subq_24.mf_internal_uuid AS mf_internal_uuid
- , subq_24.buys AS buys
+ first_value(subq_30.visits) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
+ , first_value(subq_30.visit__referrer_id) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visit__referrer_id
+ , first_value(subq_30.ds__day) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
+ , first_value(subq_30.user) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
+ , subq_33.mf_internal_uuid AS mf_internal_uuid
+ , subq_33.buys AS buys
FROM (
-- Read Elements From Semantic Model 'visits_source'
-- Metric Time Dimension 'ds'
@@ -50,8 +50,8 @@ FROM (
, user_id AS user
, referrer_id AS visit__referrer_id
, 1 AS visits
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_21
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_30
INNER JOIN (
-- Read Elements From Semantic Model 'buys_source'
-- Metric Time Dimension 'ds'
@@ -61,20 +61,20 @@ FROM (
, user_id AS user
, 1 AS buys
, GEN_RANDOM_UUID() AS mf_internal_uuid
- FROM ***************************.fct_buys buys_source_src_28002
- ) subq_24
+ FROM ***************************.fct_buys buys_source_src_28000
+ ) subq_33
ON
(
- subq_21.user = subq_24.user
+ subq_30.user = subq_33.user
) AND (
- (subq_21.ds__day <= subq_24.ds__day)
+ (subq_30.ds__day <= subq_33.ds__day)
)
- ) subq_25
+ ) subq_34
GROUP BY
visit__referrer_id
- ) subq_28
+ ) subq_37
ON
- subq_18.visit__referrer_id = subq_28.visit__referrer_id
+ subq_27.visit__referrer_id = subq_37.visit__referrer_id
GROUP BY
- COALESCE(subq_18.visit__referrer_id, subq_28.visit__referrer_id)
-) subq_29
+ COALESCE(subq_27.visit__referrer_id, subq_37.visit__referrer_id)
+) subq_38
diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/DuckDB/test_conversion_rate_with_constant_properties__plan0.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/DuckDB/test_conversion_rate_with_constant_properties__plan0.sql
index 348f11a2fd..fe163ea046 100644
--- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/DuckDB/test_conversion_rate_with_constant_properties__plan0.sql
+++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/DuckDB/test_conversion_rate_with_constant_properties__plan0.sql
@@ -1,381 +1,381 @@
-- Compute Metrics via Expressions
SELECT
- subq_14.metric_time__day
- , subq_14.visit__referrer_id
- , CAST(subq_14.buys AS DOUBLE) / CAST(NULLIF(subq_14.visits, 0) AS DOUBLE) AS visit_buy_conversion_rate_by_session
+ subq_23.metric_time__day
+ , subq_23.visit__referrer_id
+ , CAST(subq_23.buys AS DOUBLE) / CAST(NULLIF(subq_23.visits, 0) AS DOUBLE) AS visit_buy_conversion_rate_by_session
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_3.metric_time__day, subq_13.metric_time__day) AS metric_time__day
- , COALESCE(subq_3.visit__referrer_id, subq_13.visit__referrer_id) AS visit__referrer_id
- , MAX(subq_3.visits) AS visits
- , MAX(subq_13.buys) AS buys
+ COALESCE(subq_12.metric_time__day, subq_22.metric_time__day) AS metric_time__day
+ , COALESCE(subq_12.visit__referrer_id, subq_22.visit__referrer_id) AS visit__referrer_id
+ , MAX(subq_12.visits) AS visits
+ , MAX(subq_22.buys) AS buys
FROM (
-- Aggregate Measures
SELECT
- subq_2.metric_time__day
- , subq_2.visit__referrer_id
- , SUM(subq_2.visits) AS visits
+ subq_11.metric_time__day
+ , subq_11.visit__referrer_id
+ , SUM(subq_11.visits) AS visits
FROM (
-- Pass Only Elements: ['visits', 'visit__referrer_id', 'metric_time__day']
SELECT
- subq_1.metric_time__day
- , subq_1.visit__referrer_id
- , subq_1.visits
+ subq_10.metric_time__day
+ , subq_10.visit__referrer_id
+ , subq_10.visits
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.visit__ds__day
- , subq_0.visit__ds__week
- , subq_0.visit__ds__month
- , subq_0.visit__ds__quarter
- , subq_0.visit__ds__year
- , subq_0.visit__ds__extract_year
- , subq_0.visit__ds__extract_quarter
- , subq_0.visit__ds__extract_month
- , subq_0.visit__ds__extract_day
- , subq_0.visit__ds__extract_dow
- , subq_0.visit__ds__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.user
- , subq_0.session
- , subq_0.visit__user
- , subq_0.visit__session
- , subq_0.referrer_id
- , subq_0.visit__referrer_id
- , subq_0.visits
- , subq_0.visitors
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.visit__ds__day
+ , subq_9.visit__ds__week
+ , subq_9.visit__ds__month
+ , subq_9.visit__ds__quarter
+ , subq_9.visit__ds__year
+ , subq_9.visit__ds__extract_year
+ , subq_9.visit__ds__extract_quarter
+ , subq_9.visit__ds__extract_month
+ , subq_9.visit__ds__extract_day
+ , subq_9.visit__ds__extract_dow
+ , subq_9.visit__ds__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.user
+ , subq_9.session
+ , subq_9.visit__user
+ , subq_9.visit__session
+ , subq_9.referrer_id
+ , subq_9.visit__referrer_id
+ , subq_9.visits
+ , subq_9.visitors
FROM (
-- Read Elements From Semantic Model 'visits_source'
SELECT
1 AS visits
- , visits_source_src_28011.user_id AS visitors
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day
- , EXTRACT(isodow FROM visits_source_src_28011.ds) AS ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy
- , visits_source_src_28011.referrer_id
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day
- , EXTRACT(isodow FROM visits_source_src_28011.ds) AS visit__ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy
- , visits_source_src_28011.referrer_id AS visit__referrer_id
- , visits_source_src_28011.user_id AS user
- , visits_source_src_28011.session_id AS session
- , visits_source_src_28011.user_id AS visit__user
- , visits_source_src_28011.session_id AS visit__session
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_0
- ) subq_1
- ) subq_2
+ , visits_source_src_28000.user_id AS visitors
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS ds__extract_day
+ , EXTRACT(isodow FROM visits_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS ds__extract_doy
+ , visits_source_src_28000.referrer_id
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS visit__ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS visit__ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS visit__ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS visit__ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS visit__ds__extract_day
+ , EXTRACT(isodow FROM visits_source_src_28000.ds) AS visit__ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS visit__ds__extract_doy
+ , visits_source_src_28000.referrer_id AS visit__referrer_id
+ , visits_source_src_28000.user_id AS user
+ , visits_source_src_28000.session_id AS session
+ , visits_source_src_28000.user_id AS visit__user
+ , visits_source_src_28000.session_id AS visit__session
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
GROUP BY
- subq_2.metric_time__day
- , subq_2.visit__referrer_id
- ) subq_3
+ subq_11.metric_time__day
+ , subq_11.visit__referrer_id
+ ) subq_12
FULL OUTER JOIN (
-- Aggregate Measures
SELECT
- subq_12.metric_time__day
- , subq_12.visit__referrer_id
- , SUM(subq_12.buys) AS buys
+ subq_21.metric_time__day
+ , subq_21.visit__referrer_id
+ , SUM(subq_21.buys) AS buys
FROM (
-- Pass Only Elements: ['buys', 'visit__referrer_id', 'metric_time__day']
SELECT
- subq_11.metric_time__day
- , subq_11.visit__referrer_id
- , subq_11.buys
+ subq_20.metric_time__day
+ , subq_20.visit__referrer_id
+ , subq_20.buys
FROM (
-- Find conversions for user within the range of 7 day
SELECT
- subq_10.ds__day
- , subq_10.metric_time__day
- , subq_10.user
- , subq_10.session
- , subq_10.visit__referrer_id
- , subq_10.buys
- , subq_10.visits
+ subq_19.ds__day
+ , subq_19.metric_time__day
+ , subq_19.user
+ , subq_19.session
+ , subq_19.visit__referrer_id
+ , subq_19.buys
+ , subq_19.visits
FROM (
-- Dedupe the fanout with mf_internal_uuid in the conversion data set
SELECT DISTINCT
- first_value(subq_6.visits) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid, subq_9.session_id ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
- , first_value(subq_6.visit__referrer_id) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid, subq_9.session_id ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visit__referrer_id
- , first_value(subq_6.ds__day) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid, subq_9.session_id ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
- , first_value(subq_6.metric_time__day) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid, subq_9.session_id ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS metric_time__day
- , first_value(subq_6.user) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid, subq_9.session_id ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
- , first_value(subq_6.session) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid, subq_9.session_id ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS session
- , subq_9.mf_internal_uuid AS mf_internal_uuid
- , subq_9.buys AS buys
+ first_value(subq_15.visits) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid, subq_18.session_id ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
+ , first_value(subq_15.visit__referrer_id) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid, subq_18.session_id ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visit__referrer_id
+ , first_value(subq_15.ds__day) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid, subq_18.session_id ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
+ , first_value(subq_15.metric_time__day) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid, subq_18.session_id ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS metric_time__day
+ , first_value(subq_15.user) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid, subq_18.session_id ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
+ , first_value(subq_15.session) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid, subq_18.session_id ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS session
+ , subq_18.mf_internal_uuid AS mf_internal_uuid
+ , subq_18.buys AS buys
FROM (
-- Pass Only Elements: ['visits', 'visit__referrer_id', 'ds__day', 'metric_time__day', 'user', 'session']
SELECT
- subq_5.ds__day
- , subq_5.metric_time__day
- , subq_5.user
- , subq_5.session
- , subq_5.visit__referrer_id
- , subq_5.visits
+ subq_14.ds__day
+ , subq_14.metric_time__day
+ , subq_14.user
+ , subq_14.session
+ , subq_14.visit__referrer_id
+ , subq_14.visits
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_4.ds__day
- , subq_4.ds__week
- , subq_4.ds__month
- , subq_4.ds__quarter
- , subq_4.ds__year
- , subq_4.ds__extract_year
- , subq_4.ds__extract_quarter
- , subq_4.ds__extract_month
- , subq_4.ds__extract_day
- , subq_4.ds__extract_dow
- , subq_4.ds__extract_doy
- , subq_4.visit__ds__day
- , subq_4.visit__ds__week
- , subq_4.visit__ds__month
- , subq_4.visit__ds__quarter
- , subq_4.visit__ds__year
- , subq_4.visit__ds__extract_year
- , subq_4.visit__ds__extract_quarter
- , subq_4.visit__ds__extract_month
- , subq_4.visit__ds__extract_day
- , subq_4.visit__ds__extract_dow
- , subq_4.visit__ds__extract_doy
- , subq_4.ds__day AS metric_time__day
- , subq_4.ds__week AS metric_time__week
- , subq_4.ds__month AS metric_time__month
- , subq_4.ds__quarter AS metric_time__quarter
- , subq_4.ds__year AS metric_time__year
- , subq_4.ds__extract_year AS metric_time__extract_year
- , subq_4.ds__extract_quarter AS metric_time__extract_quarter
- , subq_4.ds__extract_month AS metric_time__extract_month
- , subq_4.ds__extract_day AS metric_time__extract_day
- , subq_4.ds__extract_dow AS metric_time__extract_dow
- , subq_4.ds__extract_doy AS metric_time__extract_doy
- , subq_4.user
- , subq_4.session
- , subq_4.visit__user
- , subq_4.visit__session
- , subq_4.referrer_id
- , subq_4.visit__referrer_id
- , subq_4.visits
- , subq_4.visitors
+ subq_13.ds__day
+ , subq_13.ds__week
+ , subq_13.ds__month
+ , subq_13.ds__quarter
+ , subq_13.ds__year
+ , subq_13.ds__extract_year
+ , subq_13.ds__extract_quarter
+ , subq_13.ds__extract_month
+ , subq_13.ds__extract_day
+ , subq_13.ds__extract_dow
+ , subq_13.ds__extract_doy
+ , subq_13.visit__ds__day
+ , subq_13.visit__ds__week
+ , subq_13.visit__ds__month
+ , subq_13.visit__ds__quarter
+ , subq_13.visit__ds__year
+ , subq_13.visit__ds__extract_year
+ , subq_13.visit__ds__extract_quarter
+ , subq_13.visit__ds__extract_month
+ , subq_13.visit__ds__extract_day
+ , subq_13.visit__ds__extract_dow
+ , subq_13.visit__ds__extract_doy
+ , subq_13.ds__day AS metric_time__day
+ , subq_13.ds__week AS metric_time__week
+ , subq_13.ds__month AS metric_time__month
+ , subq_13.ds__quarter AS metric_time__quarter
+ , subq_13.ds__year AS metric_time__year
+ , subq_13.ds__extract_year AS metric_time__extract_year
+ , subq_13.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_13.ds__extract_month AS metric_time__extract_month
+ , subq_13.ds__extract_day AS metric_time__extract_day
+ , subq_13.ds__extract_dow AS metric_time__extract_dow
+ , subq_13.ds__extract_doy AS metric_time__extract_doy
+ , subq_13.user
+ , subq_13.session
+ , subq_13.visit__user
+ , subq_13.visit__session
+ , subq_13.referrer_id
+ , subq_13.visit__referrer_id
+ , subq_13.visits
+ , subq_13.visitors
FROM (
-- Read Elements From Semantic Model 'visits_source'
SELECT
1 AS visits
- , visits_source_src_28011.user_id AS visitors
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day
- , EXTRACT(isodow FROM visits_source_src_28011.ds) AS ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy
- , visits_source_src_28011.referrer_id
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day
- , EXTRACT(isodow FROM visits_source_src_28011.ds) AS visit__ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy
- , visits_source_src_28011.referrer_id AS visit__referrer_id
- , visits_source_src_28011.user_id AS user
- , visits_source_src_28011.session_id AS session
- , visits_source_src_28011.user_id AS visit__user
- , visits_source_src_28011.session_id AS visit__session
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_4
- ) subq_5
- ) subq_6
+ , visits_source_src_28000.user_id AS visitors
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS ds__extract_day
+ , EXTRACT(isodow FROM visits_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS ds__extract_doy
+ , visits_source_src_28000.referrer_id
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS visit__ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS visit__ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS visit__ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS visit__ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS visit__ds__extract_day
+ , EXTRACT(isodow FROM visits_source_src_28000.ds) AS visit__ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS visit__ds__extract_doy
+ , visits_source_src_28000.referrer_id AS visit__referrer_id
+ , visits_source_src_28000.user_id AS user
+ , visits_source_src_28000.session_id AS session
+ , visits_source_src_28000.user_id AS visit__user
+ , visits_source_src_28000.session_id AS visit__session
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_13
+ ) subq_14
+ ) subq_15
INNER JOIN (
-- Add column with generated UUID
SELECT
- subq_8.ds__day
- , subq_8.ds__week
- , subq_8.ds__month
- , subq_8.ds__quarter
- , subq_8.ds__year
- , subq_8.ds__extract_year
- , subq_8.ds__extract_quarter
- , subq_8.ds__extract_month
- , subq_8.ds__extract_day
- , subq_8.ds__extract_dow
- , subq_8.ds__extract_doy
- , subq_8.buy__ds__day
- , subq_8.buy__ds__week
- , subq_8.buy__ds__month
- , subq_8.buy__ds__quarter
- , subq_8.buy__ds__year
- , subq_8.buy__ds__extract_year
- , subq_8.buy__ds__extract_quarter
- , subq_8.buy__ds__extract_month
- , subq_8.buy__ds__extract_day
- , subq_8.buy__ds__extract_dow
- , subq_8.buy__ds__extract_doy
- , subq_8.metric_time__day
- , subq_8.metric_time__week
- , subq_8.metric_time__month
- , subq_8.metric_time__quarter
- , subq_8.metric_time__year
- , subq_8.metric_time__extract_year
- , subq_8.metric_time__extract_quarter
- , subq_8.metric_time__extract_month
- , subq_8.metric_time__extract_day
- , subq_8.metric_time__extract_dow
- , subq_8.metric_time__extract_doy
- , subq_8.user
- , subq_8.session_id
- , subq_8.buy__user
- , subq_8.buy__session_id
- , subq_8.buys
- , subq_8.buyers
+ subq_17.ds__day
+ , subq_17.ds__week
+ , subq_17.ds__month
+ , subq_17.ds__quarter
+ , subq_17.ds__year
+ , subq_17.ds__extract_year
+ , subq_17.ds__extract_quarter
+ , subq_17.ds__extract_month
+ , subq_17.ds__extract_day
+ , subq_17.ds__extract_dow
+ , subq_17.ds__extract_doy
+ , subq_17.buy__ds__day
+ , subq_17.buy__ds__week
+ , subq_17.buy__ds__month
+ , subq_17.buy__ds__quarter
+ , subq_17.buy__ds__year
+ , subq_17.buy__ds__extract_year
+ , subq_17.buy__ds__extract_quarter
+ , subq_17.buy__ds__extract_month
+ , subq_17.buy__ds__extract_day
+ , subq_17.buy__ds__extract_dow
+ , subq_17.buy__ds__extract_doy
+ , subq_17.metric_time__day
+ , subq_17.metric_time__week
+ , subq_17.metric_time__month
+ , subq_17.metric_time__quarter
+ , subq_17.metric_time__year
+ , subq_17.metric_time__extract_year
+ , subq_17.metric_time__extract_quarter
+ , subq_17.metric_time__extract_month
+ , subq_17.metric_time__extract_day
+ , subq_17.metric_time__extract_dow
+ , subq_17.metric_time__extract_doy
+ , subq_17.user
+ , subq_17.session_id
+ , subq_17.buy__user
+ , subq_17.buy__session_id
+ , subq_17.buys
+ , subq_17.buyers
, GEN_RANDOM_UUID() AS mf_internal_uuid
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_7.ds__day
- , subq_7.ds__week
- , subq_7.ds__month
- , subq_7.ds__quarter
- , subq_7.ds__year
- , subq_7.ds__extract_year
- , subq_7.ds__extract_quarter
- , subq_7.ds__extract_month
- , subq_7.ds__extract_day
- , subq_7.ds__extract_dow
- , subq_7.ds__extract_doy
- , subq_7.buy__ds__day
- , subq_7.buy__ds__week
- , subq_7.buy__ds__month
- , subq_7.buy__ds__quarter
- , subq_7.buy__ds__year
- , subq_7.buy__ds__extract_year
- , subq_7.buy__ds__extract_quarter
- , subq_7.buy__ds__extract_month
- , subq_7.buy__ds__extract_day
- , subq_7.buy__ds__extract_dow
- , subq_7.buy__ds__extract_doy
- , subq_7.ds__day AS metric_time__day
- , subq_7.ds__week AS metric_time__week
- , subq_7.ds__month AS metric_time__month
- , subq_7.ds__quarter AS metric_time__quarter
- , subq_7.ds__year AS metric_time__year
- , subq_7.ds__extract_year AS metric_time__extract_year
- , subq_7.ds__extract_quarter AS metric_time__extract_quarter
- , subq_7.ds__extract_month AS metric_time__extract_month
- , subq_7.ds__extract_day AS metric_time__extract_day
- , subq_7.ds__extract_dow AS metric_time__extract_dow
- , subq_7.ds__extract_doy AS metric_time__extract_doy
- , subq_7.user
- , subq_7.session_id
- , subq_7.buy__user
- , subq_7.buy__session_id
- , subq_7.buys
- , subq_7.buyers
+ subq_16.ds__day
+ , subq_16.ds__week
+ , subq_16.ds__month
+ , subq_16.ds__quarter
+ , subq_16.ds__year
+ , subq_16.ds__extract_year
+ , subq_16.ds__extract_quarter
+ , subq_16.ds__extract_month
+ , subq_16.ds__extract_day
+ , subq_16.ds__extract_dow
+ , subq_16.ds__extract_doy
+ , subq_16.buy__ds__day
+ , subq_16.buy__ds__week
+ , subq_16.buy__ds__month
+ , subq_16.buy__ds__quarter
+ , subq_16.buy__ds__year
+ , subq_16.buy__ds__extract_year
+ , subq_16.buy__ds__extract_quarter
+ , subq_16.buy__ds__extract_month
+ , subq_16.buy__ds__extract_day
+ , subq_16.buy__ds__extract_dow
+ , subq_16.buy__ds__extract_doy
+ , subq_16.ds__day AS metric_time__day
+ , subq_16.ds__week AS metric_time__week
+ , subq_16.ds__month AS metric_time__month
+ , subq_16.ds__quarter AS metric_time__quarter
+ , subq_16.ds__year AS metric_time__year
+ , subq_16.ds__extract_year AS metric_time__extract_year
+ , subq_16.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_16.ds__extract_month AS metric_time__extract_month
+ , subq_16.ds__extract_day AS metric_time__extract_day
+ , subq_16.ds__extract_dow AS metric_time__extract_dow
+ , subq_16.ds__extract_doy AS metric_time__extract_doy
+ , subq_16.user
+ , subq_16.session_id
+ , subq_16.buy__user
+ , subq_16.buy__session_id
+ , subq_16.buys
+ , subq_16.buyers
FROM (
-- Read Elements From Semantic Model 'buys_source'
SELECT
1 AS buys
- , buys_source_src_28002.user_id AS buyers
- , DATE_TRUNC('day', buys_source_src_28002.ds) AS ds__day
- , DATE_TRUNC('week', buys_source_src_28002.ds) AS ds__week
- , DATE_TRUNC('month', buys_source_src_28002.ds) AS ds__month
- , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS ds__quarter
- , DATE_TRUNC('year', buys_source_src_28002.ds) AS ds__year
- , EXTRACT(year FROM buys_source_src_28002.ds) AS ds__extract_year
- , EXTRACT(quarter FROM buys_source_src_28002.ds) AS ds__extract_quarter
- , EXTRACT(month FROM buys_source_src_28002.ds) AS ds__extract_month
- , EXTRACT(day FROM buys_source_src_28002.ds) AS ds__extract_day
- , EXTRACT(isodow FROM buys_source_src_28002.ds) AS ds__extract_dow
- , EXTRACT(doy FROM buys_source_src_28002.ds) AS ds__extract_doy
- , DATE_TRUNC('day', buys_source_src_28002.ds) AS buy__ds__day
- , DATE_TRUNC('week', buys_source_src_28002.ds) AS buy__ds__week
- , DATE_TRUNC('month', buys_source_src_28002.ds) AS buy__ds__month
- , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS buy__ds__quarter
- , DATE_TRUNC('year', buys_source_src_28002.ds) AS buy__ds__year
- , EXTRACT(year FROM buys_source_src_28002.ds) AS buy__ds__extract_year
- , EXTRACT(quarter FROM buys_source_src_28002.ds) AS buy__ds__extract_quarter
- , EXTRACT(month FROM buys_source_src_28002.ds) AS buy__ds__extract_month
- , EXTRACT(day FROM buys_source_src_28002.ds) AS buy__ds__extract_day
- , EXTRACT(isodow FROM buys_source_src_28002.ds) AS buy__ds__extract_dow
- , EXTRACT(doy FROM buys_source_src_28002.ds) AS buy__ds__extract_doy
- , buys_source_src_28002.user_id AS user
- , buys_source_src_28002.session_id
- , buys_source_src_28002.user_id AS buy__user
- , buys_source_src_28002.session_id AS buy__session_id
- FROM ***************************.fct_buys buys_source_src_28002
- ) subq_7
- ) subq_8
- ) subq_9
+ , buys_source_src_28000.user_id AS buyers
+ , DATE_TRUNC('day', buys_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', buys_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', buys_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', buys_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', buys_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM buys_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM buys_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', buys_source_src_28000.ds) AS buy__ds__day
+ , DATE_TRUNC('week', buys_source_src_28000.ds) AS buy__ds__week
+ , DATE_TRUNC('month', buys_source_src_28000.ds) AS buy__ds__month
+ , DATE_TRUNC('quarter', buys_source_src_28000.ds) AS buy__ds__quarter
+ , DATE_TRUNC('year', buys_source_src_28000.ds) 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
+ , EXTRACT(day FROM buys_source_src_28000.ds) AS buy__ds__extract_day
+ , EXTRACT(isodow FROM buys_source_src_28000.ds) AS buy__ds__extract_dow
+ , EXTRACT(doy FROM buys_source_src_28000.ds) AS buy__ds__extract_doy
+ , buys_source_src_28000.user_id AS user
+ , buys_source_src_28000.session_id
+ , buys_source_src_28000.user_id AS buy__user
+ , buys_source_src_28000.session_id AS buy__session_id
+ FROM ***************************.fct_buys buys_source_src_28000
+ ) subq_16
+ ) subq_17
+ ) subq_18
ON
(
- subq_6.user = subq_9.user
+ subq_15.user = subq_18.user
) AND (
- subq_6.session = subq_9.session_id
+ subq_15.session = subq_18.session_id
) AND (
(
- subq_6.ds__day <= subq_9.ds__day
+ subq_15.ds__day <= subq_18.ds__day
) AND (
- subq_6.ds__day > subq_9.ds__day - INTERVAL 7 day
+ subq_15.ds__day > subq_18.ds__day - INTERVAL 7 day
)
)
- ) subq_10
- ) subq_11
- ) subq_12
+ ) subq_19
+ ) subq_20
+ ) subq_21
GROUP BY
- subq_12.metric_time__day
- , subq_12.visit__referrer_id
- ) subq_13
+ subq_21.metric_time__day
+ , subq_21.visit__referrer_id
+ ) subq_22
ON
(
- subq_3.visit__referrer_id = subq_13.visit__referrer_id
+ subq_12.visit__referrer_id = subq_22.visit__referrer_id
) AND (
- subq_3.metric_time__day = subq_13.metric_time__day
+ subq_12.metric_time__day = subq_22.metric_time__day
)
GROUP BY
- COALESCE(subq_3.metric_time__day, subq_13.metric_time__day)
- , COALESCE(subq_3.visit__referrer_id, subq_13.visit__referrer_id)
-) subq_14
+ COALESCE(subq_12.metric_time__day, subq_22.metric_time__day)
+ , COALESCE(subq_12.visit__referrer_id, subq_22.visit__referrer_id)
+) subq_23
diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/DuckDB/test_conversion_rate_with_constant_properties__plan0_optimized.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/DuckDB/test_conversion_rate_with_constant_properties__plan0_optimized.sql
index 1c8008764c..ef31de6df1 100644
--- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/DuckDB/test_conversion_rate_with_constant_properties__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/DuckDB/test_conversion_rate_with_constant_properties__plan0_optimized.sql
@@ -6,10 +6,10 @@ SELECT
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_18.metric_time__day, subq_28.metric_time__day) AS metric_time__day
- , COALESCE(subq_18.visit__referrer_id, subq_28.visit__referrer_id) AS visit__referrer_id
- , MAX(subq_18.visits) AS visits
- , MAX(subq_28.buys) AS buys
+ COALESCE(subq_27.metric_time__day, subq_37.metric_time__day) AS metric_time__day
+ , COALESCE(subq_27.visit__referrer_id, subq_37.visit__referrer_id) AS visit__referrer_id
+ , MAX(subq_27.visits) AS visits
+ , MAX(subq_37.buys) AS buys
FROM (
-- Aggregate Measures
SELECT
@@ -24,12 +24,12 @@ FROM (
DATE_TRUNC('day', ds) AS metric_time__day
, referrer_id AS visit__referrer_id
, 1 AS visits
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_17
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_26
GROUP BY
metric_time__day
, visit__referrer_id
- ) subq_18
+ ) subq_27
FULL OUTER JOIN (
-- Find conversions for user within the range of 7 day
-- Pass Only Elements: ['buys', 'visit__referrer_id', 'metric_time__day']
@@ -41,14 +41,14 @@ FROM (
FROM (
-- Dedupe the fanout with mf_internal_uuid in the conversion data set
SELECT DISTINCT
- first_value(subq_21.visits) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid, subq_24.session_id ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
- , first_value(subq_21.visit__referrer_id) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid, subq_24.session_id ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visit__referrer_id
- , first_value(subq_21.ds__day) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid, subq_24.session_id ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
- , first_value(subq_21.metric_time__day) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid, subq_24.session_id ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS metric_time__day
- , first_value(subq_21.user) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid, subq_24.session_id ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
- , first_value(subq_21.session) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid, subq_24.session_id ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS session
- , subq_24.mf_internal_uuid AS mf_internal_uuid
- , subq_24.buys AS buys
+ first_value(subq_30.visits) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid, subq_33.session_id ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
+ , first_value(subq_30.visit__referrer_id) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid, subq_33.session_id ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visit__referrer_id
+ , first_value(subq_30.ds__day) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid, subq_33.session_id ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
+ , first_value(subq_30.metric_time__day) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid, subq_33.session_id ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS metric_time__day
+ , first_value(subq_30.user) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid, subq_33.session_id ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
+ , first_value(subq_30.session) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid, subq_33.session_id ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS session
+ , subq_33.mf_internal_uuid AS mf_internal_uuid
+ , subq_33.buys AS buys
FROM (
-- Read Elements From Semantic Model 'visits_source'
-- Metric Time Dimension 'ds'
@@ -60,8 +60,8 @@ FROM (
, session_id AS session
, referrer_id AS visit__referrer_id
, 1 AS visits
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_21
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_30
INNER JOIN (
-- Read Elements From Semantic Model 'buys_source'
-- Metric Time Dimension 'ds'
@@ -72,32 +72,32 @@ FROM (
, session_id
, 1 AS buys
, GEN_RANDOM_UUID() AS mf_internal_uuid
- FROM ***************************.fct_buys buys_source_src_28002
- ) subq_24
+ FROM ***************************.fct_buys buys_source_src_28000
+ ) subq_33
ON
(
- subq_21.user = subq_24.user
+ subq_30.user = subq_33.user
) AND (
- subq_21.session = subq_24.session_id
+ subq_30.session = subq_33.session_id
) AND (
(
- subq_21.ds__day <= subq_24.ds__day
+ subq_30.ds__day <= subq_33.ds__day
) AND (
- subq_21.ds__day > subq_24.ds__day - INTERVAL 7 day
+ subq_30.ds__day > subq_33.ds__day - INTERVAL 7 day
)
)
- ) subq_25
+ ) subq_34
GROUP BY
metric_time__day
, visit__referrer_id
- ) subq_28
+ ) subq_37
ON
(
- subq_18.visit__referrer_id = subq_28.visit__referrer_id
+ subq_27.visit__referrer_id = subq_37.visit__referrer_id
) AND (
- subq_18.metric_time__day = subq_28.metric_time__day
+ subq_27.metric_time__day = subq_37.metric_time__day
)
GROUP BY
- COALESCE(subq_18.metric_time__day, subq_28.metric_time__day)
- , COALESCE(subq_18.visit__referrer_id, subq_28.visit__referrer_id)
-) subq_29
+ COALESCE(subq_27.metric_time__day, subq_37.metric_time__day)
+ , COALESCE(subq_27.visit__referrer_id, subq_37.visit__referrer_id)
+) subq_38
diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/DuckDB/test_conversion_rate_with_no_group_by__plan0.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/DuckDB/test_conversion_rate_with_no_group_by__plan0.sql
index c6bd93429f..1d2d9fd5c3 100644
--- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/DuckDB/test_conversion_rate_with_no_group_by__plan0.sql
+++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/DuckDB/test_conversion_rate_with_no_group_by__plan0.sql
@@ -1,343 +1,343 @@
-- Compute Metrics via Expressions
SELECT
- CAST(subq_14.buys AS DOUBLE) / CAST(NULLIF(subq_14.visits, 0) AS DOUBLE) AS visit_buy_conversion_rate_7days
+ CAST(subq_23.buys AS DOUBLE) / CAST(NULLIF(subq_23.visits, 0) AS DOUBLE) AS visit_buy_conversion_rate_7days
FROM (
-- Combine Aggregated Outputs
SELECT
- MAX(subq_3.visits) AS visits
- , MAX(subq_13.buys) AS buys
+ MAX(subq_12.visits) AS visits
+ , MAX(subq_22.buys) AS buys
FROM (
-- Aggregate Measures
SELECT
- SUM(subq_2.visits) AS visits
+ SUM(subq_11.visits) AS visits
FROM (
-- Pass Only Elements: ['visits',]
SELECT
- subq_1.visits
+ subq_10.visits
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.visit__ds__day
- , subq_0.visit__ds__week
- , subq_0.visit__ds__month
- , subq_0.visit__ds__quarter
- , subq_0.visit__ds__year
- , subq_0.visit__ds__extract_year
- , subq_0.visit__ds__extract_quarter
- , subq_0.visit__ds__extract_month
- , subq_0.visit__ds__extract_day
- , subq_0.visit__ds__extract_dow
- , subq_0.visit__ds__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.user
- , subq_0.session
- , subq_0.visit__user
- , subq_0.visit__session
- , subq_0.referrer_id
- , subq_0.visit__referrer_id
- , subq_0.visits
- , subq_0.visitors
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.visit__ds__day
+ , subq_9.visit__ds__week
+ , subq_9.visit__ds__month
+ , subq_9.visit__ds__quarter
+ , subq_9.visit__ds__year
+ , subq_9.visit__ds__extract_year
+ , subq_9.visit__ds__extract_quarter
+ , subq_9.visit__ds__extract_month
+ , subq_9.visit__ds__extract_day
+ , subq_9.visit__ds__extract_dow
+ , subq_9.visit__ds__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.user
+ , subq_9.session
+ , subq_9.visit__user
+ , subq_9.visit__session
+ , subq_9.referrer_id
+ , subq_9.visit__referrer_id
+ , subq_9.visits
+ , subq_9.visitors
FROM (
-- Read Elements From Semantic Model 'visits_source'
SELECT
1 AS visits
- , visits_source_src_28011.user_id AS visitors
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day
- , EXTRACT(isodow FROM visits_source_src_28011.ds) AS ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy
- , visits_source_src_28011.referrer_id
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day
- , EXTRACT(isodow FROM visits_source_src_28011.ds) AS visit__ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy
- , visits_source_src_28011.referrer_id AS visit__referrer_id
- , visits_source_src_28011.user_id AS user
- , visits_source_src_28011.session_id AS session
- , visits_source_src_28011.user_id AS visit__user
- , visits_source_src_28011.session_id AS visit__session
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_0
- ) subq_1
- ) subq_2
- ) subq_3
+ , visits_source_src_28000.user_id AS visitors
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS ds__extract_day
+ , EXTRACT(isodow FROM visits_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS ds__extract_doy
+ , visits_source_src_28000.referrer_id
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS visit__ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS visit__ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS visit__ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS visit__ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS visit__ds__extract_day
+ , EXTRACT(isodow FROM visits_source_src_28000.ds) AS visit__ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS visit__ds__extract_doy
+ , visits_source_src_28000.referrer_id AS visit__referrer_id
+ , visits_source_src_28000.user_id AS user
+ , visits_source_src_28000.session_id AS session
+ , visits_source_src_28000.user_id AS visit__user
+ , visits_source_src_28000.session_id AS visit__session
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
+ ) subq_12
CROSS JOIN (
-- Aggregate Measures
SELECT
- SUM(subq_12.buys) AS buys
+ SUM(subq_21.buys) AS buys
FROM (
-- Pass Only Elements: ['buys',]
SELECT
- subq_11.buys
+ subq_20.buys
FROM (
-- Find conversions for user within the range of 7 day
SELECT
- subq_10.ds__day
- , subq_10.user
- , subq_10.buys
- , subq_10.visits
+ subq_19.ds__day
+ , subq_19.user
+ , subq_19.buys
+ , subq_19.visits
FROM (
-- Dedupe the fanout with mf_internal_uuid in the conversion data set
SELECT DISTINCT
- first_value(subq_6.visits) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
- , first_value(subq_6.ds__day) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
- , first_value(subq_6.user) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
- , subq_9.mf_internal_uuid AS mf_internal_uuid
- , subq_9.buys AS buys
+ first_value(subq_15.visits) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
+ , first_value(subq_15.ds__day) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
+ , first_value(subq_15.user) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
+ , subq_18.mf_internal_uuid AS mf_internal_uuid
+ , subq_18.buys AS buys
FROM (
-- Pass Only Elements: ['visits', 'ds__day', 'user']
SELECT
- subq_5.ds__day
- , subq_5.user
- , subq_5.visits
+ subq_14.ds__day
+ , subq_14.user
+ , subq_14.visits
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_4.ds__day
- , subq_4.ds__week
- , subq_4.ds__month
- , subq_4.ds__quarter
- , subq_4.ds__year
- , subq_4.ds__extract_year
- , subq_4.ds__extract_quarter
- , subq_4.ds__extract_month
- , subq_4.ds__extract_day
- , subq_4.ds__extract_dow
- , subq_4.ds__extract_doy
- , subq_4.visit__ds__day
- , subq_4.visit__ds__week
- , subq_4.visit__ds__month
- , subq_4.visit__ds__quarter
- , subq_4.visit__ds__year
- , subq_4.visit__ds__extract_year
- , subq_4.visit__ds__extract_quarter
- , subq_4.visit__ds__extract_month
- , subq_4.visit__ds__extract_day
- , subq_4.visit__ds__extract_dow
- , subq_4.visit__ds__extract_doy
- , subq_4.ds__day AS metric_time__day
- , subq_4.ds__week AS metric_time__week
- , subq_4.ds__month AS metric_time__month
- , subq_4.ds__quarter AS metric_time__quarter
- , subq_4.ds__year AS metric_time__year
- , subq_4.ds__extract_year AS metric_time__extract_year
- , subq_4.ds__extract_quarter AS metric_time__extract_quarter
- , subq_4.ds__extract_month AS metric_time__extract_month
- , subq_4.ds__extract_day AS metric_time__extract_day
- , subq_4.ds__extract_dow AS metric_time__extract_dow
- , subq_4.ds__extract_doy AS metric_time__extract_doy
- , subq_4.user
- , subq_4.session
- , subq_4.visit__user
- , subq_4.visit__session
- , subq_4.referrer_id
- , subq_4.visit__referrer_id
- , subq_4.visits
- , subq_4.visitors
+ subq_13.ds__day
+ , subq_13.ds__week
+ , subq_13.ds__month
+ , subq_13.ds__quarter
+ , subq_13.ds__year
+ , subq_13.ds__extract_year
+ , subq_13.ds__extract_quarter
+ , subq_13.ds__extract_month
+ , subq_13.ds__extract_day
+ , subq_13.ds__extract_dow
+ , subq_13.ds__extract_doy
+ , subq_13.visit__ds__day
+ , subq_13.visit__ds__week
+ , subq_13.visit__ds__month
+ , subq_13.visit__ds__quarter
+ , subq_13.visit__ds__year
+ , subq_13.visit__ds__extract_year
+ , subq_13.visit__ds__extract_quarter
+ , subq_13.visit__ds__extract_month
+ , subq_13.visit__ds__extract_day
+ , subq_13.visit__ds__extract_dow
+ , subq_13.visit__ds__extract_doy
+ , subq_13.ds__day AS metric_time__day
+ , subq_13.ds__week AS metric_time__week
+ , subq_13.ds__month AS metric_time__month
+ , subq_13.ds__quarter AS metric_time__quarter
+ , subq_13.ds__year AS metric_time__year
+ , subq_13.ds__extract_year AS metric_time__extract_year
+ , subq_13.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_13.ds__extract_month AS metric_time__extract_month
+ , subq_13.ds__extract_day AS metric_time__extract_day
+ , subq_13.ds__extract_dow AS metric_time__extract_dow
+ , subq_13.ds__extract_doy AS metric_time__extract_doy
+ , subq_13.user
+ , subq_13.session
+ , subq_13.visit__user
+ , subq_13.visit__session
+ , subq_13.referrer_id
+ , subq_13.visit__referrer_id
+ , subq_13.visits
+ , subq_13.visitors
FROM (
-- Read Elements From Semantic Model 'visits_source'
SELECT
1 AS visits
- , visits_source_src_28011.user_id AS visitors
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day
- , EXTRACT(isodow FROM visits_source_src_28011.ds) AS ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy
- , visits_source_src_28011.referrer_id
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day
- , EXTRACT(isodow FROM visits_source_src_28011.ds) AS visit__ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy
- , visits_source_src_28011.referrer_id AS visit__referrer_id
- , visits_source_src_28011.user_id AS user
- , visits_source_src_28011.session_id AS session
- , visits_source_src_28011.user_id AS visit__user
- , visits_source_src_28011.session_id AS visit__session
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_4
- ) subq_5
- ) subq_6
+ , visits_source_src_28000.user_id AS visitors
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS ds__extract_day
+ , EXTRACT(isodow FROM visits_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS ds__extract_doy
+ , visits_source_src_28000.referrer_id
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS visit__ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS visit__ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS visit__ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS visit__ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS visit__ds__extract_day
+ , EXTRACT(isodow FROM visits_source_src_28000.ds) AS visit__ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS visit__ds__extract_doy
+ , visits_source_src_28000.referrer_id AS visit__referrer_id
+ , visits_source_src_28000.user_id AS user
+ , visits_source_src_28000.session_id AS session
+ , visits_source_src_28000.user_id AS visit__user
+ , visits_source_src_28000.session_id AS visit__session
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_13
+ ) subq_14
+ ) subq_15
INNER JOIN (
-- Add column with generated UUID
SELECT
- subq_8.ds__day
- , subq_8.ds__week
- , subq_8.ds__month
- , subq_8.ds__quarter
- , subq_8.ds__year
- , subq_8.ds__extract_year
- , subq_8.ds__extract_quarter
- , subq_8.ds__extract_month
- , subq_8.ds__extract_day
- , subq_8.ds__extract_dow
- , subq_8.ds__extract_doy
- , subq_8.buy__ds__day
- , subq_8.buy__ds__week
- , subq_8.buy__ds__month
- , subq_8.buy__ds__quarter
- , subq_8.buy__ds__year
- , subq_8.buy__ds__extract_year
- , subq_8.buy__ds__extract_quarter
- , subq_8.buy__ds__extract_month
- , subq_8.buy__ds__extract_day
- , subq_8.buy__ds__extract_dow
- , subq_8.buy__ds__extract_doy
- , subq_8.metric_time__day
- , subq_8.metric_time__week
- , subq_8.metric_time__month
- , subq_8.metric_time__quarter
- , subq_8.metric_time__year
- , subq_8.metric_time__extract_year
- , subq_8.metric_time__extract_quarter
- , subq_8.metric_time__extract_month
- , subq_8.metric_time__extract_day
- , subq_8.metric_time__extract_dow
- , subq_8.metric_time__extract_doy
- , subq_8.user
- , subq_8.session_id
- , subq_8.buy__user
- , subq_8.buy__session_id
- , subq_8.buys
- , subq_8.buyers
+ subq_17.ds__day
+ , subq_17.ds__week
+ , subq_17.ds__month
+ , subq_17.ds__quarter
+ , subq_17.ds__year
+ , subq_17.ds__extract_year
+ , subq_17.ds__extract_quarter
+ , subq_17.ds__extract_month
+ , subq_17.ds__extract_day
+ , subq_17.ds__extract_dow
+ , subq_17.ds__extract_doy
+ , subq_17.buy__ds__day
+ , subq_17.buy__ds__week
+ , subq_17.buy__ds__month
+ , subq_17.buy__ds__quarter
+ , subq_17.buy__ds__year
+ , subq_17.buy__ds__extract_year
+ , subq_17.buy__ds__extract_quarter
+ , subq_17.buy__ds__extract_month
+ , subq_17.buy__ds__extract_day
+ , subq_17.buy__ds__extract_dow
+ , subq_17.buy__ds__extract_doy
+ , subq_17.metric_time__day
+ , subq_17.metric_time__week
+ , subq_17.metric_time__month
+ , subq_17.metric_time__quarter
+ , subq_17.metric_time__year
+ , subq_17.metric_time__extract_year
+ , subq_17.metric_time__extract_quarter
+ , subq_17.metric_time__extract_month
+ , subq_17.metric_time__extract_day
+ , subq_17.metric_time__extract_dow
+ , subq_17.metric_time__extract_doy
+ , subq_17.user
+ , subq_17.session_id
+ , subq_17.buy__user
+ , subq_17.buy__session_id
+ , subq_17.buys
+ , subq_17.buyers
, GEN_RANDOM_UUID() AS mf_internal_uuid
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_7.ds__day
- , subq_7.ds__week
- , subq_7.ds__month
- , subq_7.ds__quarter
- , subq_7.ds__year
- , subq_7.ds__extract_year
- , subq_7.ds__extract_quarter
- , subq_7.ds__extract_month
- , subq_7.ds__extract_day
- , subq_7.ds__extract_dow
- , subq_7.ds__extract_doy
- , subq_7.buy__ds__day
- , subq_7.buy__ds__week
- , subq_7.buy__ds__month
- , subq_7.buy__ds__quarter
- , subq_7.buy__ds__year
- , subq_7.buy__ds__extract_year
- , subq_7.buy__ds__extract_quarter
- , subq_7.buy__ds__extract_month
- , subq_7.buy__ds__extract_day
- , subq_7.buy__ds__extract_dow
- , subq_7.buy__ds__extract_doy
- , subq_7.ds__day AS metric_time__day
- , subq_7.ds__week AS metric_time__week
- , subq_7.ds__month AS metric_time__month
- , subq_7.ds__quarter AS metric_time__quarter
- , subq_7.ds__year AS metric_time__year
- , subq_7.ds__extract_year AS metric_time__extract_year
- , subq_7.ds__extract_quarter AS metric_time__extract_quarter
- , subq_7.ds__extract_month AS metric_time__extract_month
- , subq_7.ds__extract_day AS metric_time__extract_day
- , subq_7.ds__extract_dow AS metric_time__extract_dow
- , subq_7.ds__extract_doy AS metric_time__extract_doy
- , subq_7.user
- , subq_7.session_id
- , subq_7.buy__user
- , subq_7.buy__session_id
- , subq_7.buys
- , subq_7.buyers
+ subq_16.ds__day
+ , subq_16.ds__week
+ , subq_16.ds__month
+ , subq_16.ds__quarter
+ , subq_16.ds__year
+ , subq_16.ds__extract_year
+ , subq_16.ds__extract_quarter
+ , subq_16.ds__extract_month
+ , subq_16.ds__extract_day
+ , subq_16.ds__extract_dow
+ , subq_16.ds__extract_doy
+ , subq_16.buy__ds__day
+ , subq_16.buy__ds__week
+ , subq_16.buy__ds__month
+ , subq_16.buy__ds__quarter
+ , subq_16.buy__ds__year
+ , subq_16.buy__ds__extract_year
+ , subq_16.buy__ds__extract_quarter
+ , subq_16.buy__ds__extract_month
+ , subq_16.buy__ds__extract_day
+ , subq_16.buy__ds__extract_dow
+ , subq_16.buy__ds__extract_doy
+ , subq_16.ds__day AS metric_time__day
+ , subq_16.ds__week AS metric_time__week
+ , subq_16.ds__month AS metric_time__month
+ , subq_16.ds__quarter AS metric_time__quarter
+ , subq_16.ds__year AS metric_time__year
+ , subq_16.ds__extract_year AS metric_time__extract_year
+ , subq_16.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_16.ds__extract_month AS metric_time__extract_month
+ , subq_16.ds__extract_day AS metric_time__extract_day
+ , subq_16.ds__extract_dow AS metric_time__extract_dow
+ , subq_16.ds__extract_doy AS metric_time__extract_doy
+ , subq_16.user
+ , subq_16.session_id
+ , subq_16.buy__user
+ , subq_16.buy__session_id
+ , subq_16.buys
+ , subq_16.buyers
FROM (
-- Read Elements From Semantic Model 'buys_source'
SELECT
1 AS buys
- , buys_source_src_28002.user_id AS buyers
- , DATE_TRUNC('day', buys_source_src_28002.ds) AS ds__day
- , DATE_TRUNC('week', buys_source_src_28002.ds) AS ds__week
- , DATE_TRUNC('month', buys_source_src_28002.ds) AS ds__month
- , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS ds__quarter
- , DATE_TRUNC('year', buys_source_src_28002.ds) AS ds__year
- , EXTRACT(year FROM buys_source_src_28002.ds) AS ds__extract_year
- , EXTRACT(quarter FROM buys_source_src_28002.ds) AS ds__extract_quarter
- , EXTRACT(month FROM buys_source_src_28002.ds) AS ds__extract_month
- , EXTRACT(day FROM buys_source_src_28002.ds) AS ds__extract_day
- , EXTRACT(isodow FROM buys_source_src_28002.ds) AS ds__extract_dow
- , EXTRACT(doy FROM buys_source_src_28002.ds) AS ds__extract_doy
- , DATE_TRUNC('day', buys_source_src_28002.ds) AS buy__ds__day
- , DATE_TRUNC('week', buys_source_src_28002.ds) AS buy__ds__week
- , DATE_TRUNC('month', buys_source_src_28002.ds) AS buy__ds__month
- , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS buy__ds__quarter
- , DATE_TRUNC('year', buys_source_src_28002.ds) AS buy__ds__year
- , EXTRACT(year FROM buys_source_src_28002.ds) AS buy__ds__extract_year
- , EXTRACT(quarter FROM buys_source_src_28002.ds) AS buy__ds__extract_quarter
- , EXTRACT(month FROM buys_source_src_28002.ds) AS buy__ds__extract_month
- , EXTRACT(day FROM buys_source_src_28002.ds) AS buy__ds__extract_day
- , EXTRACT(isodow FROM buys_source_src_28002.ds) AS buy__ds__extract_dow
- , EXTRACT(doy FROM buys_source_src_28002.ds) AS buy__ds__extract_doy
- , buys_source_src_28002.user_id AS user
- , buys_source_src_28002.session_id
- , buys_source_src_28002.user_id AS buy__user
- , buys_source_src_28002.session_id AS buy__session_id
- FROM ***************************.fct_buys buys_source_src_28002
- ) subq_7
- ) subq_8
- ) subq_9
+ , buys_source_src_28000.user_id AS buyers
+ , DATE_TRUNC('day', buys_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', buys_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', buys_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', buys_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', buys_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM buys_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM buys_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', buys_source_src_28000.ds) AS buy__ds__day
+ , DATE_TRUNC('week', buys_source_src_28000.ds) AS buy__ds__week
+ , DATE_TRUNC('month', buys_source_src_28000.ds) AS buy__ds__month
+ , DATE_TRUNC('quarter', buys_source_src_28000.ds) AS buy__ds__quarter
+ , DATE_TRUNC('year', buys_source_src_28000.ds) 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
+ , EXTRACT(day FROM buys_source_src_28000.ds) AS buy__ds__extract_day
+ , EXTRACT(isodow FROM buys_source_src_28000.ds) AS buy__ds__extract_dow
+ , EXTRACT(doy FROM buys_source_src_28000.ds) AS buy__ds__extract_doy
+ , buys_source_src_28000.user_id AS user
+ , buys_source_src_28000.session_id
+ , buys_source_src_28000.user_id AS buy__user
+ , buys_source_src_28000.session_id AS buy__session_id
+ FROM ***************************.fct_buys buys_source_src_28000
+ ) subq_16
+ ) subq_17
+ ) subq_18
ON
(
- subq_6.user = subq_9.user
+ subq_15.user = subq_18.user
) AND (
(
- subq_6.ds__day <= subq_9.ds__day
+ subq_15.ds__day <= subq_18.ds__day
) AND (
- subq_6.ds__day > subq_9.ds__day - INTERVAL 7 day
+ subq_15.ds__day > subq_18.ds__day - INTERVAL 7 day
)
)
- ) subq_10
- ) subq_11
- ) subq_12
- ) subq_13
-) subq_14
+ ) subq_19
+ ) subq_20
+ ) subq_21
+ ) subq_22
+) subq_23
diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/DuckDB/test_conversion_rate_with_no_group_by__plan0_optimized.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/DuckDB/test_conversion_rate_with_no_group_by__plan0_optimized.sql
index e93cebcc83..21705a38bb 100644
--- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/DuckDB/test_conversion_rate_with_no_group_by__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/DuckDB/test_conversion_rate_with_no_group_by__plan0_optimized.sql
@@ -1,7 +1,7 @@
-- Combine Aggregated Outputs
-- Compute Metrics via Expressions
SELECT
- CAST(MAX(subq_28.buys) AS DOUBLE) / CAST(NULLIF(MAX(subq_18.visits), 0) AS DOUBLE) AS visit_buy_conversion_rate_7days
+ CAST(MAX(subq_37.buys) AS DOUBLE) / CAST(NULLIF(MAX(subq_27.visits), 0) AS DOUBLE) AS visit_buy_conversion_rate_7days
FROM (
-- Read Elements From Semantic Model 'visits_source'
-- Metric Time Dimension 'ds'
@@ -9,8 +9,8 @@ FROM (
-- Aggregate Measures
SELECT
SUM(1) AS visits
- FROM ***************************.fct_visits visits_source_src_28011
-) subq_18
+ FROM ***************************.fct_visits visits_source_src_28000
+) subq_27
CROSS JOIN (
-- Find conversions for user within the range of 7 day
-- Pass Only Elements: ['buys',]
@@ -20,11 +20,11 @@ CROSS JOIN (
FROM (
-- Dedupe the fanout with mf_internal_uuid in the conversion data set
SELECT DISTINCT
- first_value(subq_21.visits) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
- , first_value(subq_21.ds__day) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
- , first_value(subq_21.user) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
- , subq_24.mf_internal_uuid AS mf_internal_uuid
- , subq_24.buys AS buys
+ first_value(subq_30.visits) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
+ , first_value(subq_30.ds__day) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
+ , first_value(subq_30.user) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
+ , subq_33.mf_internal_uuid AS mf_internal_uuid
+ , subq_33.buys AS buys
FROM (
-- Read Elements From Semantic Model 'visits_source'
-- Metric Time Dimension 'ds'
@@ -33,8 +33,8 @@ CROSS JOIN (
DATE_TRUNC('day', ds) AS ds__day
, user_id AS user
, 1 AS visits
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_21
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_30
INNER JOIN (
-- Read Elements From Semantic Model 'buys_source'
-- Metric Time Dimension 'ds'
@@ -44,17 +44,17 @@ CROSS JOIN (
, user_id AS user
, 1 AS buys
, GEN_RANDOM_UUID() AS mf_internal_uuid
- FROM ***************************.fct_buys buys_source_src_28002
- ) subq_24
+ FROM ***************************.fct_buys buys_source_src_28000
+ ) subq_33
ON
(
- subq_21.user = subq_24.user
+ subq_30.user = subq_33.user
) AND (
(
- subq_21.ds__day <= subq_24.ds__day
+ subq_30.ds__day <= subq_33.ds__day
) AND (
- subq_21.ds__day > subq_24.ds__day - INTERVAL 7 day
+ subq_30.ds__day > subq_33.ds__day - INTERVAL 7 day
)
)
- ) subq_25
-) subq_28
+ ) subq_34
+) subq_37
diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/DuckDB/test_conversion_rate_with_window__plan0.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/DuckDB/test_conversion_rate_with_window__plan0.sql
index 9076e7b4f8..82a7510472 100644
--- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/DuckDB/test_conversion_rate_with_window__plan0.sql
+++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/DuckDB/test_conversion_rate_with_window__plan0.sql
@@ -1,376 +1,376 @@
-- Compute Metrics via Expressions
SELECT
- subq_14.metric_time__day
- , subq_14.visit__referrer_id
- , CAST(subq_14.buys AS DOUBLE) / CAST(NULLIF(subq_14.visits, 0) AS DOUBLE) AS visit_buy_conversion_rate_7days
+ subq_23.metric_time__day
+ , subq_23.visit__referrer_id
+ , CAST(subq_23.buys AS DOUBLE) / CAST(NULLIF(subq_23.visits, 0) AS DOUBLE) AS visit_buy_conversion_rate_7days
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_3.metric_time__day, subq_13.metric_time__day) AS metric_time__day
- , COALESCE(subq_3.visit__referrer_id, subq_13.visit__referrer_id) AS visit__referrer_id
- , MAX(subq_3.visits) AS visits
- , MAX(subq_13.buys) AS buys
+ COALESCE(subq_12.metric_time__day, subq_22.metric_time__day) AS metric_time__day
+ , COALESCE(subq_12.visit__referrer_id, subq_22.visit__referrer_id) AS visit__referrer_id
+ , MAX(subq_12.visits) AS visits
+ , MAX(subq_22.buys) AS buys
FROM (
-- Aggregate Measures
SELECT
- subq_2.metric_time__day
- , subq_2.visit__referrer_id
- , SUM(subq_2.visits) AS visits
+ subq_11.metric_time__day
+ , subq_11.visit__referrer_id
+ , SUM(subq_11.visits) AS visits
FROM (
-- Pass Only Elements: ['visits', 'visit__referrer_id', 'metric_time__day']
SELECT
- subq_1.metric_time__day
- , subq_1.visit__referrer_id
- , subq_1.visits
+ subq_10.metric_time__day
+ , subq_10.visit__referrer_id
+ , subq_10.visits
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.visit__ds__day
- , subq_0.visit__ds__week
- , subq_0.visit__ds__month
- , subq_0.visit__ds__quarter
- , subq_0.visit__ds__year
- , subq_0.visit__ds__extract_year
- , subq_0.visit__ds__extract_quarter
- , subq_0.visit__ds__extract_month
- , subq_0.visit__ds__extract_day
- , subq_0.visit__ds__extract_dow
- , subq_0.visit__ds__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.user
- , subq_0.session
- , subq_0.visit__user
- , subq_0.visit__session
- , subq_0.referrer_id
- , subq_0.visit__referrer_id
- , subq_0.visits
- , subq_0.visitors
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.visit__ds__day
+ , subq_9.visit__ds__week
+ , subq_9.visit__ds__month
+ , subq_9.visit__ds__quarter
+ , subq_9.visit__ds__year
+ , subq_9.visit__ds__extract_year
+ , subq_9.visit__ds__extract_quarter
+ , subq_9.visit__ds__extract_month
+ , subq_9.visit__ds__extract_day
+ , subq_9.visit__ds__extract_dow
+ , subq_9.visit__ds__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.user
+ , subq_9.session
+ , subq_9.visit__user
+ , subq_9.visit__session
+ , subq_9.referrer_id
+ , subq_9.visit__referrer_id
+ , subq_9.visits
+ , subq_9.visitors
FROM (
-- Read Elements From Semantic Model 'visits_source'
SELECT
1 AS visits
- , visits_source_src_28011.user_id AS visitors
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day
- , EXTRACT(isodow FROM visits_source_src_28011.ds) AS ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy
- , visits_source_src_28011.referrer_id
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day
- , EXTRACT(isodow FROM visits_source_src_28011.ds) AS visit__ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy
- , visits_source_src_28011.referrer_id AS visit__referrer_id
- , visits_source_src_28011.user_id AS user
- , visits_source_src_28011.session_id AS session
- , visits_source_src_28011.user_id AS visit__user
- , visits_source_src_28011.session_id AS visit__session
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_0
- ) subq_1
- ) subq_2
+ , visits_source_src_28000.user_id AS visitors
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS ds__extract_day
+ , EXTRACT(isodow FROM visits_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS ds__extract_doy
+ , visits_source_src_28000.referrer_id
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS visit__ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS visit__ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS visit__ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS visit__ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS visit__ds__extract_day
+ , EXTRACT(isodow FROM visits_source_src_28000.ds) AS visit__ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS visit__ds__extract_doy
+ , visits_source_src_28000.referrer_id AS visit__referrer_id
+ , visits_source_src_28000.user_id AS user
+ , visits_source_src_28000.session_id AS session
+ , visits_source_src_28000.user_id AS visit__user
+ , visits_source_src_28000.session_id AS visit__session
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
GROUP BY
- subq_2.metric_time__day
- , subq_2.visit__referrer_id
- ) subq_3
+ subq_11.metric_time__day
+ , subq_11.visit__referrer_id
+ ) subq_12
FULL OUTER JOIN (
-- Aggregate Measures
SELECT
- subq_12.metric_time__day
- , subq_12.visit__referrer_id
- , SUM(subq_12.buys) AS buys
+ subq_21.metric_time__day
+ , subq_21.visit__referrer_id
+ , SUM(subq_21.buys) AS buys
FROM (
-- Pass Only Elements: ['buys', 'visit__referrer_id', 'metric_time__day']
SELECT
- subq_11.metric_time__day
- , subq_11.visit__referrer_id
- , subq_11.buys
+ subq_20.metric_time__day
+ , subq_20.visit__referrer_id
+ , subq_20.buys
FROM (
-- Find conversions for user within the range of 7 day
SELECT
- subq_10.ds__day
- , subq_10.metric_time__day
- , subq_10.user
- , subq_10.visit__referrer_id
- , subq_10.buys
- , subq_10.visits
+ subq_19.ds__day
+ , subq_19.metric_time__day
+ , subq_19.user
+ , subq_19.visit__referrer_id
+ , subq_19.buys
+ , subq_19.visits
FROM (
-- Dedupe the fanout with mf_internal_uuid in the conversion data set
SELECT DISTINCT
- first_value(subq_6.visits) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
- , first_value(subq_6.visit__referrer_id) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visit__referrer_id
- , first_value(subq_6.ds__day) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
- , first_value(subq_6.metric_time__day) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS metric_time__day
- , first_value(subq_6.user) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
- , subq_9.mf_internal_uuid AS mf_internal_uuid
- , subq_9.buys AS buys
+ first_value(subq_15.visits) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
+ , first_value(subq_15.visit__referrer_id) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visit__referrer_id
+ , first_value(subq_15.ds__day) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
+ , first_value(subq_15.metric_time__day) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS metric_time__day
+ , first_value(subq_15.user) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
+ , subq_18.mf_internal_uuid AS mf_internal_uuid
+ , subq_18.buys AS buys
FROM (
-- Pass Only Elements: ['visits', 'visit__referrer_id', 'ds__day', 'metric_time__day', 'user']
SELECT
- subq_5.ds__day
- , subq_5.metric_time__day
- , subq_5.user
- , subq_5.visit__referrer_id
- , subq_5.visits
+ subq_14.ds__day
+ , subq_14.metric_time__day
+ , subq_14.user
+ , subq_14.visit__referrer_id
+ , subq_14.visits
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_4.ds__day
- , subq_4.ds__week
- , subq_4.ds__month
- , subq_4.ds__quarter
- , subq_4.ds__year
- , subq_4.ds__extract_year
- , subq_4.ds__extract_quarter
- , subq_4.ds__extract_month
- , subq_4.ds__extract_day
- , subq_4.ds__extract_dow
- , subq_4.ds__extract_doy
- , subq_4.visit__ds__day
- , subq_4.visit__ds__week
- , subq_4.visit__ds__month
- , subq_4.visit__ds__quarter
- , subq_4.visit__ds__year
- , subq_4.visit__ds__extract_year
- , subq_4.visit__ds__extract_quarter
- , subq_4.visit__ds__extract_month
- , subq_4.visit__ds__extract_day
- , subq_4.visit__ds__extract_dow
- , subq_4.visit__ds__extract_doy
- , subq_4.ds__day AS metric_time__day
- , subq_4.ds__week AS metric_time__week
- , subq_4.ds__month AS metric_time__month
- , subq_4.ds__quarter AS metric_time__quarter
- , subq_4.ds__year AS metric_time__year
- , subq_4.ds__extract_year AS metric_time__extract_year
- , subq_4.ds__extract_quarter AS metric_time__extract_quarter
- , subq_4.ds__extract_month AS metric_time__extract_month
- , subq_4.ds__extract_day AS metric_time__extract_day
- , subq_4.ds__extract_dow AS metric_time__extract_dow
- , subq_4.ds__extract_doy AS metric_time__extract_doy
- , subq_4.user
- , subq_4.session
- , subq_4.visit__user
- , subq_4.visit__session
- , subq_4.referrer_id
- , subq_4.visit__referrer_id
- , subq_4.visits
- , subq_4.visitors
+ subq_13.ds__day
+ , subq_13.ds__week
+ , subq_13.ds__month
+ , subq_13.ds__quarter
+ , subq_13.ds__year
+ , subq_13.ds__extract_year
+ , subq_13.ds__extract_quarter
+ , subq_13.ds__extract_month
+ , subq_13.ds__extract_day
+ , subq_13.ds__extract_dow
+ , subq_13.ds__extract_doy
+ , subq_13.visit__ds__day
+ , subq_13.visit__ds__week
+ , subq_13.visit__ds__month
+ , subq_13.visit__ds__quarter
+ , subq_13.visit__ds__year
+ , subq_13.visit__ds__extract_year
+ , subq_13.visit__ds__extract_quarter
+ , subq_13.visit__ds__extract_month
+ , subq_13.visit__ds__extract_day
+ , subq_13.visit__ds__extract_dow
+ , subq_13.visit__ds__extract_doy
+ , subq_13.ds__day AS metric_time__day
+ , subq_13.ds__week AS metric_time__week
+ , subq_13.ds__month AS metric_time__month
+ , subq_13.ds__quarter AS metric_time__quarter
+ , subq_13.ds__year AS metric_time__year
+ , subq_13.ds__extract_year AS metric_time__extract_year
+ , subq_13.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_13.ds__extract_month AS metric_time__extract_month
+ , subq_13.ds__extract_day AS metric_time__extract_day
+ , subq_13.ds__extract_dow AS metric_time__extract_dow
+ , subq_13.ds__extract_doy AS metric_time__extract_doy
+ , subq_13.user
+ , subq_13.session
+ , subq_13.visit__user
+ , subq_13.visit__session
+ , subq_13.referrer_id
+ , subq_13.visit__referrer_id
+ , subq_13.visits
+ , subq_13.visitors
FROM (
-- Read Elements From Semantic Model 'visits_source'
SELECT
1 AS visits
- , visits_source_src_28011.user_id AS visitors
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day
- , EXTRACT(isodow FROM visits_source_src_28011.ds) AS ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy
- , visits_source_src_28011.referrer_id
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day
- , EXTRACT(isodow FROM visits_source_src_28011.ds) AS visit__ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy
- , visits_source_src_28011.referrer_id AS visit__referrer_id
- , visits_source_src_28011.user_id AS user
- , visits_source_src_28011.session_id AS session
- , visits_source_src_28011.user_id AS visit__user
- , visits_source_src_28011.session_id AS visit__session
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_4
- ) subq_5
- ) subq_6
+ , visits_source_src_28000.user_id AS visitors
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS ds__extract_day
+ , EXTRACT(isodow FROM visits_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS ds__extract_doy
+ , visits_source_src_28000.referrer_id
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS visit__ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS visit__ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS visit__ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS visit__ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS visit__ds__extract_day
+ , EXTRACT(isodow FROM visits_source_src_28000.ds) AS visit__ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS visit__ds__extract_doy
+ , visits_source_src_28000.referrer_id AS visit__referrer_id
+ , visits_source_src_28000.user_id AS user
+ , visits_source_src_28000.session_id AS session
+ , visits_source_src_28000.user_id AS visit__user
+ , visits_source_src_28000.session_id AS visit__session
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_13
+ ) subq_14
+ ) subq_15
INNER JOIN (
-- Add column with generated UUID
SELECT
- subq_8.ds__day
- , subq_8.ds__week
- , subq_8.ds__month
- , subq_8.ds__quarter
- , subq_8.ds__year
- , subq_8.ds__extract_year
- , subq_8.ds__extract_quarter
- , subq_8.ds__extract_month
- , subq_8.ds__extract_day
- , subq_8.ds__extract_dow
- , subq_8.ds__extract_doy
- , subq_8.buy__ds__day
- , subq_8.buy__ds__week
- , subq_8.buy__ds__month
- , subq_8.buy__ds__quarter
- , subq_8.buy__ds__year
- , subq_8.buy__ds__extract_year
- , subq_8.buy__ds__extract_quarter
- , subq_8.buy__ds__extract_month
- , subq_8.buy__ds__extract_day
- , subq_8.buy__ds__extract_dow
- , subq_8.buy__ds__extract_doy
- , subq_8.metric_time__day
- , subq_8.metric_time__week
- , subq_8.metric_time__month
- , subq_8.metric_time__quarter
- , subq_8.metric_time__year
- , subq_8.metric_time__extract_year
- , subq_8.metric_time__extract_quarter
- , subq_8.metric_time__extract_month
- , subq_8.metric_time__extract_day
- , subq_8.metric_time__extract_dow
- , subq_8.metric_time__extract_doy
- , subq_8.user
- , subq_8.session_id
- , subq_8.buy__user
- , subq_8.buy__session_id
- , subq_8.buys
- , subq_8.buyers
+ subq_17.ds__day
+ , subq_17.ds__week
+ , subq_17.ds__month
+ , subq_17.ds__quarter
+ , subq_17.ds__year
+ , subq_17.ds__extract_year
+ , subq_17.ds__extract_quarter
+ , subq_17.ds__extract_month
+ , subq_17.ds__extract_day
+ , subq_17.ds__extract_dow
+ , subq_17.ds__extract_doy
+ , subq_17.buy__ds__day
+ , subq_17.buy__ds__week
+ , subq_17.buy__ds__month
+ , subq_17.buy__ds__quarter
+ , subq_17.buy__ds__year
+ , subq_17.buy__ds__extract_year
+ , subq_17.buy__ds__extract_quarter
+ , subq_17.buy__ds__extract_month
+ , subq_17.buy__ds__extract_day
+ , subq_17.buy__ds__extract_dow
+ , subq_17.buy__ds__extract_doy
+ , subq_17.metric_time__day
+ , subq_17.metric_time__week
+ , subq_17.metric_time__month
+ , subq_17.metric_time__quarter
+ , subq_17.metric_time__year
+ , subq_17.metric_time__extract_year
+ , subq_17.metric_time__extract_quarter
+ , subq_17.metric_time__extract_month
+ , subq_17.metric_time__extract_day
+ , subq_17.metric_time__extract_dow
+ , subq_17.metric_time__extract_doy
+ , subq_17.user
+ , subq_17.session_id
+ , subq_17.buy__user
+ , subq_17.buy__session_id
+ , subq_17.buys
+ , subq_17.buyers
, GEN_RANDOM_UUID() AS mf_internal_uuid
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_7.ds__day
- , subq_7.ds__week
- , subq_7.ds__month
- , subq_7.ds__quarter
- , subq_7.ds__year
- , subq_7.ds__extract_year
- , subq_7.ds__extract_quarter
- , subq_7.ds__extract_month
- , subq_7.ds__extract_day
- , subq_7.ds__extract_dow
- , subq_7.ds__extract_doy
- , subq_7.buy__ds__day
- , subq_7.buy__ds__week
- , subq_7.buy__ds__month
- , subq_7.buy__ds__quarter
- , subq_7.buy__ds__year
- , subq_7.buy__ds__extract_year
- , subq_7.buy__ds__extract_quarter
- , subq_7.buy__ds__extract_month
- , subq_7.buy__ds__extract_day
- , subq_7.buy__ds__extract_dow
- , subq_7.buy__ds__extract_doy
- , subq_7.ds__day AS metric_time__day
- , subq_7.ds__week AS metric_time__week
- , subq_7.ds__month AS metric_time__month
- , subq_7.ds__quarter AS metric_time__quarter
- , subq_7.ds__year AS metric_time__year
- , subq_7.ds__extract_year AS metric_time__extract_year
- , subq_7.ds__extract_quarter AS metric_time__extract_quarter
- , subq_7.ds__extract_month AS metric_time__extract_month
- , subq_7.ds__extract_day AS metric_time__extract_day
- , subq_7.ds__extract_dow AS metric_time__extract_dow
- , subq_7.ds__extract_doy AS metric_time__extract_doy
- , subq_7.user
- , subq_7.session_id
- , subq_7.buy__user
- , subq_7.buy__session_id
- , subq_7.buys
- , subq_7.buyers
+ subq_16.ds__day
+ , subq_16.ds__week
+ , subq_16.ds__month
+ , subq_16.ds__quarter
+ , subq_16.ds__year
+ , subq_16.ds__extract_year
+ , subq_16.ds__extract_quarter
+ , subq_16.ds__extract_month
+ , subq_16.ds__extract_day
+ , subq_16.ds__extract_dow
+ , subq_16.ds__extract_doy
+ , subq_16.buy__ds__day
+ , subq_16.buy__ds__week
+ , subq_16.buy__ds__month
+ , subq_16.buy__ds__quarter
+ , subq_16.buy__ds__year
+ , subq_16.buy__ds__extract_year
+ , subq_16.buy__ds__extract_quarter
+ , subq_16.buy__ds__extract_month
+ , subq_16.buy__ds__extract_day
+ , subq_16.buy__ds__extract_dow
+ , subq_16.buy__ds__extract_doy
+ , subq_16.ds__day AS metric_time__day
+ , subq_16.ds__week AS metric_time__week
+ , subq_16.ds__month AS metric_time__month
+ , subq_16.ds__quarter AS metric_time__quarter
+ , subq_16.ds__year AS metric_time__year
+ , subq_16.ds__extract_year AS metric_time__extract_year
+ , subq_16.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_16.ds__extract_month AS metric_time__extract_month
+ , subq_16.ds__extract_day AS metric_time__extract_day
+ , subq_16.ds__extract_dow AS metric_time__extract_dow
+ , subq_16.ds__extract_doy AS metric_time__extract_doy
+ , subq_16.user
+ , subq_16.session_id
+ , subq_16.buy__user
+ , subq_16.buy__session_id
+ , subq_16.buys
+ , subq_16.buyers
FROM (
-- Read Elements From Semantic Model 'buys_source'
SELECT
1 AS buys
- , buys_source_src_28002.user_id AS buyers
- , DATE_TRUNC('day', buys_source_src_28002.ds) AS ds__day
- , DATE_TRUNC('week', buys_source_src_28002.ds) AS ds__week
- , DATE_TRUNC('month', buys_source_src_28002.ds) AS ds__month
- , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS ds__quarter
- , DATE_TRUNC('year', buys_source_src_28002.ds) AS ds__year
- , EXTRACT(year FROM buys_source_src_28002.ds) AS ds__extract_year
- , EXTRACT(quarter FROM buys_source_src_28002.ds) AS ds__extract_quarter
- , EXTRACT(month FROM buys_source_src_28002.ds) AS ds__extract_month
- , EXTRACT(day FROM buys_source_src_28002.ds) AS ds__extract_day
- , EXTRACT(isodow FROM buys_source_src_28002.ds) AS ds__extract_dow
- , EXTRACT(doy FROM buys_source_src_28002.ds) AS ds__extract_doy
- , DATE_TRUNC('day', buys_source_src_28002.ds) AS buy__ds__day
- , DATE_TRUNC('week', buys_source_src_28002.ds) AS buy__ds__week
- , DATE_TRUNC('month', buys_source_src_28002.ds) AS buy__ds__month
- , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS buy__ds__quarter
- , DATE_TRUNC('year', buys_source_src_28002.ds) AS buy__ds__year
- , EXTRACT(year FROM buys_source_src_28002.ds) AS buy__ds__extract_year
- , EXTRACT(quarter FROM buys_source_src_28002.ds) AS buy__ds__extract_quarter
- , EXTRACT(month FROM buys_source_src_28002.ds) AS buy__ds__extract_month
- , EXTRACT(day FROM buys_source_src_28002.ds) AS buy__ds__extract_day
- , EXTRACT(isodow FROM buys_source_src_28002.ds) AS buy__ds__extract_dow
- , EXTRACT(doy FROM buys_source_src_28002.ds) AS buy__ds__extract_doy
- , buys_source_src_28002.user_id AS user
- , buys_source_src_28002.session_id
- , buys_source_src_28002.user_id AS buy__user
- , buys_source_src_28002.session_id AS buy__session_id
- FROM ***************************.fct_buys buys_source_src_28002
- ) subq_7
- ) subq_8
- ) subq_9
+ , buys_source_src_28000.user_id AS buyers
+ , DATE_TRUNC('day', buys_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', buys_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', buys_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', buys_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', buys_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM buys_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM buys_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', buys_source_src_28000.ds) AS buy__ds__day
+ , DATE_TRUNC('week', buys_source_src_28000.ds) AS buy__ds__week
+ , DATE_TRUNC('month', buys_source_src_28000.ds) AS buy__ds__month
+ , DATE_TRUNC('quarter', buys_source_src_28000.ds) AS buy__ds__quarter
+ , DATE_TRUNC('year', buys_source_src_28000.ds) 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
+ , EXTRACT(day FROM buys_source_src_28000.ds) AS buy__ds__extract_day
+ , EXTRACT(isodow FROM buys_source_src_28000.ds) AS buy__ds__extract_dow
+ , EXTRACT(doy FROM buys_source_src_28000.ds) AS buy__ds__extract_doy
+ , buys_source_src_28000.user_id AS user
+ , buys_source_src_28000.session_id
+ , buys_source_src_28000.user_id AS buy__user
+ , buys_source_src_28000.session_id AS buy__session_id
+ FROM ***************************.fct_buys buys_source_src_28000
+ ) subq_16
+ ) subq_17
+ ) subq_18
ON
(
- subq_6.user = subq_9.user
+ subq_15.user = subq_18.user
) AND (
(
- subq_6.ds__day <= subq_9.ds__day
+ subq_15.ds__day <= subq_18.ds__day
) AND (
- subq_6.ds__day > subq_9.ds__day - INTERVAL 7 day
+ subq_15.ds__day > subq_18.ds__day - INTERVAL 7 day
)
)
- ) subq_10
- ) subq_11
- ) subq_12
+ ) subq_19
+ ) subq_20
+ ) subq_21
GROUP BY
- subq_12.metric_time__day
- , subq_12.visit__referrer_id
- ) subq_13
+ subq_21.metric_time__day
+ , subq_21.visit__referrer_id
+ ) subq_22
ON
(
- subq_3.visit__referrer_id = subq_13.visit__referrer_id
+ subq_12.visit__referrer_id = subq_22.visit__referrer_id
) AND (
- subq_3.metric_time__day = subq_13.metric_time__day
+ subq_12.metric_time__day = subq_22.metric_time__day
)
GROUP BY
- COALESCE(subq_3.metric_time__day, subq_13.metric_time__day)
- , COALESCE(subq_3.visit__referrer_id, subq_13.visit__referrer_id)
-) subq_14
+ COALESCE(subq_12.metric_time__day, subq_22.metric_time__day)
+ , COALESCE(subq_12.visit__referrer_id, subq_22.visit__referrer_id)
+) subq_23
diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/DuckDB/test_conversion_rate_with_window__plan0_optimized.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/DuckDB/test_conversion_rate_with_window__plan0_optimized.sql
index 3326904f31..37da344ff8 100644
--- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/DuckDB/test_conversion_rate_with_window__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/DuckDB/test_conversion_rate_with_window__plan0_optimized.sql
@@ -6,10 +6,10 @@ SELECT
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_18.metric_time__day, subq_28.metric_time__day) AS metric_time__day
- , COALESCE(subq_18.visit__referrer_id, subq_28.visit__referrer_id) AS visit__referrer_id
- , MAX(subq_18.visits) AS visits
- , MAX(subq_28.buys) AS buys
+ COALESCE(subq_27.metric_time__day, subq_37.metric_time__day) AS metric_time__day
+ , COALESCE(subq_27.visit__referrer_id, subq_37.visit__referrer_id) AS visit__referrer_id
+ , MAX(subq_27.visits) AS visits
+ , MAX(subq_37.buys) AS buys
FROM (
-- Aggregate Measures
SELECT
@@ -24,12 +24,12 @@ FROM (
DATE_TRUNC('day', ds) AS metric_time__day
, referrer_id AS visit__referrer_id
, 1 AS visits
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_17
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_26
GROUP BY
metric_time__day
, visit__referrer_id
- ) subq_18
+ ) subq_27
FULL OUTER JOIN (
-- Find conversions for user within the range of 7 day
-- Pass Only Elements: ['buys', 'visit__referrer_id', 'metric_time__day']
@@ -41,13 +41,13 @@ FROM (
FROM (
-- Dedupe the fanout with mf_internal_uuid in the conversion data set
SELECT DISTINCT
- first_value(subq_21.visits) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
- , first_value(subq_21.visit__referrer_id) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visit__referrer_id
- , first_value(subq_21.ds__day) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
- , first_value(subq_21.metric_time__day) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS metric_time__day
- , first_value(subq_21.user) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
- , subq_24.mf_internal_uuid AS mf_internal_uuid
- , subq_24.buys AS buys
+ first_value(subq_30.visits) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
+ , first_value(subq_30.visit__referrer_id) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visit__referrer_id
+ , first_value(subq_30.ds__day) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
+ , first_value(subq_30.metric_time__day) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS metric_time__day
+ , first_value(subq_30.user) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
+ , subq_33.mf_internal_uuid AS mf_internal_uuid
+ , subq_33.buys AS buys
FROM (
-- Read Elements From Semantic Model 'visits_source'
-- Metric Time Dimension 'ds'
@@ -58,8 +58,8 @@ FROM (
, user_id AS user
, referrer_id AS visit__referrer_id
, 1 AS visits
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_21
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_30
INNER JOIN (
-- Read Elements From Semantic Model 'buys_source'
-- Metric Time Dimension 'ds'
@@ -69,30 +69,30 @@ FROM (
, user_id AS user
, 1 AS buys
, GEN_RANDOM_UUID() AS mf_internal_uuid
- FROM ***************************.fct_buys buys_source_src_28002
- ) subq_24
+ FROM ***************************.fct_buys buys_source_src_28000
+ ) subq_33
ON
(
- subq_21.user = subq_24.user
+ subq_30.user = subq_33.user
) AND (
(
- subq_21.ds__day <= subq_24.ds__day
+ subq_30.ds__day <= subq_33.ds__day
) AND (
- subq_21.ds__day > subq_24.ds__day - INTERVAL 7 day
+ subq_30.ds__day > subq_33.ds__day - INTERVAL 7 day
)
)
- ) subq_25
+ ) subq_34
GROUP BY
metric_time__day
, visit__referrer_id
- ) subq_28
+ ) subq_37
ON
(
- subq_18.visit__referrer_id = subq_28.visit__referrer_id
+ subq_27.visit__referrer_id = subq_37.visit__referrer_id
) AND (
- subq_18.metric_time__day = subq_28.metric_time__day
+ subq_27.metric_time__day = subq_37.metric_time__day
)
GROUP BY
- COALESCE(subq_18.metric_time__day, subq_28.metric_time__day)
- , COALESCE(subq_18.visit__referrer_id, subq_28.visit__referrer_id)
-) subq_29
+ COALESCE(subq_27.metric_time__day, subq_37.metric_time__day)
+ , COALESCE(subq_27.visit__referrer_id, subq_37.visit__referrer_id)
+) subq_38
diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Postgres/test_conversion_count_with_no_group_by__plan0.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Postgres/test_conversion_count_with_no_group_by__plan0.sql
index cbcb901362..bd032d14dd 100644
--- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Postgres/test_conversion_count_with_no_group_by__plan0.sql
+++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Postgres/test_conversion_count_with_no_group_by__plan0.sql
@@ -1,343 +1,343 @@
-- Compute Metrics via Expressions
SELECT
- subq_14.buys AS visit_buy_conversions
+ subq_23.buys AS visit_buy_conversions
FROM (
-- Combine Aggregated Outputs
SELECT
- MAX(subq_3.visits) AS visits
- , COALESCE(MAX(subq_13.buys), 0) AS buys
+ MAX(subq_12.visits) AS visits
+ , COALESCE(MAX(subq_22.buys), 0) AS buys
FROM (
-- Aggregate Measures
SELECT
- SUM(subq_2.visits) AS visits
+ SUM(subq_11.visits) AS visits
FROM (
-- Pass Only Elements: ['visits',]
SELECT
- subq_1.visits
+ subq_10.visits
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.visit__ds__day
- , subq_0.visit__ds__week
- , subq_0.visit__ds__month
- , subq_0.visit__ds__quarter
- , subq_0.visit__ds__year
- , subq_0.visit__ds__extract_year
- , subq_0.visit__ds__extract_quarter
- , subq_0.visit__ds__extract_month
- , subq_0.visit__ds__extract_day
- , subq_0.visit__ds__extract_dow
- , subq_0.visit__ds__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.user
- , subq_0.session
- , subq_0.visit__user
- , subq_0.visit__session
- , subq_0.referrer_id
- , subq_0.visit__referrer_id
- , subq_0.visits
- , subq_0.visitors
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.visit__ds__day
+ , subq_9.visit__ds__week
+ , subq_9.visit__ds__month
+ , subq_9.visit__ds__quarter
+ , subq_9.visit__ds__year
+ , subq_9.visit__ds__extract_year
+ , subq_9.visit__ds__extract_quarter
+ , subq_9.visit__ds__extract_month
+ , subq_9.visit__ds__extract_day
+ , subq_9.visit__ds__extract_dow
+ , subq_9.visit__ds__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.user
+ , subq_9.session
+ , subq_9.visit__user
+ , subq_9.visit__session
+ , subq_9.referrer_id
+ , subq_9.visit__referrer_id
+ , subq_9.visits
+ , subq_9.visitors
FROM (
-- Read Elements From Semantic Model 'visits_source'
SELECT
1 AS visits
- , visits_source_src_28011.user_id AS visitors
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day
- , EXTRACT(isodow FROM visits_source_src_28011.ds) AS ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy
- , visits_source_src_28011.referrer_id
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day
- , EXTRACT(isodow FROM visits_source_src_28011.ds) AS visit__ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy
- , visits_source_src_28011.referrer_id AS visit__referrer_id
- , visits_source_src_28011.user_id AS user
- , visits_source_src_28011.session_id AS session
- , visits_source_src_28011.user_id AS visit__user
- , visits_source_src_28011.session_id AS visit__session
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_0
- ) subq_1
- ) subq_2
- ) subq_3
+ , visits_source_src_28000.user_id AS visitors
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS ds__extract_day
+ , EXTRACT(isodow FROM visits_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS ds__extract_doy
+ , visits_source_src_28000.referrer_id
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS visit__ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS visit__ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS visit__ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS visit__ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS visit__ds__extract_day
+ , EXTRACT(isodow FROM visits_source_src_28000.ds) AS visit__ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS visit__ds__extract_doy
+ , visits_source_src_28000.referrer_id AS visit__referrer_id
+ , visits_source_src_28000.user_id AS user
+ , visits_source_src_28000.session_id AS session
+ , visits_source_src_28000.user_id AS visit__user
+ , visits_source_src_28000.session_id AS visit__session
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
+ ) subq_12
CROSS JOIN (
-- Aggregate Measures
SELECT
- SUM(subq_12.buys) AS buys
+ SUM(subq_21.buys) AS buys
FROM (
-- Pass Only Elements: ['buys',]
SELECT
- subq_11.buys
+ subq_20.buys
FROM (
-- Find conversions for user within the range of 7 day
SELECT
- subq_10.ds__day
- , subq_10.user
- , subq_10.buys
- , subq_10.visits
+ subq_19.ds__day
+ , subq_19.user
+ , subq_19.buys
+ , subq_19.visits
FROM (
-- Dedupe the fanout with mf_internal_uuid in the conversion data set
SELECT DISTINCT
- first_value(subq_6.visits) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
- , first_value(subq_6.ds__day) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
- , first_value(subq_6.user) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
- , subq_9.mf_internal_uuid AS mf_internal_uuid
- , subq_9.buys AS buys
+ first_value(subq_15.visits) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
+ , first_value(subq_15.ds__day) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
+ , first_value(subq_15.user) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
+ , subq_18.mf_internal_uuid AS mf_internal_uuid
+ , subq_18.buys AS buys
FROM (
-- Pass Only Elements: ['visits', 'ds__day', 'user']
SELECT
- subq_5.ds__day
- , subq_5.user
- , subq_5.visits
+ subq_14.ds__day
+ , subq_14.user
+ , subq_14.visits
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_4.ds__day
- , subq_4.ds__week
- , subq_4.ds__month
- , subq_4.ds__quarter
- , subq_4.ds__year
- , subq_4.ds__extract_year
- , subq_4.ds__extract_quarter
- , subq_4.ds__extract_month
- , subq_4.ds__extract_day
- , subq_4.ds__extract_dow
- , subq_4.ds__extract_doy
- , subq_4.visit__ds__day
- , subq_4.visit__ds__week
- , subq_4.visit__ds__month
- , subq_4.visit__ds__quarter
- , subq_4.visit__ds__year
- , subq_4.visit__ds__extract_year
- , subq_4.visit__ds__extract_quarter
- , subq_4.visit__ds__extract_month
- , subq_4.visit__ds__extract_day
- , subq_4.visit__ds__extract_dow
- , subq_4.visit__ds__extract_doy
- , subq_4.ds__day AS metric_time__day
- , subq_4.ds__week AS metric_time__week
- , subq_4.ds__month AS metric_time__month
- , subq_4.ds__quarter AS metric_time__quarter
- , subq_4.ds__year AS metric_time__year
- , subq_4.ds__extract_year AS metric_time__extract_year
- , subq_4.ds__extract_quarter AS metric_time__extract_quarter
- , subq_4.ds__extract_month AS metric_time__extract_month
- , subq_4.ds__extract_day AS metric_time__extract_day
- , subq_4.ds__extract_dow AS metric_time__extract_dow
- , subq_4.ds__extract_doy AS metric_time__extract_doy
- , subq_4.user
- , subq_4.session
- , subq_4.visit__user
- , subq_4.visit__session
- , subq_4.referrer_id
- , subq_4.visit__referrer_id
- , subq_4.visits
- , subq_4.visitors
+ subq_13.ds__day
+ , subq_13.ds__week
+ , subq_13.ds__month
+ , subq_13.ds__quarter
+ , subq_13.ds__year
+ , subq_13.ds__extract_year
+ , subq_13.ds__extract_quarter
+ , subq_13.ds__extract_month
+ , subq_13.ds__extract_day
+ , subq_13.ds__extract_dow
+ , subq_13.ds__extract_doy
+ , subq_13.visit__ds__day
+ , subq_13.visit__ds__week
+ , subq_13.visit__ds__month
+ , subq_13.visit__ds__quarter
+ , subq_13.visit__ds__year
+ , subq_13.visit__ds__extract_year
+ , subq_13.visit__ds__extract_quarter
+ , subq_13.visit__ds__extract_month
+ , subq_13.visit__ds__extract_day
+ , subq_13.visit__ds__extract_dow
+ , subq_13.visit__ds__extract_doy
+ , subq_13.ds__day AS metric_time__day
+ , subq_13.ds__week AS metric_time__week
+ , subq_13.ds__month AS metric_time__month
+ , subq_13.ds__quarter AS metric_time__quarter
+ , subq_13.ds__year AS metric_time__year
+ , subq_13.ds__extract_year AS metric_time__extract_year
+ , subq_13.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_13.ds__extract_month AS metric_time__extract_month
+ , subq_13.ds__extract_day AS metric_time__extract_day
+ , subq_13.ds__extract_dow AS metric_time__extract_dow
+ , subq_13.ds__extract_doy AS metric_time__extract_doy
+ , subq_13.user
+ , subq_13.session
+ , subq_13.visit__user
+ , subq_13.visit__session
+ , subq_13.referrer_id
+ , subq_13.visit__referrer_id
+ , subq_13.visits
+ , subq_13.visitors
FROM (
-- Read Elements From Semantic Model 'visits_source'
SELECT
1 AS visits
- , visits_source_src_28011.user_id AS visitors
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day
- , EXTRACT(isodow FROM visits_source_src_28011.ds) AS ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy
- , visits_source_src_28011.referrer_id
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day
- , EXTRACT(isodow FROM visits_source_src_28011.ds) AS visit__ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy
- , visits_source_src_28011.referrer_id AS visit__referrer_id
- , visits_source_src_28011.user_id AS user
- , visits_source_src_28011.session_id AS session
- , visits_source_src_28011.user_id AS visit__user
- , visits_source_src_28011.session_id AS visit__session
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_4
- ) subq_5
- ) subq_6
+ , visits_source_src_28000.user_id AS visitors
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS ds__extract_day
+ , EXTRACT(isodow FROM visits_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS ds__extract_doy
+ , visits_source_src_28000.referrer_id
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS visit__ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS visit__ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS visit__ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS visit__ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS visit__ds__extract_day
+ , EXTRACT(isodow FROM visits_source_src_28000.ds) AS visit__ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS visit__ds__extract_doy
+ , visits_source_src_28000.referrer_id AS visit__referrer_id
+ , visits_source_src_28000.user_id AS user
+ , visits_source_src_28000.session_id AS session
+ , visits_source_src_28000.user_id AS visit__user
+ , visits_source_src_28000.session_id AS visit__session
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_13
+ ) subq_14
+ ) subq_15
INNER JOIN (
-- Add column with generated UUID
SELECT
- subq_8.ds__day
- , subq_8.ds__week
- , subq_8.ds__month
- , subq_8.ds__quarter
- , subq_8.ds__year
- , subq_8.ds__extract_year
- , subq_8.ds__extract_quarter
- , subq_8.ds__extract_month
- , subq_8.ds__extract_day
- , subq_8.ds__extract_dow
- , subq_8.ds__extract_doy
- , subq_8.buy__ds__day
- , subq_8.buy__ds__week
- , subq_8.buy__ds__month
- , subq_8.buy__ds__quarter
- , subq_8.buy__ds__year
- , subq_8.buy__ds__extract_year
- , subq_8.buy__ds__extract_quarter
- , subq_8.buy__ds__extract_month
- , subq_8.buy__ds__extract_day
- , subq_8.buy__ds__extract_dow
- , subq_8.buy__ds__extract_doy
- , subq_8.metric_time__day
- , subq_8.metric_time__week
- , subq_8.metric_time__month
- , subq_8.metric_time__quarter
- , subq_8.metric_time__year
- , subq_8.metric_time__extract_year
- , subq_8.metric_time__extract_quarter
- , subq_8.metric_time__extract_month
- , subq_8.metric_time__extract_day
- , subq_8.metric_time__extract_dow
- , subq_8.metric_time__extract_doy
- , subq_8.user
- , subq_8.session_id
- , subq_8.buy__user
- , subq_8.buy__session_id
- , subq_8.buys
- , subq_8.buyers
+ subq_17.ds__day
+ , subq_17.ds__week
+ , subq_17.ds__month
+ , subq_17.ds__quarter
+ , subq_17.ds__year
+ , subq_17.ds__extract_year
+ , subq_17.ds__extract_quarter
+ , subq_17.ds__extract_month
+ , subq_17.ds__extract_day
+ , subq_17.ds__extract_dow
+ , subq_17.ds__extract_doy
+ , subq_17.buy__ds__day
+ , subq_17.buy__ds__week
+ , subq_17.buy__ds__month
+ , subq_17.buy__ds__quarter
+ , subq_17.buy__ds__year
+ , subq_17.buy__ds__extract_year
+ , subq_17.buy__ds__extract_quarter
+ , subq_17.buy__ds__extract_month
+ , subq_17.buy__ds__extract_day
+ , subq_17.buy__ds__extract_dow
+ , subq_17.buy__ds__extract_doy
+ , subq_17.metric_time__day
+ , subq_17.metric_time__week
+ , subq_17.metric_time__month
+ , subq_17.metric_time__quarter
+ , subq_17.metric_time__year
+ , subq_17.metric_time__extract_year
+ , subq_17.metric_time__extract_quarter
+ , subq_17.metric_time__extract_month
+ , subq_17.metric_time__extract_day
+ , subq_17.metric_time__extract_dow
+ , subq_17.metric_time__extract_doy
+ , subq_17.user
+ , subq_17.session_id
+ , subq_17.buy__user
+ , subq_17.buy__session_id
+ , subq_17.buys
+ , subq_17.buyers
, GEN_RANDOM_UUID() AS mf_internal_uuid
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_7.ds__day
- , subq_7.ds__week
- , subq_7.ds__month
- , subq_7.ds__quarter
- , subq_7.ds__year
- , subq_7.ds__extract_year
- , subq_7.ds__extract_quarter
- , subq_7.ds__extract_month
- , subq_7.ds__extract_day
- , subq_7.ds__extract_dow
- , subq_7.ds__extract_doy
- , subq_7.buy__ds__day
- , subq_7.buy__ds__week
- , subq_7.buy__ds__month
- , subq_7.buy__ds__quarter
- , subq_7.buy__ds__year
- , subq_7.buy__ds__extract_year
- , subq_7.buy__ds__extract_quarter
- , subq_7.buy__ds__extract_month
- , subq_7.buy__ds__extract_day
- , subq_7.buy__ds__extract_dow
- , subq_7.buy__ds__extract_doy
- , subq_7.ds__day AS metric_time__day
- , subq_7.ds__week AS metric_time__week
- , subq_7.ds__month AS metric_time__month
- , subq_7.ds__quarter AS metric_time__quarter
- , subq_7.ds__year AS metric_time__year
- , subq_7.ds__extract_year AS metric_time__extract_year
- , subq_7.ds__extract_quarter AS metric_time__extract_quarter
- , subq_7.ds__extract_month AS metric_time__extract_month
- , subq_7.ds__extract_day AS metric_time__extract_day
- , subq_7.ds__extract_dow AS metric_time__extract_dow
- , subq_7.ds__extract_doy AS metric_time__extract_doy
- , subq_7.user
- , subq_7.session_id
- , subq_7.buy__user
- , subq_7.buy__session_id
- , subq_7.buys
- , subq_7.buyers
+ subq_16.ds__day
+ , subq_16.ds__week
+ , subq_16.ds__month
+ , subq_16.ds__quarter
+ , subq_16.ds__year
+ , subq_16.ds__extract_year
+ , subq_16.ds__extract_quarter
+ , subq_16.ds__extract_month
+ , subq_16.ds__extract_day
+ , subq_16.ds__extract_dow
+ , subq_16.ds__extract_doy
+ , subq_16.buy__ds__day
+ , subq_16.buy__ds__week
+ , subq_16.buy__ds__month
+ , subq_16.buy__ds__quarter
+ , subq_16.buy__ds__year
+ , subq_16.buy__ds__extract_year
+ , subq_16.buy__ds__extract_quarter
+ , subq_16.buy__ds__extract_month
+ , subq_16.buy__ds__extract_day
+ , subq_16.buy__ds__extract_dow
+ , subq_16.buy__ds__extract_doy
+ , subq_16.ds__day AS metric_time__day
+ , subq_16.ds__week AS metric_time__week
+ , subq_16.ds__month AS metric_time__month
+ , subq_16.ds__quarter AS metric_time__quarter
+ , subq_16.ds__year AS metric_time__year
+ , subq_16.ds__extract_year AS metric_time__extract_year
+ , subq_16.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_16.ds__extract_month AS metric_time__extract_month
+ , subq_16.ds__extract_day AS metric_time__extract_day
+ , subq_16.ds__extract_dow AS metric_time__extract_dow
+ , subq_16.ds__extract_doy AS metric_time__extract_doy
+ , subq_16.user
+ , subq_16.session_id
+ , subq_16.buy__user
+ , subq_16.buy__session_id
+ , subq_16.buys
+ , subq_16.buyers
FROM (
-- Read Elements From Semantic Model 'buys_source'
SELECT
1 AS buys
- , buys_source_src_28002.user_id AS buyers
- , DATE_TRUNC('day', buys_source_src_28002.ds) AS ds__day
- , DATE_TRUNC('week', buys_source_src_28002.ds) AS ds__week
- , DATE_TRUNC('month', buys_source_src_28002.ds) AS ds__month
- , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS ds__quarter
- , DATE_TRUNC('year', buys_source_src_28002.ds) AS ds__year
- , EXTRACT(year FROM buys_source_src_28002.ds) AS ds__extract_year
- , EXTRACT(quarter FROM buys_source_src_28002.ds) AS ds__extract_quarter
- , EXTRACT(month FROM buys_source_src_28002.ds) AS ds__extract_month
- , EXTRACT(day FROM buys_source_src_28002.ds) AS ds__extract_day
- , EXTRACT(isodow FROM buys_source_src_28002.ds) AS ds__extract_dow
- , EXTRACT(doy FROM buys_source_src_28002.ds) AS ds__extract_doy
- , DATE_TRUNC('day', buys_source_src_28002.ds) AS buy__ds__day
- , DATE_TRUNC('week', buys_source_src_28002.ds) AS buy__ds__week
- , DATE_TRUNC('month', buys_source_src_28002.ds) AS buy__ds__month
- , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS buy__ds__quarter
- , DATE_TRUNC('year', buys_source_src_28002.ds) AS buy__ds__year
- , EXTRACT(year FROM buys_source_src_28002.ds) AS buy__ds__extract_year
- , EXTRACT(quarter FROM buys_source_src_28002.ds) AS buy__ds__extract_quarter
- , EXTRACT(month FROM buys_source_src_28002.ds) AS buy__ds__extract_month
- , EXTRACT(day FROM buys_source_src_28002.ds) AS buy__ds__extract_day
- , EXTRACT(isodow FROM buys_source_src_28002.ds) AS buy__ds__extract_dow
- , EXTRACT(doy FROM buys_source_src_28002.ds) AS buy__ds__extract_doy
- , buys_source_src_28002.user_id AS user
- , buys_source_src_28002.session_id
- , buys_source_src_28002.user_id AS buy__user
- , buys_source_src_28002.session_id AS buy__session_id
- FROM ***************************.fct_buys buys_source_src_28002
- ) subq_7
- ) subq_8
- ) subq_9
+ , buys_source_src_28000.user_id AS buyers
+ , DATE_TRUNC('day', buys_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', buys_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', buys_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', buys_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', buys_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM buys_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM buys_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', buys_source_src_28000.ds) AS buy__ds__day
+ , DATE_TRUNC('week', buys_source_src_28000.ds) AS buy__ds__week
+ , DATE_TRUNC('month', buys_source_src_28000.ds) AS buy__ds__month
+ , DATE_TRUNC('quarter', buys_source_src_28000.ds) AS buy__ds__quarter
+ , DATE_TRUNC('year', buys_source_src_28000.ds) 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
+ , EXTRACT(day FROM buys_source_src_28000.ds) AS buy__ds__extract_day
+ , EXTRACT(isodow FROM buys_source_src_28000.ds) AS buy__ds__extract_dow
+ , EXTRACT(doy FROM buys_source_src_28000.ds) AS buy__ds__extract_doy
+ , buys_source_src_28000.user_id AS user
+ , buys_source_src_28000.session_id
+ , buys_source_src_28000.user_id AS buy__user
+ , buys_source_src_28000.session_id AS buy__session_id
+ FROM ***************************.fct_buys buys_source_src_28000
+ ) subq_16
+ ) subq_17
+ ) subq_18
ON
(
- subq_6.user = subq_9.user
+ subq_15.user = subq_18.user
) AND (
(
- subq_6.ds__day <= subq_9.ds__day
+ subq_15.ds__day <= subq_18.ds__day
) AND (
- subq_6.ds__day > subq_9.ds__day - MAKE_INTERVAL(days => 7)
+ subq_15.ds__day > subq_18.ds__day - MAKE_INTERVAL(days => 7)
)
)
- ) subq_10
- ) subq_11
- ) subq_12
- ) subq_13
-) subq_14
+ ) subq_19
+ ) subq_20
+ ) subq_21
+ ) subq_22
+) subq_23
diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Postgres/test_conversion_count_with_no_group_by__plan0_optimized.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Postgres/test_conversion_count_with_no_group_by__plan0_optimized.sql
index 4d352843c1..4b4e6dbe47 100644
--- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Postgres/test_conversion_count_with_no_group_by__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Postgres/test_conversion_count_with_no_group_by__plan0_optimized.sql
@@ -1,7 +1,7 @@
-- Combine Aggregated Outputs
-- Compute Metrics via Expressions
SELECT
- COALESCE(MAX(subq_28.buys), 0) AS visit_buy_conversions
+ COALESCE(MAX(subq_37.buys), 0) AS visit_buy_conversions
FROM (
-- Read Elements From Semantic Model 'visits_source'
-- Metric Time Dimension 'ds'
@@ -9,8 +9,8 @@ FROM (
-- Aggregate Measures
SELECT
SUM(1) AS visits
- FROM ***************************.fct_visits visits_source_src_28011
-) subq_18
+ FROM ***************************.fct_visits visits_source_src_28000
+) subq_27
CROSS JOIN (
-- Find conversions for user within the range of 7 day
-- Pass Only Elements: ['buys',]
@@ -20,11 +20,11 @@ CROSS JOIN (
FROM (
-- Dedupe the fanout with mf_internal_uuid in the conversion data set
SELECT DISTINCT
- first_value(subq_21.visits) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
- , first_value(subq_21.ds__day) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
- , first_value(subq_21.user) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
- , subq_24.mf_internal_uuid AS mf_internal_uuid
- , subq_24.buys AS buys
+ first_value(subq_30.visits) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
+ , first_value(subq_30.ds__day) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
+ , first_value(subq_30.user) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
+ , subq_33.mf_internal_uuid AS mf_internal_uuid
+ , subq_33.buys AS buys
FROM (
-- Read Elements From Semantic Model 'visits_source'
-- Metric Time Dimension 'ds'
@@ -33,8 +33,8 @@ CROSS JOIN (
DATE_TRUNC('day', ds) AS ds__day
, user_id AS user
, 1 AS visits
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_21
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_30
INNER JOIN (
-- Read Elements From Semantic Model 'buys_source'
-- Metric Time Dimension 'ds'
@@ -44,17 +44,17 @@ CROSS JOIN (
, user_id AS user
, 1 AS buys
, GEN_RANDOM_UUID() AS mf_internal_uuid
- FROM ***************************.fct_buys buys_source_src_28002
- ) subq_24
+ FROM ***************************.fct_buys buys_source_src_28000
+ ) subq_33
ON
(
- subq_21.user = subq_24.user
+ subq_30.user = subq_33.user
) AND (
(
- subq_21.ds__day <= subq_24.ds__day
+ subq_30.ds__day <= subq_33.ds__day
) AND (
- subq_21.ds__day > subq_24.ds__day - MAKE_INTERVAL(days => 7)
+ subq_30.ds__day > subq_33.ds__day - MAKE_INTERVAL(days => 7)
)
)
- ) subq_25
-) subq_28
+ ) subq_34
+) subq_37
diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Postgres/test_conversion_rate__plan0.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Postgres/test_conversion_rate__plan0.sql
index bb7adec3fe..52506786a2 100644
--- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Postgres/test_conversion_rate__plan0.sql
+++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Postgres/test_conversion_rate__plan0.sql
@@ -1,352 +1,356 @@
-- Compute Metrics via Expressions
SELECT
- subq_14.visit__referrer_id
- , CAST(subq_14.buys AS DOUBLE PRECISION) / CAST(NULLIF(subq_14.visits, 0) AS DOUBLE PRECISION) AS visit_buy_conversion_rate
+ subq_23.visit__referrer_id
+ , CAST(subq_23.buys AS DOUBLE PRECISION) / CAST(NULLIF(subq_23.visits, 0) AS DOUBLE PRECISION) AS visit_buy_conversion_rate
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_3.visit__referrer_id, subq_13.visit__referrer_id) AS visit__referrer_id
- , MAX(subq_3.visits) AS visits
- , MAX(subq_13.buys) AS buys
+ COALESCE(subq_12.visit__referrer_id, subq_22.visit__referrer_id) AS visit__referrer_id
+ , MAX(subq_12.visits) AS visits
+ , MAX(subq_22.buys) AS buys
FROM (
-- Aggregate Measures
SELECT
- subq_2.visit__referrer_id
- , SUM(subq_2.visits) AS visits
+ subq_11.visit__referrer_id
+ , SUM(subq_11.visits) AS visits
FROM (
-- Pass Only Elements: ['visits', 'visit__referrer_id']
SELECT
- subq_1.visit__referrer_id
- , subq_1.visits
+ subq_10.visit__referrer_id
+ , subq_10.visits
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.visit__ds__day
- , subq_0.visit__ds__week
- , subq_0.visit__ds__month
- , subq_0.visit__ds__quarter
- , subq_0.visit__ds__year
- , subq_0.visit__ds__extract_year
- , subq_0.visit__ds__extract_quarter
- , subq_0.visit__ds__extract_month
- , subq_0.visit__ds__extract_day
- , subq_0.visit__ds__extract_dow
- , subq_0.visit__ds__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.user
- , subq_0.session
- , subq_0.visit__user
- , subq_0.visit__session
- , subq_0.referrer_id
- , subq_0.visit__referrer_id
- , subq_0.visits
- , subq_0.visitors
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.visit__ds__day
+ , subq_9.visit__ds__week
+ , subq_9.visit__ds__month
+ , subq_9.visit__ds__quarter
+ , subq_9.visit__ds__year
+ , subq_9.visit__ds__extract_year
+ , subq_9.visit__ds__extract_quarter
+ , subq_9.visit__ds__extract_month
+ , subq_9.visit__ds__extract_day
+ , subq_9.visit__ds__extract_dow
+ , subq_9.visit__ds__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.user
+ , subq_9.session
+ , subq_9.visit__user
+ , subq_9.visit__session
+ , subq_9.referrer_id
+ , subq_9.visit__referrer_id
+ , subq_9.visits
+ , subq_9.visitors
FROM (
-- Read Elements From Semantic Model 'visits_source'
SELECT
1 AS visits
- , visits_source_src_28011.user_id AS visitors
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day
- , EXTRACT(isodow FROM visits_source_src_28011.ds) AS ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy
- , visits_source_src_28011.referrer_id
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day
- , EXTRACT(isodow FROM visits_source_src_28011.ds) AS visit__ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy
- , visits_source_src_28011.referrer_id AS visit__referrer_id
- , visits_source_src_28011.user_id AS user
- , visits_source_src_28011.session_id AS session
- , visits_source_src_28011.user_id AS visit__user
- , visits_source_src_28011.session_id AS visit__session
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_0
- ) subq_1
- ) subq_2
+ , visits_source_src_28000.user_id AS visitors
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS ds__extract_day
+ , EXTRACT(isodow FROM visits_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS ds__extract_doy
+ , visits_source_src_28000.referrer_id
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS visit__ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS visit__ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS visit__ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS visit__ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS visit__ds__extract_day
+ , EXTRACT(isodow FROM visits_source_src_28000.ds) AS visit__ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS visit__ds__extract_doy
+ , visits_source_src_28000.referrer_id AS visit__referrer_id
+ , visits_source_src_28000.user_id AS user
+ , visits_source_src_28000.session_id AS session
+ , visits_source_src_28000.user_id AS visit__user
+ , visits_source_src_28000.session_id AS visit__session
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
GROUP BY
- subq_2.visit__referrer_id
- ) subq_3
+ subq_11.visit__referrer_id
+ ) subq_12
FULL OUTER JOIN (
-- Aggregate Measures
SELECT
- subq_12.visit__referrer_id
- , SUM(subq_12.buys) AS buys
+ subq_21.visit__referrer_id
+ , SUM(subq_21.buys) AS buys
FROM (
-- Pass Only Elements: ['buys', 'visit__referrer_id']
SELECT
- subq_11.visit__referrer_id
- , subq_11.buys
+ subq_20.visit__referrer_id
+ , subq_20.buys
FROM (
-- Find conversions for user within the range of INF
SELECT
- subq_10.ds__day
- , subq_10.user
- , subq_10.visit__referrer_id
- , subq_10.buys
- , subq_10.visits
+ subq_19.ds__day
+ , subq_19.user
+ , subq_19.visit__referrer_id
+ , subq_19.buys
+ , subq_19.visits
FROM (
-- Dedupe the fanout with mf_internal_uuid in the conversion data set
SELECT DISTINCT
- first_value(subq_6.visits) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
- , first_value(subq_6.visit__referrer_id) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visit__referrer_id
- , first_value(subq_6.ds__day) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
- , first_value(subq_6.user) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
- , subq_9.mf_internal_uuid AS mf_internal_uuid
- , subq_9.buys AS buys
+ first_value(subq_15.visits) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
+ , first_value(subq_15.visit__referrer_id) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visit__referrer_id
+ , first_value(subq_15.ds__day) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
+ , first_value(subq_15.user) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
+ , subq_18.mf_internal_uuid AS mf_internal_uuid
+ , subq_18.buys AS buys
FROM (
-- Pass Only Elements: ['visits', 'visit__referrer_id', 'ds__day', 'user']
SELECT
- subq_5.ds__day
- , subq_5.user
- , subq_5.visit__referrer_id
- , subq_5.visits
+ subq_14.ds__day
+ , subq_14.user
+ , subq_14.visit__referrer_id
+ , subq_14.visits
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_4.ds__day
- , subq_4.ds__week
- , subq_4.ds__month
- , subq_4.ds__quarter
- , subq_4.ds__year
- , subq_4.ds__extract_year
- , subq_4.ds__extract_quarter
- , subq_4.ds__extract_month
- , subq_4.ds__extract_day
- , subq_4.ds__extract_dow
- , subq_4.ds__extract_doy
- , subq_4.visit__ds__day
- , subq_4.visit__ds__week
- , subq_4.visit__ds__month
- , subq_4.visit__ds__quarter
- , subq_4.visit__ds__year
- , subq_4.visit__ds__extract_year
- , subq_4.visit__ds__extract_quarter
- , subq_4.visit__ds__extract_month
- , subq_4.visit__ds__extract_day
- , subq_4.visit__ds__extract_dow
- , subq_4.visit__ds__extract_doy
- , subq_4.ds__day AS metric_time__day
- , subq_4.ds__week AS metric_time__week
- , subq_4.ds__month AS metric_time__month
- , subq_4.ds__quarter AS metric_time__quarter
- , subq_4.ds__year AS metric_time__year
- , subq_4.ds__extract_year AS metric_time__extract_year
- , subq_4.ds__extract_quarter AS metric_time__extract_quarter
- , subq_4.ds__extract_month AS metric_time__extract_month
- , subq_4.ds__extract_day AS metric_time__extract_day
- , subq_4.ds__extract_dow AS metric_time__extract_dow
- , subq_4.ds__extract_doy AS metric_time__extract_doy
- , subq_4.user
- , subq_4.session
- , subq_4.visit__user
- , subq_4.visit__session
- , subq_4.referrer_id
- , subq_4.visit__referrer_id
- , subq_4.visits
- , subq_4.visitors
+ subq_13.ds__day
+ , subq_13.ds__week
+ , subq_13.ds__month
+ , subq_13.ds__quarter
+ , subq_13.ds__year
+ , subq_13.ds__extract_year
+ , subq_13.ds__extract_quarter
+ , subq_13.ds__extract_month
+ , subq_13.ds__extract_day
+ , subq_13.ds__extract_dow
+ , subq_13.ds__extract_doy
+ , subq_13.visit__ds__day
+ , subq_13.visit__ds__week
+ , subq_13.visit__ds__month
+ , subq_13.visit__ds__quarter
+ , subq_13.visit__ds__year
+ , subq_13.visit__ds__extract_year
+ , subq_13.visit__ds__extract_quarter
+ , subq_13.visit__ds__extract_month
+ , subq_13.visit__ds__extract_day
+ , subq_13.visit__ds__extract_dow
+ , subq_13.visit__ds__extract_doy
+ , subq_13.ds__day AS metric_time__day
+ , subq_13.ds__week AS metric_time__week
+ , subq_13.ds__month AS metric_time__month
+ , subq_13.ds__quarter AS metric_time__quarter
+ , subq_13.ds__year AS metric_time__year
+ , subq_13.ds__extract_year AS metric_time__extract_year
+ , subq_13.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_13.ds__extract_month AS metric_time__extract_month
+ , subq_13.ds__extract_day AS metric_time__extract_day
+ , subq_13.ds__extract_dow AS metric_time__extract_dow
+ , subq_13.ds__extract_doy AS metric_time__extract_doy
+ , subq_13.user
+ , subq_13.session
+ , subq_13.visit__user
+ , subq_13.visit__session
+ , subq_13.referrer_id
+ , subq_13.visit__referrer_id
+ , subq_13.visits
+ , subq_13.visitors
FROM (
-- Read Elements From Semantic Model 'visits_source'
SELECT
1 AS visits
- , visits_source_src_28011.user_id AS visitors
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day
- , EXTRACT(isodow FROM visits_source_src_28011.ds) AS ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy
- , visits_source_src_28011.referrer_id
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day
- , EXTRACT(isodow FROM visits_source_src_28011.ds) AS visit__ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy
- , visits_source_src_28011.referrer_id AS visit__referrer_id
- , visits_source_src_28011.user_id AS user
- , visits_source_src_28011.session_id AS session
- , visits_source_src_28011.user_id AS visit__user
- , visits_source_src_28011.session_id AS visit__session
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_4
- ) subq_5
- ) subq_6
+ , visits_source_src_28000.user_id AS visitors
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS ds__extract_day
+ , EXTRACT(isodow FROM visits_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS ds__extract_doy
+ , visits_source_src_28000.referrer_id
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS visit__ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS visit__ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS visit__ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS visit__ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS visit__ds__extract_day
+ , EXTRACT(isodow FROM visits_source_src_28000.ds) AS visit__ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS visit__ds__extract_doy
+ , visits_source_src_28000.referrer_id AS visit__referrer_id
+ , visits_source_src_28000.user_id AS user
+ , visits_source_src_28000.session_id AS session
+ , visits_source_src_28000.user_id AS visit__user
+ , visits_source_src_28000.session_id AS visit__session
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_13
+ ) subq_14
+ ) subq_15
INNER JOIN (
-- Add column with generated UUID
SELECT
- subq_8.ds__day
- , subq_8.ds__week
- , subq_8.ds__month
- , subq_8.ds__quarter
- , subq_8.ds__year
- , subq_8.ds__extract_year
- , subq_8.ds__extract_quarter
- , subq_8.ds__extract_month
- , subq_8.ds__extract_day
- , subq_8.ds__extract_dow
- , subq_8.ds__extract_doy
- , subq_8.buy__ds__day
- , subq_8.buy__ds__week
- , subq_8.buy__ds__month
- , subq_8.buy__ds__quarter
- , subq_8.buy__ds__year
- , subq_8.buy__ds__extract_year
- , subq_8.buy__ds__extract_quarter
- , subq_8.buy__ds__extract_month
- , subq_8.buy__ds__extract_day
- , subq_8.buy__ds__extract_dow
- , subq_8.buy__ds__extract_doy
- , subq_8.metric_time__day
- , subq_8.metric_time__week
- , subq_8.metric_time__month
- , subq_8.metric_time__quarter
- , subq_8.metric_time__year
- , subq_8.metric_time__extract_year
- , subq_8.metric_time__extract_quarter
- , subq_8.metric_time__extract_month
- , subq_8.metric_time__extract_day
- , subq_8.metric_time__extract_dow
- , subq_8.metric_time__extract_doy
- , subq_8.user
- , subq_8.session_id
- , subq_8.buy__user
- , subq_8.buy__session_id
- , subq_8.buys
- , subq_8.buyers
+ subq_17.ds__day
+ , subq_17.ds__week
+ , subq_17.ds__month
+ , subq_17.ds__quarter
+ , subq_17.ds__year
+ , subq_17.ds__extract_year
+ , subq_17.ds__extract_quarter
+ , subq_17.ds__extract_month
+ , subq_17.ds__extract_day
+ , subq_17.ds__extract_dow
+ , subq_17.ds__extract_doy
+ , subq_17.buy__ds__day
+ , subq_17.buy__ds__week
+ , subq_17.buy__ds__month
+ , subq_17.buy__ds__quarter
+ , subq_17.buy__ds__year
+ , subq_17.buy__ds__extract_year
+ , subq_17.buy__ds__extract_quarter
+ , subq_17.buy__ds__extract_month
+ , subq_17.buy__ds__extract_day
+ , subq_17.buy__ds__extract_dow
+ , subq_17.buy__ds__extract_doy
+ , subq_17.metric_time__day
+ , subq_17.metric_time__week
+ , subq_17.metric_time__month
+ , subq_17.metric_time__quarter
+ , subq_17.metric_time__year
+ , subq_17.metric_time__extract_year
+ , subq_17.metric_time__extract_quarter
+ , subq_17.metric_time__extract_month
+ , subq_17.metric_time__extract_day
+ , subq_17.metric_time__extract_dow
+ , subq_17.metric_time__extract_doy
+ , subq_17.user
+ , subq_17.session_id
+ , subq_17.buy__user
+ , subq_17.buy__session_id
+ , subq_17.buys
+ , subq_17.buyers
, GEN_RANDOM_UUID() AS mf_internal_uuid
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_7.ds__day
- , subq_7.ds__week
- , subq_7.ds__month
- , subq_7.ds__quarter
- , subq_7.ds__year
- , subq_7.ds__extract_year
- , subq_7.ds__extract_quarter
- , subq_7.ds__extract_month
- , subq_7.ds__extract_day
- , subq_7.ds__extract_dow
- , subq_7.ds__extract_doy
- , subq_7.buy__ds__day
- , subq_7.buy__ds__week
- , subq_7.buy__ds__month
- , subq_7.buy__ds__quarter
- , subq_7.buy__ds__year
- , subq_7.buy__ds__extract_year
- , subq_7.buy__ds__extract_quarter
- , subq_7.buy__ds__extract_month
- , subq_7.buy__ds__extract_day
- , subq_7.buy__ds__extract_dow
- , subq_7.buy__ds__extract_doy
- , subq_7.ds__day AS metric_time__day
- , subq_7.ds__week AS metric_time__week
- , subq_7.ds__month AS metric_time__month
- , subq_7.ds__quarter AS metric_time__quarter
- , subq_7.ds__year AS metric_time__year
- , subq_7.ds__extract_year AS metric_time__extract_year
- , subq_7.ds__extract_quarter AS metric_time__extract_quarter
- , subq_7.ds__extract_month AS metric_time__extract_month
- , subq_7.ds__extract_day AS metric_time__extract_day
- , subq_7.ds__extract_dow AS metric_time__extract_dow
- , subq_7.ds__extract_doy AS metric_time__extract_doy
- , subq_7.user
- , subq_7.session_id
- , subq_7.buy__user
- , subq_7.buy__session_id
- , subq_7.buys
- , subq_7.buyers
+ subq_16.ds__day
+ , subq_16.ds__week
+ , subq_16.ds__month
+ , subq_16.ds__quarter
+ , subq_16.ds__year
+ , subq_16.ds__extract_year
+ , subq_16.ds__extract_quarter
+ , subq_16.ds__extract_month
+ , subq_16.ds__extract_day
+ , subq_16.ds__extract_dow
+ , subq_16.ds__extract_doy
+ , subq_16.buy__ds__day
+ , subq_16.buy__ds__week
+ , subq_16.buy__ds__month
+ , subq_16.buy__ds__quarter
+ , subq_16.buy__ds__year
+ , subq_16.buy__ds__extract_year
+ , subq_16.buy__ds__extract_quarter
+ , subq_16.buy__ds__extract_month
+ , subq_16.buy__ds__extract_day
+ , subq_16.buy__ds__extract_dow
+ , subq_16.buy__ds__extract_doy
+ , subq_16.ds__day AS metric_time__day
+ , subq_16.ds__week AS metric_time__week
+ , subq_16.ds__month AS metric_time__month
+ , subq_16.ds__quarter AS metric_time__quarter
+ , subq_16.ds__year AS metric_time__year
+ , subq_16.ds__extract_year AS metric_time__extract_year
+ , subq_16.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_16.ds__extract_month AS metric_time__extract_month
+ , subq_16.ds__extract_day AS metric_time__extract_day
+ , subq_16.ds__extract_dow AS metric_time__extract_dow
+ , subq_16.ds__extract_doy AS metric_time__extract_doy
+ , subq_16.user
+ , subq_16.session_id
+ , subq_16.buy__user
+ , subq_16.buy__session_id
+ , subq_16.buys
+ , subq_16.buyers
FROM (
-- Read Elements From Semantic Model 'buys_source'
SELECT
1 AS buys
- , buys_source_src_28002.user_id AS buyers
- , DATE_TRUNC('day', buys_source_src_28002.ds) AS ds__day
- , DATE_TRUNC('week', buys_source_src_28002.ds) AS ds__week
- , DATE_TRUNC('month', buys_source_src_28002.ds) AS ds__month
- , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS ds__quarter
- , DATE_TRUNC('year', buys_source_src_28002.ds) AS ds__year
- , EXTRACT(year FROM buys_source_src_28002.ds) AS ds__extract_year
- , EXTRACT(quarter FROM buys_source_src_28002.ds) AS ds__extract_quarter
- , EXTRACT(month FROM buys_source_src_28002.ds) AS ds__extract_month
- , EXTRACT(day FROM buys_source_src_28002.ds) AS ds__extract_day
- , EXTRACT(isodow FROM buys_source_src_28002.ds) AS ds__extract_dow
- , EXTRACT(doy FROM buys_source_src_28002.ds) AS ds__extract_doy
- , DATE_TRUNC('day', buys_source_src_28002.ds) AS buy__ds__day
- , DATE_TRUNC('week', buys_source_src_28002.ds) AS buy__ds__week
- , DATE_TRUNC('month', buys_source_src_28002.ds) AS buy__ds__month
- , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS buy__ds__quarter
- , DATE_TRUNC('year', buys_source_src_28002.ds) AS buy__ds__year
- , EXTRACT(year FROM buys_source_src_28002.ds) AS buy__ds__extract_year
- , EXTRACT(quarter FROM buys_source_src_28002.ds) AS buy__ds__extract_quarter
- , EXTRACT(month FROM buys_source_src_28002.ds) AS buy__ds__extract_month
- , EXTRACT(day FROM buys_source_src_28002.ds) AS buy__ds__extract_day
- , EXTRACT(isodow FROM buys_source_src_28002.ds) AS buy__ds__extract_dow
- , EXTRACT(doy FROM buys_source_src_28002.ds) AS buy__ds__extract_doy
- , buys_source_src_28002.user_id AS user
- , buys_source_src_28002.session_id
- , buys_source_src_28002.user_id AS buy__user
- , buys_source_src_28002.session_id AS buy__session_id
- FROM ***************************.fct_buys buys_source_src_28002
- ) subq_7
- ) subq_8
- ) subq_9
+ , buys_source_src_28000.user_id AS buyers
+ , DATE_TRUNC('day', buys_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', buys_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', buys_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', buys_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', buys_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM buys_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM buys_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', buys_source_src_28000.ds) AS buy__ds__day
+ , DATE_TRUNC('week', buys_source_src_28000.ds) AS buy__ds__week
+ , DATE_TRUNC('month', buys_source_src_28000.ds) AS buy__ds__month
+ , DATE_TRUNC('quarter', buys_source_src_28000.ds) AS buy__ds__quarter
+ , DATE_TRUNC('year', buys_source_src_28000.ds) 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
+ , EXTRACT(day FROM buys_source_src_28000.ds) AS buy__ds__extract_day
+ , EXTRACT(isodow FROM buys_source_src_28000.ds) AS buy__ds__extract_dow
+ , EXTRACT(doy FROM buys_source_src_28000.ds) AS buy__ds__extract_doy
+ , buys_source_src_28000.user_id AS user
+ , buys_source_src_28000.session_id
+ , buys_source_src_28000.user_id AS buy__user
+ , buys_source_src_28000.session_id AS buy__session_id
+ FROM ***************************.fct_buys buys_source_src_28000
+ ) subq_16
+ ) subq_17
+ ) subq_18
ON
- (subq_6.user = subq_9.user) AND ((subq_6.ds__day <= subq_9.ds__day))
- ) subq_10
- ) subq_11
- ) subq_12
+ (
+ subq_15.user = subq_18.user
+ ) AND (
+ (subq_15.ds__day <= subq_18.ds__day)
+ )
+ ) subq_19
+ ) subq_20
+ ) subq_21
GROUP BY
- subq_12.visit__referrer_id
- ) subq_13
+ subq_21.visit__referrer_id
+ ) subq_22
ON
- subq_3.visit__referrer_id = subq_13.visit__referrer_id
+ subq_12.visit__referrer_id = subq_22.visit__referrer_id
GROUP BY
- COALESCE(subq_3.visit__referrer_id, subq_13.visit__referrer_id)
-) subq_14
+ COALESCE(subq_12.visit__referrer_id, subq_22.visit__referrer_id)
+) subq_23
diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Postgres/test_conversion_rate__plan0_optimized.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Postgres/test_conversion_rate__plan0_optimized.sql
index eef0a1bd3a..99731f7c81 100644
--- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Postgres/test_conversion_rate__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Postgres/test_conversion_rate__plan0_optimized.sql
@@ -5,9 +5,9 @@ SELECT
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_18.visit__referrer_id, subq_28.visit__referrer_id) AS visit__referrer_id
- , MAX(subq_18.visits) AS visits
- , MAX(subq_28.buys) AS buys
+ COALESCE(subq_27.visit__referrer_id, subq_37.visit__referrer_id) AS visit__referrer_id
+ , MAX(subq_27.visits) AS visits
+ , MAX(subq_37.buys) AS buys
FROM (
-- Aggregate Measures
SELECT
@@ -20,11 +20,11 @@ FROM (
SELECT
referrer_id AS visit__referrer_id
, 1 AS visits
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_17
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_26
GROUP BY
visit__referrer_id
- ) subq_18
+ ) subq_27
FULL OUTER JOIN (
-- Find conversions for user within the range of INF
-- Pass Only Elements: ['buys', 'visit__referrer_id']
@@ -35,12 +35,12 @@ FROM (
FROM (
-- Dedupe the fanout with mf_internal_uuid in the conversion data set
SELECT DISTINCT
- first_value(subq_21.visits) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
- , first_value(subq_21.visit__referrer_id) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visit__referrer_id
- , first_value(subq_21.ds__day) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
- , first_value(subq_21.user) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
- , subq_24.mf_internal_uuid AS mf_internal_uuid
- , subq_24.buys AS buys
+ first_value(subq_30.visits) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
+ , first_value(subq_30.visit__referrer_id) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visit__referrer_id
+ , first_value(subq_30.ds__day) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
+ , first_value(subq_30.user) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
+ , subq_33.mf_internal_uuid AS mf_internal_uuid
+ , subq_33.buys AS buys
FROM (
-- Read Elements From Semantic Model 'visits_source'
-- Metric Time Dimension 'ds'
@@ -50,8 +50,8 @@ FROM (
, user_id AS user
, referrer_id AS visit__referrer_id
, 1 AS visits
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_21
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_30
INNER JOIN (
-- Read Elements From Semantic Model 'buys_source'
-- Metric Time Dimension 'ds'
@@ -61,20 +61,20 @@ FROM (
, user_id AS user
, 1 AS buys
, GEN_RANDOM_UUID() AS mf_internal_uuid
- FROM ***************************.fct_buys buys_source_src_28002
- ) subq_24
+ FROM ***************************.fct_buys buys_source_src_28000
+ ) subq_33
ON
(
- subq_21.user = subq_24.user
+ subq_30.user = subq_33.user
) AND (
- (subq_21.ds__day <= subq_24.ds__day)
+ (subq_30.ds__day <= subq_33.ds__day)
)
- ) subq_25
+ ) subq_34
GROUP BY
visit__referrer_id
- ) subq_28
+ ) subq_37
ON
- subq_18.visit__referrer_id = subq_28.visit__referrer_id
+ subq_27.visit__referrer_id = subq_37.visit__referrer_id
GROUP BY
- COALESCE(subq_18.visit__referrer_id, subq_28.visit__referrer_id)
-) subq_29
+ COALESCE(subq_27.visit__referrer_id, subq_37.visit__referrer_id)
+) subq_38
diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Postgres/test_conversion_rate_with_constant_properties__plan0.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Postgres/test_conversion_rate_with_constant_properties__plan0.sql
index 5fb17d874f..3b6d1e7f71 100644
--- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Postgres/test_conversion_rate_with_constant_properties__plan0.sql
+++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Postgres/test_conversion_rate_with_constant_properties__plan0.sql
@@ -1,381 +1,381 @@
-- Compute Metrics via Expressions
SELECT
- subq_14.metric_time__day
- , subq_14.visit__referrer_id
- , CAST(subq_14.buys AS DOUBLE PRECISION) / CAST(NULLIF(subq_14.visits, 0) AS DOUBLE PRECISION) AS visit_buy_conversion_rate_by_session
+ subq_23.metric_time__day
+ , subq_23.visit__referrer_id
+ , CAST(subq_23.buys AS DOUBLE PRECISION) / CAST(NULLIF(subq_23.visits, 0) AS DOUBLE PRECISION) AS visit_buy_conversion_rate_by_session
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_3.metric_time__day, subq_13.metric_time__day) AS metric_time__day
- , COALESCE(subq_3.visit__referrer_id, subq_13.visit__referrer_id) AS visit__referrer_id
- , MAX(subq_3.visits) AS visits
- , MAX(subq_13.buys) AS buys
+ COALESCE(subq_12.metric_time__day, subq_22.metric_time__day) AS metric_time__day
+ , COALESCE(subq_12.visit__referrer_id, subq_22.visit__referrer_id) AS visit__referrer_id
+ , MAX(subq_12.visits) AS visits
+ , MAX(subq_22.buys) AS buys
FROM (
-- Aggregate Measures
SELECT
- subq_2.metric_time__day
- , subq_2.visit__referrer_id
- , SUM(subq_2.visits) AS visits
+ subq_11.metric_time__day
+ , subq_11.visit__referrer_id
+ , SUM(subq_11.visits) AS visits
FROM (
-- Pass Only Elements: ['visits', 'visit__referrer_id', 'metric_time__day']
SELECT
- subq_1.metric_time__day
- , subq_1.visit__referrer_id
- , subq_1.visits
+ subq_10.metric_time__day
+ , subq_10.visit__referrer_id
+ , subq_10.visits
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.visit__ds__day
- , subq_0.visit__ds__week
- , subq_0.visit__ds__month
- , subq_0.visit__ds__quarter
- , subq_0.visit__ds__year
- , subq_0.visit__ds__extract_year
- , subq_0.visit__ds__extract_quarter
- , subq_0.visit__ds__extract_month
- , subq_0.visit__ds__extract_day
- , subq_0.visit__ds__extract_dow
- , subq_0.visit__ds__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.user
- , subq_0.session
- , subq_0.visit__user
- , subq_0.visit__session
- , subq_0.referrer_id
- , subq_0.visit__referrer_id
- , subq_0.visits
- , subq_0.visitors
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.visit__ds__day
+ , subq_9.visit__ds__week
+ , subq_9.visit__ds__month
+ , subq_9.visit__ds__quarter
+ , subq_9.visit__ds__year
+ , subq_9.visit__ds__extract_year
+ , subq_9.visit__ds__extract_quarter
+ , subq_9.visit__ds__extract_month
+ , subq_9.visit__ds__extract_day
+ , subq_9.visit__ds__extract_dow
+ , subq_9.visit__ds__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.user
+ , subq_9.session
+ , subq_9.visit__user
+ , subq_9.visit__session
+ , subq_9.referrer_id
+ , subq_9.visit__referrer_id
+ , subq_9.visits
+ , subq_9.visitors
FROM (
-- Read Elements From Semantic Model 'visits_source'
SELECT
1 AS visits
- , visits_source_src_28011.user_id AS visitors
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day
- , EXTRACT(isodow FROM visits_source_src_28011.ds) AS ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy
- , visits_source_src_28011.referrer_id
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day
- , EXTRACT(isodow FROM visits_source_src_28011.ds) AS visit__ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy
- , visits_source_src_28011.referrer_id AS visit__referrer_id
- , visits_source_src_28011.user_id AS user
- , visits_source_src_28011.session_id AS session
- , visits_source_src_28011.user_id AS visit__user
- , visits_source_src_28011.session_id AS visit__session
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_0
- ) subq_1
- ) subq_2
+ , visits_source_src_28000.user_id AS visitors
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS ds__extract_day
+ , EXTRACT(isodow FROM visits_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS ds__extract_doy
+ , visits_source_src_28000.referrer_id
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS visit__ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS visit__ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS visit__ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS visit__ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS visit__ds__extract_day
+ , EXTRACT(isodow FROM visits_source_src_28000.ds) AS visit__ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS visit__ds__extract_doy
+ , visits_source_src_28000.referrer_id AS visit__referrer_id
+ , visits_source_src_28000.user_id AS user
+ , visits_source_src_28000.session_id AS session
+ , visits_source_src_28000.user_id AS visit__user
+ , visits_source_src_28000.session_id AS visit__session
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
GROUP BY
- subq_2.metric_time__day
- , subq_2.visit__referrer_id
- ) subq_3
+ subq_11.metric_time__day
+ , subq_11.visit__referrer_id
+ ) subq_12
FULL OUTER JOIN (
-- Aggregate Measures
SELECT
- subq_12.metric_time__day
- , subq_12.visit__referrer_id
- , SUM(subq_12.buys) AS buys
+ subq_21.metric_time__day
+ , subq_21.visit__referrer_id
+ , SUM(subq_21.buys) AS buys
FROM (
-- Pass Only Elements: ['buys', 'visit__referrer_id', 'metric_time__day']
SELECT
- subq_11.metric_time__day
- , subq_11.visit__referrer_id
- , subq_11.buys
+ subq_20.metric_time__day
+ , subq_20.visit__referrer_id
+ , subq_20.buys
FROM (
-- Find conversions for user within the range of 7 day
SELECT
- subq_10.ds__day
- , subq_10.metric_time__day
- , subq_10.user
- , subq_10.session
- , subq_10.visit__referrer_id
- , subq_10.buys
- , subq_10.visits
+ subq_19.ds__day
+ , subq_19.metric_time__day
+ , subq_19.user
+ , subq_19.session
+ , subq_19.visit__referrer_id
+ , subq_19.buys
+ , subq_19.visits
FROM (
-- Dedupe the fanout with mf_internal_uuid in the conversion data set
SELECT DISTINCT
- first_value(subq_6.visits) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid, subq_9.session_id ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
- , first_value(subq_6.visit__referrer_id) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid, subq_9.session_id ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visit__referrer_id
- , first_value(subq_6.ds__day) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid, subq_9.session_id ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
- , first_value(subq_6.metric_time__day) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid, subq_9.session_id ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS metric_time__day
- , first_value(subq_6.user) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid, subq_9.session_id ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
- , first_value(subq_6.session) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid, subq_9.session_id ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS session
- , subq_9.mf_internal_uuid AS mf_internal_uuid
- , subq_9.buys AS buys
+ first_value(subq_15.visits) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid, subq_18.session_id ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
+ , first_value(subq_15.visit__referrer_id) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid, subq_18.session_id ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visit__referrer_id
+ , first_value(subq_15.ds__day) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid, subq_18.session_id ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
+ , first_value(subq_15.metric_time__day) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid, subq_18.session_id ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS metric_time__day
+ , first_value(subq_15.user) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid, subq_18.session_id ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
+ , first_value(subq_15.session) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid, subq_18.session_id ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS session
+ , subq_18.mf_internal_uuid AS mf_internal_uuid
+ , subq_18.buys AS buys
FROM (
-- Pass Only Elements: ['visits', 'visit__referrer_id', 'ds__day', 'metric_time__day', 'user', 'session']
SELECT
- subq_5.ds__day
- , subq_5.metric_time__day
- , subq_5.user
- , subq_5.session
- , subq_5.visit__referrer_id
- , subq_5.visits
+ subq_14.ds__day
+ , subq_14.metric_time__day
+ , subq_14.user
+ , subq_14.session
+ , subq_14.visit__referrer_id
+ , subq_14.visits
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_4.ds__day
- , subq_4.ds__week
- , subq_4.ds__month
- , subq_4.ds__quarter
- , subq_4.ds__year
- , subq_4.ds__extract_year
- , subq_4.ds__extract_quarter
- , subq_4.ds__extract_month
- , subq_4.ds__extract_day
- , subq_4.ds__extract_dow
- , subq_4.ds__extract_doy
- , subq_4.visit__ds__day
- , subq_4.visit__ds__week
- , subq_4.visit__ds__month
- , subq_4.visit__ds__quarter
- , subq_4.visit__ds__year
- , subq_4.visit__ds__extract_year
- , subq_4.visit__ds__extract_quarter
- , subq_4.visit__ds__extract_month
- , subq_4.visit__ds__extract_day
- , subq_4.visit__ds__extract_dow
- , subq_4.visit__ds__extract_doy
- , subq_4.ds__day AS metric_time__day
- , subq_4.ds__week AS metric_time__week
- , subq_4.ds__month AS metric_time__month
- , subq_4.ds__quarter AS metric_time__quarter
- , subq_4.ds__year AS metric_time__year
- , subq_4.ds__extract_year AS metric_time__extract_year
- , subq_4.ds__extract_quarter AS metric_time__extract_quarter
- , subq_4.ds__extract_month AS metric_time__extract_month
- , subq_4.ds__extract_day AS metric_time__extract_day
- , subq_4.ds__extract_dow AS metric_time__extract_dow
- , subq_4.ds__extract_doy AS metric_time__extract_doy
- , subq_4.user
- , subq_4.session
- , subq_4.visit__user
- , subq_4.visit__session
- , subq_4.referrer_id
- , subq_4.visit__referrer_id
- , subq_4.visits
- , subq_4.visitors
+ subq_13.ds__day
+ , subq_13.ds__week
+ , subq_13.ds__month
+ , subq_13.ds__quarter
+ , subq_13.ds__year
+ , subq_13.ds__extract_year
+ , subq_13.ds__extract_quarter
+ , subq_13.ds__extract_month
+ , subq_13.ds__extract_day
+ , subq_13.ds__extract_dow
+ , subq_13.ds__extract_doy
+ , subq_13.visit__ds__day
+ , subq_13.visit__ds__week
+ , subq_13.visit__ds__month
+ , subq_13.visit__ds__quarter
+ , subq_13.visit__ds__year
+ , subq_13.visit__ds__extract_year
+ , subq_13.visit__ds__extract_quarter
+ , subq_13.visit__ds__extract_month
+ , subq_13.visit__ds__extract_day
+ , subq_13.visit__ds__extract_dow
+ , subq_13.visit__ds__extract_doy
+ , subq_13.ds__day AS metric_time__day
+ , subq_13.ds__week AS metric_time__week
+ , subq_13.ds__month AS metric_time__month
+ , subq_13.ds__quarter AS metric_time__quarter
+ , subq_13.ds__year AS metric_time__year
+ , subq_13.ds__extract_year AS metric_time__extract_year
+ , subq_13.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_13.ds__extract_month AS metric_time__extract_month
+ , subq_13.ds__extract_day AS metric_time__extract_day
+ , subq_13.ds__extract_dow AS metric_time__extract_dow
+ , subq_13.ds__extract_doy AS metric_time__extract_doy
+ , subq_13.user
+ , subq_13.session
+ , subq_13.visit__user
+ , subq_13.visit__session
+ , subq_13.referrer_id
+ , subq_13.visit__referrer_id
+ , subq_13.visits
+ , subq_13.visitors
FROM (
-- Read Elements From Semantic Model 'visits_source'
SELECT
1 AS visits
- , visits_source_src_28011.user_id AS visitors
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day
- , EXTRACT(isodow FROM visits_source_src_28011.ds) AS ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy
- , visits_source_src_28011.referrer_id
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day
- , EXTRACT(isodow FROM visits_source_src_28011.ds) AS visit__ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy
- , visits_source_src_28011.referrer_id AS visit__referrer_id
- , visits_source_src_28011.user_id AS user
- , visits_source_src_28011.session_id AS session
- , visits_source_src_28011.user_id AS visit__user
- , visits_source_src_28011.session_id AS visit__session
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_4
- ) subq_5
- ) subq_6
+ , visits_source_src_28000.user_id AS visitors
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS ds__extract_day
+ , EXTRACT(isodow FROM visits_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS ds__extract_doy
+ , visits_source_src_28000.referrer_id
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS visit__ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS visit__ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS visit__ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS visit__ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS visit__ds__extract_day
+ , EXTRACT(isodow FROM visits_source_src_28000.ds) AS visit__ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS visit__ds__extract_doy
+ , visits_source_src_28000.referrer_id AS visit__referrer_id
+ , visits_source_src_28000.user_id AS user
+ , visits_source_src_28000.session_id AS session
+ , visits_source_src_28000.user_id AS visit__user
+ , visits_source_src_28000.session_id AS visit__session
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_13
+ ) subq_14
+ ) subq_15
INNER JOIN (
-- Add column with generated UUID
SELECT
- subq_8.ds__day
- , subq_8.ds__week
- , subq_8.ds__month
- , subq_8.ds__quarter
- , subq_8.ds__year
- , subq_8.ds__extract_year
- , subq_8.ds__extract_quarter
- , subq_8.ds__extract_month
- , subq_8.ds__extract_day
- , subq_8.ds__extract_dow
- , subq_8.ds__extract_doy
- , subq_8.buy__ds__day
- , subq_8.buy__ds__week
- , subq_8.buy__ds__month
- , subq_8.buy__ds__quarter
- , subq_8.buy__ds__year
- , subq_8.buy__ds__extract_year
- , subq_8.buy__ds__extract_quarter
- , subq_8.buy__ds__extract_month
- , subq_8.buy__ds__extract_day
- , subq_8.buy__ds__extract_dow
- , subq_8.buy__ds__extract_doy
- , subq_8.metric_time__day
- , subq_8.metric_time__week
- , subq_8.metric_time__month
- , subq_8.metric_time__quarter
- , subq_8.metric_time__year
- , subq_8.metric_time__extract_year
- , subq_8.metric_time__extract_quarter
- , subq_8.metric_time__extract_month
- , subq_8.metric_time__extract_day
- , subq_8.metric_time__extract_dow
- , subq_8.metric_time__extract_doy
- , subq_8.user
- , subq_8.session_id
- , subq_8.buy__user
- , subq_8.buy__session_id
- , subq_8.buys
- , subq_8.buyers
+ subq_17.ds__day
+ , subq_17.ds__week
+ , subq_17.ds__month
+ , subq_17.ds__quarter
+ , subq_17.ds__year
+ , subq_17.ds__extract_year
+ , subq_17.ds__extract_quarter
+ , subq_17.ds__extract_month
+ , subq_17.ds__extract_day
+ , subq_17.ds__extract_dow
+ , subq_17.ds__extract_doy
+ , subq_17.buy__ds__day
+ , subq_17.buy__ds__week
+ , subq_17.buy__ds__month
+ , subq_17.buy__ds__quarter
+ , subq_17.buy__ds__year
+ , subq_17.buy__ds__extract_year
+ , subq_17.buy__ds__extract_quarter
+ , subq_17.buy__ds__extract_month
+ , subq_17.buy__ds__extract_day
+ , subq_17.buy__ds__extract_dow
+ , subq_17.buy__ds__extract_doy
+ , subq_17.metric_time__day
+ , subq_17.metric_time__week
+ , subq_17.metric_time__month
+ , subq_17.metric_time__quarter
+ , subq_17.metric_time__year
+ , subq_17.metric_time__extract_year
+ , subq_17.metric_time__extract_quarter
+ , subq_17.metric_time__extract_month
+ , subq_17.metric_time__extract_day
+ , subq_17.metric_time__extract_dow
+ , subq_17.metric_time__extract_doy
+ , subq_17.user
+ , subq_17.session_id
+ , subq_17.buy__user
+ , subq_17.buy__session_id
+ , subq_17.buys
+ , subq_17.buyers
, GEN_RANDOM_UUID() AS mf_internal_uuid
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_7.ds__day
- , subq_7.ds__week
- , subq_7.ds__month
- , subq_7.ds__quarter
- , subq_7.ds__year
- , subq_7.ds__extract_year
- , subq_7.ds__extract_quarter
- , subq_7.ds__extract_month
- , subq_7.ds__extract_day
- , subq_7.ds__extract_dow
- , subq_7.ds__extract_doy
- , subq_7.buy__ds__day
- , subq_7.buy__ds__week
- , subq_7.buy__ds__month
- , subq_7.buy__ds__quarter
- , subq_7.buy__ds__year
- , subq_7.buy__ds__extract_year
- , subq_7.buy__ds__extract_quarter
- , subq_7.buy__ds__extract_month
- , subq_7.buy__ds__extract_day
- , subq_7.buy__ds__extract_dow
- , subq_7.buy__ds__extract_doy
- , subq_7.ds__day AS metric_time__day
- , subq_7.ds__week AS metric_time__week
- , subq_7.ds__month AS metric_time__month
- , subq_7.ds__quarter AS metric_time__quarter
- , subq_7.ds__year AS metric_time__year
- , subq_7.ds__extract_year AS metric_time__extract_year
- , subq_7.ds__extract_quarter AS metric_time__extract_quarter
- , subq_7.ds__extract_month AS metric_time__extract_month
- , subq_7.ds__extract_day AS metric_time__extract_day
- , subq_7.ds__extract_dow AS metric_time__extract_dow
- , subq_7.ds__extract_doy AS metric_time__extract_doy
- , subq_7.user
- , subq_7.session_id
- , subq_7.buy__user
- , subq_7.buy__session_id
- , subq_7.buys
- , subq_7.buyers
+ subq_16.ds__day
+ , subq_16.ds__week
+ , subq_16.ds__month
+ , subq_16.ds__quarter
+ , subq_16.ds__year
+ , subq_16.ds__extract_year
+ , subq_16.ds__extract_quarter
+ , subq_16.ds__extract_month
+ , subq_16.ds__extract_day
+ , subq_16.ds__extract_dow
+ , subq_16.ds__extract_doy
+ , subq_16.buy__ds__day
+ , subq_16.buy__ds__week
+ , subq_16.buy__ds__month
+ , subq_16.buy__ds__quarter
+ , subq_16.buy__ds__year
+ , subq_16.buy__ds__extract_year
+ , subq_16.buy__ds__extract_quarter
+ , subq_16.buy__ds__extract_month
+ , subq_16.buy__ds__extract_day
+ , subq_16.buy__ds__extract_dow
+ , subq_16.buy__ds__extract_doy
+ , subq_16.ds__day AS metric_time__day
+ , subq_16.ds__week AS metric_time__week
+ , subq_16.ds__month AS metric_time__month
+ , subq_16.ds__quarter AS metric_time__quarter
+ , subq_16.ds__year AS metric_time__year
+ , subq_16.ds__extract_year AS metric_time__extract_year
+ , subq_16.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_16.ds__extract_month AS metric_time__extract_month
+ , subq_16.ds__extract_day AS metric_time__extract_day
+ , subq_16.ds__extract_dow AS metric_time__extract_dow
+ , subq_16.ds__extract_doy AS metric_time__extract_doy
+ , subq_16.user
+ , subq_16.session_id
+ , subq_16.buy__user
+ , subq_16.buy__session_id
+ , subq_16.buys
+ , subq_16.buyers
FROM (
-- Read Elements From Semantic Model 'buys_source'
SELECT
1 AS buys
- , buys_source_src_28002.user_id AS buyers
- , DATE_TRUNC('day', buys_source_src_28002.ds) AS ds__day
- , DATE_TRUNC('week', buys_source_src_28002.ds) AS ds__week
- , DATE_TRUNC('month', buys_source_src_28002.ds) AS ds__month
- , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS ds__quarter
- , DATE_TRUNC('year', buys_source_src_28002.ds) AS ds__year
- , EXTRACT(year FROM buys_source_src_28002.ds) AS ds__extract_year
- , EXTRACT(quarter FROM buys_source_src_28002.ds) AS ds__extract_quarter
- , EXTRACT(month FROM buys_source_src_28002.ds) AS ds__extract_month
- , EXTRACT(day FROM buys_source_src_28002.ds) AS ds__extract_day
- , EXTRACT(isodow FROM buys_source_src_28002.ds) AS ds__extract_dow
- , EXTRACT(doy FROM buys_source_src_28002.ds) AS ds__extract_doy
- , DATE_TRUNC('day', buys_source_src_28002.ds) AS buy__ds__day
- , DATE_TRUNC('week', buys_source_src_28002.ds) AS buy__ds__week
- , DATE_TRUNC('month', buys_source_src_28002.ds) AS buy__ds__month
- , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS buy__ds__quarter
- , DATE_TRUNC('year', buys_source_src_28002.ds) AS buy__ds__year
- , EXTRACT(year FROM buys_source_src_28002.ds) AS buy__ds__extract_year
- , EXTRACT(quarter FROM buys_source_src_28002.ds) AS buy__ds__extract_quarter
- , EXTRACT(month FROM buys_source_src_28002.ds) AS buy__ds__extract_month
- , EXTRACT(day FROM buys_source_src_28002.ds) AS buy__ds__extract_day
- , EXTRACT(isodow FROM buys_source_src_28002.ds) AS buy__ds__extract_dow
- , EXTRACT(doy FROM buys_source_src_28002.ds) AS buy__ds__extract_doy
- , buys_source_src_28002.user_id AS user
- , buys_source_src_28002.session_id
- , buys_source_src_28002.user_id AS buy__user
- , buys_source_src_28002.session_id AS buy__session_id
- FROM ***************************.fct_buys buys_source_src_28002
- ) subq_7
- ) subq_8
- ) subq_9
+ , buys_source_src_28000.user_id AS buyers
+ , DATE_TRUNC('day', buys_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', buys_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', buys_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', buys_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', buys_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM buys_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM buys_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', buys_source_src_28000.ds) AS buy__ds__day
+ , DATE_TRUNC('week', buys_source_src_28000.ds) AS buy__ds__week
+ , DATE_TRUNC('month', buys_source_src_28000.ds) AS buy__ds__month
+ , DATE_TRUNC('quarter', buys_source_src_28000.ds) AS buy__ds__quarter
+ , DATE_TRUNC('year', buys_source_src_28000.ds) 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
+ , EXTRACT(day FROM buys_source_src_28000.ds) AS buy__ds__extract_day
+ , EXTRACT(isodow FROM buys_source_src_28000.ds) AS buy__ds__extract_dow
+ , EXTRACT(doy FROM buys_source_src_28000.ds) AS buy__ds__extract_doy
+ , buys_source_src_28000.user_id AS user
+ , buys_source_src_28000.session_id
+ , buys_source_src_28000.user_id AS buy__user
+ , buys_source_src_28000.session_id AS buy__session_id
+ FROM ***************************.fct_buys buys_source_src_28000
+ ) subq_16
+ ) subq_17
+ ) subq_18
ON
(
- subq_6.user = subq_9.user
+ subq_15.user = subq_18.user
) AND (
- subq_6.session = subq_9.session_id
+ subq_15.session = subq_18.session_id
) AND (
(
- subq_6.ds__day <= subq_9.ds__day
+ subq_15.ds__day <= subq_18.ds__day
) AND (
- subq_6.ds__day > subq_9.ds__day - MAKE_INTERVAL(days => 7)
+ subq_15.ds__day > subq_18.ds__day - MAKE_INTERVAL(days => 7)
)
)
- ) subq_10
- ) subq_11
- ) subq_12
+ ) subq_19
+ ) subq_20
+ ) subq_21
GROUP BY
- subq_12.metric_time__day
- , subq_12.visit__referrer_id
- ) subq_13
+ subq_21.metric_time__day
+ , subq_21.visit__referrer_id
+ ) subq_22
ON
(
- subq_3.visit__referrer_id = subq_13.visit__referrer_id
+ subq_12.visit__referrer_id = subq_22.visit__referrer_id
) AND (
- subq_3.metric_time__day = subq_13.metric_time__day
+ subq_12.metric_time__day = subq_22.metric_time__day
)
GROUP BY
- COALESCE(subq_3.metric_time__day, subq_13.metric_time__day)
- , COALESCE(subq_3.visit__referrer_id, subq_13.visit__referrer_id)
-) subq_14
+ COALESCE(subq_12.metric_time__day, subq_22.metric_time__day)
+ , COALESCE(subq_12.visit__referrer_id, subq_22.visit__referrer_id)
+) subq_23
diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Postgres/test_conversion_rate_with_constant_properties__plan0_optimized.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Postgres/test_conversion_rate_with_constant_properties__plan0_optimized.sql
index cf04b1b14c..a4612a35c1 100644
--- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Postgres/test_conversion_rate_with_constant_properties__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Postgres/test_conversion_rate_with_constant_properties__plan0_optimized.sql
@@ -6,10 +6,10 @@ SELECT
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_18.metric_time__day, subq_28.metric_time__day) AS metric_time__day
- , COALESCE(subq_18.visit__referrer_id, subq_28.visit__referrer_id) AS visit__referrer_id
- , MAX(subq_18.visits) AS visits
- , MAX(subq_28.buys) AS buys
+ COALESCE(subq_27.metric_time__day, subq_37.metric_time__day) AS metric_time__day
+ , COALESCE(subq_27.visit__referrer_id, subq_37.visit__referrer_id) AS visit__referrer_id
+ , MAX(subq_27.visits) AS visits
+ , MAX(subq_37.buys) AS buys
FROM (
-- Aggregate Measures
SELECT
@@ -24,12 +24,12 @@ FROM (
DATE_TRUNC('day', ds) AS metric_time__day
, referrer_id AS visit__referrer_id
, 1 AS visits
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_17
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_26
GROUP BY
metric_time__day
, visit__referrer_id
- ) subq_18
+ ) subq_27
FULL OUTER JOIN (
-- Find conversions for user within the range of 7 day
-- Pass Only Elements: ['buys', 'visit__referrer_id', 'metric_time__day']
@@ -41,14 +41,14 @@ FROM (
FROM (
-- Dedupe the fanout with mf_internal_uuid in the conversion data set
SELECT DISTINCT
- first_value(subq_21.visits) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid, subq_24.session_id ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
- , first_value(subq_21.visit__referrer_id) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid, subq_24.session_id ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visit__referrer_id
- , first_value(subq_21.ds__day) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid, subq_24.session_id ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
- , first_value(subq_21.metric_time__day) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid, subq_24.session_id ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS metric_time__day
- , first_value(subq_21.user) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid, subq_24.session_id ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
- , first_value(subq_21.session) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid, subq_24.session_id ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS session
- , subq_24.mf_internal_uuid AS mf_internal_uuid
- , subq_24.buys AS buys
+ first_value(subq_30.visits) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid, subq_33.session_id ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
+ , first_value(subq_30.visit__referrer_id) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid, subq_33.session_id ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visit__referrer_id
+ , first_value(subq_30.ds__day) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid, subq_33.session_id ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
+ , first_value(subq_30.metric_time__day) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid, subq_33.session_id ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS metric_time__day
+ , first_value(subq_30.user) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid, subq_33.session_id ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
+ , first_value(subq_30.session) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid, subq_33.session_id ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS session
+ , subq_33.mf_internal_uuid AS mf_internal_uuid
+ , subq_33.buys AS buys
FROM (
-- Read Elements From Semantic Model 'visits_source'
-- Metric Time Dimension 'ds'
@@ -60,8 +60,8 @@ FROM (
, session_id AS session
, referrer_id AS visit__referrer_id
, 1 AS visits
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_21
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_30
INNER JOIN (
-- Read Elements From Semantic Model 'buys_source'
-- Metric Time Dimension 'ds'
@@ -72,32 +72,32 @@ FROM (
, session_id
, 1 AS buys
, GEN_RANDOM_UUID() AS mf_internal_uuid
- FROM ***************************.fct_buys buys_source_src_28002
- ) subq_24
+ FROM ***************************.fct_buys buys_source_src_28000
+ ) subq_33
ON
(
- subq_21.user = subq_24.user
+ subq_30.user = subq_33.user
) AND (
- subq_21.session = subq_24.session_id
+ subq_30.session = subq_33.session_id
) AND (
(
- subq_21.ds__day <= subq_24.ds__day
+ subq_30.ds__day <= subq_33.ds__day
) AND (
- subq_21.ds__day > subq_24.ds__day - MAKE_INTERVAL(days => 7)
+ subq_30.ds__day > subq_33.ds__day - MAKE_INTERVAL(days => 7)
)
)
- ) subq_25
+ ) subq_34
GROUP BY
metric_time__day
, visit__referrer_id
- ) subq_28
+ ) subq_37
ON
(
- subq_18.visit__referrer_id = subq_28.visit__referrer_id
+ subq_27.visit__referrer_id = subq_37.visit__referrer_id
) AND (
- subq_18.metric_time__day = subq_28.metric_time__day
+ subq_27.metric_time__day = subq_37.metric_time__day
)
GROUP BY
- COALESCE(subq_18.metric_time__day, subq_28.metric_time__day)
- , COALESCE(subq_18.visit__referrer_id, subq_28.visit__referrer_id)
-) subq_29
+ COALESCE(subq_27.metric_time__day, subq_37.metric_time__day)
+ , COALESCE(subq_27.visit__referrer_id, subq_37.visit__referrer_id)
+) subq_38
diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Postgres/test_conversion_rate_with_no_group_by__plan0.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Postgres/test_conversion_rate_with_no_group_by__plan0.sql
index 9c76d22d39..6b869775fd 100644
--- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Postgres/test_conversion_rate_with_no_group_by__plan0.sql
+++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Postgres/test_conversion_rate_with_no_group_by__plan0.sql
@@ -1,343 +1,343 @@
-- Compute Metrics via Expressions
SELECT
- CAST(subq_14.buys AS DOUBLE PRECISION) / CAST(NULLIF(subq_14.visits, 0) AS DOUBLE PRECISION) AS visit_buy_conversion_rate_7days
+ CAST(subq_23.buys AS DOUBLE PRECISION) / CAST(NULLIF(subq_23.visits, 0) AS DOUBLE PRECISION) AS visit_buy_conversion_rate_7days
FROM (
-- Combine Aggregated Outputs
SELECT
- MAX(subq_3.visits) AS visits
- , MAX(subq_13.buys) AS buys
+ MAX(subq_12.visits) AS visits
+ , MAX(subq_22.buys) AS buys
FROM (
-- Aggregate Measures
SELECT
- SUM(subq_2.visits) AS visits
+ SUM(subq_11.visits) AS visits
FROM (
-- Pass Only Elements: ['visits',]
SELECT
- subq_1.visits
+ subq_10.visits
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.visit__ds__day
- , subq_0.visit__ds__week
- , subq_0.visit__ds__month
- , subq_0.visit__ds__quarter
- , subq_0.visit__ds__year
- , subq_0.visit__ds__extract_year
- , subq_0.visit__ds__extract_quarter
- , subq_0.visit__ds__extract_month
- , subq_0.visit__ds__extract_day
- , subq_0.visit__ds__extract_dow
- , subq_0.visit__ds__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.user
- , subq_0.session
- , subq_0.visit__user
- , subq_0.visit__session
- , subq_0.referrer_id
- , subq_0.visit__referrer_id
- , subq_0.visits
- , subq_0.visitors
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.visit__ds__day
+ , subq_9.visit__ds__week
+ , subq_9.visit__ds__month
+ , subq_9.visit__ds__quarter
+ , subq_9.visit__ds__year
+ , subq_9.visit__ds__extract_year
+ , subq_9.visit__ds__extract_quarter
+ , subq_9.visit__ds__extract_month
+ , subq_9.visit__ds__extract_day
+ , subq_9.visit__ds__extract_dow
+ , subq_9.visit__ds__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.user
+ , subq_9.session
+ , subq_9.visit__user
+ , subq_9.visit__session
+ , subq_9.referrer_id
+ , subq_9.visit__referrer_id
+ , subq_9.visits
+ , subq_9.visitors
FROM (
-- Read Elements From Semantic Model 'visits_source'
SELECT
1 AS visits
- , visits_source_src_28011.user_id AS visitors
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day
- , EXTRACT(isodow FROM visits_source_src_28011.ds) AS ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy
- , visits_source_src_28011.referrer_id
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day
- , EXTRACT(isodow FROM visits_source_src_28011.ds) AS visit__ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy
- , visits_source_src_28011.referrer_id AS visit__referrer_id
- , visits_source_src_28011.user_id AS user
- , visits_source_src_28011.session_id AS session
- , visits_source_src_28011.user_id AS visit__user
- , visits_source_src_28011.session_id AS visit__session
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_0
- ) subq_1
- ) subq_2
- ) subq_3
+ , visits_source_src_28000.user_id AS visitors
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS ds__extract_day
+ , EXTRACT(isodow FROM visits_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS ds__extract_doy
+ , visits_source_src_28000.referrer_id
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS visit__ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS visit__ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS visit__ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS visit__ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS visit__ds__extract_day
+ , EXTRACT(isodow FROM visits_source_src_28000.ds) AS visit__ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS visit__ds__extract_doy
+ , visits_source_src_28000.referrer_id AS visit__referrer_id
+ , visits_source_src_28000.user_id AS user
+ , visits_source_src_28000.session_id AS session
+ , visits_source_src_28000.user_id AS visit__user
+ , visits_source_src_28000.session_id AS visit__session
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
+ ) subq_12
CROSS JOIN (
-- Aggregate Measures
SELECT
- SUM(subq_12.buys) AS buys
+ SUM(subq_21.buys) AS buys
FROM (
-- Pass Only Elements: ['buys',]
SELECT
- subq_11.buys
+ subq_20.buys
FROM (
-- Find conversions for user within the range of 7 day
SELECT
- subq_10.ds__day
- , subq_10.user
- , subq_10.buys
- , subq_10.visits
+ subq_19.ds__day
+ , subq_19.user
+ , subq_19.buys
+ , subq_19.visits
FROM (
-- Dedupe the fanout with mf_internal_uuid in the conversion data set
SELECT DISTINCT
- first_value(subq_6.visits) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
- , first_value(subq_6.ds__day) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
- , first_value(subq_6.user) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
- , subq_9.mf_internal_uuid AS mf_internal_uuid
- , subq_9.buys AS buys
+ first_value(subq_15.visits) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
+ , first_value(subq_15.ds__day) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
+ , first_value(subq_15.user) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
+ , subq_18.mf_internal_uuid AS mf_internal_uuid
+ , subq_18.buys AS buys
FROM (
-- Pass Only Elements: ['visits', 'ds__day', 'user']
SELECT
- subq_5.ds__day
- , subq_5.user
- , subq_5.visits
+ subq_14.ds__day
+ , subq_14.user
+ , subq_14.visits
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_4.ds__day
- , subq_4.ds__week
- , subq_4.ds__month
- , subq_4.ds__quarter
- , subq_4.ds__year
- , subq_4.ds__extract_year
- , subq_4.ds__extract_quarter
- , subq_4.ds__extract_month
- , subq_4.ds__extract_day
- , subq_4.ds__extract_dow
- , subq_4.ds__extract_doy
- , subq_4.visit__ds__day
- , subq_4.visit__ds__week
- , subq_4.visit__ds__month
- , subq_4.visit__ds__quarter
- , subq_4.visit__ds__year
- , subq_4.visit__ds__extract_year
- , subq_4.visit__ds__extract_quarter
- , subq_4.visit__ds__extract_month
- , subq_4.visit__ds__extract_day
- , subq_4.visit__ds__extract_dow
- , subq_4.visit__ds__extract_doy
- , subq_4.ds__day AS metric_time__day
- , subq_4.ds__week AS metric_time__week
- , subq_4.ds__month AS metric_time__month
- , subq_4.ds__quarter AS metric_time__quarter
- , subq_4.ds__year AS metric_time__year
- , subq_4.ds__extract_year AS metric_time__extract_year
- , subq_4.ds__extract_quarter AS metric_time__extract_quarter
- , subq_4.ds__extract_month AS metric_time__extract_month
- , subq_4.ds__extract_day AS metric_time__extract_day
- , subq_4.ds__extract_dow AS metric_time__extract_dow
- , subq_4.ds__extract_doy AS metric_time__extract_doy
- , subq_4.user
- , subq_4.session
- , subq_4.visit__user
- , subq_4.visit__session
- , subq_4.referrer_id
- , subq_4.visit__referrer_id
- , subq_4.visits
- , subq_4.visitors
+ subq_13.ds__day
+ , subq_13.ds__week
+ , subq_13.ds__month
+ , subq_13.ds__quarter
+ , subq_13.ds__year
+ , subq_13.ds__extract_year
+ , subq_13.ds__extract_quarter
+ , subq_13.ds__extract_month
+ , subq_13.ds__extract_day
+ , subq_13.ds__extract_dow
+ , subq_13.ds__extract_doy
+ , subq_13.visit__ds__day
+ , subq_13.visit__ds__week
+ , subq_13.visit__ds__month
+ , subq_13.visit__ds__quarter
+ , subq_13.visit__ds__year
+ , subq_13.visit__ds__extract_year
+ , subq_13.visit__ds__extract_quarter
+ , subq_13.visit__ds__extract_month
+ , subq_13.visit__ds__extract_day
+ , subq_13.visit__ds__extract_dow
+ , subq_13.visit__ds__extract_doy
+ , subq_13.ds__day AS metric_time__day
+ , subq_13.ds__week AS metric_time__week
+ , subq_13.ds__month AS metric_time__month
+ , subq_13.ds__quarter AS metric_time__quarter
+ , subq_13.ds__year AS metric_time__year
+ , subq_13.ds__extract_year AS metric_time__extract_year
+ , subq_13.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_13.ds__extract_month AS metric_time__extract_month
+ , subq_13.ds__extract_day AS metric_time__extract_day
+ , subq_13.ds__extract_dow AS metric_time__extract_dow
+ , subq_13.ds__extract_doy AS metric_time__extract_doy
+ , subq_13.user
+ , subq_13.session
+ , subq_13.visit__user
+ , subq_13.visit__session
+ , subq_13.referrer_id
+ , subq_13.visit__referrer_id
+ , subq_13.visits
+ , subq_13.visitors
FROM (
-- Read Elements From Semantic Model 'visits_source'
SELECT
1 AS visits
- , visits_source_src_28011.user_id AS visitors
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day
- , EXTRACT(isodow FROM visits_source_src_28011.ds) AS ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy
- , visits_source_src_28011.referrer_id
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day
- , EXTRACT(isodow FROM visits_source_src_28011.ds) AS visit__ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy
- , visits_source_src_28011.referrer_id AS visit__referrer_id
- , visits_source_src_28011.user_id AS user
- , visits_source_src_28011.session_id AS session
- , visits_source_src_28011.user_id AS visit__user
- , visits_source_src_28011.session_id AS visit__session
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_4
- ) subq_5
- ) subq_6
+ , visits_source_src_28000.user_id AS visitors
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS ds__extract_day
+ , EXTRACT(isodow FROM visits_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS ds__extract_doy
+ , visits_source_src_28000.referrer_id
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS visit__ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS visit__ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS visit__ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS visit__ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS visit__ds__extract_day
+ , EXTRACT(isodow FROM visits_source_src_28000.ds) AS visit__ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS visit__ds__extract_doy
+ , visits_source_src_28000.referrer_id AS visit__referrer_id
+ , visits_source_src_28000.user_id AS user
+ , visits_source_src_28000.session_id AS session
+ , visits_source_src_28000.user_id AS visit__user
+ , visits_source_src_28000.session_id AS visit__session
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_13
+ ) subq_14
+ ) subq_15
INNER JOIN (
-- Add column with generated UUID
SELECT
- subq_8.ds__day
- , subq_8.ds__week
- , subq_8.ds__month
- , subq_8.ds__quarter
- , subq_8.ds__year
- , subq_8.ds__extract_year
- , subq_8.ds__extract_quarter
- , subq_8.ds__extract_month
- , subq_8.ds__extract_day
- , subq_8.ds__extract_dow
- , subq_8.ds__extract_doy
- , subq_8.buy__ds__day
- , subq_8.buy__ds__week
- , subq_8.buy__ds__month
- , subq_8.buy__ds__quarter
- , subq_8.buy__ds__year
- , subq_8.buy__ds__extract_year
- , subq_8.buy__ds__extract_quarter
- , subq_8.buy__ds__extract_month
- , subq_8.buy__ds__extract_day
- , subq_8.buy__ds__extract_dow
- , subq_8.buy__ds__extract_doy
- , subq_8.metric_time__day
- , subq_8.metric_time__week
- , subq_8.metric_time__month
- , subq_8.metric_time__quarter
- , subq_8.metric_time__year
- , subq_8.metric_time__extract_year
- , subq_8.metric_time__extract_quarter
- , subq_8.metric_time__extract_month
- , subq_8.metric_time__extract_day
- , subq_8.metric_time__extract_dow
- , subq_8.metric_time__extract_doy
- , subq_8.user
- , subq_8.session_id
- , subq_8.buy__user
- , subq_8.buy__session_id
- , subq_8.buys
- , subq_8.buyers
+ subq_17.ds__day
+ , subq_17.ds__week
+ , subq_17.ds__month
+ , subq_17.ds__quarter
+ , subq_17.ds__year
+ , subq_17.ds__extract_year
+ , subq_17.ds__extract_quarter
+ , subq_17.ds__extract_month
+ , subq_17.ds__extract_day
+ , subq_17.ds__extract_dow
+ , subq_17.ds__extract_doy
+ , subq_17.buy__ds__day
+ , subq_17.buy__ds__week
+ , subq_17.buy__ds__month
+ , subq_17.buy__ds__quarter
+ , subq_17.buy__ds__year
+ , subq_17.buy__ds__extract_year
+ , subq_17.buy__ds__extract_quarter
+ , subq_17.buy__ds__extract_month
+ , subq_17.buy__ds__extract_day
+ , subq_17.buy__ds__extract_dow
+ , subq_17.buy__ds__extract_doy
+ , subq_17.metric_time__day
+ , subq_17.metric_time__week
+ , subq_17.metric_time__month
+ , subq_17.metric_time__quarter
+ , subq_17.metric_time__year
+ , subq_17.metric_time__extract_year
+ , subq_17.metric_time__extract_quarter
+ , subq_17.metric_time__extract_month
+ , subq_17.metric_time__extract_day
+ , subq_17.metric_time__extract_dow
+ , subq_17.metric_time__extract_doy
+ , subq_17.user
+ , subq_17.session_id
+ , subq_17.buy__user
+ , subq_17.buy__session_id
+ , subq_17.buys
+ , subq_17.buyers
, GEN_RANDOM_UUID() AS mf_internal_uuid
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_7.ds__day
- , subq_7.ds__week
- , subq_7.ds__month
- , subq_7.ds__quarter
- , subq_7.ds__year
- , subq_7.ds__extract_year
- , subq_7.ds__extract_quarter
- , subq_7.ds__extract_month
- , subq_7.ds__extract_day
- , subq_7.ds__extract_dow
- , subq_7.ds__extract_doy
- , subq_7.buy__ds__day
- , subq_7.buy__ds__week
- , subq_7.buy__ds__month
- , subq_7.buy__ds__quarter
- , subq_7.buy__ds__year
- , subq_7.buy__ds__extract_year
- , subq_7.buy__ds__extract_quarter
- , subq_7.buy__ds__extract_month
- , subq_7.buy__ds__extract_day
- , subq_7.buy__ds__extract_dow
- , subq_7.buy__ds__extract_doy
- , subq_7.ds__day AS metric_time__day
- , subq_7.ds__week AS metric_time__week
- , subq_7.ds__month AS metric_time__month
- , subq_7.ds__quarter AS metric_time__quarter
- , subq_7.ds__year AS metric_time__year
- , subq_7.ds__extract_year AS metric_time__extract_year
- , subq_7.ds__extract_quarter AS metric_time__extract_quarter
- , subq_7.ds__extract_month AS metric_time__extract_month
- , subq_7.ds__extract_day AS metric_time__extract_day
- , subq_7.ds__extract_dow AS metric_time__extract_dow
- , subq_7.ds__extract_doy AS metric_time__extract_doy
- , subq_7.user
- , subq_7.session_id
- , subq_7.buy__user
- , subq_7.buy__session_id
- , subq_7.buys
- , subq_7.buyers
+ subq_16.ds__day
+ , subq_16.ds__week
+ , subq_16.ds__month
+ , subq_16.ds__quarter
+ , subq_16.ds__year
+ , subq_16.ds__extract_year
+ , subq_16.ds__extract_quarter
+ , subq_16.ds__extract_month
+ , subq_16.ds__extract_day
+ , subq_16.ds__extract_dow
+ , subq_16.ds__extract_doy
+ , subq_16.buy__ds__day
+ , subq_16.buy__ds__week
+ , subq_16.buy__ds__month
+ , subq_16.buy__ds__quarter
+ , subq_16.buy__ds__year
+ , subq_16.buy__ds__extract_year
+ , subq_16.buy__ds__extract_quarter
+ , subq_16.buy__ds__extract_month
+ , subq_16.buy__ds__extract_day
+ , subq_16.buy__ds__extract_dow
+ , subq_16.buy__ds__extract_doy
+ , subq_16.ds__day AS metric_time__day
+ , subq_16.ds__week AS metric_time__week
+ , subq_16.ds__month AS metric_time__month
+ , subq_16.ds__quarter AS metric_time__quarter
+ , subq_16.ds__year AS metric_time__year
+ , subq_16.ds__extract_year AS metric_time__extract_year
+ , subq_16.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_16.ds__extract_month AS metric_time__extract_month
+ , subq_16.ds__extract_day AS metric_time__extract_day
+ , subq_16.ds__extract_dow AS metric_time__extract_dow
+ , subq_16.ds__extract_doy AS metric_time__extract_doy
+ , subq_16.user
+ , subq_16.session_id
+ , subq_16.buy__user
+ , subq_16.buy__session_id
+ , subq_16.buys
+ , subq_16.buyers
FROM (
-- Read Elements From Semantic Model 'buys_source'
SELECT
1 AS buys
- , buys_source_src_28002.user_id AS buyers
- , DATE_TRUNC('day', buys_source_src_28002.ds) AS ds__day
- , DATE_TRUNC('week', buys_source_src_28002.ds) AS ds__week
- , DATE_TRUNC('month', buys_source_src_28002.ds) AS ds__month
- , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS ds__quarter
- , DATE_TRUNC('year', buys_source_src_28002.ds) AS ds__year
- , EXTRACT(year FROM buys_source_src_28002.ds) AS ds__extract_year
- , EXTRACT(quarter FROM buys_source_src_28002.ds) AS ds__extract_quarter
- , EXTRACT(month FROM buys_source_src_28002.ds) AS ds__extract_month
- , EXTRACT(day FROM buys_source_src_28002.ds) AS ds__extract_day
- , EXTRACT(isodow FROM buys_source_src_28002.ds) AS ds__extract_dow
- , EXTRACT(doy FROM buys_source_src_28002.ds) AS ds__extract_doy
- , DATE_TRUNC('day', buys_source_src_28002.ds) AS buy__ds__day
- , DATE_TRUNC('week', buys_source_src_28002.ds) AS buy__ds__week
- , DATE_TRUNC('month', buys_source_src_28002.ds) AS buy__ds__month
- , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS buy__ds__quarter
- , DATE_TRUNC('year', buys_source_src_28002.ds) AS buy__ds__year
- , EXTRACT(year FROM buys_source_src_28002.ds) AS buy__ds__extract_year
- , EXTRACT(quarter FROM buys_source_src_28002.ds) AS buy__ds__extract_quarter
- , EXTRACT(month FROM buys_source_src_28002.ds) AS buy__ds__extract_month
- , EXTRACT(day FROM buys_source_src_28002.ds) AS buy__ds__extract_day
- , EXTRACT(isodow FROM buys_source_src_28002.ds) AS buy__ds__extract_dow
- , EXTRACT(doy FROM buys_source_src_28002.ds) AS buy__ds__extract_doy
- , buys_source_src_28002.user_id AS user
- , buys_source_src_28002.session_id
- , buys_source_src_28002.user_id AS buy__user
- , buys_source_src_28002.session_id AS buy__session_id
- FROM ***************************.fct_buys buys_source_src_28002
- ) subq_7
- ) subq_8
- ) subq_9
+ , buys_source_src_28000.user_id AS buyers
+ , DATE_TRUNC('day', buys_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', buys_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', buys_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', buys_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', buys_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM buys_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM buys_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', buys_source_src_28000.ds) AS buy__ds__day
+ , DATE_TRUNC('week', buys_source_src_28000.ds) AS buy__ds__week
+ , DATE_TRUNC('month', buys_source_src_28000.ds) AS buy__ds__month
+ , DATE_TRUNC('quarter', buys_source_src_28000.ds) AS buy__ds__quarter
+ , DATE_TRUNC('year', buys_source_src_28000.ds) 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
+ , EXTRACT(day FROM buys_source_src_28000.ds) AS buy__ds__extract_day
+ , EXTRACT(isodow FROM buys_source_src_28000.ds) AS buy__ds__extract_dow
+ , EXTRACT(doy FROM buys_source_src_28000.ds) AS buy__ds__extract_doy
+ , buys_source_src_28000.user_id AS user
+ , buys_source_src_28000.session_id
+ , buys_source_src_28000.user_id AS buy__user
+ , buys_source_src_28000.session_id AS buy__session_id
+ FROM ***************************.fct_buys buys_source_src_28000
+ ) subq_16
+ ) subq_17
+ ) subq_18
ON
(
- subq_6.user = subq_9.user
+ subq_15.user = subq_18.user
) AND (
(
- subq_6.ds__day <= subq_9.ds__day
+ subq_15.ds__day <= subq_18.ds__day
) AND (
- subq_6.ds__day > subq_9.ds__day - MAKE_INTERVAL(days => 7)
+ subq_15.ds__day > subq_18.ds__day - MAKE_INTERVAL(days => 7)
)
)
- ) subq_10
- ) subq_11
- ) subq_12
- ) subq_13
-) subq_14
+ ) subq_19
+ ) subq_20
+ ) subq_21
+ ) subq_22
+) subq_23
diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Postgres/test_conversion_rate_with_no_group_by__plan0_optimized.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Postgres/test_conversion_rate_with_no_group_by__plan0_optimized.sql
index cbecf69018..6cf7c39d63 100644
--- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Postgres/test_conversion_rate_with_no_group_by__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Postgres/test_conversion_rate_with_no_group_by__plan0_optimized.sql
@@ -1,7 +1,7 @@
-- Combine Aggregated Outputs
-- Compute Metrics via Expressions
SELECT
- CAST(MAX(subq_28.buys) AS DOUBLE PRECISION) / CAST(NULLIF(MAX(subq_18.visits), 0) AS DOUBLE PRECISION) AS visit_buy_conversion_rate_7days
+ CAST(MAX(subq_37.buys) AS DOUBLE PRECISION) / CAST(NULLIF(MAX(subq_27.visits), 0) AS DOUBLE PRECISION) AS visit_buy_conversion_rate_7days
FROM (
-- Read Elements From Semantic Model 'visits_source'
-- Metric Time Dimension 'ds'
@@ -9,8 +9,8 @@ FROM (
-- Aggregate Measures
SELECT
SUM(1) AS visits
- FROM ***************************.fct_visits visits_source_src_28011
-) subq_18
+ FROM ***************************.fct_visits visits_source_src_28000
+) subq_27
CROSS JOIN (
-- Find conversions for user within the range of 7 day
-- Pass Only Elements: ['buys',]
@@ -20,11 +20,11 @@ CROSS JOIN (
FROM (
-- Dedupe the fanout with mf_internal_uuid in the conversion data set
SELECT DISTINCT
- first_value(subq_21.visits) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
- , first_value(subq_21.ds__day) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
- , first_value(subq_21.user) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
- , subq_24.mf_internal_uuid AS mf_internal_uuid
- , subq_24.buys AS buys
+ first_value(subq_30.visits) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
+ , first_value(subq_30.ds__day) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
+ , first_value(subq_30.user) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
+ , subq_33.mf_internal_uuid AS mf_internal_uuid
+ , subq_33.buys AS buys
FROM (
-- Read Elements From Semantic Model 'visits_source'
-- Metric Time Dimension 'ds'
@@ -33,8 +33,8 @@ CROSS JOIN (
DATE_TRUNC('day', ds) AS ds__day
, user_id AS user
, 1 AS visits
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_21
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_30
INNER JOIN (
-- Read Elements From Semantic Model 'buys_source'
-- Metric Time Dimension 'ds'
@@ -44,17 +44,17 @@ CROSS JOIN (
, user_id AS user
, 1 AS buys
, GEN_RANDOM_UUID() AS mf_internal_uuid
- FROM ***************************.fct_buys buys_source_src_28002
- ) subq_24
+ FROM ***************************.fct_buys buys_source_src_28000
+ ) subq_33
ON
(
- subq_21.user = subq_24.user
+ subq_30.user = subq_33.user
) AND (
(
- subq_21.ds__day <= subq_24.ds__day
+ subq_30.ds__day <= subq_33.ds__day
) AND (
- subq_21.ds__day > subq_24.ds__day - MAKE_INTERVAL(days => 7)
+ subq_30.ds__day > subq_33.ds__day - MAKE_INTERVAL(days => 7)
)
)
- ) subq_25
-) subq_28
+ ) subq_34
+) subq_37
diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Postgres/test_conversion_rate_with_window__plan0.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Postgres/test_conversion_rate_with_window__plan0.sql
index 1c26ca1d8e..a63cb8b42d 100644
--- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Postgres/test_conversion_rate_with_window__plan0.sql
+++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Postgres/test_conversion_rate_with_window__plan0.sql
@@ -1,376 +1,376 @@
-- Compute Metrics via Expressions
SELECT
- subq_14.metric_time__day
- , subq_14.visit__referrer_id
- , CAST(subq_14.buys AS DOUBLE PRECISION) / CAST(NULLIF(subq_14.visits, 0) AS DOUBLE PRECISION) AS visit_buy_conversion_rate_7days
+ subq_23.metric_time__day
+ , subq_23.visit__referrer_id
+ , CAST(subq_23.buys AS DOUBLE PRECISION) / CAST(NULLIF(subq_23.visits, 0) AS DOUBLE PRECISION) AS visit_buy_conversion_rate_7days
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_3.metric_time__day, subq_13.metric_time__day) AS metric_time__day
- , COALESCE(subq_3.visit__referrer_id, subq_13.visit__referrer_id) AS visit__referrer_id
- , MAX(subq_3.visits) AS visits
- , MAX(subq_13.buys) AS buys
+ COALESCE(subq_12.metric_time__day, subq_22.metric_time__day) AS metric_time__day
+ , COALESCE(subq_12.visit__referrer_id, subq_22.visit__referrer_id) AS visit__referrer_id
+ , MAX(subq_12.visits) AS visits
+ , MAX(subq_22.buys) AS buys
FROM (
-- Aggregate Measures
SELECT
- subq_2.metric_time__day
- , subq_2.visit__referrer_id
- , SUM(subq_2.visits) AS visits
+ subq_11.metric_time__day
+ , subq_11.visit__referrer_id
+ , SUM(subq_11.visits) AS visits
FROM (
-- Pass Only Elements: ['visits', 'visit__referrer_id', 'metric_time__day']
SELECT
- subq_1.metric_time__day
- , subq_1.visit__referrer_id
- , subq_1.visits
+ subq_10.metric_time__day
+ , subq_10.visit__referrer_id
+ , subq_10.visits
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.visit__ds__day
- , subq_0.visit__ds__week
- , subq_0.visit__ds__month
- , subq_0.visit__ds__quarter
- , subq_0.visit__ds__year
- , subq_0.visit__ds__extract_year
- , subq_0.visit__ds__extract_quarter
- , subq_0.visit__ds__extract_month
- , subq_0.visit__ds__extract_day
- , subq_0.visit__ds__extract_dow
- , subq_0.visit__ds__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.user
- , subq_0.session
- , subq_0.visit__user
- , subq_0.visit__session
- , subq_0.referrer_id
- , subq_0.visit__referrer_id
- , subq_0.visits
- , subq_0.visitors
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.visit__ds__day
+ , subq_9.visit__ds__week
+ , subq_9.visit__ds__month
+ , subq_9.visit__ds__quarter
+ , subq_9.visit__ds__year
+ , subq_9.visit__ds__extract_year
+ , subq_9.visit__ds__extract_quarter
+ , subq_9.visit__ds__extract_month
+ , subq_9.visit__ds__extract_day
+ , subq_9.visit__ds__extract_dow
+ , subq_9.visit__ds__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.user
+ , subq_9.session
+ , subq_9.visit__user
+ , subq_9.visit__session
+ , subq_9.referrer_id
+ , subq_9.visit__referrer_id
+ , subq_9.visits
+ , subq_9.visitors
FROM (
-- Read Elements From Semantic Model 'visits_source'
SELECT
1 AS visits
- , visits_source_src_28011.user_id AS visitors
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day
- , EXTRACT(isodow FROM visits_source_src_28011.ds) AS ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy
- , visits_source_src_28011.referrer_id
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day
- , EXTRACT(isodow FROM visits_source_src_28011.ds) AS visit__ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy
- , visits_source_src_28011.referrer_id AS visit__referrer_id
- , visits_source_src_28011.user_id AS user
- , visits_source_src_28011.session_id AS session
- , visits_source_src_28011.user_id AS visit__user
- , visits_source_src_28011.session_id AS visit__session
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_0
- ) subq_1
- ) subq_2
+ , visits_source_src_28000.user_id AS visitors
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS ds__extract_day
+ , EXTRACT(isodow FROM visits_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS ds__extract_doy
+ , visits_source_src_28000.referrer_id
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS visit__ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS visit__ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS visit__ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS visit__ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS visit__ds__extract_day
+ , EXTRACT(isodow FROM visits_source_src_28000.ds) AS visit__ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS visit__ds__extract_doy
+ , visits_source_src_28000.referrer_id AS visit__referrer_id
+ , visits_source_src_28000.user_id AS user
+ , visits_source_src_28000.session_id AS session
+ , visits_source_src_28000.user_id AS visit__user
+ , visits_source_src_28000.session_id AS visit__session
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
GROUP BY
- subq_2.metric_time__day
- , subq_2.visit__referrer_id
- ) subq_3
+ subq_11.metric_time__day
+ , subq_11.visit__referrer_id
+ ) subq_12
FULL OUTER JOIN (
-- Aggregate Measures
SELECT
- subq_12.metric_time__day
- , subq_12.visit__referrer_id
- , SUM(subq_12.buys) AS buys
+ subq_21.metric_time__day
+ , subq_21.visit__referrer_id
+ , SUM(subq_21.buys) AS buys
FROM (
-- Pass Only Elements: ['buys', 'visit__referrer_id', 'metric_time__day']
SELECT
- subq_11.metric_time__day
- , subq_11.visit__referrer_id
- , subq_11.buys
+ subq_20.metric_time__day
+ , subq_20.visit__referrer_id
+ , subq_20.buys
FROM (
-- Find conversions for user within the range of 7 day
SELECT
- subq_10.ds__day
- , subq_10.metric_time__day
- , subq_10.user
- , subq_10.visit__referrer_id
- , subq_10.buys
- , subq_10.visits
+ subq_19.ds__day
+ , subq_19.metric_time__day
+ , subq_19.user
+ , subq_19.visit__referrer_id
+ , subq_19.buys
+ , subq_19.visits
FROM (
-- Dedupe the fanout with mf_internal_uuid in the conversion data set
SELECT DISTINCT
- first_value(subq_6.visits) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
- , first_value(subq_6.visit__referrer_id) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visit__referrer_id
- , first_value(subq_6.ds__day) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
- , first_value(subq_6.metric_time__day) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS metric_time__day
- , first_value(subq_6.user) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
- , subq_9.mf_internal_uuid AS mf_internal_uuid
- , subq_9.buys AS buys
+ first_value(subq_15.visits) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
+ , first_value(subq_15.visit__referrer_id) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visit__referrer_id
+ , first_value(subq_15.ds__day) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
+ , first_value(subq_15.metric_time__day) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS metric_time__day
+ , first_value(subq_15.user) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
+ , subq_18.mf_internal_uuid AS mf_internal_uuid
+ , subq_18.buys AS buys
FROM (
-- Pass Only Elements: ['visits', 'visit__referrer_id', 'ds__day', 'metric_time__day', 'user']
SELECT
- subq_5.ds__day
- , subq_5.metric_time__day
- , subq_5.user
- , subq_5.visit__referrer_id
- , subq_5.visits
+ subq_14.ds__day
+ , subq_14.metric_time__day
+ , subq_14.user
+ , subq_14.visit__referrer_id
+ , subq_14.visits
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_4.ds__day
- , subq_4.ds__week
- , subq_4.ds__month
- , subq_4.ds__quarter
- , subq_4.ds__year
- , subq_4.ds__extract_year
- , subq_4.ds__extract_quarter
- , subq_4.ds__extract_month
- , subq_4.ds__extract_day
- , subq_4.ds__extract_dow
- , subq_4.ds__extract_doy
- , subq_4.visit__ds__day
- , subq_4.visit__ds__week
- , subq_4.visit__ds__month
- , subq_4.visit__ds__quarter
- , subq_4.visit__ds__year
- , subq_4.visit__ds__extract_year
- , subq_4.visit__ds__extract_quarter
- , subq_4.visit__ds__extract_month
- , subq_4.visit__ds__extract_day
- , subq_4.visit__ds__extract_dow
- , subq_4.visit__ds__extract_doy
- , subq_4.ds__day AS metric_time__day
- , subq_4.ds__week AS metric_time__week
- , subq_4.ds__month AS metric_time__month
- , subq_4.ds__quarter AS metric_time__quarter
- , subq_4.ds__year AS metric_time__year
- , subq_4.ds__extract_year AS metric_time__extract_year
- , subq_4.ds__extract_quarter AS metric_time__extract_quarter
- , subq_4.ds__extract_month AS metric_time__extract_month
- , subq_4.ds__extract_day AS metric_time__extract_day
- , subq_4.ds__extract_dow AS metric_time__extract_dow
- , subq_4.ds__extract_doy AS metric_time__extract_doy
- , subq_4.user
- , subq_4.session
- , subq_4.visit__user
- , subq_4.visit__session
- , subq_4.referrer_id
- , subq_4.visit__referrer_id
- , subq_4.visits
- , subq_4.visitors
+ subq_13.ds__day
+ , subq_13.ds__week
+ , subq_13.ds__month
+ , subq_13.ds__quarter
+ , subq_13.ds__year
+ , subq_13.ds__extract_year
+ , subq_13.ds__extract_quarter
+ , subq_13.ds__extract_month
+ , subq_13.ds__extract_day
+ , subq_13.ds__extract_dow
+ , subq_13.ds__extract_doy
+ , subq_13.visit__ds__day
+ , subq_13.visit__ds__week
+ , subq_13.visit__ds__month
+ , subq_13.visit__ds__quarter
+ , subq_13.visit__ds__year
+ , subq_13.visit__ds__extract_year
+ , subq_13.visit__ds__extract_quarter
+ , subq_13.visit__ds__extract_month
+ , subq_13.visit__ds__extract_day
+ , subq_13.visit__ds__extract_dow
+ , subq_13.visit__ds__extract_doy
+ , subq_13.ds__day AS metric_time__day
+ , subq_13.ds__week AS metric_time__week
+ , subq_13.ds__month AS metric_time__month
+ , subq_13.ds__quarter AS metric_time__quarter
+ , subq_13.ds__year AS metric_time__year
+ , subq_13.ds__extract_year AS metric_time__extract_year
+ , subq_13.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_13.ds__extract_month AS metric_time__extract_month
+ , subq_13.ds__extract_day AS metric_time__extract_day
+ , subq_13.ds__extract_dow AS metric_time__extract_dow
+ , subq_13.ds__extract_doy AS metric_time__extract_doy
+ , subq_13.user
+ , subq_13.session
+ , subq_13.visit__user
+ , subq_13.visit__session
+ , subq_13.referrer_id
+ , subq_13.visit__referrer_id
+ , subq_13.visits
+ , subq_13.visitors
FROM (
-- Read Elements From Semantic Model 'visits_source'
SELECT
1 AS visits
- , visits_source_src_28011.user_id AS visitors
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day
- , EXTRACT(isodow FROM visits_source_src_28011.ds) AS ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy
- , visits_source_src_28011.referrer_id
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day
- , EXTRACT(isodow FROM visits_source_src_28011.ds) AS visit__ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy
- , visits_source_src_28011.referrer_id AS visit__referrer_id
- , visits_source_src_28011.user_id AS user
- , visits_source_src_28011.session_id AS session
- , visits_source_src_28011.user_id AS visit__user
- , visits_source_src_28011.session_id AS visit__session
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_4
- ) subq_5
- ) subq_6
+ , visits_source_src_28000.user_id AS visitors
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS ds__extract_day
+ , EXTRACT(isodow FROM visits_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS ds__extract_doy
+ , visits_source_src_28000.referrer_id
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS visit__ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS visit__ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS visit__ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS visit__ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS visit__ds__extract_day
+ , EXTRACT(isodow FROM visits_source_src_28000.ds) AS visit__ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS visit__ds__extract_doy
+ , visits_source_src_28000.referrer_id AS visit__referrer_id
+ , visits_source_src_28000.user_id AS user
+ , visits_source_src_28000.session_id AS session
+ , visits_source_src_28000.user_id AS visit__user
+ , visits_source_src_28000.session_id AS visit__session
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_13
+ ) subq_14
+ ) subq_15
INNER JOIN (
-- Add column with generated UUID
SELECT
- subq_8.ds__day
- , subq_8.ds__week
- , subq_8.ds__month
- , subq_8.ds__quarter
- , subq_8.ds__year
- , subq_8.ds__extract_year
- , subq_8.ds__extract_quarter
- , subq_8.ds__extract_month
- , subq_8.ds__extract_day
- , subq_8.ds__extract_dow
- , subq_8.ds__extract_doy
- , subq_8.buy__ds__day
- , subq_8.buy__ds__week
- , subq_8.buy__ds__month
- , subq_8.buy__ds__quarter
- , subq_8.buy__ds__year
- , subq_8.buy__ds__extract_year
- , subq_8.buy__ds__extract_quarter
- , subq_8.buy__ds__extract_month
- , subq_8.buy__ds__extract_day
- , subq_8.buy__ds__extract_dow
- , subq_8.buy__ds__extract_doy
- , subq_8.metric_time__day
- , subq_8.metric_time__week
- , subq_8.metric_time__month
- , subq_8.metric_time__quarter
- , subq_8.metric_time__year
- , subq_8.metric_time__extract_year
- , subq_8.metric_time__extract_quarter
- , subq_8.metric_time__extract_month
- , subq_8.metric_time__extract_day
- , subq_8.metric_time__extract_dow
- , subq_8.metric_time__extract_doy
- , subq_8.user
- , subq_8.session_id
- , subq_8.buy__user
- , subq_8.buy__session_id
- , subq_8.buys
- , subq_8.buyers
+ subq_17.ds__day
+ , subq_17.ds__week
+ , subq_17.ds__month
+ , subq_17.ds__quarter
+ , subq_17.ds__year
+ , subq_17.ds__extract_year
+ , subq_17.ds__extract_quarter
+ , subq_17.ds__extract_month
+ , subq_17.ds__extract_day
+ , subq_17.ds__extract_dow
+ , subq_17.ds__extract_doy
+ , subq_17.buy__ds__day
+ , subq_17.buy__ds__week
+ , subq_17.buy__ds__month
+ , subq_17.buy__ds__quarter
+ , subq_17.buy__ds__year
+ , subq_17.buy__ds__extract_year
+ , subq_17.buy__ds__extract_quarter
+ , subq_17.buy__ds__extract_month
+ , subq_17.buy__ds__extract_day
+ , subq_17.buy__ds__extract_dow
+ , subq_17.buy__ds__extract_doy
+ , subq_17.metric_time__day
+ , subq_17.metric_time__week
+ , subq_17.metric_time__month
+ , subq_17.metric_time__quarter
+ , subq_17.metric_time__year
+ , subq_17.metric_time__extract_year
+ , subq_17.metric_time__extract_quarter
+ , subq_17.metric_time__extract_month
+ , subq_17.metric_time__extract_day
+ , subq_17.metric_time__extract_dow
+ , subq_17.metric_time__extract_doy
+ , subq_17.user
+ , subq_17.session_id
+ , subq_17.buy__user
+ , subq_17.buy__session_id
+ , subq_17.buys
+ , subq_17.buyers
, GEN_RANDOM_UUID() AS mf_internal_uuid
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_7.ds__day
- , subq_7.ds__week
- , subq_7.ds__month
- , subq_7.ds__quarter
- , subq_7.ds__year
- , subq_7.ds__extract_year
- , subq_7.ds__extract_quarter
- , subq_7.ds__extract_month
- , subq_7.ds__extract_day
- , subq_7.ds__extract_dow
- , subq_7.ds__extract_doy
- , subq_7.buy__ds__day
- , subq_7.buy__ds__week
- , subq_7.buy__ds__month
- , subq_7.buy__ds__quarter
- , subq_7.buy__ds__year
- , subq_7.buy__ds__extract_year
- , subq_7.buy__ds__extract_quarter
- , subq_7.buy__ds__extract_month
- , subq_7.buy__ds__extract_day
- , subq_7.buy__ds__extract_dow
- , subq_7.buy__ds__extract_doy
- , subq_7.ds__day AS metric_time__day
- , subq_7.ds__week AS metric_time__week
- , subq_7.ds__month AS metric_time__month
- , subq_7.ds__quarter AS metric_time__quarter
- , subq_7.ds__year AS metric_time__year
- , subq_7.ds__extract_year AS metric_time__extract_year
- , subq_7.ds__extract_quarter AS metric_time__extract_quarter
- , subq_7.ds__extract_month AS metric_time__extract_month
- , subq_7.ds__extract_day AS metric_time__extract_day
- , subq_7.ds__extract_dow AS metric_time__extract_dow
- , subq_7.ds__extract_doy AS metric_time__extract_doy
- , subq_7.user
- , subq_7.session_id
- , subq_7.buy__user
- , subq_7.buy__session_id
- , subq_7.buys
- , subq_7.buyers
+ subq_16.ds__day
+ , subq_16.ds__week
+ , subq_16.ds__month
+ , subq_16.ds__quarter
+ , subq_16.ds__year
+ , subq_16.ds__extract_year
+ , subq_16.ds__extract_quarter
+ , subq_16.ds__extract_month
+ , subq_16.ds__extract_day
+ , subq_16.ds__extract_dow
+ , subq_16.ds__extract_doy
+ , subq_16.buy__ds__day
+ , subq_16.buy__ds__week
+ , subq_16.buy__ds__month
+ , subq_16.buy__ds__quarter
+ , subq_16.buy__ds__year
+ , subq_16.buy__ds__extract_year
+ , subq_16.buy__ds__extract_quarter
+ , subq_16.buy__ds__extract_month
+ , subq_16.buy__ds__extract_day
+ , subq_16.buy__ds__extract_dow
+ , subq_16.buy__ds__extract_doy
+ , subq_16.ds__day AS metric_time__day
+ , subq_16.ds__week AS metric_time__week
+ , subq_16.ds__month AS metric_time__month
+ , subq_16.ds__quarter AS metric_time__quarter
+ , subq_16.ds__year AS metric_time__year
+ , subq_16.ds__extract_year AS metric_time__extract_year
+ , subq_16.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_16.ds__extract_month AS metric_time__extract_month
+ , subq_16.ds__extract_day AS metric_time__extract_day
+ , subq_16.ds__extract_dow AS metric_time__extract_dow
+ , subq_16.ds__extract_doy AS metric_time__extract_doy
+ , subq_16.user
+ , subq_16.session_id
+ , subq_16.buy__user
+ , subq_16.buy__session_id
+ , subq_16.buys
+ , subq_16.buyers
FROM (
-- Read Elements From Semantic Model 'buys_source'
SELECT
1 AS buys
- , buys_source_src_28002.user_id AS buyers
- , DATE_TRUNC('day', buys_source_src_28002.ds) AS ds__day
- , DATE_TRUNC('week', buys_source_src_28002.ds) AS ds__week
- , DATE_TRUNC('month', buys_source_src_28002.ds) AS ds__month
- , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS ds__quarter
- , DATE_TRUNC('year', buys_source_src_28002.ds) AS ds__year
- , EXTRACT(year FROM buys_source_src_28002.ds) AS ds__extract_year
- , EXTRACT(quarter FROM buys_source_src_28002.ds) AS ds__extract_quarter
- , EXTRACT(month FROM buys_source_src_28002.ds) AS ds__extract_month
- , EXTRACT(day FROM buys_source_src_28002.ds) AS ds__extract_day
- , EXTRACT(isodow FROM buys_source_src_28002.ds) AS ds__extract_dow
- , EXTRACT(doy FROM buys_source_src_28002.ds) AS ds__extract_doy
- , DATE_TRUNC('day', buys_source_src_28002.ds) AS buy__ds__day
- , DATE_TRUNC('week', buys_source_src_28002.ds) AS buy__ds__week
- , DATE_TRUNC('month', buys_source_src_28002.ds) AS buy__ds__month
- , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS buy__ds__quarter
- , DATE_TRUNC('year', buys_source_src_28002.ds) AS buy__ds__year
- , EXTRACT(year FROM buys_source_src_28002.ds) AS buy__ds__extract_year
- , EXTRACT(quarter FROM buys_source_src_28002.ds) AS buy__ds__extract_quarter
- , EXTRACT(month FROM buys_source_src_28002.ds) AS buy__ds__extract_month
- , EXTRACT(day FROM buys_source_src_28002.ds) AS buy__ds__extract_day
- , EXTRACT(isodow FROM buys_source_src_28002.ds) AS buy__ds__extract_dow
- , EXTRACT(doy FROM buys_source_src_28002.ds) AS buy__ds__extract_doy
- , buys_source_src_28002.user_id AS user
- , buys_source_src_28002.session_id
- , buys_source_src_28002.user_id AS buy__user
- , buys_source_src_28002.session_id AS buy__session_id
- FROM ***************************.fct_buys buys_source_src_28002
- ) subq_7
- ) subq_8
- ) subq_9
+ , buys_source_src_28000.user_id AS buyers
+ , DATE_TRUNC('day', buys_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', buys_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', buys_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', buys_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', buys_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM buys_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM buys_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', buys_source_src_28000.ds) AS buy__ds__day
+ , DATE_TRUNC('week', buys_source_src_28000.ds) AS buy__ds__week
+ , DATE_TRUNC('month', buys_source_src_28000.ds) AS buy__ds__month
+ , DATE_TRUNC('quarter', buys_source_src_28000.ds) AS buy__ds__quarter
+ , DATE_TRUNC('year', buys_source_src_28000.ds) 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
+ , EXTRACT(day FROM buys_source_src_28000.ds) AS buy__ds__extract_day
+ , EXTRACT(isodow FROM buys_source_src_28000.ds) AS buy__ds__extract_dow
+ , EXTRACT(doy FROM buys_source_src_28000.ds) AS buy__ds__extract_doy
+ , buys_source_src_28000.user_id AS user
+ , buys_source_src_28000.session_id
+ , buys_source_src_28000.user_id AS buy__user
+ , buys_source_src_28000.session_id AS buy__session_id
+ FROM ***************************.fct_buys buys_source_src_28000
+ ) subq_16
+ ) subq_17
+ ) subq_18
ON
(
- subq_6.user = subq_9.user
+ subq_15.user = subq_18.user
) AND (
(
- subq_6.ds__day <= subq_9.ds__day
+ subq_15.ds__day <= subq_18.ds__day
) AND (
- subq_6.ds__day > subq_9.ds__day - MAKE_INTERVAL(days => 7)
+ subq_15.ds__day > subq_18.ds__day - MAKE_INTERVAL(days => 7)
)
)
- ) subq_10
- ) subq_11
- ) subq_12
+ ) subq_19
+ ) subq_20
+ ) subq_21
GROUP BY
- subq_12.metric_time__day
- , subq_12.visit__referrer_id
- ) subq_13
+ subq_21.metric_time__day
+ , subq_21.visit__referrer_id
+ ) subq_22
ON
(
- subq_3.visit__referrer_id = subq_13.visit__referrer_id
+ subq_12.visit__referrer_id = subq_22.visit__referrer_id
) AND (
- subq_3.metric_time__day = subq_13.metric_time__day
+ subq_12.metric_time__day = subq_22.metric_time__day
)
GROUP BY
- COALESCE(subq_3.metric_time__day, subq_13.metric_time__day)
- , COALESCE(subq_3.visit__referrer_id, subq_13.visit__referrer_id)
-) subq_14
+ COALESCE(subq_12.metric_time__day, subq_22.metric_time__day)
+ , COALESCE(subq_12.visit__referrer_id, subq_22.visit__referrer_id)
+) subq_23
diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Postgres/test_conversion_rate_with_window__plan0_optimized.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Postgres/test_conversion_rate_with_window__plan0_optimized.sql
index 9f9740236c..5863366113 100644
--- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Postgres/test_conversion_rate_with_window__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Postgres/test_conversion_rate_with_window__plan0_optimized.sql
@@ -6,10 +6,10 @@ SELECT
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_18.metric_time__day, subq_28.metric_time__day) AS metric_time__day
- , COALESCE(subq_18.visit__referrer_id, subq_28.visit__referrer_id) AS visit__referrer_id
- , MAX(subq_18.visits) AS visits
- , MAX(subq_28.buys) AS buys
+ COALESCE(subq_27.metric_time__day, subq_37.metric_time__day) AS metric_time__day
+ , COALESCE(subq_27.visit__referrer_id, subq_37.visit__referrer_id) AS visit__referrer_id
+ , MAX(subq_27.visits) AS visits
+ , MAX(subq_37.buys) AS buys
FROM (
-- Aggregate Measures
SELECT
@@ -24,12 +24,12 @@ FROM (
DATE_TRUNC('day', ds) AS metric_time__day
, referrer_id AS visit__referrer_id
, 1 AS visits
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_17
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_26
GROUP BY
metric_time__day
, visit__referrer_id
- ) subq_18
+ ) subq_27
FULL OUTER JOIN (
-- Find conversions for user within the range of 7 day
-- Pass Only Elements: ['buys', 'visit__referrer_id', 'metric_time__day']
@@ -41,13 +41,13 @@ FROM (
FROM (
-- Dedupe the fanout with mf_internal_uuid in the conversion data set
SELECT DISTINCT
- first_value(subq_21.visits) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
- , first_value(subq_21.visit__referrer_id) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visit__referrer_id
- , first_value(subq_21.ds__day) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
- , first_value(subq_21.metric_time__day) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS metric_time__day
- , first_value(subq_21.user) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
- , subq_24.mf_internal_uuid AS mf_internal_uuid
- , subq_24.buys AS buys
+ first_value(subq_30.visits) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
+ , first_value(subq_30.visit__referrer_id) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visit__referrer_id
+ , first_value(subq_30.ds__day) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
+ , first_value(subq_30.metric_time__day) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS metric_time__day
+ , first_value(subq_30.user) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
+ , subq_33.mf_internal_uuid AS mf_internal_uuid
+ , subq_33.buys AS buys
FROM (
-- Read Elements From Semantic Model 'visits_source'
-- Metric Time Dimension 'ds'
@@ -58,8 +58,8 @@ FROM (
, user_id AS user
, referrer_id AS visit__referrer_id
, 1 AS visits
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_21
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_30
INNER JOIN (
-- Read Elements From Semantic Model 'buys_source'
-- Metric Time Dimension 'ds'
@@ -69,30 +69,30 @@ FROM (
, user_id AS user
, 1 AS buys
, GEN_RANDOM_UUID() AS mf_internal_uuid
- FROM ***************************.fct_buys buys_source_src_28002
- ) subq_24
+ FROM ***************************.fct_buys buys_source_src_28000
+ ) subq_33
ON
(
- subq_21.user = subq_24.user
+ subq_30.user = subq_33.user
) AND (
(
- subq_21.ds__day <= subq_24.ds__day
+ subq_30.ds__day <= subq_33.ds__day
) AND (
- subq_21.ds__day > subq_24.ds__day - MAKE_INTERVAL(days => 7)
+ subq_30.ds__day > subq_33.ds__day - MAKE_INTERVAL(days => 7)
)
)
- ) subq_25
+ ) subq_34
GROUP BY
metric_time__day
, visit__referrer_id
- ) subq_28
+ ) subq_37
ON
(
- subq_18.visit__referrer_id = subq_28.visit__referrer_id
+ subq_27.visit__referrer_id = subq_37.visit__referrer_id
) AND (
- subq_18.metric_time__day = subq_28.metric_time__day
+ subq_27.metric_time__day = subq_37.metric_time__day
)
GROUP BY
- COALESCE(subq_18.metric_time__day, subq_28.metric_time__day)
- , COALESCE(subq_18.visit__referrer_id, subq_28.visit__referrer_id)
-) subq_29
+ COALESCE(subq_27.metric_time__day, subq_37.metric_time__day)
+ , COALESCE(subq_27.visit__referrer_id, subq_37.visit__referrer_id)
+) subq_38
diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Redshift/test_conversion_count_with_no_group_by__plan0.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Redshift/test_conversion_count_with_no_group_by__plan0.sql
index ea94c52f9a..144c372b0a 100644
--- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Redshift/test_conversion_count_with_no_group_by__plan0.sql
+++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Redshift/test_conversion_count_with_no_group_by__plan0.sql
@@ -1,343 +1,343 @@
-- Compute Metrics via Expressions
SELECT
- subq_14.buys AS visit_buy_conversions
+ subq_23.buys AS visit_buy_conversions
FROM (
-- Combine Aggregated Outputs
SELECT
- MAX(subq_3.visits) AS visits
- , COALESCE(MAX(subq_13.buys), 0) AS buys
+ MAX(subq_12.visits) AS visits
+ , COALESCE(MAX(subq_22.buys), 0) AS buys
FROM (
-- Aggregate Measures
SELECT
- SUM(subq_2.visits) AS visits
+ SUM(subq_11.visits) AS visits
FROM (
-- Pass Only Elements: ['visits',]
SELECT
- subq_1.visits
+ subq_10.visits
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.visit__ds__day
- , subq_0.visit__ds__week
- , subq_0.visit__ds__month
- , subq_0.visit__ds__quarter
- , subq_0.visit__ds__year
- , subq_0.visit__ds__extract_year
- , subq_0.visit__ds__extract_quarter
- , subq_0.visit__ds__extract_month
- , subq_0.visit__ds__extract_day
- , subq_0.visit__ds__extract_dow
- , subq_0.visit__ds__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.user
- , subq_0.session
- , subq_0.visit__user
- , subq_0.visit__session
- , subq_0.referrer_id
- , subq_0.visit__referrer_id
- , subq_0.visits
- , subq_0.visitors
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.visit__ds__day
+ , subq_9.visit__ds__week
+ , subq_9.visit__ds__month
+ , subq_9.visit__ds__quarter
+ , subq_9.visit__ds__year
+ , subq_9.visit__ds__extract_year
+ , subq_9.visit__ds__extract_quarter
+ , subq_9.visit__ds__extract_month
+ , subq_9.visit__ds__extract_day
+ , subq_9.visit__ds__extract_dow
+ , subq_9.visit__ds__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.user
+ , subq_9.session
+ , subq_9.visit__user
+ , subq_9.visit__session
+ , subq_9.referrer_id
+ , subq_9.visit__referrer_id
+ , subq_9.visits
+ , subq_9.visitors
FROM (
-- Read Elements From Semantic Model 'visits_source'
SELECT
1 AS visits
- , visits_source_src_28011.user_id AS visitors
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day
- , CASE WHEN EXTRACT(dow FROM visits_source_src_28011.ds) = 0 THEN EXTRACT(dow FROM visits_source_src_28011.ds) + 7 ELSE EXTRACT(dow FROM visits_source_src_28011.ds) END AS ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy
- , visits_source_src_28011.referrer_id
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day
- , CASE WHEN EXTRACT(dow FROM visits_source_src_28011.ds) = 0 THEN EXTRACT(dow FROM visits_source_src_28011.ds) + 7 ELSE EXTRACT(dow FROM visits_source_src_28011.ds) END AS visit__ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy
- , visits_source_src_28011.referrer_id AS visit__referrer_id
- , visits_source_src_28011.user_id AS user
- , visits_source_src_28011.session_id AS session
- , visits_source_src_28011.user_id AS visit__user
- , visits_source_src_28011.session_id AS visit__session
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_0
- ) subq_1
- ) subq_2
- ) subq_3
+ , visits_source_src_28000.user_id AS visitors
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS ds__extract_day
+ , CASE WHEN EXTRACT(dow FROM visits_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM visits_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM visits_source_src_28000.ds) END AS ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS ds__extract_doy
+ , visits_source_src_28000.referrer_id
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS visit__ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS visit__ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS visit__ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS visit__ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS visit__ds__extract_day
+ , CASE WHEN EXTRACT(dow FROM visits_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM visits_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM visits_source_src_28000.ds) END AS visit__ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS visit__ds__extract_doy
+ , visits_source_src_28000.referrer_id AS visit__referrer_id
+ , visits_source_src_28000.user_id AS user
+ , visits_source_src_28000.session_id AS session
+ , visits_source_src_28000.user_id AS visit__user
+ , visits_source_src_28000.session_id AS visit__session
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
+ ) subq_12
CROSS JOIN (
-- Aggregate Measures
SELECT
- SUM(subq_12.buys) AS buys
+ SUM(subq_21.buys) AS buys
FROM (
-- Pass Only Elements: ['buys',]
SELECT
- subq_11.buys
+ subq_20.buys
FROM (
-- Find conversions for user within the range of 7 day
SELECT
- subq_10.ds__day
- , subq_10.user
- , subq_10.buys
- , subq_10.visits
+ subq_19.ds__day
+ , subq_19.user
+ , subq_19.buys
+ , subq_19.visits
FROM (
-- Dedupe the fanout with mf_internal_uuid in the conversion data set
SELECT DISTINCT
- first_value(subq_6.visits) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
- , first_value(subq_6.ds__day) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
- , first_value(subq_6.user) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
- , subq_9.mf_internal_uuid AS mf_internal_uuid
- , subq_9.buys AS buys
+ first_value(subq_15.visits) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
+ , first_value(subq_15.ds__day) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
+ , first_value(subq_15.user) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
+ , subq_18.mf_internal_uuid AS mf_internal_uuid
+ , subq_18.buys AS buys
FROM (
-- Pass Only Elements: ['visits', 'ds__day', 'user']
SELECT
- subq_5.ds__day
- , subq_5.user
- , subq_5.visits
+ subq_14.ds__day
+ , subq_14.user
+ , subq_14.visits
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_4.ds__day
- , subq_4.ds__week
- , subq_4.ds__month
- , subq_4.ds__quarter
- , subq_4.ds__year
- , subq_4.ds__extract_year
- , subq_4.ds__extract_quarter
- , subq_4.ds__extract_month
- , subq_4.ds__extract_day
- , subq_4.ds__extract_dow
- , subq_4.ds__extract_doy
- , subq_4.visit__ds__day
- , subq_4.visit__ds__week
- , subq_4.visit__ds__month
- , subq_4.visit__ds__quarter
- , subq_4.visit__ds__year
- , subq_4.visit__ds__extract_year
- , subq_4.visit__ds__extract_quarter
- , subq_4.visit__ds__extract_month
- , subq_4.visit__ds__extract_day
- , subq_4.visit__ds__extract_dow
- , subq_4.visit__ds__extract_doy
- , subq_4.ds__day AS metric_time__day
- , subq_4.ds__week AS metric_time__week
- , subq_4.ds__month AS metric_time__month
- , subq_4.ds__quarter AS metric_time__quarter
- , subq_4.ds__year AS metric_time__year
- , subq_4.ds__extract_year AS metric_time__extract_year
- , subq_4.ds__extract_quarter AS metric_time__extract_quarter
- , subq_4.ds__extract_month AS metric_time__extract_month
- , subq_4.ds__extract_day AS metric_time__extract_day
- , subq_4.ds__extract_dow AS metric_time__extract_dow
- , subq_4.ds__extract_doy AS metric_time__extract_doy
- , subq_4.user
- , subq_4.session
- , subq_4.visit__user
- , subq_4.visit__session
- , subq_4.referrer_id
- , subq_4.visit__referrer_id
- , subq_4.visits
- , subq_4.visitors
+ subq_13.ds__day
+ , subq_13.ds__week
+ , subq_13.ds__month
+ , subq_13.ds__quarter
+ , subq_13.ds__year
+ , subq_13.ds__extract_year
+ , subq_13.ds__extract_quarter
+ , subq_13.ds__extract_month
+ , subq_13.ds__extract_day
+ , subq_13.ds__extract_dow
+ , subq_13.ds__extract_doy
+ , subq_13.visit__ds__day
+ , subq_13.visit__ds__week
+ , subq_13.visit__ds__month
+ , subq_13.visit__ds__quarter
+ , subq_13.visit__ds__year
+ , subq_13.visit__ds__extract_year
+ , subq_13.visit__ds__extract_quarter
+ , subq_13.visit__ds__extract_month
+ , subq_13.visit__ds__extract_day
+ , subq_13.visit__ds__extract_dow
+ , subq_13.visit__ds__extract_doy
+ , subq_13.ds__day AS metric_time__day
+ , subq_13.ds__week AS metric_time__week
+ , subq_13.ds__month AS metric_time__month
+ , subq_13.ds__quarter AS metric_time__quarter
+ , subq_13.ds__year AS metric_time__year
+ , subq_13.ds__extract_year AS metric_time__extract_year
+ , subq_13.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_13.ds__extract_month AS metric_time__extract_month
+ , subq_13.ds__extract_day AS metric_time__extract_day
+ , subq_13.ds__extract_dow AS metric_time__extract_dow
+ , subq_13.ds__extract_doy AS metric_time__extract_doy
+ , subq_13.user
+ , subq_13.session
+ , subq_13.visit__user
+ , subq_13.visit__session
+ , subq_13.referrer_id
+ , subq_13.visit__referrer_id
+ , subq_13.visits
+ , subq_13.visitors
FROM (
-- Read Elements From Semantic Model 'visits_source'
SELECT
1 AS visits
- , visits_source_src_28011.user_id AS visitors
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day
- , CASE WHEN EXTRACT(dow FROM visits_source_src_28011.ds) = 0 THEN EXTRACT(dow FROM visits_source_src_28011.ds) + 7 ELSE EXTRACT(dow FROM visits_source_src_28011.ds) END AS ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy
- , visits_source_src_28011.referrer_id
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day
- , CASE WHEN EXTRACT(dow FROM visits_source_src_28011.ds) = 0 THEN EXTRACT(dow FROM visits_source_src_28011.ds) + 7 ELSE EXTRACT(dow FROM visits_source_src_28011.ds) END AS visit__ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy
- , visits_source_src_28011.referrer_id AS visit__referrer_id
- , visits_source_src_28011.user_id AS user
- , visits_source_src_28011.session_id AS session
- , visits_source_src_28011.user_id AS visit__user
- , visits_source_src_28011.session_id AS visit__session
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_4
- ) subq_5
- ) subq_6
+ , visits_source_src_28000.user_id AS visitors
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS ds__extract_day
+ , CASE WHEN EXTRACT(dow FROM visits_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM visits_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM visits_source_src_28000.ds) END AS ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS ds__extract_doy
+ , visits_source_src_28000.referrer_id
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS visit__ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS visit__ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS visit__ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS visit__ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS visit__ds__extract_day
+ , CASE WHEN EXTRACT(dow FROM visits_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM visits_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM visits_source_src_28000.ds) END AS visit__ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS visit__ds__extract_doy
+ , visits_source_src_28000.referrer_id AS visit__referrer_id
+ , visits_source_src_28000.user_id AS user
+ , visits_source_src_28000.session_id AS session
+ , visits_source_src_28000.user_id AS visit__user
+ , visits_source_src_28000.session_id AS visit__session
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_13
+ ) subq_14
+ ) subq_15
INNER JOIN (
-- Add column with generated UUID
SELECT
- subq_8.ds__day
- , subq_8.ds__week
- , subq_8.ds__month
- , subq_8.ds__quarter
- , subq_8.ds__year
- , subq_8.ds__extract_year
- , subq_8.ds__extract_quarter
- , subq_8.ds__extract_month
- , subq_8.ds__extract_day
- , subq_8.ds__extract_dow
- , subq_8.ds__extract_doy
- , subq_8.buy__ds__day
- , subq_8.buy__ds__week
- , subq_8.buy__ds__month
- , subq_8.buy__ds__quarter
- , subq_8.buy__ds__year
- , subq_8.buy__ds__extract_year
- , subq_8.buy__ds__extract_quarter
- , subq_8.buy__ds__extract_month
- , subq_8.buy__ds__extract_day
- , subq_8.buy__ds__extract_dow
- , subq_8.buy__ds__extract_doy
- , subq_8.metric_time__day
- , subq_8.metric_time__week
- , subq_8.metric_time__month
- , subq_8.metric_time__quarter
- , subq_8.metric_time__year
- , subq_8.metric_time__extract_year
- , subq_8.metric_time__extract_quarter
- , subq_8.metric_time__extract_month
- , subq_8.metric_time__extract_day
- , subq_8.metric_time__extract_dow
- , subq_8.metric_time__extract_doy
- , subq_8.user
- , subq_8.session_id
- , subq_8.buy__user
- , subq_8.buy__session_id
- , subq_8.buys
- , subq_8.buyers
+ subq_17.ds__day
+ , subq_17.ds__week
+ , subq_17.ds__month
+ , subq_17.ds__quarter
+ , subq_17.ds__year
+ , subq_17.ds__extract_year
+ , subq_17.ds__extract_quarter
+ , subq_17.ds__extract_month
+ , subq_17.ds__extract_day
+ , subq_17.ds__extract_dow
+ , subq_17.ds__extract_doy
+ , subq_17.buy__ds__day
+ , subq_17.buy__ds__week
+ , subq_17.buy__ds__month
+ , subq_17.buy__ds__quarter
+ , subq_17.buy__ds__year
+ , subq_17.buy__ds__extract_year
+ , subq_17.buy__ds__extract_quarter
+ , subq_17.buy__ds__extract_month
+ , subq_17.buy__ds__extract_day
+ , subq_17.buy__ds__extract_dow
+ , subq_17.buy__ds__extract_doy
+ , subq_17.metric_time__day
+ , subq_17.metric_time__week
+ , subq_17.metric_time__month
+ , subq_17.metric_time__quarter
+ , subq_17.metric_time__year
+ , subq_17.metric_time__extract_year
+ , subq_17.metric_time__extract_quarter
+ , subq_17.metric_time__extract_month
+ , subq_17.metric_time__extract_day
+ , subq_17.metric_time__extract_dow
+ , subq_17.metric_time__extract_doy
+ , subq_17.user
+ , subq_17.session_id
+ , subq_17.buy__user
+ , subq_17.buy__session_id
+ , subq_17.buys
+ , subq_17.buyers
, CONCAT(CAST(RANDOM()*100000000 AS INT)::VARCHAR,CAST(RANDOM()*100000000 AS INT)::VARCHAR) AS mf_internal_uuid
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_7.ds__day
- , subq_7.ds__week
- , subq_7.ds__month
- , subq_7.ds__quarter
- , subq_7.ds__year
- , subq_7.ds__extract_year
- , subq_7.ds__extract_quarter
- , subq_7.ds__extract_month
- , subq_7.ds__extract_day
- , subq_7.ds__extract_dow
- , subq_7.ds__extract_doy
- , subq_7.buy__ds__day
- , subq_7.buy__ds__week
- , subq_7.buy__ds__month
- , subq_7.buy__ds__quarter
- , subq_7.buy__ds__year
- , subq_7.buy__ds__extract_year
- , subq_7.buy__ds__extract_quarter
- , subq_7.buy__ds__extract_month
- , subq_7.buy__ds__extract_day
- , subq_7.buy__ds__extract_dow
- , subq_7.buy__ds__extract_doy
- , subq_7.ds__day AS metric_time__day
- , subq_7.ds__week AS metric_time__week
- , subq_7.ds__month AS metric_time__month
- , subq_7.ds__quarter AS metric_time__quarter
- , subq_7.ds__year AS metric_time__year
- , subq_7.ds__extract_year AS metric_time__extract_year
- , subq_7.ds__extract_quarter AS metric_time__extract_quarter
- , subq_7.ds__extract_month AS metric_time__extract_month
- , subq_7.ds__extract_day AS metric_time__extract_day
- , subq_7.ds__extract_dow AS metric_time__extract_dow
- , subq_7.ds__extract_doy AS metric_time__extract_doy
- , subq_7.user
- , subq_7.session_id
- , subq_7.buy__user
- , subq_7.buy__session_id
- , subq_7.buys
- , subq_7.buyers
+ subq_16.ds__day
+ , subq_16.ds__week
+ , subq_16.ds__month
+ , subq_16.ds__quarter
+ , subq_16.ds__year
+ , subq_16.ds__extract_year
+ , subq_16.ds__extract_quarter
+ , subq_16.ds__extract_month
+ , subq_16.ds__extract_day
+ , subq_16.ds__extract_dow
+ , subq_16.ds__extract_doy
+ , subq_16.buy__ds__day
+ , subq_16.buy__ds__week
+ , subq_16.buy__ds__month
+ , subq_16.buy__ds__quarter
+ , subq_16.buy__ds__year
+ , subq_16.buy__ds__extract_year
+ , subq_16.buy__ds__extract_quarter
+ , subq_16.buy__ds__extract_month
+ , subq_16.buy__ds__extract_day
+ , subq_16.buy__ds__extract_dow
+ , subq_16.buy__ds__extract_doy
+ , subq_16.ds__day AS metric_time__day
+ , subq_16.ds__week AS metric_time__week
+ , subq_16.ds__month AS metric_time__month
+ , subq_16.ds__quarter AS metric_time__quarter
+ , subq_16.ds__year AS metric_time__year
+ , subq_16.ds__extract_year AS metric_time__extract_year
+ , subq_16.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_16.ds__extract_month AS metric_time__extract_month
+ , subq_16.ds__extract_day AS metric_time__extract_day
+ , subq_16.ds__extract_dow AS metric_time__extract_dow
+ , subq_16.ds__extract_doy AS metric_time__extract_doy
+ , subq_16.user
+ , subq_16.session_id
+ , subq_16.buy__user
+ , subq_16.buy__session_id
+ , subq_16.buys
+ , subq_16.buyers
FROM (
-- Read Elements From Semantic Model 'buys_source'
SELECT
1 AS buys
- , buys_source_src_28002.user_id AS buyers
- , DATE_TRUNC('day', buys_source_src_28002.ds) AS ds__day
- , DATE_TRUNC('week', buys_source_src_28002.ds) AS ds__week
- , DATE_TRUNC('month', buys_source_src_28002.ds) AS ds__month
- , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS ds__quarter
- , DATE_TRUNC('year', buys_source_src_28002.ds) AS ds__year
- , EXTRACT(year FROM buys_source_src_28002.ds) AS ds__extract_year
- , EXTRACT(quarter FROM buys_source_src_28002.ds) AS ds__extract_quarter
- , EXTRACT(month FROM buys_source_src_28002.ds) AS ds__extract_month
- , EXTRACT(day FROM buys_source_src_28002.ds) AS ds__extract_day
- , CASE WHEN EXTRACT(dow FROM buys_source_src_28002.ds) = 0 THEN EXTRACT(dow FROM buys_source_src_28002.ds) + 7 ELSE EXTRACT(dow FROM buys_source_src_28002.ds) END AS ds__extract_dow
- , EXTRACT(doy FROM buys_source_src_28002.ds) AS ds__extract_doy
- , DATE_TRUNC('day', buys_source_src_28002.ds) AS buy__ds__day
- , DATE_TRUNC('week', buys_source_src_28002.ds) AS buy__ds__week
- , DATE_TRUNC('month', buys_source_src_28002.ds) AS buy__ds__month
- , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS buy__ds__quarter
- , DATE_TRUNC('year', buys_source_src_28002.ds) AS buy__ds__year
- , EXTRACT(year FROM buys_source_src_28002.ds) AS buy__ds__extract_year
- , EXTRACT(quarter FROM buys_source_src_28002.ds) AS buy__ds__extract_quarter
- , EXTRACT(month FROM buys_source_src_28002.ds) AS buy__ds__extract_month
- , EXTRACT(day FROM buys_source_src_28002.ds) AS buy__ds__extract_day
- , CASE WHEN EXTRACT(dow FROM buys_source_src_28002.ds) = 0 THEN EXTRACT(dow FROM buys_source_src_28002.ds) + 7 ELSE EXTRACT(dow FROM buys_source_src_28002.ds) END AS buy__ds__extract_dow
- , EXTRACT(doy FROM buys_source_src_28002.ds) AS buy__ds__extract_doy
- , buys_source_src_28002.user_id AS user
- , buys_source_src_28002.session_id
- , buys_source_src_28002.user_id AS buy__user
- , buys_source_src_28002.session_id AS buy__session_id
- FROM ***************************.fct_buys buys_source_src_28002
- ) subq_7
- ) subq_8
- ) subq_9
+ , buys_source_src_28000.user_id AS buyers
+ , DATE_TRUNC('day', buys_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', buys_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', buys_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', buys_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', buys_source_src_28000.ds) 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
+ , CASE WHEN EXTRACT(dow FROM buys_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM buys_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM buys_source_src_28000.ds) END AS ds__extract_dow
+ , EXTRACT(doy FROM buys_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', buys_source_src_28000.ds) AS buy__ds__day
+ , DATE_TRUNC('week', buys_source_src_28000.ds) AS buy__ds__week
+ , DATE_TRUNC('month', buys_source_src_28000.ds) AS buy__ds__month
+ , DATE_TRUNC('quarter', buys_source_src_28000.ds) AS buy__ds__quarter
+ , DATE_TRUNC('year', buys_source_src_28000.ds) 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
+ , EXTRACT(day FROM buys_source_src_28000.ds) AS buy__ds__extract_day
+ , CASE WHEN EXTRACT(dow FROM buys_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM buys_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM buys_source_src_28000.ds) END AS buy__ds__extract_dow
+ , EXTRACT(doy FROM buys_source_src_28000.ds) AS buy__ds__extract_doy
+ , buys_source_src_28000.user_id AS user
+ , buys_source_src_28000.session_id
+ , buys_source_src_28000.user_id AS buy__user
+ , buys_source_src_28000.session_id AS buy__session_id
+ FROM ***************************.fct_buys buys_source_src_28000
+ ) subq_16
+ ) subq_17
+ ) subq_18
ON
(
- subq_6.user = subq_9.user
+ subq_15.user = subq_18.user
) AND (
(
- subq_6.ds__day <= subq_9.ds__day
+ subq_15.ds__day <= subq_18.ds__day
) AND (
- subq_6.ds__day > DATEADD(day, -7, subq_9.ds__day)
+ subq_15.ds__day > DATEADD(day, -7, subq_18.ds__day)
)
)
- ) subq_10
- ) subq_11
- ) subq_12
- ) subq_13
-) subq_14
+ ) subq_19
+ ) subq_20
+ ) subq_21
+ ) subq_22
+) subq_23
diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Redshift/test_conversion_count_with_no_group_by__plan0_optimized.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Redshift/test_conversion_count_with_no_group_by__plan0_optimized.sql
index 186b31c974..f79318dd55 100644
--- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Redshift/test_conversion_count_with_no_group_by__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Redshift/test_conversion_count_with_no_group_by__plan0_optimized.sql
@@ -1,7 +1,7 @@
-- Combine Aggregated Outputs
-- Compute Metrics via Expressions
SELECT
- COALESCE(MAX(subq_28.buys), 0) AS visit_buy_conversions
+ COALESCE(MAX(subq_37.buys), 0) AS visit_buy_conversions
FROM (
-- Read Elements From Semantic Model 'visits_source'
-- Metric Time Dimension 'ds'
@@ -9,8 +9,8 @@ FROM (
-- Aggregate Measures
SELECT
SUM(1) AS visits
- FROM ***************************.fct_visits visits_source_src_28011
-) subq_18
+ FROM ***************************.fct_visits visits_source_src_28000
+) subq_27
CROSS JOIN (
-- Find conversions for user within the range of 7 day
-- Pass Only Elements: ['buys',]
@@ -20,11 +20,11 @@ CROSS JOIN (
FROM (
-- Dedupe the fanout with mf_internal_uuid in the conversion data set
SELECT DISTINCT
- first_value(subq_21.visits) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
- , first_value(subq_21.ds__day) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
- , first_value(subq_21.user) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
- , subq_24.mf_internal_uuid AS mf_internal_uuid
- , subq_24.buys AS buys
+ first_value(subq_30.visits) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
+ , first_value(subq_30.ds__day) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
+ , first_value(subq_30.user) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
+ , subq_33.mf_internal_uuid AS mf_internal_uuid
+ , subq_33.buys AS buys
FROM (
-- Read Elements From Semantic Model 'visits_source'
-- Metric Time Dimension 'ds'
@@ -33,8 +33,8 @@ CROSS JOIN (
DATE_TRUNC('day', ds) AS ds__day
, user_id AS user
, 1 AS visits
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_21
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_30
INNER JOIN (
-- Read Elements From Semantic Model 'buys_source'
-- Metric Time Dimension 'ds'
@@ -44,17 +44,17 @@ CROSS JOIN (
, user_id AS user
, 1 AS buys
, CONCAT(CAST(RANDOM()*100000000 AS INT)::VARCHAR,CAST(RANDOM()*100000000 AS INT)::VARCHAR) AS mf_internal_uuid
- FROM ***************************.fct_buys buys_source_src_28002
- ) subq_24
+ FROM ***************************.fct_buys buys_source_src_28000
+ ) subq_33
ON
(
- subq_21.user = subq_24.user
+ subq_30.user = subq_33.user
) AND (
(
- subq_21.ds__day <= subq_24.ds__day
+ subq_30.ds__day <= subq_33.ds__day
) AND (
- subq_21.ds__day > DATEADD(day, -7, subq_24.ds__day)
+ subq_30.ds__day > DATEADD(day, -7, subq_33.ds__day)
)
)
- ) subq_25
-) subq_28
+ ) subq_34
+) subq_37
diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Redshift/test_conversion_rate__plan0.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Redshift/test_conversion_rate__plan0.sql
index dd5dda5d57..7720eb0a6c 100644
--- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Redshift/test_conversion_rate__plan0.sql
+++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Redshift/test_conversion_rate__plan0.sql
@@ -1,352 +1,356 @@
-- Compute Metrics via Expressions
SELECT
- subq_14.visit__referrer_id
- , CAST(subq_14.buys AS DOUBLE PRECISION) / CAST(NULLIF(subq_14.visits, 0) AS DOUBLE PRECISION) AS visit_buy_conversion_rate
+ subq_23.visit__referrer_id
+ , CAST(subq_23.buys AS DOUBLE PRECISION) / CAST(NULLIF(subq_23.visits, 0) AS DOUBLE PRECISION) AS visit_buy_conversion_rate
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_3.visit__referrer_id, subq_13.visit__referrer_id) AS visit__referrer_id
- , MAX(subq_3.visits) AS visits
- , MAX(subq_13.buys) AS buys
+ COALESCE(subq_12.visit__referrer_id, subq_22.visit__referrer_id) AS visit__referrer_id
+ , MAX(subq_12.visits) AS visits
+ , MAX(subq_22.buys) AS buys
FROM (
-- Aggregate Measures
SELECT
- subq_2.visit__referrer_id
- , SUM(subq_2.visits) AS visits
+ subq_11.visit__referrer_id
+ , SUM(subq_11.visits) AS visits
FROM (
-- Pass Only Elements: ['visits', 'visit__referrer_id']
SELECT
- subq_1.visit__referrer_id
- , subq_1.visits
+ subq_10.visit__referrer_id
+ , subq_10.visits
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.visit__ds__day
- , subq_0.visit__ds__week
- , subq_0.visit__ds__month
- , subq_0.visit__ds__quarter
- , subq_0.visit__ds__year
- , subq_0.visit__ds__extract_year
- , subq_0.visit__ds__extract_quarter
- , subq_0.visit__ds__extract_month
- , subq_0.visit__ds__extract_day
- , subq_0.visit__ds__extract_dow
- , subq_0.visit__ds__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.user
- , subq_0.session
- , subq_0.visit__user
- , subq_0.visit__session
- , subq_0.referrer_id
- , subq_0.visit__referrer_id
- , subq_0.visits
- , subq_0.visitors
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.visit__ds__day
+ , subq_9.visit__ds__week
+ , subq_9.visit__ds__month
+ , subq_9.visit__ds__quarter
+ , subq_9.visit__ds__year
+ , subq_9.visit__ds__extract_year
+ , subq_9.visit__ds__extract_quarter
+ , subq_9.visit__ds__extract_month
+ , subq_9.visit__ds__extract_day
+ , subq_9.visit__ds__extract_dow
+ , subq_9.visit__ds__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.user
+ , subq_9.session
+ , subq_9.visit__user
+ , subq_9.visit__session
+ , subq_9.referrer_id
+ , subq_9.visit__referrer_id
+ , subq_9.visits
+ , subq_9.visitors
FROM (
-- Read Elements From Semantic Model 'visits_source'
SELECT
1 AS visits
- , visits_source_src_28011.user_id AS visitors
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day
- , CASE WHEN EXTRACT(dow FROM visits_source_src_28011.ds) = 0 THEN EXTRACT(dow FROM visits_source_src_28011.ds) + 7 ELSE EXTRACT(dow FROM visits_source_src_28011.ds) END AS ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy
- , visits_source_src_28011.referrer_id
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day
- , CASE WHEN EXTRACT(dow FROM visits_source_src_28011.ds) = 0 THEN EXTRACT(dow FROM visits_source_src_28011.ds) + 7 ELSE EXTRACT(dow FROM visits_source_src_28011.ds) END AS visit__ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy
- , visits_source_src_28011.referrer_id AS visit__referrer_id
- , visits_source_src_28011.user_id AS user
- , visits_source_src_28011.session_id AS session
- , visits_source_src_28011.user_id AS visit__user
- , visits_source_src_28011.session_id AS visit__session
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_0
- ) subq_1
- ) subq_2
+ , visits_source_src_28000.user_id AS visitors
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS ds__extract_day
+ , CASE WHEN EXTRACT(dow FROM visits_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM visits_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM visits_source_src_28000.ds) END AS ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS ds__extract_doy
+ , visits_source_src_28000.referrer_id
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS visit__ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS visit__ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS visit__ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS visit__ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS visit__ds__extract_day
+ , CASE WHEN EXTRACT(dow FROM visits_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM visits_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM visits_source_src_28000.ds) END AS visit__ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS visit__ds__extract_doy
+ , visits_source_src_28000.referrer_id AS visit__referrer_id
+ , visits_source_src_28000.user_id AS user
+ , visits_source_src_28000.session_id AS session
+ , visits_source_src_28000.user_id AS visit__user
+ , visits_source_src_28000.session_id AS visit__session
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
GROUP BY
- subq_2.visit__referrer_id
- ) subq_3
+ subq_11.visit__referrer_id
+ ) subq_12
FULL OUTER JOIN (
-- Aggregate Measures
SELECT
- subq_12.visit__referrer_id
- , SUM(subq_12.buys) AS buys
+ subq_21.visit__referrer_id
+ , SUM(subq_21.buys) AS buys
FROM (
-- Pass Only Elements: ['buys', 'visit__referrer_id']
SELECT
- subq_11.visit__referrer_id
- , subq_11.buys
+ subq_20.visit__referrer_id
+ , subq_20.buys
FROM (
-- Find conversions for user within the range of INF
SELECT
- subq_10.ds__day
- , subq_10.user
- , subq_10.visit__referrer_id
- , subq_10.buys
- , subq_10.visits
+ subq_19.ds__day
+ , subq_19.user
+ , subq_19.visit__referrer_id
+ , subq_19.buys
+ , subq_19.visits
FROM (
-- Dedupe the fanout with mf_internal_uuid in the conversion data set
SELECT DISTINCT
- first_value(subq_6.visits) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
- , first_value(subq_6.visit__referrer_id) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visit__referrer_id
- , first_value(subq_6.ds__day) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
- , first_value(subq_6.user) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
- , subq_9.mf_internal_uuid AS mf_internal_uuid
- , subq_9.buys AS buys
+ first_value(subq_15.visits) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
+ , first_value(subq_15.visit__referrer_id) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visit__referrer_id
+ , first_value(subq_15.ds__day) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
+ , first_value(subq_15.user) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
+ , subq_18.mf_internal_uuid AS mf_internal_uuid
+ , subq_18.buys AS buys
FROM (
-- Pass Only Elements: ['visits', 'visit__referrer_id', 'ds__day', 'user']
SELECT
- subq_5.ds__day
- , subq_5.user
- , subq_5.visit__referrer_id
- , subq_5.visits
+ subq_14.ds__day
+ , subq_14.user
+ , subq_14.visit__referrer_id
+ , subq_14.visits
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_4.ds__day
- , subq_4.ds__week
- , subq_4.ds__month
- , subq_4.ds__quarter
- , subq_4.ds__year
- , subq_4.ds__extract_year
- , subq_4.ds__extract_quarter
- , subq_4.ds__extract_month
- , subq_4.ds__extract_day
- , subq_4.ds__extract_dow
- , subq_4.ds__extract_doy
- , subq_4.visit__ds__day
- , subq_4.visit__ds__week
- , subq_4.visit__ds__month
- , subq_4.visit__ds__quarter
- , subq_4.visit__ds__year
- , subq_4.visit__ds__extract_year
- , subq_4.visit__ds__extract_quarter
- , subq_4.visit__ds__extract_month
- , subq_4.visit__ds__extract_day
- , subq_4.visit__ds__extract_dow
- , subq_4.visit__ds__extract_doy
- , subq_4.ds__day AS metric_time__day
- , subq_4.ds__week AS metric_time__week
- , subq_4.ds__month AS metric_time__month
- , subq_4.ds__quarter AS metric_time__quarter
- , subq_4.ds__year AS metric_time__year
- , subq_4.ds__extract_year AS metric_time__extract_year
- , subq_4.ds__extract_quarter AS metric_time__extract_quarter
- , subq_4.ds__extract_month AS metric_time__extract_month
- , subq_4.ds__extract_day AS metric_time__extract_day
- , subq_4.ds__extract_dow AS metric_time__extract_dow
- , subq_4.ds__extract_doy AS metric_time__extract_doy
- , subq_4.user
- , subq_4.session
- , subq_4.visit__user
- , subq_4.visit__session
- , subq_4.referrer_id
- , subq_4.visit__referrer_id
- , subq_4.visits
- , subq_4.visitors
+ subq_13.ds__day
+ , subq_13.ds__week
+ , subq_13.ds__month
+ , subq_13.ds__quarter
+ , subq_13.ds__year
+ , subq_13.ds__extract_year
+ , subq_13.ds__extract_quarter
+ , subq_13.ds__extract_month
+ , subq_13.ds__extract_day
+ , subq_13.ds__extract_dow
+ , subq_13.ds__extract_doy
+ , subq_13.visit__ds__day
+ , subq_13.visit__ds__week
+ , subq_13.visit__ds__month
+ , subq_13.visit__ds__quarter
+ , subq_13.visit__ds__year
+ , subq_13.visit__ds__extract_year
+ , subq_13.visit__ds__extract_quarter
+ , subq_13.visit__ds__extract_month
+ , subq_13.visit__ds__extract_day
+ , subq_13.visit__ds__extract_dow
+ , subq_13.visit__ds__extract_doy
+ , subq_13.ds__day AS metric_time__day
+ , subq_13.ds__week AS metric_time__week
+ , subq_13.ds__month AS metric_time__month
+ , subq_13.ds__quarter AS metric_time__quarter
+ , subq_13.ds__year AS metric_time__year
+ , subq_13.ds__extract_year AS metric_time__extract_year
+ , subq_13.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_13.ds__extract_month AS metric_time__extract_month
+ , subq_13.ds__extract_day AS metric_time__extract_day
+ , subq_13.ds__extract_dow AS metric_time__extract_dow
+ , subq_13.ds__extract_doy AS metric_time__extract_doy
+ , subq_13.user
+ , subq_13.session
+ , subq_13.visit__user
+ , subq_13.visit__session
+ , subq_13.referrer_id
+ , subq_13.visit__referrer_id
+ , subq_13.visits
+ , subq_13.visitors
FROM (
-- Read Elements From Semantic Model 'visits_source'
SELECT
1 AS visits
- , visits_source_src_28011.user_id AS visitors
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day
- , CASE WHEN EXTRACT(dow FROM visits_source_src_28011.ds) = 0 THEN EXTRACT(dow FROM visits_source_src_28011.ds) + 7 ELSE EXTRACT(dow FROM visits_source_src_28011.ds) END AS ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy
- , visits_source_src_28011.referrer_id
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day
- , CASE WHEN EXTRACT(dow FROM visits_source_src_28011.ds) = 0 THEN EXTRACT(dow FROM visits_source_src_28011.ds) + 7 ELSE EXTRACT(dow FROM visits_source_src_28011.ds) END AS visit__ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy
- , visits_source_src_28011.referrer_id AS visit__referrer_id
- , visits_source_src_28011.user_id AS user
- , visits_source_src_28011.session_id AS session
- , visits_source_src_28011.user_id AS visit__user
- , visits_source_src_28011.session_id AS visit__session
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_4
- ) subq_5
- ) subq_6
+ , visits_source_src_28000.user_id AS visitors
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS ds__extract_day
+ , CASE WHEN EXTRACT(dow FROM visits_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM visits_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM visits_source_src_28000.ds) END AS ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS ds__extract_doy
+ , visits_source_src_28000.referrer_id
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS visit__ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS visit__ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS visit__ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS visit__ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS visit__ds__extract_day
+ , CASE WHEN EXTRACT(dow FROM visits_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM visits_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM visits_source_src_28000.ds) END AS visit__ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS visit__ds__extract_doy
+ , visits_source_src_28000.referrer_id AS visit__referrer_id
+ , visits_source_src_28000.user_id AS user
+ , visits_source_src_28000.session_id AS session
+ , visits_source_src_28000.user_id AS visit__user
+ , visits_source_src_28000.session_id AS visit__session
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_13
+ ) subq_14
+ ) subq_15
INNER JOIN (
-- Add column with generated UUID
SELECT
- subq_8.ds__day
- , subq_8.ds__week
- , subq_8.ds__month
- , subq_8.ds__quarter
- , subq_8.ds__year
- , subq_8.ds__extract_year
- , subq_8.ds__extract_quarter
- , subq_8.ds__extract_month
- , subq_8.ds__extract_day
- , subq_8.ds__extract_dow
- , subq_8.ds__extract_doy
- , subq_8.buy__ds__day
- , subq_8.buy__ds__week
- , subq_8.buy__ds__month
- , subq_8.buy__ds__quarter
- , subq_8.buy__ds__year
- , subq_8.buy__ds__extract_year
- , subq_8.buy__ds__extract_quarter
- , subq_8.buy__ds__extract_month
- , subq_8.buy__ds__extract_day
- , subq_8.buy__ds__extract_dow
- , subq_8.buy__ds__extract_doy
- , subq_8.metric_time__day
- , subq_8.metric_time__week
- , subq_8.metric_time__month
- , subq_8.metric_time__quarter
- , subq_8.metric_time__year
- , subq_8.metric_time__extract_year
- , subq_8.metric_time__extract_quarter
- , subq_8.metric_time__extract_month
- , subq_8.metric_time__extract_day
- , subq_8.metric_time__extract_dow
- , subq_8.metric_time__extract_doy
- , subq_8.user
- , subq_8.session_id
- , subq_8.buy__user
- , subq_8.buy__session_id
- , subq_8.buys
- , subq_8.buyers
+ subq_17.ds__day
+ , subq_17.ds__week
+ , subq_17.ds__month
+ , subq_17.ds__quarter
+ , subq_17.ds__year
+ , subq_17.ds__extract_year
+ , subq_17.ds__extract_quarter
+ , subq_17.ds__extract_month
+ , subq_17.ds__extract_day
+ , subq_17.ds__extract_dow
+ , subq_17.ds__extract_doy
+ , subq_17.buy__ds__day
+ , subq_17.buy__ds__week
+ , subq_17.buy__ds__month
+ , subq_17.buy__ds__quarter
+ , subq_17.buy__ds__year
+ , subq_17.buy__ds__extract_year
+ , subq_17.buy__ds__extract_quarter
+ , subq_17.buy__ds__extract_month
+ , subq_17.buy__ds__extract_day
+ , subq_17.buy__ds__extract_dow
+ , subq_17.buy__ds__extract_doy
+ , subq_17.metric_time__day
+ , subq_17.metric_time__week
+ , subq_17.metric_time__month
+ , subq_17.metric_time__quarter
+ , subq_17.metric_time__year
+ , subq_17.metric_time__extract_year
+ , subq_17.metric_time__extract_quarter
+ , subq_17.metric_time__extract_month
+ , subq_17.metric_time__extract_day
+ , subq_17.metric_time__extract_dow
+ , subq_17.metric_time__extract_doy
+ , subq_17.user
+ , subq_17.session_id
+ , subq_17.buy__user
+ , subq_17.buy__session_id
+ , subq_17.buys
+ , subq_17.buyers
, CONCAT(CAST(RANDOM()*100000000 AS INT)::VARCHAR,CAST(RANDOM()*100000000 AS INT)::VARCHAR) AS mf_internal_uuid
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_7.ds__day
- , subq_7.ds__week
- , subq_7.ds__month
- , subq_7.ds__quarter
- , subq_7.ds__year
- , subq_7.ds__extract_year
- , subq_7.ds__extract_quarter
- , subq_7.ds__extract_month
- , subq_7.ds__extract_day
- , subq_7.ds__extract_dow
- , subq_7.ds__extract_doy
- , subq_7.buy__ds__day
- , subq_7.buy__ds__week
- , subq_7.buy__ds__month
- , subq_7.buy__ds__quarter
- , subq_7.buy__ds__year
- , subq_7.buy__ds__extract_year
- , subq_7.buy__ds__extract_quarter
- , subq_7.buy__ds__extract_month
- , subq_7.buy__ds__extract_day
- , subq_7.buy__ds__extract_dow
- , subq_7.buy__ds__extract_doy
- , subq_7.ds__day AS metric_time__day
- , subq_7.ds__week AS metric_time__week
- , subq_7.ds__month AS metric_time__month
- , subq_7.ds__quarter AS metric_time__quarter
- , subq_7.ds__year AS metric_time__year
- , subq_7.ds__extract_year AS metric_time__extract_year
- , subq_7.ds__extract_quarter AS metric_time__extract_quarter
- , subq_7.ds__extract_month AS metric_time__extract_month
- , subq_7.ds__extract_day AS metric_time__extract_day
- , subq_7.ds__extract_dow AS metric_time__extract_dow
- , subq_7.ds__extract_doy AS metric_time__extract_doy
- , subq_7.user
- , subq_7.session_id
- , subq_7.buy__user
- , subq_7.buy__session_id
- , subq_7.buys
- , subq_7.buyers
+ subq_16.ds__day
+ , subq_16.ds__week
+ , subq_16.ds__month
+ , subq_16.ds__quarter
+ , subq_16.ds__year
+ , subq_16.ds__extract_year
+ , subq_16.ds__extract_quarter
+ , subq_16.ds__extract_month
+ , subq_16.ds__extract_day
+ , subq_16.ds__extract_dow
+ , subq_16.ds__extract_doy
+ , subq_16.buy__ds__day
+ , subq_16.buy__ds__week
+ , subq_16.buy__ds__month
+ , subq_16.buy__ds__quarter
+ , subq_16.buy__ds__year
+ , subq_16.buy__ds__extract_year
+ , subq_16.buy__ds__extract_quarter
+ , subq_16.buy__ds__extract_month
+ , subq_16.buy__ds__extract_day
+ , subq_16.buy__ds__extract_dow
+ , subq_16.buy__ds__extract_doy
+ , subq_16.ds__day AS metric_time__day
+ , subq_16.ds__week AS metric_time__week
+ , subq_16.ds__month AS metric_time__month
+ , subq_16.ds__quarter AS metric_time__quarter
+ , subq_16.ds__year AS metric_time__year
+ , subq_16.ds__extract_year AS metric_time__extract_year
+ , subq_16.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_16.ds__extract_month AS metric_time__extract_month
+ , subq_16.ds__extract_day AS metric_time__extract_day
+ , subq_16.ds__extract_dow AS metric_time__extract_dow
+ , subq_16.ds__extract_doy AS metric_time__extract_doy
+ , subq_16.user
+ , subq_16.session_id
+ , subq_16.buy__user
+ , subq_16.buy__session_id
+ , subq_16.buys
+ , subq_16.buyers
FROM (
-- Read Elements From Semantic Model 'buys_source'
SELECT
1 AS buys
- , buys_source_src_28002.user_id AS buyers
- , DATE_TRUNC('day', buys_source_src_28002.ds) AS ds__day
- , DATE_TRUNC('week', buys_source_src_28002.ds) AS ds__week
- , DATE_TRUNC('month', buys_source_src_28002.ds) AS ds__month
- , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS ds__quarter
- , DATE_TRUNC('year', buys_source_src_28002.ds) AS ds__year
- , EXTRACT(year FROM buys_source_src_28002.ds) AS ds__extract_year
- , EXTRACT(quarter FROM buys_source_src_28002.ds) AS ds__extract_quarter
- , EXTRACT(month FROM buys_source_src_28002.ds) AS ds__extract_month
- , EXTRACT(day FROM buys_source_src_28002.ds) AS ds__extract_day
- , CASE WHEN EXTRACT(dow FROM buys_source_src_28002.ds) = 0 THEN EXTRACT(dow FROM buys_source_src_28002.ds) + 7 ELSE EXTRACT(dow FROM buys_source_src_28002.ds) END AS ds__extract_dow
- , EXTRACT(doy FROM buys_source_src_28002.ds) AS ds__extract_doy
- , DATE_TRUNC('day', buys_source_src_28002.ds) AS buy__ds__day
- , DATE_TRUNC('week', buys_source_src_28002.ds) AS buy__ds__week
- , DATE_TRUNC('month', buys_source_src_28002.ds) AS buy__ds__month
- , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS buy__ds__quarter
- , DATE_TRUNC('year', buys_source_src_28002.ds) AS buy__ds__year
- , EXTRACT(year FROM buys_source_src_28002.ds) AS buy__ds__extract_year
- , EXTRACT(quarter FROM buys_source_src_28002.ds) AS buy__ds__extract_quarter
- , EXTRACT(month FROM buys_source_src_28002.ds) AS buy__ds__extract_month
- , EXTRACT(day FROM buys_source_src_28002.ds) AS buy__ds__extract_day
- , CASE WHEN EXTRACT(dow FROM buys_source_src_28002.ds) = 0 THEN EXTRACT(dow FROM buys_source_src_28002.ds) + 7 ELSE EXTRACT(dow FROM buys_source_src_28002.ds) END AS buy__ds__extract_dow
- , EXTRACT(doy FROM buys_source_src_28002.ds) AS buy__ds__extract_doy
- , buys_source_src_28002.user_id AS user
- , buys_source_src_28002.session_id
- , buys_source_src_28002.user_id AS buy__user
- , buys_source_src_28002.session_id AS buy__session_id
- FROM ***************************.fct_buys buys_source_src_28002
- ) subq_7
- ) subq_8
- ) subq_9
+ , buys_source_src_28000.user_id AS buyers
+ , DATE_TRUNC('day', buys_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', buys_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', buys_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', buys_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', buys_source_src_28000.ds) 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
+ , CASE WHEN EXTRACT(dow FROM buys_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM buys_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM buys_source_src_28000.ds) END AS ds__extract_dow
+ , EXTRACT(doy FROM buys_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', buys_source_src_28000.ds) AS buy__ds__day
+ , DATE_TRUNC('week', buys_source_src_28000.ds) AS buy__ds__week
+ , DATE_TRUNC('month', buys_source_src_28000.ds) AS buy__ds__month
+ , DATE_TRUNC('quarter', buys_source_src_28000.ds) AS buy__ds__quarter
+ , DATE_TRUNC('year', buys_source_src_28000.ds) 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
+ , EXTRACT(day FROM buys_source_src_28000.ds) AS buy__ds__extract_day
+ , CASE WHEN EXTRACT(dow FROM buys_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM buys_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM buys_source_src_28000.ds) END AS buy__ds__extract_dow
+ , EXTRACT(doy FROM buys_source_src_28000.ds) AS buy__ds__extract_doy
+ , buys_source_src_28000.user_id AS user
+ , buys_source_src_28000.session_id
+ , buys_source_src_28000.user_id AS buy__user
+ , buys_source_src_28000.session_id AS buy__session_id
+ FROM ***************************.fct_buys buys_source_src_28000
+ ) subq_16
+ ) subq_17
+ ) subq_18
ON
- (subq_6.user = subq_9.user) AND ((subq_6.ds__day <= subq_9.ds__day))
- ) subq_10
- ) subq_11
- ) subq_12
+ (
+ subq_15.user = subq_18.user
+ ) AND (
+ (subq_15.ds__day <= subq_18.ds__day)
+ )
+ ) subq_19
+ ) subq_20
+ ) subq_21
GROUP BY
- subq_12.visit__referrer_id
- ) subq_13
+ subq_21.visit__referrer_id
+ ) subq_22
ON
- subq_3.visit__referrer_id = subq_13.visit__referrer_id
+ subq_12.visit__referrer_id = subq_22.visit__referrer_id
GROUP BY
- COALESCE(subq_3.visit__referrer_id, subq_13.visit__referrer_id)
-) subq_14
+ COALESCE(subq_12.visit__referrer_id, subq_22.visit__referrer_id)
+) subq_23
diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Redshift/test_conversion_rate__plan0_optimized.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Redshift/test_conversion_rate__plan0_optimized.sql
index 90b1250d8a..aa5cf0eb43 100644
--- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Redshift/test_conversion_rate__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Redshift/test_conversion_rate__plan0_optimized.sql
@@ -5,9 +5,9 @@ SELECT
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_18.visit__referrer_id, subq_28.visit__referrer_id) AS visit__referrer_id
- , MAX(subq_18.visits) AS visits
- , MAX(subq_28.buys) AS buys
+ COALESCE(subq_27.visit__referrer_id, subq_37.visit__referrer_id) AS visit__referrer_id
+ , MAX(subq_27.visits) AS visits
+ , MAX(subq_37.buys) AS buys
FROM (
-- Aggregate Measures
SELECT
@@ -20,11 +20,11 @@ FROM (
SELECT
referrer_id AS visit__referrer_id
, 1 AS visits
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_17
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_26
GROUP BY
visit__referrer_id
- ) subq_18
+ ) subq_27
FULL OUTER JOIN (
-- Find conversions for user within the range of INF
-- Pass Only Elements: ['buys', 'visit__referrer_id']
@@ -35,12 +35,12 @@ FROM (
FROM (
-- Dedupe the fanout with mf_internal_uuid in the conversion data set
SELECT DISTINCT
- first_value(subq_21.visits) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
- , first_value(subq_21.visit__referrer_id) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visit__referrer_id
- , first_value(subq_21.ds__day) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
- , first_value(subq_21.user) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
- , subq_24.mf_internal_uuid AS mf_internal_uuid
- , subq_24.buys AS buys
+ first_value(subq_30.visits) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
+ , first_value(subq_30.visit__referrer_id) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visit__referrer_id
+ , first_value(subq_30.ds__day) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
+ , first_value(subq_30.user) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
+ , subq_33.mf_internal_uuid AS mf_internal_uuid
+ , subq_33.buys AS buys
FROM (
-- Read Elements From Semantic Model 'visits_source'
-- Metric Time Dimension 'ds'
@@ -50,8 +50,8 @@ FROM (
, user_id AS user
, referrer_id AS visit__referrer_id
, 1 AS visits
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_21
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_30
INNER JOIN (
-- Read Elements From Semantic Model 'buys_source'
-- Metric Time Dimension 'ds'
@@ -61,20 +61,20 @@ FROM (
, user_id AS user
, 1 AS buys
, CONCAT(CAST(RANDOM()*100000000 AS INT)::VARCHAR,CAST(RANDOM()*100000000 AS INT)::VARCHAR) AS mf_internal_uuid
- FROM ***************************.fct_buys buys_source_src_28002
- ) subq_24
+ FROM ***************************.fct_buys buys_source_src_28000
+ ) subq_33
ON
(
- subq_21.user = subq_24.user
+ subq_30.user = subq_33.user
) AND (
- (subq_21.ds__day <= subq_24.ds__day)
+ (subq_30.ds__day <= subq_33.ds__day)
)
- ) subq_25
+ ) subq_34
GROUP BY
visit__referrer_id
- ) subq_28
+ ) subq_37
ON
- subq_18.visit__referrer_id = subq_28.visit__referrer_id
+ subq_27.visit__referrer_id = subq_37.visit__referrer_id
GROUP BY
- COALESCE(subq_18.visit__referrer_id, subq_28.visit__referrer_id)
-) subq_29
+ COALESCE(subq_27.visit__referrer_id, subq_37.visit__referrer_id)
+) subq_38
diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Redshift/test_conversion_rate_with_constant_properties__plan0.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Redshift/test_conversion_rate_with_constant_properties__plan0.sql
index f172695f8d..315527076e 100644
--- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Redshift/test_conversion_rate_with_constant_properties__plan0.sql
+++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Redshift/test_conversion_rate_with_constant_properties__plan0.sql
@@ -1,381 +1,381 @@
-- Compute Metrics via Expressions
SELECT
- subq_14.metric_time__day
- , subq_14.visit__referrer_id
- , CAST(subq_14.buys AS DOUBLE PRECISION) / CAST(NULLIF(subq_14.visits, 0) AS DOUBLE PRECISION) AS visit_buy_conversion_rate_by_session
+ subq_23.metric_time__day
+ , subq_23.visit__referrer_id
+ , CAST(subq_23.buys AS DOUBLE PRECISION) / CAST(NULLIF(subq_23.visits, 0) AS DOUBLE PRECISION) AS visit_buy_conversion_rate_by_session
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_3.metric_time__day, subq_13.metric_time__day) AS metric_time__day
- , COALESCE(subq_3.visit__referrer_id, subq_13.visit__referrer_id) AS visit__referrer_id
- , MAX(subq_3.visits) AS visits
- , MAX(subq_13.buys) AS buys
+ COALESCE(subq_12.metric_time__day, subq_22.metric_time__day) AS metric_time__day
+ , COALESCE(subq_12.visit__referrer_id, subq_22.visit__referrer_id) AS visit__referrer_id
+ , MAX(subq_12.visits) AS visits
+ , MAX(subq_22.buys) AS buys
FROM (
-- Aggregate Measures
SELECT
- subq_2.metric_time__day
- , subq_2.visit__referrer_id
- , SUM(subq_2.visits) AS visits
+ subq_11.metric_time__day
+ , subq_11.visit__referrer_id
+ , SUM(subq_11.visits) AS visits
FROM (
-- Pass Only Elements: ['visits', 'visit__referrer_id', 'metric_time__day']
SELECT
- subq_1.metric_time__day
- , subq_1.visit__referrer_id
- , subq_1.visits
+ subq_10.metric_time__day
+ , subq_10.visit__referrer_id
+ , subq_10.visits
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.visit__ds__day
- , subq_0.visit__ds__week
- , subq_0.visit__ds__month
- , subq_0.visit__ds__quarter
- , subq_0.visit__ds__year
- , subq_0.visit__ds__extract_year
- , subq_0.visit__ds__extract_quarter
- , subq_0.visit__ds__extract_month
- , subq_0.visit__ds__extract_day
- , subq_0.visit__ds__extract_dow
- , subq_0.visit__ds__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.user
- , subq_0.session
- , subq_0.visit__user
- , subq_0.visit__session
- , subq_0.referrer_id
- , subq_0.visit__referrer_id
- , subq_0.visits
- , subq_0.visitors
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.visit__ds__day
+ , subq_9.visit__ds__week
+ , subq_9.visit__ds__month
+ , subq_9.visit__ds__quarter
+ , subq_9.visit__ds__year
+ , subq_9.visit__ds__extract_year
+ , subq_9.visit__ds__extract_quarter
+ , subq_9.visit__ds__extract_month
+ , subq_9.visit__ds__extract_day
+ , subq_9.visit__ds__extract_dow
+ , subq_9.visit__ds__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.user
+ , subq_9.session
+ , subq_9.visit__user
+ , subq_9.visit__session
+ , subq_9.referrer_id
+ , subq_9.visit__referrer_id
+ , subq_9.visits
+ , subq_9.visitors
FROM (
-- Read Elements From Semantic Model 'visits_source'
SELECT
1 AS visits
- , visits_source_src_28011.user_id AS visitors
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day
- , CASE WHEN EXTRACT(dow FROM visits_source_src_28011.ds) = 0 THEN EXTRACT(dow FROM visits_source_src_28011.ds) + 7 ELSE EXTRACT(dow FROM visits_source_src_28011.ds) END AS ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy
- , visits_source_src_28011.referrer_id
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day
- , CASE WHEN EXTRACT(dow FROM visits_source_src_28011.ds) = 0 THEN EXTRACT(dow FROM visits_source_src_28011.ds) + 7 ELSE EXTRACT(dow FROM visits_source_src_28011.ds) END AS visit__ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy
- , visits_source_src_28011.referrer_id AS visit__referrer_id
- , visits_source_src_28011.user_id AS user
- , visits_source_src_28011.session_id AS session
- , visits_source_src_28011.user_id AS visit__user
- , visits_source_src_28011.session_id AS visit__session
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_0
- ) subq_1
- ) subq_2
+ , visits_source_src_28000.user_id AS visitors
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS ds__extract_day
+ , CASE WHEN EXTRACT(dow FROM visits_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM visits_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM visits_source_src_28000.ds) END AS ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS ds__extract_doy
+ , visits_source_src_28000.referrer_id
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS visit__ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS visit__ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS visit__ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS visit__ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS visit__ds__extract_day
+ , CASE WHEN EXTRACT(dow FROM visits_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM visits_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM visits_source_src_28000.ds) END AS visit__ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS visit__ds__extract_doy
+ , visits_source_src_28000.referrer_id AS visit__referrer_id
+ , visits_source_src_28000.user_id AS user
+ , visits_source_src_28000.session_id AS session
+ , visits_source_src_28000.user_id AS visit__user
+ , visits_source_src_28000.session_id AS visit__session
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
GROUP BY
- subq_2.metric_time__day
- , subq_2.visit__referrer_id
- ) subq_3
+ subq_11.metric_time__day
+ , subq_11.visit__referrer_id
+ ) subq_12
FULL OUTER JOIN (
-- Aggregate Measures
SELECT
- subq_12.metric_time__day
- , subq_12.visit__referrer_id
- , SUM(subq_12.buys) AS buys
+ subq_21.metric_time__day
+ , subq_21.visit__referrer_id
+ , SUM(subq_21.buys) AS buys
FROM (
-- Pass Only Elements: ['buys', 'visit__referrer_id', 'metric_time__day']
SELECT
- subq_11.metric_time__day
- , subq_11.visit__referrer_id
- , subq_11.buys
+ subq_20.metric_time__day
+ , subq_20.visit__referrer_id
+ , subq_20.buys
FROM (
-- Find conversions for user within the range of 7 day
SELECT
- subq_10.ds__day
- , subq_10.metric_time__day
- , subq_10.user
- , subq_10.session
- , subq_10.visit__referrer_id
- , subq_10.buys
- , subq_10.visits
+ subq_19.ds__day
+ , subq_19.metric_time__day
+ , subq_19.user
+ , subq_19.session
+ , subq_19.visit__referrer_id
+ , subq_19.buys
+ , subq_19.visits
FROM (
-- Dedupe the fanout with mf_internal_uuid in the conversion data set
SELECT DISTINCT
- first_value(subq_6.visits) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid, subq_9.session_id ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
- , first_value(subq_6.visit__referrer_id) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid, subq_9.session_id ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visit__referrer_id
- , first_value(subq_6.ds__day) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid, subq_9.session_id ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
- , first_value(subq_6.metric_time__day) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid, subq_9.session_id ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS metric_time__day
- , first_value(subq_6.user) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid, subq_9.session_id ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
- , first_value(subq_6.session) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid, subq_9.session_id ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS session
- , subq_9.mf_internal_uuid AS mf_internal_uuid
- , subq_9.buys AS buys
+ first_value(subq_15.visits) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid, subq_18.session_id ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
+ , first_value(subq_15.visit__referrer_id) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid, subq_18.session_id ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visit__referrer_id
+ , first_value(subq_15.ds__day) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid, subq_18.session_id ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
+ , first_value(subq_15.metric_time__day) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid, subq_18.session_id ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS metric_time__day
+ , first_value(subq_15.user) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid, subq_18.session_id ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
+ , first_value(subq_15.session) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid, subq_18.session_id ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS session
+ , subq_18.mf_internal_uuid AS mf_internal_uuid
+ , subq_18.buys AS buys
FROM (
-- Pass Only Elements: ['visits', 'visit__referrer_id', 'ds__day', 'metric_time__day', 'user', 'session']
SELECT
- subq_5.ds__day
- , subq_5.metric_time__day
- , subq_5.user
- , subq_5.session
- , subq_5.visit__referrer_id
- , subq_5.visits
+ subq_14.ds__day
+ , subq_14.metric_time__day
+ , subq_14.user
+ , subq_14.session
+ , subq_14.visit__referrer_id
+ , subq_14.visits
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_4.ds__day
- , subq_4.ds__week
- , subq_4.ds__month
- , subq_4.ds__quarter
- , subq_4.ds__year
- , subq_4.ds__extract_year
- , subq_4.ds__extract_quarter
- , subq_4.ds__extract_month
- , subq_4.ds__extract_day
- , subq_4.ds__extract_dow
- , subq_4.ds__extract_doy
- , subq_4.visit__ds__day
- , subq_4.visit__ds__week
- , subq_4.visit__ds__month
- , subq_4.visit__ds__quarter
- , subq_4.visit__ds__year
- , subq_4.visit__ds__extract_year
- , subq_4.visit__ds__extract_quarter
- , subq_4.visit__ds__extract_month
- , subq_4.visit__ds__extract_day
- , subq_4.visit__ds__extract_dow
- , subq_4.visit__ds__extract_doy
- , subq_4.ds__day AS metric_time__day
- , subq_4.ds__week AS metric_time__week
- , subq_4.ds__month AS metric_time__month
- , subq_4.ds__quarter AS metric_time__quarter
- , subq_4.ds__year AS metric_time__year
- , subq_4.ds__extract_year AS metric_time__extract_year
- , subq_4.ds__extract_quarter AS metric_time__extract_quarter
- , subq_4.ds__extract_month AS metric_time__extract_month
- , subq_4.ds__extract_day AS metric_time__extract_day
- , subq_4.ds__extract_dow AS metric_time__extract_dow
- , subq_4.ds__extract_doy AS metric_time__extract_doy
- , subq_4.user
- , subq_4.session
- , subq_4.visit__user
- , subq_4.visit__session
- , subq_4.referrer_id
- , subq_4.visit__referrer_id
- , subq_4.visits
- , subq_4.visitors
+ subq_13.ds__day
+ , subq_13.ds__week
+ , subq_13.ds__month
+ , subq_13.ds__quarter
+ , subq_13.ds__year
+ , subq_13.ds__extract_year
+ , subq_13.ds__extract_quarter
+ , subq_13.ds__extract_month
+ , subq_13.ds__extract_day
+ , subq_13.ds__extract_dow
+ , subq_13.ds__extract_doy
+ , subq_13.visit__ds__day
+ , subq_13.visit__ds__week
+ , subq_13.visit__ds__month
+ , subq_13.visit__ds__quarter
+ , subq_13.visit__ds__year
+ , subq_13.visit__ds__extract_year
+ , subq_13.visit__ds__extract_quarter
+ , subq_13.visit__ds__extract_month
+ , subq_13.visit__ds__extract_day
+ , subq_13.visit__ds__extract_dow
+ , subq_13.visit__ds__extract_doy
+ , subq_13.ds__day AS metric_time__day
+ , subq_13.ds__week AS metric_time__week
+ , subq_13.ds__month AS metric_time__month
+ , subq_13.ds__quarter AS metric_time__quarter
+ , subq_13.ds__year AS metric_time__year
+ , subq_13.ds__extract_year AS metric_time__extract_year
+ , subq_13.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_13.ds__extract_month AS metric_time__extract_month
+ , subq_13.ds__extract_day AS metric_time__extract_day
+ , subq_13.ds__extract_dow AS metric_time__extract_dow
+ , subq_13.ds__extract_doy AS metric_time__extract_doy
+ , subq_13.user
+ , subq_13.session
+ , subq_13.visit__user
+ , subq_13.visit__session
+ , subq_13.referrer_id
+ , subq_13.visit__referrer_id
+ , subq_13.visits
+ , subq_13.visitors
FROM (
-- Read Elements From Semantic Model 'visits_source'
SELECT
1 AS visits
- , visits_source_src_28011.user_id AS visitors
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day
- , CASE WHEN EXTRACT(dow FROM visits_source_src_28011.ds) = 0 THEN EXTRACT(dow FROM visits_source_src_28011.ds) + 7 ELSE EXTRACT(dow FROM visits_source_src_28011.ds) END AS ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy
- , visits_source_src_28011.referrer_id
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day
- , CASE WHEN EXTRACT(dow FROM visits_source_src_28011.ds) = 0 THEN EXTRACT(dow FROM visits_source_src_28011.ds) + 7 ELSE EXTRACT(dow FROM visits_source_src_28011.ds) END AS visit__ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy
- , visits_source_src_28011.referrer_id AS visit__referrer_id
- , visits_source_src_28011.user_id AS user
- , visits_source_src_28011.session_id AS session
- , visits_source_src_28011.user_id AS visit__user
- , visits_source_src_28011.session_id AS visit__session
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_4
- ) subq_5
- ) subq_6
+ , visits_source_src_28000.user_id AS visitors
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS ds__extract_day
+ , CASE WHEN EXTRACT(dow FROM visits_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM visits_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM visits_source_src_28000.ds) END AS ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS ds__extract_doy
+ , visits_source_src_28000.referrer_id
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS visit__ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS visit__ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS visit__ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS visit__ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS visit__ds__extract_day
+ , CASE WHEN EXTRACT(dow FROM visits_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM visits_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM visits_source_src_28000.ds) END AS visit__ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS visit__ds__extract_doy
+ , visits_source_src_28000.referrer_id AS visit__referrer_id
+ , visits_source_src_28000.user_id AS user
+ , visits_source_src_28000.session_id AS session
+ , visits_source_src_28000.user_id AS visit__user
+ , visits_source_src_28000.session_id AS visit__session
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_13
+ ) subq_14
+ ) subq_15
INNER JOIN (
-- Add column with generated UUID
SELECT
- subq_8.ds__day
- , subq_8.ds__week
- , subq_8.ds__month
- , subq_8.ds__quarter
- , subq_8.ds__year
- , subq_8.ds__extract_year
- , subq_8.ds__extract_quarter
- , subq_8.ds__extract_month
- , subq_8.ds__extract_day
- , subq_8.ds__extract_dow
- , subq_8.ds__extract_doy
- , subq_8.buy__ds__day
- , subq_8.buy__ds__week
- , subq_8.buy__ds__month
- , subq_8.buy__ds__quarter
- , subq_8.buy__ds__year
- , subq_8.buy__ds__extract_year
- , subq_8.buy__ds__extract_quarter
- , subq_8.buy__ds__extract_month
- , subq_8.buy__ds__extract_day
- , subq_8.buy__ds__extract_dow
- , subq_8.buy__ds__extract_doy
- , subq_8.metric_time__day
- , subq_8.metric_time__week
- , subq_8.metric_time__month
- , subq_8.metric_time__quarter
- , subq_8.metric_time__year
- , subq_8.metric_time__extract_year
- , subq_8.metric_time__extract_quarter
- , subq_8.metric_time__extract_month
- , subq_8.metric_time__extract_day
- , subq_8.metric_time__extract_dow
- , subq_8.metric_time__extract_doy
- , subq_8.user
- , subq_8.session_id
- , subq_8.buy__user
- , subq_8.buy__session_id
- , subq_8.buys
- , subq_8.buyers
+ subq_17.ds__day
+ , subq_17.ds__week
+ , subq_17.ds__month
+ , subq_17.ds__quarter
+ , subq_17.ds__year
+ , subq_17.ds__extract_year
+ , subq_17.ds__extract_quarter
+ , subq_17.ds__extract_month
+ , subq_17.ds__extract_day
+ , subq_17.ds__extract_dow
+ , subq_17.ds__extract_doy
+ , subq_17.buy__ds__day
+ , subq_17.buy__ds__week
+ , subq_17.buy__ds__month
+ , subq_17.buy__ds__quarter
+ , subq_17.buy__ds__year
+ , subq_17.buy__ds__extract_year
+ , subq_17.buy__ds__extract_quarter
+ , subq_17.buy__ds__extract_month
+ , subq_17.buy__ds__extract_day
+ , subq_17.buy__ds__extract_dow
+ , subq_17.buy__ds__extract_doy
+ , subq_17.metric_time__day
+ , subq_17.metric_time__week
+ , subq_17.metric_time__month
+ , subq_17.metric_time__quarter
+ , subq_17.metric_time__year
+ , subq_17.metric_time__extract_year
+ , subq_17.metric_time__extract_quarter
+ , subq_17.metric_time__extract_month
+ , subq_17.metric_time__extract_day
+ , subq_17.metric_time__extract_dow
+ , subq_17.metric_time__extract_doy
+ , subq_17.user
+ , subq_17.session_id
+ , subq_17.buy__user
+ , subq_17.buy__session_id
+ , subq_17.buys
+ , subq_17.buyers
, CONCAT(CAST(RANDOM()*100000000 AS INT)::VARCHAR,CAST(RANDOM()*100000000 AS INT)::VARCHAR) AS mf_internal_uuid
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_7.ds__day
- , subq_7.ds__week
- , subq_7.ds__month
- , subq_7.ds__quarter
- , subq_7.ds__year
- , subq_7.ds__extract_year
- , subq_7.ds__extract_quarter
- , subq_7.ds__extract_month
- , subq_7.ds__extract_day
- , subq_7.ds__extract_dow
- , subq_7.ds__extract_doy
- , subq_7.buy__ds__day
- , subq_7.buy__ds__week
- , subq_7.buy__ds__month
- , subq_7.buy__ds__quarter
- , subq_7.buy__ds__year
- , subq_7.buy__ds__extract_year
- , subq_7.buy__ds__extract_quarter
- , subq_7.buy__ds__extract_month
- , subq_7.buy__ds__extract_day
- , subq_7.buy__ds__extract_dow
- , subq_7.buy__ds__extract_doy
- , subq_7.ds__day AS metric_time__day
- , subq_7.ds__week AS metric_time__week
- , subq_7.ds__month AS metric_time__month
- , subq_7.ds__quarter AS metric_time__quarter
- , subq_7.ds__year AS metric_time__year
- , subq_7.ds__extract_year AS metric_time__extract_year
- , subq_7.ds__extract_quarter AS metric_time__extract_quarter
- , subq_7.ds__extract_month AS metric_time__extract_month
- , subq_7.ds__extract_day AS metric_time__extract_day
- , subq_7.ds__extract_dow AS metric_time__extract_dow
- , subq_7.ds__extract_doy AS metric_time__extract_doy
- , subq_7.user
- , subq_7.session_id
- , subq_7.buy__user
- , subq_7.buy__session_id
- , subq_7.buys
- , subq_7.buyers
+ subq_16.ds__day
+ , subq_16.ds__week
+ , subq_16.ds__month
+ , subq_16.ds__quarter
+ , subq_16.ds__year
+ , subq_16.ds__extract_year
+ , subq_16.ds__extract_quarter
+ , subq_16.ds__extract_month
+ , subq_16.ds__extract_day
+ , subq_16.ds__extract_dow
+ , subq_16.ds__extract_doy
+ , subq_16.buy__ds__day
+ , subq_16.buy__ds__week
+ , subq_16.buy__ds__month
+ , subq_16.buy__ds__quarter
+ , subq_16.buy__ds__year
+ , subq_16.buy__ds__extract_year
+ , subq_16.buy__ds__extract_quarter
+ , subq_16.buy__ds__extract_month
+ , subq_16.buy__ds__extract_day
+ , subq_16.buy__ds__extract_dow
+ , subq_16.buy__ds__extract_doy
+ , subq_16.ds__day AS metric_time__day
+ , subq_16.ds__week AS metric_time__week
+ , subq_16.ds__month AS metric_time__month
+ , subq_16.ds__quarter AS metric_time__quarter
+ , subq_16.ds__year AS metric_time__year
+ , subq_16.ds__extract_year AS metric_time__extract_year
+ , subq_16.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_16.ds__extract_month AS metric_time__extract_month
+ , subq_16.ds__extract_day AS metric_time__extract_day
+ , subq_16.ds__extract_dow AS metric_time__extract_dow
+ , subq_16.ds__extract_doy AS metric_time__extract_doy
+ , subq_16.user
+ , subq_16.session_id
+ , subq_16.buy__user
+ , subq_16.buy__session_id
+ , subq_16.buys
+ , subq_16.buyers
FROM (
-- Read Elements From Semantic Model 'buys_source'
SELECT
1 AS buys
- , buys_source_src_28002.user_id AS buyers
- , DATE_TRUNC('day', buys_source_src_28002.ds) AS ds__day
- , DATE_TRUNC('week', buys_source_src_28002.ds) AS ds__week
- , DATE_TRUNC('month', buys_source_src_28002.ds) AS ds__month
- , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS ds__quarter
- , DATE_TRUNC('year', buys_source_src_28002.ds) AS ds__year
- , EXTRACT(year FROM buys_source_src_28002.ds) AS ds__extract_year
- , EXTRACT(quarter FROM buys_source_src_28002.ds) AS ds__extract_quarter
- , EXTRACT(month FROM buys_source_src_28002.ds) AS ds__extract_month
- , EXTRACT(day FROM buys_source_src_28002.ds) AS ds__extract_day
- , CASE WHEN EXTRACT(dow FROM buys_source_src_28002.ds) = 0 THEN EXTRACT(dow FROM buys_source_src_28002.ds) + 7 ELSE EXTRACT(dow FROM buys_source_src_28002.ds) END AS ds__extract_dow
- , EXTRACT(doy FROM buys_source_src_28002.ds) AS ds__extract_doy
- , DATE_TRUNC('day', buys_source_src_28002.ds) AS buy__ds__day
- , DATE_TRUNC('week', buys_source_src_28002.ds) AS buy__ds__week
- , DATE_TRUNC('month', buys_source_src_28002.ds) AS buy__ds__month
- , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS buy__ds__quarter
- , DATE_TRUNC('year', buys_source_src_28002.ds) AS buy__ds__year
- , EXTRACT(year FROM buys_source_src_28002.ds) AS buy__ds__extract_year
- , EXTRACT(quarter FROM buys_source_src_28002.ds) AS buy__ds__extract_quarter
- , EXTRACT(month FROM buys_source_src_28002.ds) AS buy__ds__extract_month
- , EXTRACT(day FROM buys_source_src_28002.ds) AS buy__ds__extract_day
- , CASE WHEN EXTRACT(dow FROM buys_source_src_28002.ds) = 0 THEN EXTRACT(dow FROM buys_source_src_28002.ds) + 7 ELSE EXTRACT(dow FROM buys_source_src_28002.ds) END AS buy__ds__extract_dow
- , EXTRACT(doy FROM buys_source_src_28002.ds) AS buy__ds__extract_doy
- , buys_source_src_28002.user_id AS user
- , buys_source_src_28002.session_id
- , buys_source_src_28002.user_id AS buy__user
- , buys_source_src_28002.session_id AS buy__session_id
- FROM ***************************.fct_buys buys_source_src_28002
- ) subq_7
- ) subq_8
- ) subq_9
+ , buys_source_src_28000.user_id AS buyers
+ , DATE_TRUNC('day', buys_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', buys_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', buys_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', buys_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', buys_source_src_28000.ds) 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
+ , CASE WHEN EXTRACT(dow FROM buys_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM buys_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM buys_source_src_28000.ds) END AS ds__extract_dow
+ , EXTRACT(doy FROM buys_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', buys_source_src_28000.ds) AS buy__ds__day
+ , DATE_TRUNC('week', buys_source_src_28000.ds) AS buy__ds__week
+ , DATE_TRUNC('month', buys_source_src_28000.ds) AS buy__ds__month
+ , DATE_TRUNC('quarter', buys_source_src_28000.ds) AS buy__ds__quarter
+ , DATE_TRUNC('year', buys_source_src_28000.ds) 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
+ , EXTRACT(day FROM buys_source_src_28000.ds) AS buy__ds__extract_day
+ , CASE WHEN EXTRACT(dow FROM buys_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM buys_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM buys_source_src_28000.ds) END AS buy__ds__extract_dow
+ , EXTRACT(doy FROM buys_source_src_28000.ds) AS buy__ds__extract_doy
+ , buys_source_src_28000.user_id AS user
+ , buys_source_src_28000.session_id
+ , buys_source_src_28000.user_id AS buy__user
+ , buys_source_src_28000.session_id AS buy__session_id
+ FROM ***************************.fct_buys buys_source_src_28000
+ ) subq_16
+ ) subq_17
+ ) subq_18
ON
(
- subq_6.user = subq_9.user
+ subq_15.user = subq_18.user
) AND (
- subq_6.session = subq_9.session_id
+ subq_15.session = subq_18.session_id
) AND (
(
- subq_6.ds__day <= subq_9.ds__day
+ subq_15.ds__day <= subq_18.ds__day
) AND (
- subq_6.ds__day > DATEADD(day, -7, subq_9.ds__day)
+ subq_15.ds__day > DATEADD(day, -7, subq_18.ds__day)
)
)
- ) subq_10
- ) subq_11
- ) subq_12
+ ) subq_19
+ ) subq_20
+ ) subq_21
GROUP BY
- subq_12.metric_time__day
- , subq_12.visit__referrer_id
- ) subq_13
+ subq_21.metric_time__day
+ , subq_21.visit__referrer_id
+ ) subq_22
ON
(
- subq_3.visit__referrer_id = subq_13.visit__referrer_id
+ subq_12.visit__referrer_id = subq_22.visit__referrer_id
) AND (
- subq_3.metric_time__day = subq_13.metric_time__day
+ subq_12.metric_time__day = subq_22.metric_time__day
)
GROUP BY
- COALESCE(subq_3.metric_time__day, subq_13.metric_time__day)
- , COALESCE(subq_3.visit__referrer_id, subq_13.visit__referrer_id)
-) subq_14
+ COALESCE(subq_12.metric_time__day, subq_22.metric_time__day)
+ , COALESCE(subq_12.visit__referrer_id, subq_22.visit__referrer_id)
+) subq_23
diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Redshift/test_conversion_rate_with_constant_properties__plan0_optimized.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Redshift/test_conversion_rate_with_constant_properties__plan0_optimized.sql
index 196158ae82..52617b047f 100644
--- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Redshift/test_conversion_rate_with_constant_properties__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Redshift/test_conversion_rate_with_constant_properties__plan0_optimized.sql
@@ -6,10 +6,10 @@ SELECT
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_18.metric_time__day, subq_28.metric_time__day) AS metric_time__day
- , COALESCE(subq_18.visit__referrer_id, subq_28.visit__referrer_id) AS visit__referrer_id
- , MAX(subq_18.visits) AS visits
- , MAX(subq_28.buys) AS buys
+ COALESCE(subq_27.metric_time__day, subq_37.metric_time__day) AS metric_time__day
+ , COALESCE(subq_27.visit__referrer_id, subq_37.visit__referrer_id) AS visit__referrer_id
+ , MAX(subq_27.visits) AS visits
+ , MAX(subq_37.buys) AS buys
FROM (
-- Aggregate Measures
SELECT
@@ -24,12 +24,12 @@ FROM (
DATE_TRUNC('day', ds) AS metric_time__day
, referrer_id AS visit__referrer_id
, 1 AS visits
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_17
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_26
GROUP BY
metric_time__day
, visit__referrer_id
- ) subq_18
+ ) subq_27
FULL OUTER JOIN (
-- Find conversions for user within the range of 7 day
-- Pass Only Elements: ['buys', 'visit__referrer_id', 'metric_time__day']
@@ -41,14 +41,14 @@ FROM (
FROM (
-- Dedupe the fanout with mf_internal_uuid in the conversion data set
SELECT DISTINCT
- first_value(subq_21.visits) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid, subq_24.session_id ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
- , first_value(subq_21.visit__referrer_id) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid, subq_24.session_id ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visit__referrer_id
- , first_value(subq_21.ds__day) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid, subq_24.session_id ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
- , first_value(subq_21.metric_time__day) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid, subq_24.session_id ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS metric_time__day
- , first_value(subq_21.user) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid, subq_24.session_id ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
- , first_value(subq_21.session) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid, subq_24.session_id ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS session
- , subq_24.mf_internal_uuid AS mf_internal_uuid
- , subq_24.buys AS buys
+ first_value(subq_30.visits) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid, subq_33.session_id ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
+ , first_value(subq_30.visit__referrer_id) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid, subq_33.session_id ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visit__referrer_id
+ , first_value(subq_30.ds__day) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid, subq_33.session_id ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
+ , first_value(subq_30.metric_time__day) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid, subq_33.session_id ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS metric_time__day
+ , first_value(subq_30.user) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid, subq_33.session_id ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
+ , first_value(subq_30.session) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid, subq_33.session_id ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS session
+ , subq_33.mf_internal_uuid AS mf_internal_uuid
+ , subq_33.buys AS buys
FROM (
-- Read Elements From Semantic Model 'visits_source'
-- Metric Time Dimension 'ds'
@@ -60,8 +60,8 @@ FROM (
, session_id AS session
, referrer_id AS visit__referrer_id
, 1 AS visits
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_21
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_30
INNER JOIN (
-- Read Elements From Semantic Model 'buys_source'
-- Metric Time Dimension 'ds'
@@ -72,32 +72,32 @@ FROM (
, session_id
, 1 AS buys
, CONCAT(CAST(RANDOM()*100000000 AS INT)::VARCHAR,CAST(RANDOM()*100000000 AS INT)::VARCHAR) AS mf_internal_uuid
- FROM ***************************.fct_buys buys_source_src_28002
- ) subq_24
+ FROM ***************************.fct_buys buys_source_src_28000
+ ) subq_33
ON
(
- subq_21.user = subq_24.user
+ subq_30.user = subq_33.user
) AND (
- subq_21.session = subq_24.session_id
+ subq_30.session = subq_33.session_id
) AND (
(
- subq_21.ds__day <= subq_24.ds__day
+ subq_30.ds__day <= subq_33.ds__day
) AND (
- subq_21.ds__day > DATEADD(day, -7, subq_24.ds__day)
+ subq_30.ds__day > DATEADD(day, -7, subq_33.ds__day)
)
)
- ) subq_25
+ ) subq_34
GROUP BY
metric_time__day
, visit__referrer_id
- ) subq_28
+ ) subq_37
ON
(
- subq_18.visit__referrer_id = subq_28.visit__referrer_id
+ subq_27.visit__referrer_id = subq_37.visit__referrer_id
) AND (
- subq_18.metric_time__day = subq_28.metric_time__day
+ subq_27.metric_time__day = subq_37.metric_time__day
)
GROUP BY
- COALESCE(subq_18.metric_time__day, subq_28.metric_time__day)
- , COALESCE(subq_18.visit__referrer_id, subq_28.visit__referrer_id)
-) subq_29
+ COALESCE(subq_27.metric_time__day, subq_37.metric_time__day)
+ , COALESCE(subq_27.visit__referrer_id, subq_37.visit__referrer_id)
+) subq_38
diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Redshift/test_conversion_rate_with_no_group_by__plan0.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Redshift/test_conversion_rate_with_no_group_by__plan0.sql
index ed6d1ba541..707284ce04 100644
--- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Redshift/test_conversion_rate_with_no_group_by__plan0.sql
+++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Redshift/test_conversion_rate_with_no_group_by__plan0.sql
@@ -1,343 +1,343 @@
-- Compute Metrics via Expressions
SELECT
- CAST(subq_14.buys AS DOUBLE PRECISION) / CAST(NULLIF(subq_14.visits, 0) AS DOUBLE PRECISION) AS visit_buy_conversion_rate_7days
+ CAST(subq_23.buys AS DOUBLE PRECISION) / CAST(NULLIF(subq_23.visits, 0) AS DOUBLE PRECISION) AS visit_buy_conversion_rate_7days
FROM (
-- Combine Aggregated Outputs
SELECT
- MAX(subq_3.visits) AS visits
- , MAX(subq_13.buys) AS buys
+ MAX(subq_12.visits) AS visits
+ , MAX(subq_22.buys) AS buys
FROM (
-- Aggregate Measures
SELECT
- SUM(subq_2.visits) AS visits
+ SUM(subq_11.visits) AS visits
FROM (
-- Pass Only Elements: ['visits',]
SELECT
- subq_1.visits
+ subq_10.visits
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.visit__ds__day
- , subq_0.visit__ds__week
- , subq_0.visit__ds__month
- , subq_0.visit__ds__quarter
- , subq_0.visit__ds__year
- , subq_0.visit__ds__extract_year
- , subq_0.visit__ds__extract_quarter
- , subq_0.visit__ds__extract_month
- , subq_0.visit__ds__extract_day
- , subq_0.visit__ds__extract_dow
- , subq_0.visit__ds__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.user
- , subq_0.session
- , subq_0.visit__user
- , subq_0.visit__session
- , subq_0.referrer_id
- , subq_0.visit__referrer_id
- , subq_0.visits
- , subq_0.visitors
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.visit__ds__day
+ , subq_9.visit__ds__week
+ , subq_9.visit__ds__month
+ , subq_9.visit__ds__quarter
+ , subq_9.visit__ds__year
+ , subq_9.visit__ds__extract_year
+ , subq_9.visit__ds__extract_quarter
+ , subq_9.visit__ds__extract_month
+ , subq_9.visit__ds__extract_day
+ , subq_9.visit__ds__extract_dow
+ , subq_9.visit__ds__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.user
+ , subq_9.session
+ , subq_9.visit__user
+ , subq_9.visit__session
+ , subq_9.referrer_id
+ , subq_9.visit__referrer_id
+ , subq_9.visits
+ , subq_9.visitors
FROM (
-- Read Elements From Semantic Model 'visits_source'
SELECT
1 AS visits
- , visits_source_src_28011.user_id AS visitors
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day
- , CASE WHEN EXTRACT(dow FROM visits_source_src_28011.ds) = 0 THEN EXTRACT(dow FROM visits_source_src_28011.ds) + 7 ELSE EXTRACT(dow FROM visits_source_src_28011.ds) END AS ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy
- , visits_source_src_28011.referrer_id
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day
- , CASE WHEN EXTRACT(dow FROM visits_source_src_28011.ds) = 0 THEN EXTRACT(dow FROM visits_source_src_28011.ds) + 7 ELSE EXTRACT(dow FROM visits_source_src_28011.ds) END AS visit__ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy
- , visits_source_src_28011.referrer_id AS visit__referrer_id
- , visits_source_src_28011.user_id AS user
- , visits_source_src_28011.session_id AS session
- , visits_source_src_28011.user_id AS visit__user
- , visits_source_src_28011.session_id AS visit__session
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_0
- ) subq_1
- ) subq_2
- ) subq_3
+ , visits_source_src_28000.user_id AS visitors
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS ds__extract_day
+ , CASE WHEN EXTRACT(dow FROM visits_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM visits_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM visits_source_src_28000.ds) END AS ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS ds__extract_doy
+ , visits_source_src_28000.referrer_id
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS visit__ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS visit__ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS visit__ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS visit__ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS visit__ds__extract_day
+ , CASE WHEN EXTRACT(dow FROM visits_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM visits_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM visits_source_src_28000.ds) END AS visit__ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS visit__ds__extract_doy
+ , visits_source_src_28000.referrer_id AS visit__referrer_id
+ , visits_source_src_28000.user_id AS user
+ , visits_source_src_28000.session_id AS session
+ , visits_source_src_28000.user_id AS visit__user
+ , visits_source_src_28000.session_id AS visit__session
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
+ ) subq_12
CROSS JOIN (
-- Aggregate Measures
SELECT
- SUM(subq_12.buys) AS buys
+ SUM(subq_21.buys) AS buys
FROM (
-- Pass Only Elements: ['buys',]
SELECT
- subq_11.buys
+ subq_20.buys
FROM (
-- Find conversions for user within the range of 7 day
SELECT
- subq_10.ds__day
- , subq_10.user
- , subq_10.buys
- , subq_10.visits
+ subq_19.ds__day
+ , subq_19.user
+ , subq_19.buys
+ , subq_19.visits
FROM (
-- Dedupe the fanout with mf_internal_uuid in the conversion data set
SELECT DISTINCT
- first_value(subq_6.visits) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
- , first_value(subq_6.ds__day) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
- , first_value(subq_6.user) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
- , subq_9.mf_internal_uuid AS mf_internal_uuid
- , subq_9.buys AS buys
+ first_value(subq_15.visits) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
+ , first_value(subq_15.ds__day) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
+ , first_value(subq_15.user) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
+ , subq_18.mf_internal_uuid AS mf_internal_uuid
+ , subq_18.buys AS buys
FROM (
-- Pass Only Elements: ['visits', 'ds__day', 'user']
SELECT
- subq_5.ds__day
- , subq_5.user
- , subq_5.visits
+ subq_14.ds__day
+ , subq_14.user
+ , subq_14.visits
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_4.ds__day
- , subq_4.ds__week
- , subq_4.ds__month
- , subq_4.ds__quarter
- , subq_4.ds__year
- , subq_4.ds__extract_year
- , subq_4.ds__extract_quarter
- , subq_4.ds__extract_month
- , subq_4.ds__extract_day
- , subq_4.ds__extract_dow
- , subq_4.ds__extract_doy
- , subq_4.visit__ds__day
- , subq_4.visit__ds__week
- , subq_4.visit__ds__month
- , subq_4.visit__ds__quarter
- , subq_4.visit__ds__year
- , subq_4.visit__ds__extract_year
- , subq_4.visit__ds__extract_quarter
- , subq_4.visit__ds__extract_month
- , subq_4.visit__ds__extract_day
- , subq_4.visit__ds__extract_dow
- , subq_4.visit__ds__extract_doy
- , subq_4.ds__day AS metric_time__day
- , subq_4.ds__week AS metric_time__week
- , subq_4.ds__month AS metric_time__month
- , subq_4.ds__quarter AS metric_time__quarter
- , subq_4.ds__year AS metric_time__year
- , subq_4.ds__extract_year AS metric_time__extract_year
- , subq_4.ds__extract_quarter AS metric_time__extract_quarter
- , subq_4.ds__extract_month AS metric_time__extract_month
- , subq_4.ds__extract_day AS metric_time__extract_day
- , subq_4.ds__extract_dow AS metric_time__extract_dow
- , subq_4.ds__extract_doy AS metric_time__extract_doy
- , subq_4.user
- , subq_4.session
- , subq_4.visit__user
- , subq_4.visit__session
- , subq_4.referrer_id
- , subq_4.visit__referrer_id
- , subq_4.visits
- , subq_4.visitors
+ subq_13.ds__day
+ , subq_13.ds__week
+ , subq_13.ds__month
+ , subq_13.ds__quarter
+ , subq_13.ds__year
+ , subq_13.ds__extract_year
+ , subq_13.ds__extract_quarter
+ , subq_13.ds__extract_month
+ , subq_13.ds__extract_day
+ , subq_13.ds__extract_dow
+ , subq_13.ds__extract_doy
+ , subq_13.visit__ds__day
+ , subq_13.visit__ds__week
+ , subq_13.visit__ds__month
+ , subq_13.visit__ds__quarter
+ , subq_13.visit__ds__year
+ , subq_13.visit__ds__extract_year
+ , subq_13.visit__ds__extract_quarter
+ , subq_13.visit__ds__extract_month
+ , subq_13.visit__ds__extract_day
+ , subq_13.visit__ds__extract_dow
+ , subq_13.visit__ds__extract_doy
+ , subq_13.ds__day AS metric_time__day
+ , subq_13.ds__week AS metric_time__week
+ , subq_13.ds__month AS metric_time__month
+ , subq_13.ds__quarter AS metric_time__quarter
+ , subq_13.ds__year AS metric_time__year
+ , subq_13.ds__extract_year AS metric_time__extract_year
+ , subq_13.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_13.ds__extract_month AS metric_time__extract_month
+ , subq_13.ds__extract_day AS metric_time__extract_day
+ , subq_13.ds__extract_dow AS metric_time__extract_dow
+ , subq_13.ds__extract_doy AS metric_time__extract_doy
+ , subq_13.user
+ , subq_13.session
+ , subq_13.visit__user
+ , subq_13.visit__session
+ , subq_13.referrer_id
+ , subq_13.visit__referrer_id
+ , subq_13.visits
+ , subq_13.visitors
FROM (
-- Read Elements From Semantic Model 'visits_source'
SELECT
1 AS visits
- , visits_source_src_28011.user_id AS visitors
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day
- , CASE WHEN EXTRACT(dow FROM visits_source_src_28011.ds) = 0 THEN EXTRACT(dow FROM visits_source_src_28011.ds) + 7 ELSE EXTRACT(dow FROM visits_source_src_28011.ds) END AS ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy
- , visits_source_src_28011.referrer_id
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day
- , CASE WHEN EXTRACT(dow FROM visits_source_src_28011.ds) = 0 THEN EXTRACT(dow FROM visits_source_src_28011.ds) + 7 ELSE EXTRACT(dow FROM visits_source_src_28011.ds) END AS visit__ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy
- , visits_source_src_28011.referrer_id AS visit__referrer_id
- , visits_source_src_28011.user_id AS user
- , visits_source_src_28011.session_id AS session
- , visits_source_src_28011.user_id AS visit__user
- , visits_source_src_28011.session_id AS visit__session
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_4
- ) subq_5
- ) subq_6
+ , visits_source_src_28000.user_id AS visitors
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS ds__extract_day
+ , CASE WHEN EXTRACT(dow FROM visits_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM visits_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM visits_source_src_28000.ds) END AS ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS ds__extract_doy
+ , visits_source_src_28000.referrer_id
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS visit__ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS visit__ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS visit__ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS visit__ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS visit__ds__extract_day
+ , CASE WHEN EXTRACT(dow FROM visits_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM visits_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM visits_source_src_28000.ds) END AS visit__ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS visit__ds__extract_doy
+ , visits_source_src_28000.referrer_id AS visit__referrer_id
+ , visits_source_src_28000.user_id AS user
+ , visits_source_src_28000.session_id AS session
+ , visits_source_src_28000.user_id AS visit__user
+ , visits_source_src_28000.session_id AS visit__session
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_13
+ ) subq_14
+ ) subq_15
INNER JOIN (
-- Add column with generated UUID
SELECT
- subq_8.ds__day
- , subq_8.ds__week
- , subq_8.ds__month
- , subq_8.ds__quarter
- , subq_8.ds__year
- , subq_8.ds__extract_year
- , subq_8.ds__extract_quarter
- , subq_8.ds__extract_month
- , subq_8.ds__extract_day
- , subq_8.ds__extract_dow
- , subq_8.ds__extract_doy
- , subq_8.buy__ds__day
- , subq_8.buy__ds__week
- , subq_8.buy__ds__month
- , subq_8.buy__ds__quarter
- , subq_8.buy__ds__year
- , subq_8.buy__ds__extract_year
- , subq_8.buy__ds__extract_quarter
- , subq_8.buy__ds__extract_month
- , subq_8.buy__ds__extract_day
- , subq_8.buy__ds__extract_dow
- , subq_8.buy__ds__extract_doy
- , subq_8.metric_time__day
- , subq_8.metric_time__week
- , subq_8.metric_time__month
- , subq_8.metric_time__quarter
- , subq_8.metric_time__year
- , subq_8.metric_time__extract_year
- , subq_8.metric_time__extract_quarter
- , subq_8.metric_time__extract_month
- , subq_8.metric_time__extract_day
- , subq_8.metric_time__extract_dow
- , subq_8.metric_time__extract_doy
- , subq_8.user
- , subq_8.session_id
- , subq_8.buy__user
- , subq_8.buy__session_id
- , subq_8.buys
- , subq_8.buyers
+ subq_17.ds__day
+ , subq_17.ds__week
+ , subq_17.ds__month
+ , subq_17.ds__quarter
+ , subq_17.ds__year
+ , subq_17.ds__extract_year
+ , subq_17.ds__extract_quarter
+ , subq_17.ds__extract_month
+ , subq_17.ds__extract_day
+ , subq_17.ds__extract_dow
+ , subq_17.ds__extract_doy
+ , subq_17.buy__ds__day
+ , subq_17.buy__ds__week
+ , subq_17.buy__ds__month
+ , subq_17.buy__ds__quarter
+ , subq_17.buy__ds__year
+ , subq_17.buy__ds__extract_year
+ , subq_17.buy__ds__extract_quarter
+ , subq_17.buy__ds__extract_month
+ , subq_17.buy__ds__extract_day
+ , subq_17.buy__ds__extract_dow
+ , subq_17.buy__ds__extract_doy
+ , subq_17.metric_time__day
+ , subq_17.metric_time__week
+ , subq_17.metric_time__month
+ , subq_17.metric_time__quarter
+ , subq_17.metric_time__year
+ , subq_17.metric_time__extract_year
+ , subq_17.metric_time__extract_quarter
+ , subq_17.metric_time__extract_month
+ , subq_17.metric_time__extract_day
+ , subq_17.metric_time__extract_dow
+ , subq_17.metric_time__extract_doy
+ , subq_17.user
+ , subq_17.session_id
+ , subq_17.buy__user
+ , subq_17.buy__session_id
+ , subq_17.buys
+ , subq_17.buyers
, CONCAT(CAST(RANDOM()*100000000 AS INT)::VARCHAR,CAST(RANDOM()*100000000 AS INT)::VARCHAR) AS mf_internal_uuid
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_7.ds__day
- , subq_7.ds__week
- , subq_7.ds__month
- , subq_7.ds__quarter
- , subq_7.ds__year
- , subq_7.ds__extract_year
- , subq_7.ds__extract_quarter
- , subq_7.ds__extract_month
- , subq_7.ds__extract_day
- , subq_7.ds__extract_dow
- , subq_7.ds__extract_doy
- , subq_7.buy__ds__day
- , subq_7.buy__ds__week
- , subq_7.buy__ds__month
- , subq_7.buy__ds__quarter
- , subq_7.buy__ds__year
- , subq_7.buy__ds__extract_year
- , subq_7.buy__ds__extract_quarter
- , subq_7.buy__ds__extract_month
- , subq_7.buy__ds__extract_day
- , subq_7.buy__ds__extract_dow
- , subq_7.buy__ds__extract_doy
- , subq_7.ds__day AS metric_time__day
- , subq_7.ds__week AS metric_time__week
- , subq_7.ds__month AS metric_time__month
- , subq_7.ds__quarter AS metric_time__quarter
- , subq_7.ds__year AS metric_time__year
- , subq_7.ds__extract_year AS metric_time__extract_year
- , subq_7.ds__extract_quarter AS metric_time__extract_quarter
- , subq_7.ds__extract_month AS metric_time__extract_month
- , subq_7.ds__extract_day AS metric_time__extract_day
- , subq_7.ds__extract_dow AS metric_time__extract_dow
- , subq_7.ds__extract_doy AS metric_time__extract_doy
- , subq_7.user
- , subq_7.session_id
- , subq_7.buy__user
- , subq_7.buy__session_id
- , subq_7.buys
- , subq_7.buyers
+ subq_16.ds__day
+ , subq_16.ds__week
+ , subq_16.ds__month
+ , subq_16.ds__quarter
+ , subq_16.ds__year
+ , subq_16.ds__extract_year
+ , subq_16.ds__extract_quarter
+ , subq_16.ds__extract_month
+ , subq_16.ds__extract_day
+ , subq_16.ds__extract_dow
+ , subq_16.ds__extract_doy
+ , subq_16.buy__ds__day
+ , subq_16.buy__ds__week
+ , subq_16.buy__ds__month
+ , subq_16.buy__ds__quarter
+ , subq_16.buy__ds__year
+ , subq_16.buy__ds__extract_year
+ , subq_16.buy__ds__extract_quarter
+ , subq_16.buy__ds__extract_month
+ , subq_16.buy__ds__extract_day
+ , subq_16.buy__ds__extract_dow
+ , subq_16.buy__ds__extract_doy
+ , subq_16.ds__day AS metric_time__day
+ , subq_16.ds__week AS metric_time__week
+ , subq_16.ds__month AS metric_time__month
+ , subq_16.ds__quarter AS metric_time__quarter
+ , subq_16.ds__year AS metric_time__year
+ , subq_16.ds__extract_year AS metric_time__extract_year
+ , subq_16.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_16.ds__extract_month AS metric_time__extract_month
+ , subq_16.ds__extract_day AS metric_time__extract_day
+ , subq_16.ds__extract_dow AS metric_time__extract_dow
+ , subq_16.ds__extract_doy AS metric_time__extract_doy
+ , subq_16.user
+ , subq_16.session_id
+ , subq_16.buy__user
+ , subq_16.buy__session_id
+ , subq_16.buys
+ , subq_16.buyers
FROM (
-- Read Elements From Semantic Model 'buys_source'
SELECT
1 AS buys
- , buys_source_src_28002.user_id AS buyers
- , DATE_TRUNC('day', buys_source_src_28002.ds) AS ds__day
- , DATE_TRUNC('week', buys_source_src_28002.ds) AS ds__week
- , DATE_TRUNC('month', buys_source_src_28002.ds) AS ds__month
- , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS ds__quarter
- , DATE_TRUNC('year', buys_source_src_28002.ds) AS ds__year
- , EXTRACT(year FROM buys_source_src_28002.ds) AS ds__extract_year
- , EXTRACT(quarter FROM buys_source_src_28002.ds) AS ds__extract_quarter
- , EXTRACT(month FROM buys_source_src_28002.ds) AS ds__extract_month
- , EXTRACT(day FROM buys_source_src_28002.ds) AS ds__extract_day
- , CASE WHEN EXTRACT(dow FROM buys_source_src_28002.ds) = 0 THEN EXTRACT(dow FROM buys_source_src_28002.ds) + 7 ELSE EXTRACT(dow FROM buys_source_src_28002.ds) END AS ds__extract_dow
- , EXTRACT(doy FROM buys_source_src_28002.ds) AS ds__extract_doy
- , DATE_TRUNC('day', buys_source_src_28002.ds) AS buy__ds__day
- , DATE_TRUNC('week', buys_source_src_28002.ds) AS buy__ds__week
- , DATE_TRUNC('month', buys_source_src_28002.ds) AS buy__ds__month
- , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS buy__ds__quarter
- , DATE_TRUNC('year', buys_source_src_28002.ds) AS buy__ds__year
- , EXTRACT(year FROM buys_source_src_28002.ds) AS buy__ds__extract_year
- , EXTRACT(quarter FROM buys_source_src_28002.ds) AS buy__ds__extract_quarter
- , EXTRACT(month FROM buys_source_src_28002.ds) AS buy__ds__extract_month
- , EXTRACT(day FROM buys_source_src_28002.ds) AS buy__ds__extract_day
- , CASE WHEN EXTRACT(dow FROM buys_source_src_28002.ds) = 0 THEN EXTRACT(dow FROM buys_source_src_28002.ds) + 7 ELSE EXTRACT(dow FROM buys_source_src_28002.ds) END AS buy__ds__extract_dow
- , EXTRACT(doy FROM buys_source_src_28002.ds) AS buy__ds__extract_doy
- , buys_source_src_28002.user_id AS user
- , buys_source_src_28002.session_id
- , buys_source_src_28002.user_id AS buy__user
- , buys_source_src_28002.session_id AS buy__session_id
- FROM ***************************.fct_buys buys_source_src_28002
- ) subq_7
- ) subq_8
- ) subq_9
+ , buys_source_src_28000.user_id AS buyers
+ , DATE_TRUNC('day', buys_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', buys_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', buys_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', buys_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', buys_source_src_28000.ds) 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
+ , CASE WHEN EXTRACT(dow FROM buys_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM buys_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM buys_source_src_28000.ds) END AS ds__extract_dow
+ , EXTRACT(doy FROM buys_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', buys_source_src_28000.ds) AS buy__ds__day
+ , DATE_TRUNC('week', buys_source_src_28000.ds) AS buy__ds__week
+ , DATE_TRUNC('month', buys_source_src_28000.ds) AS buy__ds__month
+ , DATE_TRUNC('quarter', buys_source_src_28000.ds) AS buy__ds__quarter
+ , DATE_TRUNC('year', buys_source_src_28000.ds) 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
+ , EXTRACT(day FROM buys_source_src_28000.ds) AS buy__ds__extract_day
+ , CASE WHEN EXTRACT(dow FROM buys_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM buys_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM buys_source_src_28000.ds) END AS buy__ds__extract_dow
+ , EXTRACT(doy FROM buys_source_src_28000.ds) AS buy__ds__extract_doy
+ , buys_source_src_28000.user_id AS user
+ , buys_source_src_28000.session_id
+ , buys_source_src_28000.user_id AS buy__user
+ , buys_source_src_28000.session_id AS buy__session_id
+ FROM ***************************.fct_buys buys_source_src_28000
+ ) subq_16
+ ) subq_17
+ ) subq_18
ON
(
- subq_6.user = subq_9.user
+ subq_15.user = subq_18.user
) AND (
(
- subq_6.ds__day <= subq_9.ds__day
+ subq_15.ds__day <= subq_18.ds__day
) AND (
- subq_6.ds__day > DATEADD(day, -7, subq_9.ds__day)
+ subq_15.ds__day > DATEADD(day, -7, subq_18.ds__day)
)
)
- ) subq_10
- ) subq_11
- ) subq_12
- ) subq_13
-) subq_14
+ ) subq_19
+ ) subq_20
+ ) subq_21
+ ) subq_22
+) subq_23
diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Redshift/test_conversion_rate_with_no_group_by__plan0_optimized.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Redshift/test_conversion_rate_with_no_group_by__plan0_optimized.sql
index 797aac359e..becf445ac2 100644
--- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Redshift/test_conversion_rate_with_no_group_by__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Redshift/test_conversion_rate_with_no_group_by__plan0_optimized.sql
@@ -1,7 +1,7 @@
-- Combine Aggregated Outputs
-- Compute Metrics via Expressions
SELECT
- CAST(MAX(subq_28.buys) AS DOUBLE PRECISION) / CAST(NULLIF(MAX(subq_18.visits), 0) AS DOUBLE PRECISION) AS visit_buy_conversion_rate_7days
+ CAST(MAX(subq_37.buys) AS DOUBLE PRECISION) / CAST(NULLIF(MAX(subq_27.visits), 0) AS DOUBLE PRECISION) AS visit_buy_conversion_rate_7days
FROM (
-- Read Elements From Semantic Model 'visits_source'
-- Metric Time Dimension 'ds'
@@ -9,8 +9,8 @@ FROM (
-- Aggregate Measures
SELECT
SUM(1) AS visits
- FROM ***************************.fct_visits visits_source_src_28011
-) subq_18
+ FROM ***************************.fct_visits visits_source_src_28000
+) subq_27
CROSS JOIN (
-- Find conversions for user within the range of 7 day
-- Pass Only Elements: ['buys',]
@@ -20,11 +20,11 @@ CROSS JOIN (
FROM (
-- Dedupe the fanout with mf_internal_uuid in the conversion data set
SELECT DISTINCT
- first_value(subq_21.visits) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
- , first_value(subq_21.ds__day) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
- , first_value(subq_21.user) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
- , subq_24.mf_internal_uuid AS mf_internal_uuid
- , subq_24.buys AS buys
+ first_value(subq_30.visits) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
+ , first_value(subq_30.ds__day) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
+ , first_value(subq_30.user) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
+ , subq_33.mf_internal_uuid AS mf_internal_uuid
+ , subq_33.buys AS buys
FROM (
-- Read Elements From Semantic Model 'visits_source'
-- Metric Time Dimension 'ds'
@@ -33,8 +33,8 @@ CROSS JOIN (
DATE_TRUNC('day', ds) AS ds__day
, user_id AS user
, 1 AS visits
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_21
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_30
INNER JOIN (
-- Read Elements From Semantic Model 'buys_source'
-- Metric Time Dimension 'ds'
@@ -44,17 +44,17 @@ CROSS JOIN (
, user_id AS user
, 1 AS buys
, CONCAT(CAST(RANDOM()*100000000 AS INT)::VARCHAR,CAST(RANDOM()*100000000 AS INT)::VARCHAR) AS mf_internal_uuid
- FROM ***************************.fct_buys buys_source_src_28002
- ) subq_24
+ FROM ***************************.fct_buys buys_source_src_28000
+ ) subq_33
ON
(
- subq_21.user = subq_24.user
+ subq_30.user = subq_33.user
) AND (
(
- subq_21.ds__day <= subq_24.ds__day
+ subq_30.ds__day <= subq_33.ds__day
) AND (
- subq_21.ds__day > DATEADD(day, -7, subq_24.ds__day)
+ subq_30.ds__day > DATEADD(day, -7, subq_33.ds__day)
)
)
- ) subq_25
-) subq_28
+ ) subq_34
+) subq_37
diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Redshift/test_conversion_rate_with_window__plan0.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Redshift/test_conversion_rate_with_window__plan0.sql
index b95b5f3ac4..4666a59a48 100644
--- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Redshift/test_conversion_rate_with_window__plan0.sql
+++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Redshift/test_conversion_rate_with_window__plan0.sql
@@ -1,376 +1,376 @@
-- Compute Metrics via Expressions
SELECT
- subq_14.metric_time__day
- , subq_14.visit__referrer_id
- , CAST(subq_14.buys AS DOUBLE PRECISION) / CAST(NULLIF(subq_14.visits, 0) AS DOUBLE PRECISION) AS visit_buy_conversion_rate_7days
+ subq_23.metric_time__day
+ , subq_23.visit__referrer_id
+ , CAST(subq_23.buys AS DOUBLE PRECISION) / CAST(NULLIF(subq_23.visits, 0) AS DOUBLE PRECISION) AS visit_buy_conversion_rate_7days
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_3.metric_time__day, subq_13.metric_time__day) AS metric_time__day
- , COALESCE(subq_3.visit__referrer_id, subq_13.visit__referrer_id) AS visit__referrer_id
- , MAX(subq_3.visits) AS visits
- , MAX(subq_13.buys) AS buys
+ COALESCE(subq_12.metric_time__day, subq_22.metric_time__day) AS metric_time__day
+ , COALESCE(subq_12.visit__referrer_id, subq_22.visit__referrer_id) AS visit__referrer_id
+ , MAX(subq_12.visits) AS visits
+ , MAX(subq_22.buys) AS buys
FROM (
-- Aggregate Measures
SELECT
- subq_2.metric_time__day
- , subq_2.visit__referrer_id
- , SUM(subq_2.visits) AS visits
+ subq_11.metric_time__day
+ , subq_11.visit__referrer_id
+ , SUM(subq_11.visits) AS visits
FROM (
-- Pass Only Elements: ['visits', 'visit__referrer_id', 'metric_time__day']
SELECT
- subq_1.metric_time__day
- , subq_1.visit__referrer_id
- , subq_1.visits
+ subq_10.metric_time__day
+ , subq_10.visit__referrer_id
+ , subq_10.visits
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.visit__ds__day
- , subq_0.visit__ds__week
- , subq_0.visit__ds__month
- , subq_0.visit__ds__quarter
- , subq_0.visit__ds__year
- , subq_0.visit__ds__extract_year
- , subq_0.visit__ds__extract_quarter
- , subq_0.visit__ds__extract_month
- , subq_0.visit__ds__extract_day
- , subq_0.visit__ds__extract_dow
- , subq_0.visit__ds__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.user
- , subq_0.session
- , subq_0.visit__user
- , subq_0.visit__session
- , subq_0.referrer_id
- , subq_0.visit__referrer_id
- , subq_0.visits
- , subq_0.visitors
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.visit__ds__day
+ , subq_9.visit__ds__week
+ , subq_9.visit__ds__month
+ , subq_9.visit__ds__quarter
+ , subq_9.visit__ds__year
+ , subq_9.visit__ds__extract_year
+ , subq_9.visit__ds__extract_quarter
+ , subq_9.visit__ds__extract_month
+ , subq_9.visit__ds__extract_day
+ , subq_9.visit__ds__extract_dow
+ , subq_9.visit__ds__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.user
+ , subq_9.session
+ , subq_9.visit__user
+ , subq_9.visit__session
+ , subq_9.referrer_id
+ , subq_9.visit__referrer_id
+ , subq_9.visits
+ , subq_9.visitors
FROM (
-- Read Elements From Semantic Model 'visits_source'
SELECT
1 AS visits
- , visits_source_src_28011.user_id AS visitors
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day
- , CASE WHEN EXTRACT(dow FROM visits_source_src_28011.ds) = 0 THEN EXTRACT(dow FROM visits_source_src_28011.ds) + 7 ELSE EXTRACT(dow FROM visits_source_src_28011.ds) END AS ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy
- , visits_source_src_28011.referrer_id
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day
- , CASE WHEN EXTRACT(dow FROM visits_source_src_28011.ds) = 0 THEN EXTRACT(dow FROM visits_source_src_28011.ds) + 7 ELSE EXTRACT(dow FROM visits_source_src_28011.ds) END AS visit__ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy
- , visits_source_src_28011.referrer_id AS visit__referrer_id
- , visits_source_src_28011.user_id AS user
- , visits_source_src_28011.session_id AS session
- , visits_source_src_28011.user_id AS visit__user
- , visits_source_src_28011.session_id AS visit__session
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_0
- ) subq_1
- ) subq_2
+ , visits_source_src_28000.user_id AS visitors
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS ds__extract_day
+ , CASE WHEN EXTRACT(dow FROM visits_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM visits_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM visits_source_src_28000.ds) END AS ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS ds__extract_doy
+ , visits_source_src_28000.referrer_id
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS visit__ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS visit__ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS visit__ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS visit__ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS visit__ds__extract_day
+ , CASE WHEN EXTRACT(dow FROM visits_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM visits_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM visits_source_src_28000.ds) END AS visit__ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS visit__ds__extract_doy
+ , visits_source_src_28000.referrer_id AS visit__referrer_id
+ , visits_source_src_28000.user_id AS user
+ , visits_source_src_28000.session_id AS session
+ , visits_source_src_28000.user_id AS visit__user
+ , visits_source_src_28000.session_id AS visit__session
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
GROUP BY
- subq_2.metric_time__day
- , subq_2.visit__referrer_id
- ) subq_3
+ subq_11.metric_time__day
+ , subq_11.visit__referrer_id
+ ) subq_12
FULL OUTER JOIN (
-- Aggregate Measures
SELECT
- subq_12.metric_time__day
- , subq_12.visit__referrer_id
- , SUM(subq_12.buys) AS buys
+ subq_21.metric_time__day
+ , subq_21.visit__referrer_id
+ , SUM(subq_21.buys) AS buys
FROM (
-- Pass Only Elements: ['buys', 'visit__referrer_id', 'metric_time__day']
SELECT
- subq_11.metric_time__day
- , subq_11.visit__referrer_id
- , subq_11.buys
+ subq_20.metric_time__day
+ , subq_20.visit__referrer_id
+ , subq_20.buys
FROM (
-- Find conversions for user within the range of 7 day
SELECT
- subq_10.ds__day
- , subq_10.metric_time__day
- , subq_10.user
- , subq_10.visit__referrer_id
- , subq_10.buys
- , subq_10.visits
+ subq_19.ds__day
+ , subq_19.metric_time__day
+ , subq_19.user
+ , subq_19.visit__referrer_id
+ , subq_19.buys
+ , subq_19.visits
FROM (
-- Dedupe the fanout with mf_internal_uuid in the conversion data set
SELECT DISTINCT
- first_value(subq_6.visits) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
- , first_value(subq_6.visit__referrer_id) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visit__referrer_id
- , first_value(subq_6.ds__day) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
- , first_value(subq_6.metric_time__day) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS metric_time__day
- , first_value(subq_6.user) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
- , subq_9.mf_internal_uuid AS mf_internal_uuid
- , subq_9.buys AS buys
+ first_value(subq_15.visits) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
+ , first_value(subq_15.visit__referrer_id) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visit__referrer_id
+ , first_value(subq_15.ds__day) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
+ , first_value(subq_15.metric_time__day) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS metric_time__day
+ , first_value(subq_15.user) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
+ , subq_18.mf_internal_uuid AS mf_internal_uuid
+ , subq_18.buys AS buys
FROM (
-- Pass Only Elements: ['visits', 'visit__referrer_id', 'ds__day', 'metric_time__day', 'user']
SELECT
- subq_5.ds__day
- , subq_5.metric_time__day
- , subq_5.user
- , subq_5.visit__referrer_id
- , subq_5.visits
+ subq_14.ds__day
+ , subq_14.metric_time__day
+ , subq_14.user
+ , subq_14.visit__referrer_id
+ , subq_14.visits
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_4.ds__day
- , subq_4.ds__week
- , subq_4.ds__month
- , subq_4.ds__quarter
- , subq_4.ds__year
- , subq_4.ds__extract_year
- , subq_4.ds__extract_quarter
- , subq_4.ds__extract_month
- , subq_4.ds__extract_day
- , subq_4.ds__extract_dow
- , subq_4.ds__extract_doy
- , subq_4.visit__ds__day
- , subq_4.visit__ds__week
- , subq_4.visit__ds__month
- , subq_4.visit__ds__quarter
- , subq_4.visit__ds__year
- , subq_4.visit__ds__extract_year
- , subq_4.visit__ds__extract_quarter
- , subq_4.visit__ds__extract_month
- , subq_4.visit__ds__extract_day
- , subq_4.visit__ds__extract_dow
- , subq_4.visit__ds__extract_doy
- , subq_4.ds__day AS metric_time__day
- , subq_4.ds__week AS metric_time__week
- , subq_4.ds__month AS metric_time__month
- , subq_4.ds__quarter AS metric_time__quarter
- , subq_4.ds__year AS metric_time__year
- , subq_4.ds__extract_year AS metric_time__extract_year
- , subq_4.ds__extract_quarter AS metric_time__extract_quarter
- , subq_4.ds__extract_month AS metric_time__extract_month
- , subq_4.ds__extract_day AS metric_time__extract_day
- , subq_4.ds__extract_dow AS metric_time__extract_dow
- , subq_4.ds__extract_doy AS metric_time__extract_doy
- , subq_4.user
- , subq_4.session
- , subq_4.visit__user
- , subq_4.visit__session
- , subq_4.referrer_id
- , subq_4.visit__referrer_id
- , subq_4.visits
- , subq_4.visitors
+ subq_13.ds__day
+ , subq_13.ds__week
+ , subq_13.ds__month
+ , subq_13.ds__quarter
+ , subq_13.ds__year
+ , subq_13.ds__extract_year
+ , subq_13.ds__extract_quarter
+ , subq_13.ds__extract_month
+ , subq_13.ds__extract_day
+ , subq_13.ds__extract_dow
+ , subq_13.ds__extract_doy
+ , subq_13.visit__ds__day
+ , subq_13.visit__ds__week
+ , subq_13.visit__ds__month
+ , subq_13.visit__ds__quarter
+ , subq_13.visit__ds__year
+ , subq_13.visit__ds__extract_year
+ , subq_13.visit__ds__extract_quarter
+ , subq_13.visit__ds__extract_month
+ , subq_13.visit__ds__extract_day
+ , subq_13.visit__ds__extract_dow
+ , subq_13.visit__ds__extract_doy
+ , subq_13.ds__day AS metric_time__day
+ , subq_13.ds__week AS metric_time__week
+ , subq_13.ds__month AS metric_time__month
+ , subq_13.ds__quarter AS metric_time__quarter
+ , subq_13.ds__year AS metric_time__year
+ , subq_13.ds__extract_year AS metric_time__extract_year
+ , subq_13.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_13.ds__extract_month AS metric_time__extract_month
+ , subq_13.ds__extract_day AS metric_time__extract_day
+ , subq_13.ds__extract_dow AS metric_time__extract_dow
+ , subq_13.ds__extract_doy AS metric_time__extract_doy
+ , subq_13.user
+ , subq_13.session
+ , subq_13.visit__user
+ , subq_13.visit__session
+ , subq_13.referrer_id
+ , subq_13.visit__referrer_id
+ , subq_13.visits
+ , subq_13.visitors
FROM (
-- Read Elements From Semantic Model 'visits_source'
SELECT
1 AS visits
- , visits_source_src_28011.user_id AS visitors
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day
- , CASE WHEN EXTRACT(dow FROM visits_source_src_28011.ds) = 0 THEN EXTRACT(dow FROM visits_source_src_28011.ds) + 7 ELSE EXTRACT(dow FROM visits_source_src_28011.ds) END AS ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy
- , visits_source_src_28011.referrer_id
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day
- , CASE WHEN EXTRACT(dow FROM visits_source_src_28011.ds) = 0 THEN EXTRACT(dow FROM visits_source_src_28011.ds) + 7 ELSE EXTRACT(dow FROM visits_source_src_28011.ds) END AS visit__ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy
- , visits_source_src_28011.referrer_id AS visit__referrer_id
- , visits_source_src_28011.user_id AS user
- , visits_source_src_28011.session_id AS session
- , visits_source_src_28011.user_id AS visit__user
- , visits_source_src_28011.session_id AS visit__session
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_4
- ) subq_5
- ) subq_6
+ , visits_source_src_28000.user_id AS visitors
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS ds__extract_day
+ , CASE WHEN EXTRACT(dow FROM visits_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM visits_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM visits_source_src_28000.ds) END AS ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS ds__extract_doy
+ , visits_source_src_28000.referrer_id
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS visit__ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS visit__ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS visit__ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS visit__ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS visit__ds__extract_day
+ , CASE WHEN EXTRACT(dow FROM visits_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM visits_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM visits_source_src_28000.ds) END AS visit__ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS visit__ds__extract_doy
+ , visits_source_src_28000.referrer_id AS visit__referrer_id
+ , visits_source_src_28000.user_id AS user
+ , visits_source_src_28000.session_id AS session
+ , visits_source_src_28000.user_id AS visit__user
+ , visits_source_src_28000.session_id AS visit__session
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_13
+ ) subq_14
+ ) subq_15
INNER JOIN (
-- Add column with generated UUID
SELECT
- subq_8.ds__day
- , subq_8.ds__week
- , subq_8.ds__month
- , subq_8.ds__quarter
- , subq_8.ds__year
- , subq_8.ds__extract_year
- , subq_8.ds__extract_quarter
- , subq_8.ds__extract_month
- , subq_8.ds__extract_day
- , subq_8.ds__extract_dow
- , subq_8.ds__extract_doy
- , subq_8.buy__ds__day
- , subq_8.buy__ds__week
- , subq_8.buy__ds__month
- , subq_8.buy__ds__quarter
- , subq_8.buy__ds__year
- , subq_8.buy__ds__extract_year
- , subq_8.buy__ds__extract_quarter
- , subq_8.buy__ds__extract_month
- , subq_8.buy__ds__extract_day
- , subq_8.buy__ds__extract_dow
- , subq_8.buy__ds__extract_doy
- , subq_8.metric_time__day
- , subq_8.metric_time__week
- , subq_8.metric_time__month
- , subq_8.metric_time__quarter
- , subq_8.metric_time__year
- , subq_8.metric_time__extract_year
- , subq_8.metric_time__extract_quarter
- , subq_8.metric_time__extract_month
- , subq_8.metric_time__extract_day
- , subq_8.metric_time__extract_dow
- , subq_8.metric_time__extract_doy
- , subq_8.user
- , subq_8.session_id
- , subq_8.buy__user
- , subq_8.buy__session_id
- , subq_8.buys
- , subq_8.buyers
+ subq_17.ds__day
+ , subq_17.ds__week
+ , subq_17.ds__month
+ , subq_17.ds__quarter
+ , subq_17.ds__year
+ , subq_17.ds__extract_year
+ , subq_17.ds__extract_quarter
+ , subq_17.ds__extract_month
+ , subq_17.ds__extract_day
+ , subq_17.ds__extract_dow
+ , subq_17.ds__extract_doy
+ , subq_17.buy__ds__day
+ , subq_17.buy__ds__week
+ , subq_17.buy__ds__month
+ , subq_17.buy__ds__quarter
+ , subq_17.buy__ds__year
+ , subq_17.buy__ds__extract_year
+ , subq_17.buy__ds__extract_quarter
+ , subq_17.buy__ds__extract_month
+ , subq_17.buy__ds__extract_day
+ , subq_17.buy__ds__extract_dow
+ , subq_17.buy__ds__extract_doy
+ , subq_17.metric_time__day
+ , subq_17.metric_time__week
+ , subq_17.metric_time__month
+ , subq_17.metric_time__quarter
+ , subq_17.metric_time__year
+ , subq_17.metric_time__extract_year
+ , subq_17.metric_time__extract_quarter
+ , subq_17.metric_time__extract_month
+ , subq_17.metric_time__extract_day
+ , subq_17.metric_time__extract_dow
+ , subq_17.metric_time__extract_doy
+ , subq_17.user
+ , subq_17.session_id
+ , subq_17.buy__user
+ , subq_17.buy__session_id
+ , subq_17.buys
+ , subq_17.buyers
, CONCAT(CAST(RANDOM()*100000000 AS INT)::VARCHAR,CAST(RANDOM()*100000000 AS INT)::VARCHAR) AS mf_internal_uuid
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_7.ds__day
- , subq_7.ds__week
- , subq_7.ds__month
- , subq_7.ds__quarter
- , subq_7.ds__year
- , subq_7.ds__extract_year
- , subq_7.ds__extract_quarter
- , subq_7.ds__extract_month
- , subq_7.ds__extract_day
- , subq_7.ds__extract_dow
- , subq_7.ds__extract_doy
- , subq_7.buy__ds__day
- , subq_7.buy__ds__week
- , subq_7.buy__ds__month
- , subq_7.buy__ds__quarter
- , subq_7.buy__ds__year
- , subq_7.buy__ds__extract_year
- , subq_7.buy__ds__extract_quarter
- , subq_7.buy__ds__extract_month
- , subq_7.buy__ds__extract_day
- , subq_7.buy__ds__extract_dow
- , subq_7.buy__ds__extract_doy
- , subq_7.ds__day AS metric_time__day
- , subq_7.ds__week AS metric_time__week
- , subq_7.ds__month AS metric_time__month
- , subq_7.ds__quarter AS metric_time__quarter
- , subq_7.ds__year AS metric_time__year
- , subq_7.ds__extract_year AS metric_time__extract_year
- , subq_7.ds__extract_quarter AS metric_time__extract_quarter
- , subq_7.ds__extract_month AS metric_time__extract_month
- , subq_7.ds__extract_day AS metric_time__extract_day
- , subq_7.ds__extract_dow AS metric_time__extract_dow
- , subq_7.ds__extract_doy AS metric_time__extract_doy
- , subq_7.user
- , subq_7.session_id
- , subq_7.buy__user
- , subq_7.buy__session_id
- , subq_7.buys
- , subq_7.buyers
+ subq_16.ds__day
+ , subq_16.ds__week
+ , subq_16.ds__month
+ , subq_16.ds__quarter
+ , subq_16.ds__year
+ , subq_16.ds__extract_year
+ , subq_16.ds__extract_quarter
+ , subq_16.ds__extract_month
+ , subq_16.ds__extract_day
+ , subq_16.ds__extract_dow
+ , subq_16.ds__extract_doy
+ , subq_16.buy__ds__day
+ , subq_16.buy__ds__week
+ , subq_16.buy__ds__month
+ , subq_16.buy__ds__quarter
+ , subq_16.buy__ds__year
+ , subq_16.buy__ds__extract_year
+ , subq_16.buy__ds__extract_quarter
+ , subq_16.buy__ds__extract_month
+ , subq_16.buy__ds__extract_day
+ , subq_16.buy__ds__extract_dow
+ , subq_16.buy__ds__extract_doy
+ , subq_16.ds__day AS metric_time__day
+ , subq_16.ds__week AS metric_time__week
+ , subq_16.ds__month AS metric_time__month
+ , subq_16.ds__quarter AS metric_time__quarter
+ , subq_16.ds__year AS metric_time__year
+ , subq_16.ds__extract_year AS metric_time__extract_year
+ , subq_16.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_16.ds__extract_month AS metric_time__extract_month
+ , subq_16.ds__extract_day AS metric_time__extract_day
+ , subq_16.ds__extract_dow AS metric_time__extract_dow
+ , subq_16.ds__extract_doy AS metric_time__extract_doy
+ , subq_16.user
+ , subq_16.session_id
+ , subq_16.buy__user
+ , subq_16.buy__session_id
+ , subq_16.buys
+ , subq_16.buyers
FROM (
-- Read Elements From Semantic Model 'buys_source'
SELECT
1 AS buys
- , buys_source_src_28002.user_id AS buyers
- , DATE_TRUNC('day', buys_source_src_28002.ds) AS ds__day
- , DATE_TRUNC('week', buys_source_src_28002.ds) AS ds__week
- , DATE_TRUNC('month', buys_source_src_28002.ds) AS ds__month
- , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS ds__quarter
- , DATE_TRUNC('year', buys_source_src_28002.ds) AS ds__year
- , EXTRACT(year FROM buys_source_src_28002.ds) AS ds__extract_year
- , EXTRACT(quarter FROM buys_source_src_28002.ds) AS ds__extract_quarter
- , EXTRACT(month FROM buys_source_src_28002.ds) AS ds__extract_month
- , EXTRACT(day FROM buys_source_src_28002.ds) AS ds__extract_day
- , CASE WHEN EXTRACT(dow FROM buys_source_src_28002.ds) = 0 THEN EXTRACT(dow FROM buys_source_src_28002.ds) + 7 ELSE EXTRACT(dow FROM buys_source_src_28002.ds) END AS ds__extract_dow
- , EXTRACT(doy FROM buys_source_src_28002.ds) AS ds__extract_doy
- , DATE_TRUNC('day', buys_source_src_28002.ds) AS buy__ds__day
- , DATE_TRUNC('week', buys_source_src_28002.ds) AS buy__ds__week
- , DATE_TRUNC('month', buys_source_src_28002.ds) AS buy__ds__month
- , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS buy__ds__quarter
- , DATE_TRUNC('year', buys_source_src_28002.ds) AS buy__ds__year
- , EXTRACT(year FROM buys_source_src_28002.ds) AS buy__ds__extract_year
- , EXTRACT(quarter FROM buys_source_src_28002.ds) AS buy__ds__extract_quarter
- , EXTRACT(month FROM buys_source_src_28002.ds) AS buy__ds__extract_month
- , EXTRACT(day FROM buys_source_src_28002.ds) AS buy__ds__extract_day
- , CASE WHEN EXTRACT(dow FROM buys_source_src_28002.ds) = 0 THEN EXTRACT(dow FROM buys_source_src_28002.ds) + 7 ELSE EXTRACT(dow FROM buys_source_src_28002.ds) END AS buy__ds__extract_dow
- , EXTRACT(doy FROM buys_source_src_28002.ds) AS buy__ds__extract_doy
- , buys_source_src_28002.user_id AS user
- , buys_source_src_28002.session_id
- , buys_source_src_28002.user_id AS buy__user
- , buys_source_src_28002.session_id AS buy__session_id
- FROM ***************************.fct_buys buys_source_src_28002
- ) subq_7
- ) subq_8
- ) subq_9
+ , buys_source_src_28000.user_id AS buyers
+ , DATE_TRUNC('day', buys_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', buys_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', buys_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', buys_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', buys_source_src_28000.ds) 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
+ , CASE WHEN EXTRACT(dow FROM buys_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM buys_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM buys_source_src_28000.ds) END AS ds__extract_dow
+ , EXTRACT(doy FROM buys_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', buys_source_src_28000.ds) AS buy__ds__day
+ , DATE_TRUNC('week', buys_source_src_28000.ds) AS buy__ds__week
+ , DATE_TRUNC('month', buys_source_src_28000.ds) AS buy__ds__month
+ , DATE_TRUNC('quarter', buys_source_src_28000.ds) AS buy__ds__quarter
+ , DATE_TRUNC('year', buys_source_src_28000.ds) 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
+ , EXTRACT(day FROM buys_source_src_28000.ds) AS buy__ds__extract_day
+ , CASE WHEN EXTRACT(dow FROM buys_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM buys_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM buys_source_src_28000.ds) END AS buy__ds__extract_dow
+ , EXTRACT(doy FROM buys_source_src_28000.ds) AS buy__ds__extract_doy
+ , buys_source_src_28000.user_id AS user
+ , buys_source_src_28000.session_id
+ , buys_source_src_28000.user_id AS buy__user
+ , buys_source_src_28000.session_id AS buy__session_id
+ FROM ***************************.fct_buys buys_source_src_28000
+ ) subq_16
+ ) subq_17
+ ) subq_18
ON
(
- subq_6.user = subq_9.user
+ subq_15.user = subq_18.user
) AND (
(
- subq_6.ds__day <= subq_9.ds__day
+ subq_15.ds__day <= subq_18.ds__day
) AND (
- subq_6.ds__day > DATEADD(day, -7, subq_9.ds__day)
+ subq_15.ds__day > DATEADD(day, -7, subq_18.ds__day)
)
)
- ) subq_10
- ) subq_11
- ) subq_12
+ ) subq_19
+ ) subq_20
+ ) subq_21
GROUP BY
- subq_12.metric_time__day
- , subq_12.visit__referrer_id
- ) subq_13
+ subq_21.metric_time__day
+ , subq_21.visit__referrer_id
+ ) subq_22
ON
(
- subq_3.visit__referrer_id = subq_13.visit__referrer_id
+ subq_12.visit__referrer_id = subq_22.visit__referrer_id
) AND (
- subq_3.metric_time__day = subq_13.metric_time__day
+ subq_12.metric_time__day = subq_22.metric_time__day
)
GROUP BY
- COALESCE(subq_3.metric_time__day, subq_13.metric_time__day)
- , COALESCE(subq_3.visit__referrer_id, subq_13.visit__referrer_id)
-) subq_14
+ COALESCE(subq_12.metric_time__day, subq_22.metric_time__day)
+ , COALESCE(subq_12.visit__referrer_id, subq_22.visit__referrer_id)
+) subq_23
diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Redshift/test_conversion_rate_with_window__plan0_optimized.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Redshift/test_conversion_rate_with_window__plan0_optimized.sql
index ce5b8ae2a9..34afc895d8 100644
--- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Redshift/test_conversion_rate_with_window__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Redshift/test_conversion_rate_with_window__plan0_optimized.sql
@@ -6,10 +6,10 @@ SELECT
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_18.metric_time__day, subq_28.metric_time__day) AS metric_time__day
- , COALESCE(subq_18.visit__referrer_id, subq_28.visit__referrer_id) AS visit__referrer_id
- , MAX(subq_18.visits) AS visits
- , MAX(subq_28.buys) AS buys
+ COALESCE(subq_27.metric_time__day, subq_37.metric_time__day) AS metric_time__day
+ , COALESCE(subq_27.visit__referrer_id, subq_37.visit__referrer_id) AS visit__referrer_id
+ , MAX(subq_27.visits) AS visits
+ , MAX(subq_37.buys) AS buys
FROM (
-- Aggregate Measures
SELECT
@@ -24,12 +24,12 @@ FROM (
DATE_TRUNC('day', ds) AS metric_time__day
, referrer_id AS visit__referrer_id
, 1 AS visits
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_17
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_26
GROUP BY
metric_time__day
, visit__referrer_id
- ) subq_18
+ ) subq_27
FULL OUTER JOIN (
-- Find conversions for user within the range of 7 day
-- Pass Only Elements: ['buys', 'visit__referrer_id', 'metric_time__day']
@@ -41,13 +41,13 @@ FROM (
FROM (
-- Dedupe the fanout with mf_internal_uuid in the conversion data set
SELECT DISTINCT
- first_value(subq_21.visits) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
- , first_value(subq_21.visit__referrer_id) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visit__referrer_id
- , first_value(subq_21.ds__day) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
- , first_value(subq_21.metric_time__day) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS metric_time__day
- , first_value(subq_21.user) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
- , subq_24.mf_internal_uuid AS mf_internal_uuid
- , subq_24.buys AS buys
+ first_value(subq_30.visits) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
+ , first_value(subq_30.visit__referrer_id) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visit__referrer_id
+ , first_value(subq_30.ds__day) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
+ , first_value(subq_30.metric_time__day) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS metric_time__day
+ , first_value(subq_30.user) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
+ , subq_33.mf_internal_uuid AS mf_internal_uuid
+ , subq_33.buys AS buys
FROM (
-- Read Elements From Semantic Model 'visits_source'
-- Metric Time Dimension 'ds'
@@ -58,8 +58,8 @@ FROM (
, user_id AS user
, referrer_id AS visit__referrer_id
, 1 AS visits
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_21
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_30
INNER JOIN (
-- Read Elements From Semantic Model 'buys_source'
-- Metric Time Dimension 'ds'
@@ -69,30 +69,30 @@ FROM (
, user_id AS user
, 1 AS buys
, CONCAT(CAST(RANDOM()*100000000 AS INT)::VARCHAR,CAST(RANDOM()*100000000 AS INT)::VARCHAR) AS mf_internal_uuid
- FROM ***************************.fct_buys buys_source_src_28002
- ) subq_24
+ FROM ***************************.fct_buys buys_source_src_28000
+ ) subq_33
ON
(
- subq_21.user = subq_24.user
+ subq_30.user = subq_33.user
) AND (
(
- subq_21.ds__day <= subq_24.ds__day
+ subq_30.ds__day <= subq_33.ds__day
) AND (
- subq_21.ds__day > DATEADD(day, -7, subq_24.ds__day)
+ subq_30.ds__day > DATEADD(day, -7, subq_33.ds__day)
)
)
- ) subq_25
+ ) subq_34
GROUP BY
metric_time__day
, visit__referrer_id
- ) subq_28
+ ) subq_37
ON
(
- subq_18.visit__referrer_id = subq_28.visit__referrer_id
+ subq_27.visit__referrer_id = subq_37.visit__referrer_id
) AND (
- subq_18.metric_time__day = subq_28.metric_time__day
+ subq_27.metric_time__day = subq_37.metric_time__day
)
GROUP BY
- COALESCE(subq_18.metric_time__day, subq_28.metric_time__day)
- , COALESCE(subq_18.visit__referrer_id, subq_28.visit__referrer_id)
-) subq_29
+ COALESCE(subq_27.metric_time__day, subq_37.metric_time__day)
+ , COALESCE(subq_27.visit__referrer_id, subq_37.visit__referrer_id)
+) subq_38
diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Snowflake/test_conversion_count_with_no_group_by__plan0.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Snowflake/test_conversion_count_with_no_group_by__plan0.sql
index 29fddc3aad..565162a453 100644
--- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Snowflake/test_conversion_count_with_no_group_by__plan0.sql
+++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Snowflake/test_conversion_count_with_no_group_by__plan0.sql
@@ -1,343 +1,343 @@
-- Compute Metrics via Expressions
SELECT
- subq_14.buys AS visit_buy_conversions
+ subq_23.buys AS visit_buy_conversions
FROM (
-- Combine Aggregated Outputs
SELECT
- MAX(subq_3.visits) AS visits
- , COALESCE(MAX(subq_13.buys), 0) AS buys
+ MAX(subq_12.visits) AS visits
+ , COALESCE(MAX(subq_22.buys), 0) AS buys
FROM (
-- Aggregate Measures
SELECT
- SUM(subq_2.visits) AS visits
+ SUM(subq_11.visits) AS visits
FROM (
-- Pass Only Elements: ['visits',]
SELECT
- subq_1.visits
+ subq_10.visits
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.visit__ds__day
- , subq_0.visit__ds__week
- , subq_0.visit__ds__month
- , subq_0.visit__ds__quarter
- , subq_0.visit__ds__year
- , subq_0.visit__ds__extract_year
- , subq_0.visit__ds__extract_quarter
- , subq_0.visit__ds__extract_month
- , subq_0.visit__ds__extract_day
- , subq_0.visit__ds__extract_dow
- , subq_0.visit__ds__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.user
- , subq_0.session
- , subq_0.visit__user
- , subq_0.visit__session
- , subq_0.referrer_id
- , subq_0.visit__referrer_id
- , subq_0.visits
- , subq_0.visitors
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.visit__ds__day
+ , subq_9.visit__ds__week
+ , subq_9.visit__ds__month
+ , subq_9.visit__ds__quarter
+ , subq_9.visit__ds__year
+ , subq_9.visit__ds__extract_year
+ , subq_9.visit__ds__extract_quarter
+ , subq_9.visit__ds__extract_month
+ , subq_9.visit__ds__extract_day
+ , subq_9.visit__ds__extract_dow
+ , subq_9.visit__ds__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.user
+ , subq_9.session
+ , subq_9.visit__user
+ , subq_9.visit__session
+ , subq_9.referrer_id
+ , subq_9.visit__referrer_id
+ , subq_9.visits
+ , subq_9.visitors
FROM (
-- Read Elements From Semantic Model 'visits_source'
SELECT
1 AS visits
- , visits_source_src_28011.user_id AS visitors
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day
- , EXTRACT(dayofweekiso FROM visits_source_src_28011.ds) AS ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy
- , visits_source_src_28011.referrer_id
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day
- , EXTRACT(dayofweekiso FROM visits_source_src_28011.ds) AS visit__ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy
- , visits_source_src_28011.referrer_id AS visit__referrer_id
- , visits_source_src_28011.user_id AS user
- , visits_source_src_28011.session_id AS session
- , visits_source_src_28011.user_id AS visit__user
- , visits_source_src_28011.session_id AS visit__session
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_0
- ) subq_1
- ) subq_2
- ) subq_3
+ , visits_source_src_28000.user_id AS visitors
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS ds__extract_day
+ , EXTRACT(dayofweekiso FROM visits_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS ds__extract_doy
+ , visits_source_src_28000.referrer_id
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS visit__ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS visit__ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS visit__ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS visit__ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS visit__ds__extract_day
+ , EXTRACT(dayofweekiso FROM visits_source_src_28000.ds) AS visit__ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS visit__ds__extract_doy
+ , visits_source_src_28000.referrer_id AS visit__referrer_id
+ , visits_source_src_28000.user_id AS user
+ , visits_source_src_28000.session_id AS session
+ , visits_source_src_28000.user_id AS visit__user
+ , visits_source_src_28000.session_id AS visit__session
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
+ ) subq_12
CROSS JOIN (
-- Aggregate Measures
SELECT
- SUM(subq_12.buys) AS buys
+ SUM(subq_21.buys) AS buys
FROM (
-- Pass Only Elements: ['buys',]
SELECT
- subq_11.buys
+ subq_20.buys
FROM (
-- Find conversions for user within the range of 7 day
SELECT
- subq_10.ds__day
- , subq_10.user
- , subq_10.buys
- , subq_10.visits
+ subq_19.ds__day
+ , subq_19.user
+ , subq_19.buys
+ , subq_19.visits
FROM (
-- Dedupe the fanout with mf_internal_uuid in the conversion data set
SELECT DISTINCT
- first_value(subq_6.visits) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
- , first_value(subq_6.ds__day) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
- , first_value(subq_6.user) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
- , subq_9.mf_internal_uuid AS mf_internal_uuid
- , subq_9.buys AS buys
+ first_value(subq_15.visits) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
+ , first_value(subq_15.ds__day) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
+ , first_value(subq_15.user) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
+ , subq_18.mf_internal_uuid AS mf_internal_uuid
+ , subq_18.buys AS buys
FROM (
-- Pass Only Elements: ['visits', 'ds__day', 'user']
SELECT
- subq_5.ds__day
- , subq_5.user
- , subq_5.visits
+ subq_14.ds__day
+ , subq_14.user
+ , subq_14.visits
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_4.ds__day
- , subq_4.ds__week
- , subq_4.ds__month
- , subq_4.ds__quarter
- , subq_4.ds__year
- , subq_4.ds__extract_year
- , subq_4.ds__extract_quarter
- , subq_4.ds__extract_month
- , subq_4.ds__extract_day
- , subq_4.ds__extract_dow
- , subq_4.ds__extract_doy
- , subq_4.visit__ds__day
- , subq_4.visit__ds__week
- , subq_4.visit__ds__month
- , subq_4.visit__ds__quarter
- , subq_4.visit__ds__year
- , subq_4.visit__ds__extract_year
- , subq_4.visit__ds__extract_quarter
- , subq_4.visit__ds__extract_month
- , subq_4.visit__ds__extract_day
- , subq_4.visit__ds__extract_dow
- , subq_4.visit__ds__extract_doy
- , subq_4.ds__day AS metric_time__day
- , subq_4.ds__week AS metric_time__week
- , subq_4.ds__month AS metric_time__month
- , subq_4.ds__quarter AS metric_time__quarter
- , subq_4.ds__year AS metric_time__year
- , subq_4.ds__extract_year AS metric_time__extract_year
- , subq_4.ds__extract_quarter AS metric_time__extract_quarter
- , subq_4.ds__extract_month AS metric_time__extract_month
- , subq_4.ds__extract_day AS metric_time__extract_day
- , subq_4.ds__extract_dow AS metric_time__extract_dow
- , subq_4.ds__extract_doy AS metric_time__extract_doy
- , subq_4.user
- , subq_4.session
- , subq_4.visit__user
- , subq_4.visit__session
- , subq_4.referrer_id
- , subq_4.visit__referrer_id
- , subq_4.visits
- , subq_4.visitors
+ subq_13.ds__day
+ , subq_13.ds__week
+ , subq_13.ds__month
+ , subq_13.ds__quarter
+ , subq_13.ds__year
+ , subq_13.ds__extract_year
+ , subq_13.ds__extract_quarter
+ , subq_13.ds__extract_month
+ , subq_13.ds__extract_day
+ , subq_13.ds__extract_dow
+ , subq_13.ds__extract_doy
+ , subq_13.visit__ds__day
+ , subq_13.visit__ds__week
+ , subq_13.visit__ds__month
+ , subq_13.visit__ds__quarter
+ , subq_13.visit__ds__year
+ , subq_13.visit__ds__extract_year
+ , subq_13.visit__ds__extract_quarter
+ , subq_13.visit__ds__extract_month
+ , subq_13.visit__ds__extract_day
+ , subq_13.visit__ds__extract_dow
+ , subq_13.visit__ds__extract_doy
+ , subq_13.ds__day AS metric_time__day
+ , subq_13.ds__week AS metric_time__week
+ , subq_13.ds__month AS metric_time__month
+ , subq_13.ds__quarter AS metric_time__quarter
+ , subq_13.ds__year AS metric_time__year
+ , subq_13.ds__extract_year AS metric_time__extract_year
+ , subq_13.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_13.ds__extract_month AS metric_time__extract_month
+ , subq_13.ds__extract_day AS metric_time__extract_day
+ , subq_13.ds__extract_dow AS metric_time__extract_dow
+ , subq_13.ds__extract_doy AS metric_time__extract_doy
+ , subq_13.user
+ , subq_13.session
+ , subq_13.visit__user
+ , subq_13.visit__session
+ , subq_13.referrer_id
+ , subq_13.visit__referrer_id
+ , subq_13.visits
+ , subq_13.visitors
FROM (
-- Read Elements From Semantic Model 'visits_source'
SELECT
1 AS visits
- , visits_source_src_28011.user_id AS visitors
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day
- , EXTRACT(dayofweekiso FROM visits_source_src_28011.ds) AS ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy
- , visits_source_src_28011.referrer_id
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day
- , EXTRACT(dayofweekiso FROM visits_source_src_28011.ds) AS visit__ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy
- , visits_source_src_28011.referrer_id AS visit__referrer_id
- , visits_source_src_28011.user_id AS user
- , visits_source_src_28011.session_id AS session
- , visits_source_src_28011.user_id AS visit__user
- , visits_source_src_28011.session_id AS visit__session
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_4
- ) subq_5
- ) subq_6
+ , visits_source_src_28000.user_id AS visitors
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS ds__extract_day
+ , EXTRACT(dayofweekiso FROM visits_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS ds__extract_doy
+ , visits_source_src_28000.referrer_id
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS visit__ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS visit__ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS visit__ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS visit__ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS visit__ds__extract_day
+ , EXTRACT(dayofweekiso FROM visits_source_src_28000.ds) AS visit__ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS visit__ds__extract_doy
+ , visits_source_src_28000.referrer_id AS visit__referrer_id
+ , visits_source_src_28000.user_id AS user
+ , visits_source_src_28000.session_id AS session
+ , visits_source_src_28000.user_id AS visit__user
+ , visits_source_src_28000.session_id AS visit__session
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_13
+ ) subq_14
+ ) subq_15
INNER JOIN (
-- Add column with generated UUID
SELECT
- subq_8.ds__day
- , subq_8.ds__week
- , subq_8.ds__month
- , subq_8.ds__quarter
- , subq_8.ds__year
- , subq_8.ds__extract_year
- , subq_8.ds__extract_quarter
- , subq_8.ds__extract_month
- , subq_8.ds__extract_day
- , subq_8.ds__extract_dow
- , subq_8.ds__extract_doy
- , subq_8.buy__ds__day
- , subq_8.buy__ds__week
- , subq_8.buy__ds__month
- , subq_8.buy__ds__quarter
- , subq_8.buy__ds__year
- , subq_8.buy__ds__extract_year
- , subq_8.buy__ds__extract_quarter
- , subq_8.buy__ds__extract_month
- , subq_8.buy__ds__extract_day
- , subq_8.buy__ds__extract_dow
- , subq_8.buy__ds__extract_doy
- , subq_8.metric_time__day
- , subq_8.metric_time__week
- , subq_8.metric_time__month
- , subq_8.metric_time__quarter
- , subq_8.metric_time__year
- , subq_8.metric_time__extract_year
- , subq_8.metric_time__extract_quarter
- , subq_8.metric_time__extract_month
- , subq_8.metric_time__extract_day
- , subq_8.metric_time__extract_dow
- , subq_8.metric_time__extract_doy
- , subq_8.user
- , subq_8.session_id
- , subq_8.buy__user
- , subq_8.buy__session_id
- , subq_8.buys
- , subq_8.buyers
+ subq_17.ds__day
+ , subq_17.ds__week
+ , subq_17.ds__month
+ , subq_17.ds__quarter
+ , subq_17.ds__year
+ , subq_17.ds__extract_year
+ , subq_17.ds__extract_quarter
+ , subq_17.ds__extract_month
+ , subq_17.ds__extract_day
+ , subq_17.ds__extract_dow
+ , subq_17.ds__extract_doy
+ , subq_17.buy__ds__day
+ , subq_17.buy__ds__week
+ , subq_17.buy__ds__month
+ , subq_17.buy__ds__quarter
+ , subq_17.buy__ds__year
+ , subq_17.buy__ds__extract_year
+ , subq_17.buy__ds__extract_quarter
+ , subq_17.buy__ds__extract_month
+ , subq_17.buy__ds__extract_day
+ , subq_17.buy__ds__extract_dow
+ , subq_17.buy__ds__extract_doy
+ , subq_17.metric_time__day
+ , subq_17.metric_time__week
+ , subq_17.metric_time__month
+ , subq_17.metric_time__quarter
+ , subq_17.metric_time__year
+ , subq_17.metric_time__extract_year
+ , subq_17.metric_time__extract_quarter
+ , subq_17.metric_time__extract_month
+ , subq_17.metric_time__extract_day
+ , subq_17.metric_time__extract_dow
+ , subq_17.metric_time__extract_doy
+ , subq_17.user
+ , subq_17.session_id
+ , subq_17.buy__user
+ , subq_17.buy__session_id
+ , subq_17.buys
+ , subq_17.buyers
, UUID_STRING() AS mf_internal_uuid
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_7.ds__day
- , subq_7.ds__week
- , subq_7.ds__month
- , subq_7.ds__quarter
- , subq_7.ds__year
- , subq_7.ds__extract_year
- , subq_7.ds__extract_quarter
- , subq_7.ds__extract_month
- , subq_7.ds__extract_day
- , subq_7.ds__extract_dow
- , subq_7.ds__extract_doy
- , subq_7.buy__ds__day
- , subq_7.buy__ds__week
- , subq_7.buy__ds__month
- , subq_7.buy__ds__quarter
- , subq_7.buy__ds__year
- , subq_7.buy__ds__extract_year
- , subq_7.buy__ds__extract_quarter
- , subq_7.buy__ds__extract_month
- , subq_7.buy__ds__extract_day
- , subq_7.buy__ds__extract_dow
- , subq_7.buy__ds__extract_doy
- , subq_7.ds__day AS metric_time__day
- , subq_7.ds__week AS metric_time__week
- , subq_7.ds__month AS metric_time__month
- , subq_7.ds__quarter AS metric_time__quarter
- , subq_7.ds__year AS metric_time__year
- , subq_7.ds__extract_year AS metric_time__extract_year
- , subq_7.ds__extract_quarter AS metric_time__extract_quarter
- , subq_7.ds__extract_month AS metric_time__extract_month
- , subq_7.ds__extract_day AS metric_time__extract_day
- , subq_7.ds__extract_dow AS metric_time__extract_dow
- , subq_7.ds__extract_doy AS metric_time__extract_doy
- , subq_7.user
- , subq_7.session_id
- , subq_7.buy__user
- , subq_7.buy__session_id
- , subq_7.buys
- , subq_7.buyers
+ subq_16.ds__day
+ , subq_16.ds__week
+ , subq_16.ds__month
+ , subq_16.ds__quarter
+ , subq_16.ds__year
+ , subq_16.ds__extract_year
+ , subq_16.ds__extract_quarter
+ , subq_16.ds__extract_month
+ , subq_16.ds__extract_day
+ , subq_16.ds__extract_dow
+ , subq_16.ds__extract_doy
+ , subq_16.buy__ds__day
+ , subq_16.buy__ds__week
+ , subq_16.buy__ds__month
+ , subq_16.buy__ds__quarter
+ , subq_16.buy__ds__year
+ , subq_16.buy__ds__extract_year
+ , subq_16.buy__ds__extract_quarter
+ , subq_16.buy__ds__extract_month
+ , subq_16.buy__ds__extract_day
+ , subq_16.buy__ds__extract_dow
+ , subq_16.buy__ds__extract_doy
+ , subq_16.ds__day AS metric_time__day
+ , subq_16.ds__week AS metric_time__week
+ , subq_16.ds__month AS metric_time__month
+ , subq_16.ds__quarter AS metric_time__quarter
+ , subq_16.ds__year AS metric_time__year
+ , subq_16.ds__extract_year AS metric_time__extract_year
+ , subq_16.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_16.ds__extract_month AS metric_time__extract_month
+ , subq_16.ds__extract_day AS metric_time__extract_day
+ , subq_16.ds__extract_dow AS metric_time__extract_dow
+ , subq_16.ds__extract_doy AS metric_time__extract_doy
+ , subq_16.user
+ , subq_16.session_id
+ , subq_16.buy__user
+ , subq_16.buy__session_id
+ , subq_16.buys
+ , subq_16.buyers
FROM (
-- Read Elements From Semantic Model 'buys_source'
SELECT
1 AS buys
- , buys_source_src_28002.user_id AS buyers
- , DATE_TRUNC('day', buys_source_src_28002.ds) AS ds__day
- , DATE_TRUNC('week', buys_source_src_28002.ds) AS ds__week
- , DATE_TRUNC('month', buys_source_src_28002.ds) AS ds__month
- , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS ds__quarter
- , DATE_TRUNC('year', buys_source_src_28002.ds) AS ds__year
- , EXTRACT(year FROM buys_source_src_28002.ds) AS ds__extract_year
- , EXTRACT(quarter FROM buys_source_src_28002.ds) AS ds__extract_quarter
- , EXTRACT(month FROM buys_source_src_28002.ds) AS ds__extract_month
- , EXTRACT(day FROM buys_source_src_28002.ds) AS ds__extract_day
- , EXTRACT(dayofweekiso FROM buys_source_src_28002.ds) AS ds__extract_dow
- , EXTRACT(doy FROM buys_source_src_28002.ds) AS ds__extract_doy
- , DATE_TRUNC('day', buys_source_src_28002.ds) AS buy__ds__day
- , DATE_TRUNC('week', buys_source_src_28002.ds) AS buy__ds__week
- , DATE_TRUNC('month', buys_source_src_28002.ds) AS buy__ds__month
- , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS buy__ds__quarter
- , DATE_TRUNC('year', buys_source_src_28002.ds) AS buy__ds__year
- , EXTRACT(year FROM buys_source_src_28002.ds) AS buy__ds__extract_year
- , EXTRACT(quarter FROM buys_source_src_28002.ds) AS buy__ds__extract_quarter
- , EXTRACT(month FROM buys_source_src_28002.ds) AS buy__ds__extract_month
- , EXTRACT(day FROM buys_source_src_28002.ds) AS buy__ds__extract_day
- , EXTRACT(dayofweekiso FROM buys_source_src_28002.ds) AS buy__ds__extract_dow
- , EXTRACT(doy FROM buys_source_src_28002.ds) AS buy__ds__extract_doy
- , buys_source_src_28002.user_id AS user
- , buys_source_src_28002.session_id
- , buys_source_src_28002.user_id AS buy__user
- , buys_source_src_28002.session_id AS buy__session_id
- FROM ***************************.fct_buys buys_source_src_28002
- ) subq_7
- ) subq_8
- ) subq_9
+ , buys_source_src_28000.user_id AS buyers
+ , DATE_TRUNC('day', buys_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', buys_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', buys_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', buys_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', buys_source_src_28000.ds) 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
+ , EXTRACT(dayofweekiso FROM buys_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM buys_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', buys_source_src_28000.ds) AS buy__ds__day
+ , DATE_TRUNC('week', buys_source_src_28000.ds) AS buy__ds__week
+ , DATE_TRUNC('month', buys_source_src_28000.ds) AS buy__ds__month
+ , DATE_TRUNC('quarter', buys_source_src_28000.ds) AS buy__ds__quarter
+ , DATE_TRUNC('year', buys_source_src_28000.ds) 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
+ , EXTRACT(day FROM buys_source_src_28000.ds) AS buy__ds__extract_day
+ , EXTRACT(dayofweekiso FROM buys_source_src_28000.ds) AS buy__ds__extract_dow
+ , EXTRACT(doy FROM buys_source_src_28000.ds) AS buy__ds__extract_doy
+ , buys_source_src_28000.user_id AS user
+ , buys_source_src_28000.session_id
+ , buys_source_src_28000.user_id AS buy__user
+ , buys_source_src_28000.session_id AS buy__session_id
+ FROM ***************************.fct_buys buys_source_src_28000
+ ) subq_16
+ ) subq_17
+ ) subq_18
ON
(
- subq_6.user = subq_9.user
+ subq_15.user = subq_18.user
) AND (
(
- subq_6.ds__day <= subq_9.ds__day
+ subq_15.ds__day <= subq_18.ds__day
) AND (
- subq_6.ds__day > DATEADD(day, -7, subq_9.ds__day)
+ subq_15.ds__day > DATEADD(day, -7, subq_18.ds__day)
)
)
- ) subq_10
- ) subq_11
- ) subq_12
- ) subq_13
-) subq_14
+ ) subq_19
+ ) subq_20
+ ) subq_21
+ ) subq_22
+) subq_23
diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Snowflake/test_conversion_count_with_no_group_by__plan0_optimized.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Snowflake/test_conversion_count_with_no_group_by__plan0_optimized.sql
index a49f83324a..a476f2d738 100644
--- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Snowflake/test_conversion_count_with_no_group_by__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Snowflake/test_conversion_count_with_no_group_by__plan0_optimized.sql
@@ -1,7 +1,7 @@
-- Combine Aggregated Outputs
-- Compute Metrics via Expressions
SELECT
- COALESCE(MAX(subq_28.buys), 0) AS visit_buy_conversions
+ COALESCE(MAX(subq_37.buys), 0) AS visit_buy_conversions
FROM (
-- Read Elements From Semantic Model 'visits_source'
-- Metric Time Dimension 'ds'
@@ -9,8 +9,8 @@ FROM (
-- Aggregate Measures
SELECT
SUM(1) AS visits
- FROM ***************************.fct_visits visits_source_src_28011
-) subq_18
+ FROM ***************************.fct_visits visits_source_src_28000
+) subq_27
CROSS JOIN (
-- Find conversions for user within the range of 7 day
-- Pass Only Elements: ['buys',]
@@ -20,11 +20,11 @@ CROSS JOIN (
FROM (
-- Dedupe the fanout with mf_internal_uuid in the conversion data set
SELECT DISTINCT
- first_value(subq_21.visits) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
- , first_value(subq_21.ds__day) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
- , first_value(subq_21.user) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
- , subq_24.mf_internal_uuid AS mf_internal_uuid
- , subq_24.buys AS buys
+ first_value(subq_30.visits) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
+ , first_value(subq_30.ds__day) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
+ , first_value(subq_30.user) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
+ , subq_33.mf_internal_uuid AS mf_internal_uuid
+ , subq_33.buys AS buys
FROM (
-- Read Elements From Semantic Model 'visits_source'
-- Metric Time Dimension 'ds'
@@ -33,8 +33,8 @@ CROSS JOIN (
DATE_TRUNC('day', ds) AS ds__day
, user_id AS user
, 1 AS visits
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_21
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_30
INNER JOIN (
-- Read Elements From Semantic Model 'buys_source'
-- Metric Time Dimension 'ds'
@@ -44,17 +44,17 @@ CROSS JOIN (
, user_id AS user
, 1 AS buys
, UUID_STRING() AS mf_internal_uuid
- FROM ***************************.fct_buys buys_source_src_28002
- ) subq_24
+ FROM ***************************.fct_buys buys_source_src_28000
+ ) subq_33
ON
(
- subq_21.user = subq_24.user
+ subq_30.user = subq_33.user
) AND (
(
- subq_21.ds__day <= subq_24.ds__day
+ subq_30.ds__day <= subq_33.ds__day
) AND (
- subq_21.ds__day > DATEADD(day, -7, subq_24.ds__day)
+ subq_30.ds__day > DATEADD(day, -7, subq_33.ds__day)
)
)
- ) subq_25
-) subq_28
+ ) subq_34
+) subq_37
diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Snowflake/test_conversion_rate__plan0.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Snowflake/test_conversion_rate__plan0.sql
index 162684165c..6e9b8afa69 100644
--- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Snowflake/test_conversion_rate__plan0.sql
+++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Snowflake/test_conversion_rate__plan0.sql
@@ -1,352 +1,356 @@
-- Compute Metrics via Expressions
SELECT
- subq_14.visit__referrer_id
- , CAST(subq_14.buys AS DOUBLE) / CAST(NULLIF(subq_14.visits, 0) AS DOUBLE) AS visit_buy_conversion_rate
+ subq_23.visit__referrer_id
+ , CAST(subq_23.buys AS DOUBLE) / CAST(NULLIF(subq_23.visits, 0) AS DOUBLE) AS visit_buy_conversion_rate
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_3.visit__referrer_id, subq_13.visit__referrer_id) AS visit__referrer_id
- , MAX(subq_3.visits) AS visits
- , MAX(subq_13.buys) AS buys
+ COALESCE(subq_12.visit__referrer_id, subq_22.visit__referrer_id) AS visit__referrer_id
+ , MAX(subq_12.visits) AS visits
+ , MAX(subq_22.buys) AS buys
FROM (
-- Aggregate Measures
SELECT
- subq_2.visit__referrer_id
- , SUM(subq_2.visits) AS visits
+ subq_11.visit__referrer_id
+ , SUM(subq_11.visits) AS visits
FROM (
-- Pass Only Elements: ['visits', 'visit__referrer_id']
SELECT
- subq_1.visit__referrer_id
- , subq_1.visits
+ subq_10.visit__referrer_id
+ , subq_10.visits
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.visit__ds__day
- , subq_0.visit__ds__week
- , subq_0.visit__ds__month
- , subq_0.visit__ds__quarter
- , subq_0.visit__ds__year
- , subq_0.visit__ds__extract_year
- , subq_0.visit__ds__extract_quarter
- , subq_0.visit__ds__extract_month
- , subq_0.visit__ds__extract_day
- , subq_0.visit__ds__extract_dow
- , subq_0.visit__ds__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.user
- , subq_0.session
- , subq_0.visit__user
- , subq_0.visit__session
- , subq_0.referrer_id
- , subq_0.visit__referrer_id
- , subq_0.visits
- , subq_0.visitors
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.visit__ds__day
+ , subq_9.visit__ds__week
+ , subq_9.visit__ds__month
+ , subq_9.visit__ds__quarter
+ , subq_9.visit__ds__year
+ , subq_9.visit__ds__extract_year
+ , subq_9.visit__ds__extract_quarter
+ , subq_9.visit__ds__extract_month
+ , subq_9.visit__ds__extract_day
+ , subq_9.visit__ds__extract_dow
+ , subq_9.visit__ds__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.user
+ , subq_9.session
+ , subq_9.visit__user
+ , subq_9.visit__session
+ , subq_9.referrer_id
+ , subq_9.visit__referrer_id
+ , subq_9.visits
+ , subq_9.visitors
FROM (
-- Read Elements From Semantic Model 'visits_source'
SELECT
1 AS visits
- , visits_source_src_28011.user_id AS visitors
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day
- , EXTRACT(dayofweekiso FROM visits_source_src_28011.ds) AS ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy
- , visits_source_src_28011.referrer_id
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day
- , EXTRACT(dayofweekiso FROM visits_source_src_28011.ds) AS visit__ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy
- , visits_source_src_28011.referrer_id AS visit__referrer_id
- , visits_source_src_28011.user_id AS user
- , visits_source_src_28011.session_id AS session
- , visits_source_src_28011.user_id AS visit__user
- , visits_source_src_28011.session_id AS visit__session
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_0
- ) subq_1
- ) subq_2
+ , visits_source_src_28000.user_id AS visitors
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS ds__extract_day
+ , EXTRACT(dayofweekiso FROM visits_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS ds__extract_doy
+ , visits_source_src_28000.referrer_id
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS visit__ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS visit__ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS visit__ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS visit__ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS visit__ds__extract_day
+ , EXTRACT(dayofweekiso FROM visits_source_src_28000.ds) AS visit__ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS visit__ds__extract_doy
+ , visits_source_src_28000.referrer_id AS visit__referrer_id
+ , visits_source_src_28000.user_id AS user
+ , visits_source_src_28000.session_id AS session
+ , visits_source_src_28000.user_id AS visit__user
+ , visits_source_src_28000.session_id AS visit__session
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
GROUP BY
- subq_2.visit__referrer_id
- ) subq_3
+ subq_11.visit__referrer_id
+ ) subq_12
FULL OUTER JOIN (
-- Aggregate Measures
SELECT
- subq_12.visit__referrer_id
- , SUM(subq_12.buys) AS buys
+ subq_21.visit__referrer_id
+ , SUM(subq_21.buys) AS buys
FROM (
-- Pass Only Elements: ['buys', 'visit__referrer_id']
SELECT
- subq_11.visit__referrer_id
- , subq_11.buys
+ subq_20.visit__referrer_id
+ , subq_20.buys
FROM (
-- Find conversions for user within the range of INF
SELECT
- subq_10.ds__day
- , subq_10.user
- , subq_10.visit__referrer_id
- , subq_10.buys
- , subq_10.visits
+ subq_19.ds__day
+ , subq_19.user
+ , subq_19.visit__referrer_id
+ , subq_19.buys
+ , subq_19.visits
FROM (
-- Dedupe the fanout with mf_internal_uuid in the conversion data set
SELECT DISTINCT
- first_value(subq_6.visits) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
- , first_value(subq_6.visit__referrer_id) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visit__referrer_id
- , first_value(subq_6.ds__day) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
- , first_value(subq_6.user) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
- , subq_9.mf_internal_uuid AS mf_internal_uuid
- , subq_9.buys AS buys
+ first_value(subq_15.visits) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
+ , first_value(subq_15.visit__referrer_id) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visit__referrer_id
+ , first_value(subq_15.ds__day) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
+ , first_value(subq_15.user) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
+ , subq_18.mf_internal_uuid AS mf_internal_uuid
+ , subq_18.buys AS buys
FROM (
-- Pass Only Elements: ['visits', 'visit__referrer_id', 'ds__day', 'user']
SELECT
- subq_5.ds__day
- , subq_5.user
- , subq_5.visit__referrer_id
- , subq_5.visits
+ subq_14.ds__day
+ , subq_14.user
+ , subq_14.visit__referrer_id
+ , subq_14.visits
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_4.ds__day
- , subq_4.ds__week
- , subq_4.ds__month
- , subq_4.ds__quarter
- , subq_4.ds__year
- , subq_4.ds__extract_year
- , subq_4.ds__extract_quarter
- , subq_4.ds__extract_month
- , subq_4.ds__extract_day
- , subq_4.ds__extract_dow
- , subq_4.ds__extract_doy
- , subq_4.visit__ds__day
- , subq_4.visit__ds__week
- , subq_4.visit__ds__month
- , subq_4.visit__ds__quarter
- , subq_4.visit__ds__year
- , subq_4.visit__ds__extract_year
- , subq_4.visit__ds__extract_quarter
- , subq_4.visit__ds__extract_month
- , subq_4.visit__ds__extract_day
- , subq_4.visit__ds__extract_dow
- , subq_4.visit__ds__extract_doy
- , subq_4.ds__day AS metric_time__day
- , subq_4.ds__week AS metric_time__week
- , subq_4.ds__month AS metric_time__month
- , subq_4.ds__quarter AS metric_time__quarter
- , subq_4.ds__year AS metric_time__year
- , subq_4.ds__extract_year AS metric_time__extract_year
- , subq_4.ds__extract_quarter AS metric_time__extract_quarter
- , subq_4.ds__extract_month AS metric_time__extract_month
- , subq_4.ds__extract_day AS metric_time__extract_day
- , subq_4.ds__extract_dow AS metric_time__extract_dow
- , subq_4.ds__extract_doy AS metric_time__extract_doy
- , subq_4.user
- , subq_4.session
- , subq_4.visit__user
- , subq_4.visit__session
- , subq_4.referrer_id
- , subq_4.visit__referrer_id
- , subq_4.visits
- , subq_4.visitors
+ subq_13.ds__day
+ , subq_13.ds__week
+ , subq_13.ds__month
+ , subq_13.ds__quarter
+ , subq_13.ds__year
+ , subq_13.ds__extract_year
+ , subq_13.ds__extract_quarter
+ , subq_13.ds__extract_month
+ , subq_13.ds__extract_day
+ , subq_13.ds__extract_dow
+ , subq_13.ds__extract_doy
+ , subq_13.visit__ds__day
+ , subq_13.visit__ds__week
+ , subq_13.visit__ds__month
+ , subq_13.visit__ds__quarter
+ , subq_13.visit__ds__year
+ , subq_13.visit__ds__extract_year
+ , subq_13.visit__ds__extract_quarter
+ , subq_13.visit__ds__extract_month
+ , subq_13.visit__ds__extract_day
+ , subq_13.visit__ds__extract_dow
+ , subq_13.visit__ds__extract_doy
+ , subq_13.ds__day AS metric_time__day
+ , subq_13.ds__week AS metric_time__week
+ , subq_13.ds__month AS metric_time__month
+ , subq_13.ds__quarter AS metric_time__quarter
+ , subq_13.ds__year AS metric_time__year
+ , subq_13.ds__extract_year AS metric_time__extract_year
+ , subq_13.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_13.ds__extract_month AS metric_time__extract_month
+ , subq_13.ds__extract_day AS metric_time__extract_day
+ , subq_13.ds__extract_dow AS metric_time__extract_dow
+ , subq_13.ds__extract_doy AS metric_time__extract_doy
+ , subq_13.user
+ , subq_13.session
+ , subq_13.visit__user
+ , subq_13.visit__session
+ , subq_13.referrer_id
+ , subq_13.visit__referrer_id
+ , subq_13.visits
+ , subq_13.visitors
FROM (
-- Read Elements From Semantic Model 'visits_source'
SELECT
1 AS visits
- , visits_source_src_28011.user_id AS visitors
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day
- , EXTRACT(dayofweekiso FROM visits_source_src_28011.ds) AS ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy
- , visits_source_src_28011.referrer_id
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day
- , EXTRACT(dayofweekiso FROM visits_source_src_28011.ds) AS visit__ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy
- , visits_source_src_28011.referrer_id AS visit__referrer_id
- , visits_source_src_28011.user_id AS user
- , visits_source_src_28011.session_id AS session
- , visits_source_src_28011.user_id AS visit__user
- , visits_source_src_28011.session_id AS visit__session
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_4
- ) subq_5
- ) subq_6
+ , visits_source_src_28000.user_id AS visitors
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS ds__extract_day
+ , EXTRACT(dayofweekiso FROM visits_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS ds__extract_doy
+ , visits_source_src_28000.referrer_id
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS visit__ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS visit__ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS visit__ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS visit__ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS visit__ds__extract_day
+ , EXTRACT(dayofweekiso FROM visits_source_src_28000.ds) AS visit__ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS visit__ds__extract_doy
+ , visits_source_src_28000.referrer_id AS visit__referrer_id
+ , visits_source_src_28000.user_id AS user
+ , visits_source_src_28000.session_id AS session
+ , visits_source_src_28000.user_id AS visit__user
+ , visits_source_src_28000.session_id AS visit__session
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_13
+ ) subq_14
+ ) subq_15
INNER JOIN (
-- Add column with generated UUID
SELECT
- subq_8.ds__day
- , subq_8.ds__week
- , subq_8.ds__month
- , subq_8.ds__quarter
- , subq_8.ds__year
- , subq_8.ds__extract_year
- , subq_8.ds__extract_quarter
- , subq_8.ds__extract_month
- , subq_8.ds__extract_day
- , subq_8.ds__extract_dow
- , subq_8.ds__extract_doy
- , subq_8.buy__ds__day
- , subq_8.buy__ds__week
- , subq_8.buy__ds__month
- , subq_8.buy__ds__quarter
- , subq_8.buy__ds__year
- , subq_8.buy__ds__extract_year
- , subq_8.buy__ds__extract_quarter
- , subq_8.buy__ds__extract_month
- , subq_8.buy__ds__extract_day
- , subq_8.buy__ds__extract_dow
- , subq_8.buy__ds__extract_doy
- , subq_8.metric_time__day
- , subq_8.metric_time__week
- , subq_8.metric_time__month
- , subq_8.metric_time__quarter
- , subq_8.metric_time__year
- , subq_8.metric_time__extract_year
- , subq_8.metric_time__extract_quarter
- , subq_8.metric_time__extract_month
- , subq_8.metric_time__extract_day
- , subq_8.metric_time__extract_dow
- , subq_8.metric_time__extract_doy
- , subq_8.user
- , subq_8.session_id
- , subq_8.buy__user
- , subq_8.buy__session_id
- , subq_8.buys
- , subq_8.buyers
+ subq_17.ds__day
+ , subq_17.ds__week
+ , subq_17.ds__month
+ , subq_17.ds__quarter
+ , subq_17.ds__year
+ , subq_17.ds__extract_year
+ , subq_17.ds__extract_quarter
+ , subq_17.ds__extract_month
+ , subq_17.ds__extract_day
+ , subq_17.ds__extract_dow
+ , subq_17.ds__extract_doy
+ , subq_17.buy__ds__day
+ , subq_17.buy__ds__week
+ , subq_17.buy__ds__month
+ , subq_17.buy__ds__quarter
+ , subq_17.buy__ds__year
+ , subq_17.buy__ds__extract_year
+ , subq_17.buy__ds__extract_quarter
+ , subq_17.buy__ds__extract_month
+ , subq_17.buy__ds__extract_day
+ , subq_17.buy__ds__extract_dow
+ , subq_17.buy__ds__extract_doy
+ , subq_17.metric_time__day
+ , subq_17.metric_time__week
+ , subq_17.metric_time__month
+ , subq_17.metric_time__quarter
+ , subq_17.metric_time__year
+ , subq_17.metric_time__extract_year
+ , subq_17.metric_time__extract_quarter
+ , subq_17.metric_time__extract_month
+ , subq_17.metric_time__extract_day
+ , subq_17.metric_time__extract_dow
+ , subq_17.metric_time__extract_doy
+ , subq_17.user
+ , subq_17.session_id
+ , subq_17.buy__user
+ , subq_17.buy__session_id
+ , subq_17.buys
+ , subq_17.buyers
, UUID_STRING() AS mf_internal_uuid
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_7.ds__day
- , subq_7.ds__week
- , subq_7.ds__month
- , subq_7.ds__quarter
- , subq_7.ds__year
- , subq_7.ds__extract_year
- , subq_7.ds__extract_quarter
- , subq_7.ds__extract_month
- , subq_7.ds__extract_day
- , subq_7.ds__extract_dow
- , subq_7.ds__extract_doy
- , subq_7.buy__ds__day
- , subq_7.buy__ds__week
- , subq_7.buy__ds__month
- , subq_7.buy__ds__quarter
- , subq_7.buy__ds__year
- , subq_7.buy__ds__extract_year
- , subq_7.buy__ds__extract_quarter
- , subq_7.buy__ds__extract_month
- , subq_7.buy__ds__extract_day
- , subq_7.buy__ds__extract_dow
- , subq_7.buy__ds__extract_doy
- , subq_7.ds__day AS metric_time__day
- , subq_7.ds__week AS metric_time__week
- , subq_7.ds__month AS metric_time__month
- , subq_7.ds__quarter AS metric_time__quarter
- , subq_7.ds__year AS metric_time__year
- , subq_7.ds__extract_year AS metric_time__extract_year
- , subq_7.ds__extract_quarter AS metric_time__extract_quarter
- , subq_7.ds__extract_month AS metric_time__extract_month
- , subq_7.ds__extract_day AS metric_time__extract_day
- , subq_7.ds__extract_dow AS metric_time__extract_dow
- , subq_7.ds__extract_doy AS metric_time__extract_doy
- , subq_7.user
- , subq_7.session_id
- , subq_7.buy__user
- , subq_7.buy__session_id
- , subq_7.buys
- , subq_7.buyers
+ subq_16.ds__day
+ , subq_16.ds__week
+ , subq_16.ds__month
+ , subq_16.ds__quarter
+ , subq_16.ds__year
+ , subq_16.ds__extract_year
+ , subq_16.ds__extract_quarter
+ , subq_16.ds__extract_month
+ , subq_16.ds__extract_day
+ , subq_16.ds__extract_dow
+ , subq_16.ds__extract_doy
+ , subq_16.buy__ds__day
+ , subq_16.buy__ds__week
+ , subq_16.buy__ds__month
+ , subq_16.buy__ds__quarter
+ , subq_16.buy__ds__year
+ , subq_16.buy__ds__extract_year
+ , subq_16.buy__ds__extract_quarter
+ , subq_16.buy__ds__extract_month
+ , subq_16.buy__ds__extract_day
+ , subq_16.buy__ds__extract_dow
+ , subq_16.buy__ds__extract_doy
+ , subq_16.ds__day AS metric_time__day
+ , subq_16.ds__week AS metric_time__week
+ , subq_16.ds__month AS metric_time__month
+ , subq_16.ds__quarter AS metric_time__quarter
+ , subq_16.ds__year AS metric_time__year
+ , subq_16.ds__extract_year AS metric_time__extract_year
+ , subq_16.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_16.ds__extract_month AS metric_time__extract_month
+ , subq_16.ds__extract_day AS metric_time__extract_day
+ , subq_16.ds__extract_dow AS metric_time__extract_dow
+ , subq_16.ds__extract_doy AS metric_time__extract_doy
+ , subq_16.user
+ , subq_16.session_id
+ , subq_16.buy__user
+ , subq_16.buy__session_id
+ , subq_16.buys
+ , subq_16.buyers
FROM (
-- Read Elements From Semantic Model 'buys_source'
SELECT
1 AS buys
- , buys_source_src_28002.user_id AS buyers
- , DATE_TRUNC('day', buys_source_src_28002.ds) AS ds__day
- , DATE_TRUNC('week', buys_source_src_28002.ds) AS ds__week
- , DATE_TRUNC('month', buys_source_src_28002.ds) AS ds__month
- , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS ds__quarter
- , DATE_TRUNC('year', buys_source_src_28002.ds) AS ds__year
- , EXTRACT(year FROM buys_source_src_28002.ds) AS ds__extract_year
- , EXTRACT(quarter FROM buys_source_src_28002.ds) AS ds__extract_quarter
- , EXTRACT(month FROM buys_source_src_28002.ds) AS ds__extract_month
- , EXTRACT(day FROM buys_source_src_28002.ds) AS ds__extract_day
- , EXTRACT(dayofweekiso FROM buys_source_src_28002.ds) AS ds__extract_dow
- , EXTRACT(doy FROM buys_source_src_28002.ds) AS ds__extract_doy
- , DATE_TRUNC('day', buys_source_src_28002.ds) AS buy__ds__day
- , DATE_TRUNC('week', buys_source_src_28002.ds) AS buy__ds__week
- , DATE_TRUNC('month', buys_source_src_28002.ds) AS buy__ds__month
- , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS buy__ds__quarter
- , DATE_TRUNC('year', buys_source_src_28002.ds) AS buy__ds__year
- , EXTRACT(year FROM buys_source_src_28002.ds) AS buy__ds__extract_year
- , EXTRACT(quarter FROM buys_source_src_28002.ds) AS buy__ds__extract_quarter
- , EXTRACT(month FROM buys_source_src_28002.ds) AS buy__ds__extract_month
- , EXTRACT(day FROM buys_source_src_28002.ds) AS buy__ds__extract_day
- , EXTRACT(dayofweekiso FROM buys_source_src_28002.ds) AS buy__ds__extract_dow
- , EXTRACT(doy FROM buys_source_src_28002.ds) AS buy__ds__extract_doy
- , buys_source_src_28002.user_id AS user
- , buys_source_src_28002.session_id
- , buys_source_src_28002.user_id AS buy__user
- , buys_source_src_28002.session_id AS buy__session_id
- FROM ***************************.fct_buys buys_source_src_28002
- ) subq_7
- ) subq_8
- ) subq_9
+ , buys_source_src_28000.user_id AS buyers
+ , DATE_TRUNC('day', buys_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', buys_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', buys_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', buys_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', buys_source_src_28000.ds) 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
+ , EXTRACT(dayofweekiso FROM buys_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM buys_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', buys_source_src_28000.ds) AS buy__ds__day
+ , DATE_TRUNC('week', buys_source_src_28000.ds) AS buy__ds__week
+ , DATE_TRUNC('month', buys_source_src_28000.ds) AS buy__ds__month
+ , DATE_TRUNC('quarter', buys_source_src_28000.ds) AS buy__ds__quarter
+ , DATE_TRUNC('year', buys_source_src_28000.ds) 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
+ , EXTRACT(day FROM buys_source_src_28000.ds) AS buy__ds__extract_day
+ , EXTRACT(dayofweekiso FROM buys_source_src_28000.ds) AS buy__ds__extract_dow
+ , EXTRACT(doy FROM buys_source_src_28000.ds) AS buy__ds__extract_doy
+ , buys_source_src_28000.user_id AS user
+ , buys_source_src_28000.session_id
+ , buys_source_src_28000.user_id AS buy__user
+ , buys_source_src_28000.session_id AS buy__session_id
+ FROM ***************************.fct_buys buys_source_src_28000
+ ) subq_16
+ ) subq_17
+ ) subq_18
ON
- (subq_6.user = subq_9.user) AND ((subq_6.ds__day <= subq_9.ds__day))
- ) subq_10
- ) subq_11
- ) subq_12
+ (
+ subq_15.user = subq_18.user
+ ) AND (
+ (subq_15.ds__day <= subq_18.ds__day)
+ )
+ ) subq_19
+ ) subq_20
+ ) subq_21
GROUP BY
- subq_12.visit__referrer_id
- ) subq_13
+ subq_21.visit__referrer_id
+ ) subq_22
ON
- subq_3.visit__referrer_id = subq_13.visit__referrer_id
+ subq_12.visit__referrer_id = subq_22.visit__referrer_id
GROUP BY
- COALESCE(subq_3.visit__referrer_id, subq_13.visit__referrer_id)
-) subq_14
+ COALESCE(subq_12.visit__referrer_id, subq_22.visit__referrer_id)
+) subq_23
diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Snowflake/test_conversion_rate__plan0_optimized.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Snowflake/test_conversion_rate__plan0_optimized.sql
index 2504974b1b..07a93f8911 100644
--- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Snowflake/test_conversion_rate__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Snowflake/test_conversion_rate__plan0_optimized.sql
@@ -5,9 +5,9 @@ SELECT
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_18.visit__referrer_id, subq_28.visit__referrer_id) AS visit__referrer_id
- , MAX(subq_18.visits) AS visits
- , MAX(subq_28.buys) AS buys
+ COALESCE(subq_27.visit__referrer_id, subq_37.visit__referrer_id) AS visit__referrer_id
+ , MAX(subq_27.visits) AS visits
+ , MAX(subq_37.buys) AS buys
FROM (
-- Aggregate Measures
SELECT
@@ -20,11 +20,11 @@ FROM (
SELECT
referrer_id AS visit__referrer_id
, 1 AS visits
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_17
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_26
GROUP BY
visit__referrer_id
- ) subq_18
+ ) subq_27
FULL OUTER JOIN (
-- Find conversions for user within the range of INF
-- Pass Only Elements: ['buys', 'visit__referrer_id']
@@ -35,12 +35,12 @@ FROM (
FROM (
-- Dedupe the fanout with mf_internal_uuid in the conversion data set
SELECT DISTINCT
- first_value(subq_21.visits) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
- , first_value(subq_21.visit__referrer_id) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visit__referrer_id
- , first_value(subq_21.ds__day) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
- , first_value(subq_21.user) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
- , subq_24.mf_internal_uuid AS mf_internal_uuid
- , subq_24.buys AS buys
+ first_value(subq_30.visits) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
+ , first_value(subq_30.visit__referrer_id) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visit__referrer_id
+ , first_value(subq_30.ds__day) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
+ , first_value(subq_30.user) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
+ , subq_33.mf_internal_uuid AS mf_internal_uuid
+ , subq_33.buys AS buys
FROM (
-- Read Elements From Semantic Model 'visits_source'
-- Metric Time Dimension 'ds'
@@ -50,8 +50,8 @@ FROM (
, user_id AS user
, referrer_id AS visit__referrer_id
, 1 AS visits
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_21
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_30
INNER JOIN (
-- Read Elements From Semantic Model 'buys_source'
-- Metric Time Dimension 'ds'
@@ -61,20 +61,20 @@ FROM (
, user_id AS user
, 1 AS buys
, UUID_STRING() AS mf_internal_uuid
- FROM ***************************.fct_buys buys_source_src_28002
- ) subq_24
+ FROM ***************************.fct_buys buys_source_src_28000
+ ) subq_33
ON
(
- subq_21.user = subq_24.user
+ subq_30.user = subq_33.user
) AND (
- (subq_21.ds__day <= subq_24.ds__day)
+ (subq_30.ds__day <= subq_33.ds__day)
)
- ) subq_25
+ ) subq_34
GROUP BY
visit__referrer_id
- ) subq_28
+ ) subq_37
ON
- subq_18.visit__referrer_id = subq_28.visit__referrer_id
+ subq_27.visit__referrer_id = subq_37.visit__referrer_id
GROUP BY
- COALESCE(subq_18.visit__referrer_id, subq_28.visit__referrer_id)
-) subq_29
+ COALESCE(subq_27.visit__referrer_id, subq_37.visit__referrer_id)
+) subq_38
diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Snowflake/test_conversion_rate_with_constant_properties__plan0.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Snowflake/test_conversion_rate_with_constant_properties__plan0.sql
index 771fa3ef07..769cb97ec8 100644
--- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Snowflake/test_conversion_rate_with_constant_properties__plan0.sql
+++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Snowflake/test_conversion_rate_with_constant_properties__plan0.sql
@@ -1,381 +1,381 @@
-- Compute Metrics via Expressions
SELECT
- subq_14.metric_time__day
- , subq_14.visit__referrer_id
- , CAST(subq_14.buys AS DOUBLE) / CAST(NULLIF(subq_14.visits, 0) AS DOUBLE) AS visit_buy_conversion_rate_by_session
+ subq_23.metric_time__day
+ , subq_23.visit__referrer_id
+ , CAST(subq_23.buys AS DOUBLE) / CAST(NULLIF(subq_23.visits, 0) AS DOUBLE) AS visit_buy_conversion_rate_by_session
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_3.metric_time__day, subq_13.metric_time__day) AS metric_time__day
- , COALESCE(subq_3.visit__referrer_id, subq_13.visit__referrer_id) AS visit__referrer_id
- , MAX(subq_3.visits) AS visits
- , MAX(subq_13.buys) AS buys
+ COALESCE(subq_12.metric_time__day, subq_22.metric_time__day) AS metric_time__day
+ , COALESCE(subq_12.visit__referrer_id, subq_22.visit__referrer_id) AS visit__referrer_id
+ , MAX(subq_12.visits) AS visits
+ , MAX(subq_22.buys) AS buys
FROM (
-- Aggregate Measures
SELECT
- subq_2.metric_time__day
- , subq_2.visit__referrer_id
- , SUM(subq_2.visits) AS visits
+ subq_11.metric_time__day
+ , subq_11.visit__referrer_id
+ , SUM(subq_11.visits) AS visits
FROM (
-- Pass Only Elements: ['visits', 'visit__referrer_id', 'metric_time__day']
SELECT
- subq_1.metric_time__day
- , subq_1.visit__referrer_id
- , subq_1.visits
+ subq_10.metric_time__day
+ , subq_10.visit__referrer_id
+ , subq_10.visits
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.visit__ds__day
- , subq_0.visit__ds__week
- , subq_0.visit__ds__month
- , subq_0.visit__ds__quarter
- , subq_0.visit__ds__year
- , subq_0.visit__ds__extract_year
- , subq_0.visit__ds__extract_quarter
- , subq_0.visit__ds__extract_month
- , subq_0.visit__ds__extract_day
- , subq_0.visit__ds__extract_dow
- , subq_0.visit__ds__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.user
- , subq_0.session
- , subq_0.visit__user
- , subq_0.visit__session
- , subq_0.referrer_id
- , subq_0.visit__referrer_id
- , subq_0.visits
- , subq_0.visitors
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.visit__ds__day
+ , subq_9.visit__ds__week
+ , subq_9.visit__ds__month
+ , subq_9.visit__ds__quarter
+ , subq_9.visit__ds__year
+ , subq_9.visit__ds__extract_year
+ , subq_9.visit__ds__extract_quarter
+ , subq_9.visit__ds__extract_month
+ , subq_9.visit__ds__extract_day
+ , subq_9.visit__ds__extract_dow
+ , subq_9.visit__ds__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.user
+ , subq_9.session
+ , subq_9.visit__user
+ , subq_9.visit__session
+ , subq_9.referrer_id
+ , subq_9.visit__referrer_id
+ , subq_9.visits
+ , subq_9.visitors
FROM (
-- Read Elements From Semantic Model 'visits_source'
SELECT
1 AS visits
- , visits_source_src_28011.user_id AS visitors
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day
- , EXTRACT(dayofweekiso FROM visits_source_src_28011.ds) AS ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy
- , visits_source_src_28011.referrer_id
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day
- , EXTRACT(dayofweekiso FROM visits_source_src_28011.ds) AS visit__ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy
- , visits_source_src_28011.referrer_id AS visit__referrer_id
- , visits_source_src_28011.user_id AS user
- , visits_source_src_28011.session_id AS session
- , visits_source_src_28011.user_id AS visit__user
- , visits_source_src_28011.session_id AS visit__session
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_0
- ) subq_1
- ) subq_2
+ , visits_source_src_28000.user_id AS visitors
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS ds__extract_day
+ , EXTRACT(dayofweekiso FROM visits_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS ds__extract_doy
+ , visits_source_src_28000.referrer_id
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS visit__ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS visit__ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS visit__ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS visit__ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS visit__ds__extract_day
+ , EXTRACT(dayofweekiso FROM visits_source_src_28000.ds) AS visit__ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS visit__ds__extract_doy
+ , visits_source_src_28000.referrer_id AS visit__referrer_id
+ , visits_source_src_28000.user_id AS user
+ , visits_source_src_28000.session_id AS session
+ , visits_source_src_28000.user_id AS visit__user
+ , visits_source_src_28000.session_id AS visit__session
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
GROUP BY
- subq_2.metric_time__day
- , subq_2.visit__referrer_id
- ) subq_3
+ subq_11.metric_time__day
+ , subq_11.visit__referrer_id
+ ) subq_12
FULL OUTER JOIN (
-- Aggregate Measures
SELECT
- subq_12.metric_time__day
- , subq_12.visit__referrer_id
- , SUM(subq_12.buys) AS buys
+ subq_21.metric_time__day
+ , subq_21.visit__referrer_id
+ , SUM(subq_21.buys) AS buys
FROM (
-- Pass Only Elements: ['buys', 'visit__referrer_id', 'metric_time__day']
SELECT
- subq_11.metric_time__day
- , subq_11.visit__referrer_id
- , subq_11.buys
+ subq_20.metric_time__day
+ , subq_20.visit__referrer_id
+ , subq_20.buys
FROM (
-- Find conversions for user within the range of 7 day
SELECT
- subq_10.ds__day
- , subq_10.metric_time__day
- , subq_10.user
- , subq_10.session
- , subq_10.visit__referrer_id
- , subq_10.buys
- , subq_10.visits
+ subq_19.ds__day
+ , subq_19.metric_time__day
+ , subq_19.user
+ , subq_19.session
+ , subq_19.visit__referrer_id
+ , subq_19.buys
+ , subq_19.visits
FROM (
-- Dedupe the fanout with mf_internal_uuid in the conversion data set
SELECT DISTINCT
- first_value(subq_6.visits) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid, subq_9.session_id ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
- , first_value(subq_6.visit__referrer_id) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid, subq_9.session_id ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visit__referrer_id
- , first_value(subq_6.ds__day) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid, subq_9.session_id ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
- , first_value(subq_6.metric_time__day) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid, subq_9.session_id ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS metric_time__day
- , first_value(subq_6.user) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid, subq_9.session_id ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
- , first_value(subq_6.session) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid, subq_9.session_id ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS session
- , subq_9.mf_internal_uuid AS mf_internal_uuid
- , subq_9.buys AS buys
+ first_value(subq_15.visits) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid, subq_18.session_id ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
+ , first_value(subq_15.visit__referrer_id) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid, subq_18.session_id ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visit__referrer_id
+ , first_value(subq_15.ds__day) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid, subq_18.session_id ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
+ , first_value(subq_15.metric_time__day) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid, subq_18.session_id ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS metric_time__day
+ , first_value(subq_15.user) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid, subq_18.session_id ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
+ , first_value(subq_15.session) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid, subq_18.session_id ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS session
+ , subq_18.mf_internal_uuid AS mf_internal_uuid
+ , subq_18.buys AS buys
FROM (
-- Pass Only Elements: ['visits', 'visit__referrer_id', 'ds__day', 'metric_time__day', 'user', 'session']
SELECT
- subq_5.ds__day
- , subq_5.metric_time__day
- , subq_5.user
- , subq_5.session
- , subq_5.visit__referrer_id
- , subq_5.visits
+ subq_14.ds__day
+ , subq_14.metric_time__day
+ , subq_14.user
+ , subq_14.session
+ , subq_14.visit__referrer_id
+ , subq_14.visits
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_4.ds__day
- , subq_4.ds__week
- , subq_4.ds__month
- , subq_4.ds__quarter
- , subq_4.ds__year
- , subq_4.ds__extract_year
- , subq_4.ds__extract_quarter
- , subq_4.ds__extract_month
- , subq_4.ds__extract_day
- , subq_4.ds__extract_dow
- , subq_4.ds__extract_doy
- , subq_4.visit__ds__day
- , subq_4.visit__ds__week
- , subq_4.visit__ds__month
- , subq_4.visit__ds__quarter
- , subq_4.visit__ds__year
- , subq_4.visit__ds__extract_year
- , subq_4.visit__ds__extract_quarter
- , subq_4.visit__ds__extract_month
- , subq_4.visit__ds__extract_day
- , subq_4.visit__ds__extract_dow
- , subq_4.visit__ds__extract_doy
- , subq_4.ds__day AS metric_time__day
- , subq_4.ds__week AS metric_time__week
- , subq_4.ds__month AS metric_time__month
- , subq_4.ds__quarter AS metric_time__quarter
- , subq_4.ds__year AS metric_time__year
- , subq_4.ds__extract_year AS metric_time__extract_year
- , subq_4.ds__extract_quarter AS metric_time__extract_quarter
- , subq_4.ds__extract_month AS metric_time__extract_month
- , subq_4.ds__extract_day AS metric_time__extract_day
- , subq_4.ds__extract_dow AS metric_time__extract_dow
- , subq_4.ds__extract_doy AS metric_time__extract_doy
- , subq_4.user
- , subq_4.session
- , subq_4.visit__user
- , subq_4.visit__session
- , subq_4.referrer_id
- , subq_4.visit__referrer_id
- , subq_4.visits
- , subq_4.visitors
+ subq_13.ds__day
+ , subq_13.ds__week
+ , subq_13.ds__month
+ , subq_13.ds__quarter
+ , subq_13.ds__year
+ , subq_13.ds__extract_year
+ , subq_13.ds__extract_quarter
+ , subq_13.ds__extract_month
+ , subq_13.ds__extract_day
+ , subq_13.ds__extract_dow
+ , subq_13.ds__extract_doy
+ , subq_13.visit__ds__day
+ , subq_13.visit__ds__week
+ , subq_13.visit__ds__month
+ , subq_13.visit__ds__quarter
+ , subq_13.visit__ds__year
+ , subq_13.visit__ds__extract_year
+ , subq_13.visit__ds__extract_quarter
+ , subq_13.visit__ds__extract_month
+ , subq_13.visit__ds__extract_day
+ , subq_13.visit__ds__extract_dow
+ , subq_13.visit__ds__extract_doy
+ , subq_13.ds__day AS metric_time__day
+ , subq_13.ds__week AS metric_time__week
+ , subq_13.ds__month AS metric_time__month
+ , subq_13.ds__quarter AS metric_time__quarter
+ , subq_13.ds__year AS metric_time__year
+ , subq_13.ds__extract_year AS metric_time__extract_year
+ , subq_13.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_13.ds__extract_month AS metric_time__extract_month
+ , subq_13.ds__extract_day AS metric_time__extract_day
+ , subq_13.ds__extract_dow AS metric_time__extract_dow
+ , subq_13.ds__extract_doy AS metric_time__extract_doy
+ , subq_13.user
+ , subq_13.session
+ , subq_13.visit__user
+ , subq_13.visit__session
+ , subq_13.referrer_id
+ , subq_13.visit__referrer_id
+ , subq_13.visits
+ , subq_13.visitors
FROM (
-- Read Elements From Semantic Model 'visits_source'
SELECT
1 AS visits
- , visits_source_src_28011.user_id AS visitors
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day
- , EXTRACT(dayofweekiso FROM visits_source_src_28011.ds) AS ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy
- , visits_source_src_28011.referrer_id
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day
- , EXTRACT(dayofweekiso FROM visits_source_src_28011.ds) AS visit__ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy
- , visits_source_src_28011.referrer_id AS visit__referrer_id
- , visits_source_src_28011.user_id AS user
- , visits_source_src_28011.session_id AS session
- , visits_source_src_28011.user_id AS visit__user
- , visits_source_src_28011.session_id AS visit__session
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_4
- ) subq_5
- ) subq_6
+ , visits_source_src_28000.user_id AS visitors
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS ds__extract_day
+ , EXTRACT(dayofweekiso FROM visits_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS ds__extract_doy
+ , visits_source_src_28000.referrer_id
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS visit__ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS visit__ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS visit__ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS visit__ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS visit__ds__extract_day
+ , EXTRACT(dayofweekiso FROM visits_source_src_28000.ds) AS visit__ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS visit__ds__extract_doy
+ , visits_source_src_28000.referrer_id AS visit__referrer_id
+ , visits_source_src_28000.user_id AS user
+ , visits_source_src_28000.session_id AS session
+ , visits_source_src_28000.user_id AS visit__user
+ , visits_source_src_28000.session_id AS visit__session
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_13
+ ) subq_14
+ ) subq_15
INNER JOIN (
-- Add column with generated UUID
SELECT
- subq_8.ds__day
- , subq_8.ds__week
- , subq_8.ds__month
- , subq_8.ds__quarter
- , subq_8.ds__year
- , subq_8.ds__extract_year
- , subq_8.ds__extract_quarter
- , subq_8.ds__extract_month
- , subq_8.ds__extract_day
- , subq_8.ds__extract_dow
- , subq_8.ds__extract_doy
- , subq_8.buy__ds__day
- , subq_8.buy__ds__week
- , subq_8.buy__ds__month
- , subq_8.buy__ds__quarter
- , subq_8.buy__ds__year
- , subq_8.buy__ds__extract_year
- , subq_8.buy__ds__extract_quarter
- , subq_8.buy__ds__extract_month
- , subq_8.buy__ds__extract_day
- , subq_8.buy__ds__extract_dow
- , subq_8.buy__ds__extract_doy
- , subq_8.metric_time__day
- , subq_8.metric_time__week
- , subq_8.metric_time__month
- , subq_8.metric_time__quarter
- , subq_8.metric_time__year
- , subq_8.metric_time__extract_year
- , subq_8.metric_time__extract_quarter
- , subq_8.metric_time__extract_month
- , subq_8.metric_time__extract_day
- , subq_8.metric_time__extract_dow
- , subq_8.metric_time__extract_doy
- , subq_8.user
- , subq_8.session_id
- , subq_8.buy__user
- , subq_8.buy__session_id
- , subq_8.buys
- , subq_8.buyers
+ subq_17.ds__day
+ , subq_17.ds__week
+ , subq_17.ds__month
+ , subq_17.ds__quarter
+ , subq_17.ds__year
+ , subq_17.ds__extract_year
+ , subq_17.ds__extract_quarter
+ , subq_17.ds__extract_month
+ , subq_17.ds__extract_day
+ , subq_17.ds__extract_dow
+ , subq_17.ds__extract_doy
+ , subq_17.buy__ds__day
+ , subq_17.buy__ds__week
+ , subq_17.buy__ds__month
+ , subq_17.buy__ds__quarter
+ , subq_17.buy__ds__year
+ , subq_17.buy__ds__extract_year
+ , subq_17.buy__ds__extract_quarter
+ , subq_17.buy__ds__extract_month
+ , subq_17.buy__ds__extract_day
+ , subq_17.buy__ds__extract_dow
+ , subq_17.buy__ds__extract_doy
+ , subq_17.metric_time__day
+ , subq_17.metric_time__week
+ , subq_17.metric_time__month
+ , subq_17.metric_time__quarter
+ , subq_17.metric_time__year
+ , subq_17.metric_time__extract_year
+ , subq_17.metric_time__extract_quarter
+ , subq_17.metric_time__extract_month
+ , subq_17.metric_time__extract_day
+ , subq_17.metric_time__extract_dow
+ , subq_17.metric_time__extract_doy
+ , subq_17.user
+ , subq_17.session_id
+ , subq_17.buy__user
+ , subq_17.buy__session_id
+ , subq_17.buys
+ , subq_17.buyers
, UUID_STRING() AS mf_internal_uuid
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_7.ds__day
- , subq_7.ds__week
- , subq_7.ds__month
- , subq_7.ds__quarter
- , subq_7.ds__year
- , subq_7.ds__extract_year
- , subq_7.ds__extract_quarter
- , subq_7.ds__extract_month
- , subq_7.ds__extract_day
- , subq_7.ds__extract_dow
- , subq_7.ds__extract_doy
- , subq_7.buy__ds__day
- , subq_7.buy__ds__week
- , subq_7.buy__ds__month
- , subq_7.buy__ds__quarter
- , subq_7.buy__ds__year
- , subq_7.buy__ds__extract_year
- , subq_7.buy__ds__extract_quarter
- , subq_7.buy__ds__extract_month
- , subq_7.buy__ds__extract_day
- , subq_7.buy__ds__extract_dow
- , subq_7.buy__ds__extract_doy
- , subq_7.ds__day AS metric_time__day
- , subq_7.ds__week AS metric_time__week
- , subq_7.ds__month AS metric_time__month
- , subq_7.ds__quarter AS metric_time__quarter
- , subq_7.ds__year AS metric_time__year
- , subq_7.ds__extract_year AS metric_time__extract_year
- , subq_7.ds__extract_quarter AS metric_time__extract_quarter
- , subq_7.ds__extract_month AS metric_time__extract_month
- , subq_7.ds__extract_day AS metric_time__extract_day
- , subq_7.ds__extract_dow AS metric_time__extract_dow
- , subq_7.ds__extract_doy AS metric_time__extract_doy
- , subq_7.user
- , subq_7.session_id
- , subq_7.buy__user
- , subq_7.buy__session_id
- , subq_7.buys
- , subq_7.buyers
+ subq_16.ds__day
+ , subq_16.ds__week
+ , subq_16.ds__month
+ , subq_16.ds__quarter
+ , subq_16.ds__year
+ , subq_16.ds__extract_year
+ , subq_16.ds__extract_quarter
+ , subq_16.ds__extract_month
+ , subq_16.ds__extract_day
+ , subq_16.ds__extract_dow
+ , subq_16.ds__extract_doy
+ , subq_16.buy__ds__day
+ , subq_16.buy__ds__week
+ , subq_16.buy__ds__month
+ , subq_16.buy__ds__quarter
+ , subq_16.buy__ds__year
+ , subq_16.buy__ds__extract_year
+ , subq_16.buy__ds__extract_quarter
+ , subq_16.buy__ds__extract_month
+ , subq_16.buy__ds__extract_day
+ , subq_16.buy__ds__extract_dow
+ , subq_16.buy__ds__extract_doy
+ , subq_16.ds__day AS metric_time__day
+ , subq_16.ds__week AS metric_time__week
+ , subq_16.ds__month AS metric_time__month
+ , subq_16.ds__quarter AS metric_time__quarter
+ , subq_16.ds__year AS metric_time__year
+ , subq_16.ds__extract_year AS metric_time__extract_year
+ , subq_16.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_16.ds__extract_month AS metric_time__extract_month
+ , subq_16.ds__extract_day AS metric_time__extract_day
+ , subq_16.ds__extract_dow AS metric_time__extract_dow
+ , subq_16.ds__extract_doy AS metric_time__extract_doy
+ , subq_16.user
+ , subq_16.session_id
+ , subq_16.buy__user
+ , subq_16.buy__session_id
+ , subq_16.buys
+ , subq_16.buyers
FROM (
-- Read Elements From Semantic Model 'buys_source'
SELECT
1 AS buys
- , buys_source_src_28002.user_id AS buyers
- , DATE_TRUNC('day', buys_source_src_28002.ds) AS ds__day
- , DATE_TRUNC('week', buys_source_src_28002.ds) AS ds__week
- , DATE_TRUNC('month', buys_source_src_28002.ds) AS ds__month
- , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS ds__quarter
- , DATE_TRUNC('year', buys_source_src_28002.ds) AS ds__year
- , EXTRACT(year FROM buys_source_src_28002.ds) AS ds__extract_year
- , EXTRACT(quarter FROM buys_source_src_28002.ds) AS ds__extract_quarter
- , EXTRACT(month FROM buys_source_src_28002.ds) AS ds__extract_month
- , EXTRACT(day FROM buys_source_src_28002.ds) AS ds__extract_day
- , EXTRACT(dayofweekiso FROM buys_source_src_28002.ds) AS ds__extract_dow
- , EXTRACT(doy FROM buys_source_src_28002.ds) AS ds__extract_doy
- , DATE_TRUNC('day', buys_source_src_28002.ds) AS buy__ds__day
- , DATE_TRUNC('week', buys_source_src_28002.ds) AS buy__ds__week
- , DATE_TRUNC('month', buys_source_src_28002.ds) AS buy__ds__month
- , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS buy__ds__quarter
- , DATE_TRUNC('year', buys_source_src_28002.ds) AS buy__ds__year
- , EXTRACT(year FROM buys_source_src_28002.ds) AS buy__ds__extract_year
- , EXTRACT(quarter FROM buys_source_src_28002.ds) AS buy__ds__extract_quarter
- , EXTRACT(month FROM buys_source_src_28002.ds) AS buy__ds__extract_month
- , EXTRACT(day FROM buys_source_src_28002.ds) AS buy__ds__extract_day
- , EXTRACT(dayofweekiso FROM buys_source_src_28002.ds) AS buy__ds__extract_dow
- , EXTRACT(doy FROM buys_source_src_28002.ds) AS buy__ds__extract_doy
- , buys_source_src_28002.user_id AS user
- , buys_source_src_28002.session_id
- , buys_source_src_28002.user_id AS buy__user
- , buys_source_src_28002.session_id AS buy__session_id
- FROM ***************************.fct_buys buys_source_src_28002
- ) subq_7
- ) subq_8
- ) subq_9
+ , buys_source_src_28000.user_id AS buyers
+ , DATE_TRUNC('day', buys_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', buys_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', buys_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', buys_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', buys_source_src_28000.ds) 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
+ , EXTRACT(dayofweekiso FROM buys_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM buys_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', buys_source_src_28000.ds) AS buy__ds__day
+ , DATE_TRUNC('week', buys_source_src_28000.ds) AS buy__ds__week
+ , DATE_TRUNC('month', buys_source_src_28000.ds) AS buy__ds__month
+ , DATE_TRUNC('quarter', buys_source_src_28000.ds) AS buy__ds__quarter
+ , DATE_TRUNC('year', buys_source_src_28000.ds) 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
+ , EXTRACT(day FROM buys_source_src_28000.ds) AS buy__ds__extract_day
+ , EXTRACT(dayofweekiso FROM buys_source_src_28000.ds) AS buy__ds__extract_dow
+ , EXTRACT(doy FROM buys_source_src_28000.ds) AS buy__ds__extract_doy
+ , buys_source_src_28000.user_id AS user
+ , buys_source_src_28000.session_id
+ , buys_source_src_28000.user_id AS buy__user
+ , buys_source_src_28000.session_id AS buy__session_id
+ FROM ***************************.fct_buys buys_source_src_28000
+ ) subq_16
+ ) subq_17
+ ) subq_18
ON
(
- subq_6.user = subq_9.user
+ subq_15.user = subq_18.user
) AND (
- subq_6.session = subq_9.session_id
+ subq_15.session = subq_18.session_id
) AND (
(
- subq_6.ds__day <= subq_9.ds__day
+ subq_15.ds__day <= subq_18.ds__day
) AND (
- subq_6.ds__day > DATEADD(day, -7, subq_9.ds__day)
+ subq_15.ds__day > DATEADD(day, -7, subq_18.ds__day)
)
)
- ) subq_10
- ) subq_11
- ) subq_12
+ ) subq_19
+ ) subq_20
+ ) subq_21
GROUP BY
- subq_12.metric_time__day
- , subq_12.visit__referrer_id
- ) subq_13
+ subq_21.metric_time__day
+ , subq_21.visit__referrer_id
+ ) subq_22
ON
(
- subq_3.visit__referrer_id = subq_13.visit__referrer_id
+ subq_12.visit__referrer_id = subq_22.visit__referrer_id
) AND (
- subq_3.metric_time__day = subq_13.metric_time__day
+ subq_12.metric_time__day = subq_22.metric_time__day
)
GROUP BY
- COALESCE(subq_3.metric_time__day, subq_13.metric_time__day)
- , COALESCE(subq_3.visit__referrer_id, subq_13.visit__referrer_id)
-) subq_14
+ COALESCE(subq_12.metric_time__day, subq_22.metric_time__day)
+ , COALESCE(subq_12.visit__referrer_id, subq_22.visit__referrer_id)
+) subq_23
diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Snowflake/test_conversion_rate_with_constant_properties__plan0_optimized.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Snowflake/test_conversion_rate_with_constant_properties__plan0_optimized.sql
index 2f27e70af7..0af52ccf3c 100644
--- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Snowflake/test_conversion_rate_with_constant_properties__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Snowflake/test_conversion_rate_with_constant_properties__plan0_optimized.sql
@@ -6,10 +6,10 @@ SELECT
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_18.metric_time__day, subq_28.metric_time__day) AS metric_time__day
- , COALESCE(subq_18.visit__referrer_id, subq_28.visit__referrer_id) AS visit__referrer_id
- , MAX(subq_18.visits) AS visits
- , MAX(subq_28.buys) AS buys
+ COALESCE(subq_27.metric_time__day, subq_37.metric_time__day) AS metric_time__day
+ , COALESCE(subq_27.visit__referrer_id, subq_37.visit__referrer_id) AS visit__referrer_id
+ , MAX(subq_27.visits) AS visits
+ , MAX(subq_37.buys) AS buys
FROM (
-- Aggregate Measures
SELECT
@@ -24,12 +24,12 @@ FROM (
DATE_TRUNC('day', ds) AS metric_time__day
, referrer_id AS visit__referrer_id
, 1 AS visits
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_17
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_26
GROUP BY
metric_time__day
, visit__referrer_id
- ) subq_18
+ ) subq_27
FULL OUTER JOIN (
-- Find conversions for user within the range of 7 day
-- Pass Only Elements: ['buys', 'visit__referrer_id', 'metric_time__day']
@@ -41,14 +41,14 @@ FROM (
FROM (
-- Dedupe the fanout with mf_internal_uuid in the conversion data set
SELECT DISTINCT
- first_value(subq_21.visits) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid, subq_24.session_id ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
- , first_value(subq_21.visit__referrer_id) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid, subq_24.session_id ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visit__referrer_id
- , first_value(subq_21.ds__day) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid, subq_24.session_id ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
- , first_value(subq_21.metric_time__day) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid, subq_24.session_id ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS metric_time__day
- , first_value(subq_21.user) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid, subq_24.session_id ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
- , first_value(subq_21.session) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid, subq_24.session_id ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS session
- , subq_24.mf_internal_uuid AS mf_internal_uuid
- , subq_24.buys AS buys
+ first_value(subq_30.visits) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid, subq_33.session_id ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
+ , first_value(subq_30.visit__referrer_id) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid, subq_33.session_id ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visit__referrer_id
+ , first_value(subq_30.ds__day) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid, subq_33.session_id ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
+ , first_value(subq_30.metric_time__day) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid, subq_33.session_id ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS metric_time__day
+ , first_value(subq_30.user) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid, subq_33.session_id ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
+ , first_value(subq_30.session) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid, subq_33.session_id ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS session
+ , subq_33.mf_internal_uuid AS mf_internal_uuid
+ , subq_33.buys AS buys
FROM (
-- Read Elements From Semantic Model 'visits_source'
-- Metric Time Dimension 'ds'
@@ -60,8 +60,8 @@ FROM (
, session_id AS session
, referrer_id AS visit__referrer_id
, 1 AS visits
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_21
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_30
INNER JOIN (
-- Read Elements From Semantic Model 'buys_source'
-- Metric Time Dimension 'ds'
@@ -72,32 +72,32 @@ FROM (
, session_id
, 1 AS buys
, UUID_STRING() AS mf_internal_uuid
- FROM ***************************.fct_buys buys_source_src_28002
- ) subq_24
+ FROM ***************************.fct_buys buys_source_src_28000
+ ) subq_33
ON
(
- subq_21.user = subq_24.user
+ subq_30.user = subq_33.user
) AND (
- subq_21.session = subq_24.session_id
+ subq_30.session = subq_33.session_id
) AND (
(
- subq_21.ds__day <= subq_24.ds__day
+ subq_30.ds__day <= subq_33.ds__day
) AND (
- subq_21.ds__day > DATEADD(day, -7, subq_24.ds__day)
+ subq_30.ds__day > DATEADD(day, -7, subq_33.ds__day)
)
)
- ) subq_25
+ ) subq_34
GROUP BY
metric_time__day
, visit__referrer_id
- ) subq_28
+ ) subq_37
ON
(
- subq_18.visit__referrer_id = subq_28.visit__referrer_id
+ subq_27.visit__referrer_id = subq_37.visit__referrer_id
) AND (
- subq_18.metric_time__day = subq_28.metric_time__day
+ subq_27.metric_time__day = subq_37.metric_time__day
)
GROUP BY
- COALESCE(subq_18.metric_time__day, subq_28.metric_time__day)
- , COALESCE(subq_18.visit__referrer_id, subq_28.visit__referrer_id)
-) subq_29
+ COALESCE(subq_27.metric_time__day, subq_37.metric_time__day)
+ , COALESCE(subq_27.visit__referrer_id, subq_37.visit__referrer_id)
+) subq_38
diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Snowflake/test_conversion_rate_with_no_group_by__plan0.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Snowflake/test_conversion_rate_with_no_group_by__plan0.sql
index 61f5e44e8d..437ddbddd7 100644
--- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Snowflake/test_conversion_rate_with_no_group_by__plan0.sql
+++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Snowflake/test_conversion_rate_with_no_group_by__plan0.sql
@@ -1,343 +1,343 @@
-- Compute Metrics via Expressions
SELECT
- CAST(subq_14.buys AS DOUBLE) / CAST(NULLIF(subq_14.visits, 0) AS DOUBLE) AS visit_buy_conversion_rate_7days
+ CAST(subq_23.buys AS DOUBLE) / CAST(NULLIF(subq_23.visits, 0) AS DOUBLE) AS visit_buy_conversion_rate_7days
FROM (
-- Combine Aggregated Outputs
SELECT
- MAX(subq_3.visits) AS visits
- , MAX(subq_13.buys) AS buys
+ MAX(subq_12.visits) AS visits
+ , MAX(subq_22.buys) AS buys
FROM (
-- Aggregate Measures
SELECT
- SUM(subq_2.visits) AS visits
+ SUM(subq_11.visits) AS visits
FROM (
-- Pass Only Elements: ['visits',]
SELECT
- subq_1.visits
+ subq_10.visits
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.visit__ds__day
- , subq_0.visit__ds__week
- , subq_0.visit__ds__month
- , subq_0.visit__ds__quarter
- , subq_0.visit__ds__year
- , subq_0.visit__ds__extract_year
- , subq_0.visit__ds__extract_quarter
- , subq_0.visit__ds__extract_month
- , subq_0.visit__ds__extract_day
- , subq_0.visit__ds__extract_dow
- , subq_0.visit__ds__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.user
- , subq_0.session
- , subq_0.visit__user
- , subq_0.visit__session
- , subq_0.referrer_id
- , subq_0.visit__referrer_id
- , subq_0.visits
- , subq_0.visitors
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.visit__ds__day
+ , subq_9.visit__ds__week
+ , subq_9.visit__ds__month
+ , subq_9.visit__ds__quarter
+ , subq_9.visit__ds__year
+ , subq_9.visit__ds__extract_year
+ , subq_9.visit__ds__extract_quarter
+ , subq_9.visit__ds__extract_month
+ , subq_9.visit__ds__extract_day
+ , subq_9.visit__ds__extract_dow
+ , subq_9.visit__ds__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.user
+ , subq_9.session
+ , subq_9.visit__user
+ , subq_9.visit__session
+ , subq_9.referrer_id
+ , subq_9.visit__referrer_id
+ , subq_9.visits
+ , subq_9.visitors
FROM (
-- Read Elements From Semantic Model 'visits_source'
SELECT
1 AS visits
- , visits_source_src_28011.user_id AS visitors
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day
- , EXTRACT(dayofweekiso FROM visits_source_src_28011.ds) AS ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy
- , visits_source_src_28011.referrer_id
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day
- , EXTRACT(dayofweekiso FROM visits_source_src_28011.ds) AS visit__ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy
- , visits_source_src_28011.referrer_id AS visit__referrer_id
- , visits_source_src_28011.user_id AS user
- , visits_source_src_28011.session_id AS session
- , visits_source_src_28011.user_id AS visit__user
- , visits_source_src_28011.session_id AS visit__session
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_0
- ) subq_1
- ) subq_2
- ) subq_3
+ , visits_source_src_28000.user_id AS visitors
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS ds__extract_day
+ , EXTRACT(dayofweekiso FROM visits_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS ds__extract_doy
+ , visits_source_src_28000.referrer_id
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS visit__ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS visit__ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS visit__ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS visit__ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS visit__ds__extract_day
+ , EXTRACT(dayofweekiso FROM visits_source_src_28000.ds) AS visit__ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS visit__ds__extract_doy
+ , visits_source_src_28000.referrer_id AS visit__referrer_id
+ , visits_source_src_28000.user_id AS user
+ , visits_source_src_28000.session_id AS session
+ , visits_source_src_28000.user_id AS visit__user
+ , visits_source_src_28000.session_id AS visit__session
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
+ ) subq_12
CROSS JOIN (
-- Aggregate Measures
SELECT
- SUM(subq_12.buys) AS buys
+ SUM(subq_21.buys) AS buys
FROM (
-- Pass Only Elements: ['buys',]
SELECT
- subq_11.buys
+ subq_20.buys
FROM (
-- Find conversions for user within the range of 7 day
SELECT
- subq_10.ds__day
- , subq_10.user
- , subq_10.buys
- , subq_10.visits
+ subq_19.ds__day
+ , subq_19.user
+ , subq_19.buys
+ , subq_19.visits
FROM (
-- Dedupe the fanout with mf_internal_uuid in the conversion data set
SELECT DISTINCT
- first_value(subq_6.visits) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
- , first_value(subq_6.ds__day) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
- , first_value(subq_6.user) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
- , subq_9.mf_internal_uuid AS mf_internal_uuid
- , subq_9.buys AS buys
+ first_value(subq_15.visits) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
+ , first_value(subq_15.ds__day) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
+ , first_value(subq_15.user) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
+ , subq_18.mf_internal_uuid AS mf_internal_uuid
+ , subq_18.buys AS buys
FROM (
-- Pass Only Elements: ['visits', 'ds__day', 'user']
SELECT
- subq_5.ds__day
- , subq_5.user
- , subq_5.visits
+ subq_14.ds__day
+ , subq_14.user
+ , subq_14.visits
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_4.ds__day
- , subq_4.ds__week
- , subq_4.ds__month
- , subq_4.ds__quarter
- , subq_4.ds__year
- , subq_4.ds__extract_year
- , subq_4.ds__extract_quarter
- , subq_4.ds__extract_month
- , subq_4.ds__extract_day
- , subq_4.ds__extract_dow
- , subq_4.ds__extract_doy
- , subq_4.visit__ds__day
- , subq_4.visit__ds__week
- , subq_4.visit__ds__month
- , subq_4.visit__ds__quarter
- , subq_4.visit__ds__year
- , subq_4.visit__ds__extract_year
- , subq_4.visit__ds__extract_quarter
- , subq_4.visit__ds__extract_month
- , subq_4.visit__ds__extract_day
- , subq_4.visit__ds__extract_dow
- , subq_4.visit__ds__extract_doy
- , subq_4.ds__day AS metric_time__day
- , subq_4.ds__week AS metric_time__week
- , subq_4.ds__month AS metric_time__month
- , subq_4.ds__quarter AS metric_time__quarter
- , subq_4.ds__year AS metric_time__year
- , subq_4.ds__extract_year AS metric_time__extract_year
- , subq_4.ds__extract_quarter AS metric_time__extract_quarter
- , subq_4.ds__extract_month AS metric_time__extract_month
- , subq_4.ds__extract_day AS metric_time__extract_day
- , subq_4.ds__extract_dow AS metric_time__extract_dow
- , subq_4.ds__extract_doy AS metric_time__extract_doy
- , subq_4.user
- , subq_4.session
- , subq_4.visit__user
- , subq_4.visit__session
- , subq_4.referrer_id
- , subq_4.visit__referrer_id
- , subq_4.visits
- , subq_4.visitors
+ subq_13.ds__day
+ , subq_13.ds__week
+ , subq_13.ds__month
+ , subq_13.ds__quarter
+ , subq_13.ds__year
+ , subq_13.ds__extract_year
+ , subq_13.ds__extract_quarter
+ , subq_13.ds__extract_month
+ , subq_13.ds__extract_day
+ , subq_13.ds__extract_dow
+ , subq_13.ds__extract_doy
+ , subq_13.visit__ds__day
+ , subq_13.visit__ds__week
+ , subq_13.visit__ds__month
+ , subq_13.visit__ds__quarter
+ , subq_13.visit__ds__year
+ , subq_13.visit__ds__extract_year
+ , subq_13.visit__ds__extract_quarter
+ , subq_13.visit__ds__extract_month
+ , subq_13.visit__ds__extract_day
+ , subq_13.visit__ds__extract_dow
+ , subq_13.visit__ds__extract_doy
+ , subq_13.ds__day AS metric_time__day
+ , subq_13.ds__week AS metric_time__week
+ , subq_13.ds__month AS metric_time__month
+ , subq_13.ds__quarter AS metric_time__quarter
+ , subq_13.ds__year AS metric_time__year
+ , subq_13.ds__extract_year AS metric_time__extract_year
+ , subq_13.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_13.ds__extract_month AS metric_time__extract_month
+ , subq_13.ds__extract_day AS metric_time__extract_day
+ , subq_13.ds__extract_dow AS metric_time__extract_dow
+ , subq_13.ds__extract_doy AS metric_time__extract_doy
+ , subq_13.user
+ , subq_13.session
+ , subq_13.visit__user
+ , subq_13.visit__session
+ , subq_13.referrer_id
+ , subq_13.visit__referrer_id
+ , subq_13.visits
+ , subq_13.visitors
FROM (
-- Read Elements From Semantic Model 'visits_source'
SELECT
1 AS visits
- , visits_source_src_28011.user_id AS visitors
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day
- , EXTRACT(dayofweekiso FROM visits_source_src_28011.ds) AS ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy
- , visits_source_src_28011.referrer_id
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day
- , EXTRACT(dayofweekiso FROM visits_source_src_28011.ds) AS visit__ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy
- , visits_source_src_28011.referrer_id AS visit__referrer_id
- , visits_source_src_28011.user_id AS user
- , visits_source_src_28011.session_id AS session
- , visits_source_src_28011.user_id AS visit__user
- , visits_source_src_28011.session_id AS visit__session
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_4
- ) subq_5
- ) subq_6
+ , visits_source_src_28000.user_id AS visitors
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS ds__extract_day
+ , EXTRACT(dayofweekiso FROM visits_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS ds__extract_doy
+ , visits_source_src_28000.referrer_id
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS visit__ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS visit__ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS visit__ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS visit__ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS visit__ds__extract_day
+ , EXTRACT(dayofweekiso FROM visits_source_src_28000.ds) AS visit__ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS visit__ds__extract_doy
+ , visits_source_src_28000.referrer_id AS visit__referrer_id
+ , visits_source_src_28000.user_id AS user
+ , visits_source_src_28000.session_id AS session
+ , visits_source_src_28000.user_id AS visit__user
+ , visits_source_src_28000.session_id AS visit__session
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_13
+ ) subq_14
+ ) subq_15
INNER JOIN (
-- Add column with generated UUID
SELECT
- subq_8.ds__day
- , subq_8.ds__week
- , subq_8.ds__month
- , subq_8.ds__quarter
- , subq_8.ds__year
- , subq_8.ds__extract_year
- , subq_8.ds__extract_quarter
- , subq_8.ds__extract_month
- , subq_8.ds__extract_day
- , subq_8.ds__extract_dow
- , subq_8.ds__extract_doy
- , subq_8.buy__ds__day
- , subq_8.buy__ds__week
- , subq_8.buy__ds__month
- , subq_8.buy__ds__quarter
- , subq_8.buy__ds__year
- , subq_8.buy__ds__extract_year
- , subq_8.buy__ds__extract_quarter
- , subq_8.buy__ds__extract_month
- , subq_8.buy__ds__extract_day
- , subq_8.buy__ds__extract_dow
- , subq_8.buy__ds__extract_doy
- , subq_8.metric_time__day
- , subq_8.metric_time__week
- , subq_8.metric_time__month
- , subq_8.metric_time__quarter
- , subq_8.metric_time__year
- , subq_8.metric_time__extract_year
- , subq_8.metric_time__extract_quarter
- , subq_8.metric_time__extract_month
- , subq_8.metric_time__extract_day
- , subq_8.metric_time__extract_dow
- , subq_8.metric_time__extract_doy
- , subq_8.user
- , subq_8.session_id
- , subq_8.buy__user
- , subq_8.buy__session_id
- , subq_8.buys
- , subq_8.buyers
+ subq_17.ds__day
+ , subq_17.ds__week
+ , subq_17.ds__month
+ , subq_17.ds__quarter
+ , subq_17.ds__year
+ , subq_17.ds__extract_year
+ , subq_17.ds__extract_quarter
+ , subq_17.ds__extract_month
+ , subq_17.ds__extract_day
+ , subq_17.ds__extract_dow
+ , subq_17.ds__extract_doy
+ , subq_17.buy__ds__day
+ , subq_17.buy__ds__week
+ , subq_17.buy__ds__month
+ , subq_17.buy__ds__quarter
+ , subq_17.buy__ds__year
+ , subq_17.buy__ds__extract_year
+ , subq_17.buy__ds__extract_quarter
+ , subq_17.buy__ds__extract_month
+ , subq_17.buy__ds__extract_day
+ , subq_17.buy__ds__extract_dow
+ , subq_17.buy__ds__extract_doy
+ , subq_17.metric_time__day
+ , subq_17.metric_time__week
+ , subq_17.metric_time__month
+ , subq_17.metric_time__quarter
+ , subq_17.metric_time__year
+ , subq_17.metric_time__extract_year
+ , subq_17.metric_time__extract_quarter
+ , subq_17.metric_time__extract_month
+ , subq_17.metric_time__extract_day
+ , subq_17.metric_time__extract_dow
+ , subq_17.metric_time__extract_doy
+ , subq_17.user
+ , subq_17.session_id
+ , subq_17.buy__user
+ , subq_17.buy__session_id
+ , subq_17.buys
+ , subq_17.buyers
, UUID_STRING() AS mf_internal_uuid
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_7.ds__day
- , subq_7.ds__week
- , subq_7.ds__month
- , subq_7.ds__quarter
- , subq_7.ds__year
- , subq_7.ds__extract_year
- , subq_7.ds__extract_quarter
- , subq_7.ds__extract_month
- , subq_7.ds__extract_day
- , subq_7.ds__extract_dow
- , subq_7.ds__extract_doy
- , subq_7.buy__ds__day
- , subq_7.buy__ds__week
- , subq_7.buy__ds__month
- , subq_7.buy__ds__quarter
- , subq_7.buy__ds__year
- , subq_7.buy__ds__extract_year
- , subq_7.buy__ds__extract_quarter
- , subq_7.buy__ds__extract_month
- , subq_7.buy__ds__extract_day
- , subq_7.buy__ds__extract_dow
- , subq_7.buy__ds__extract_doy
- , subq_7.ds__day AS metric_time__day
- , subq_7.ds__week AS metric_time__week
- , subq_7.ds__month AS metric_time__month
- , subq_7.ds__quarter AS metric_time__quarter
- , subq_7.ds__year AS metric_time__year
- , subq_7.ds__extract_year AS metric_time__extract_year
- , subq_7.ds__extract_quarter AS metric_time__extract_quarter
- , subq_7.ds__extract_month AS metric_time__extract_month
- , subq_7.ds__extract_day AS metric_time__extract_day
- , subq_7.ds__extract_dow AS metric_time__extract_dow
- , subq_7.ds__extract_doy AS metric_time__extract_doy
- , subq_7.user
- , subq_7.session_id
- , subq_7.buy__user
- , subq_7.buy__session_id
- , subq_7.buys
- , subq_7.buyers
+ subq_16.ds__day
+ , subq_16.ds__week
+ , subq_16.ds__month
+ , subq_16.ds__quarter
+ , subq_16.ds__year
+ , subq_16.ds__extract_year
+ , subq_16.ds__extract_quarter
+ , subq_16.ds__extract_month
+ , subq_16.ds__extract_day
+ , subq_16.ds__extract_dow
+ , subq_16.ds__extract_doy
+ , subq_16.buy__ds__day
+ , subq_16.buy__ds__week
+ , subq_16.buy__ds__month
+ , subq_16.buy__ds__quarter
+ , subq_16.buy__ds__year
+ , subq_16.buy__ds__extract_year
+ , subq_16.buy__ds__extract_quarter
+ , subq_16.buy__ds__extract_month
+ , subq_16.buy__ds__extract_day
+ , subq_16.buy__ds__extract_dow
+ , subq_16.buy__ds__extract_doy
+ , subq_16.ds__day AS metric_time__day
+ , subq_16.ds__week AS metric_time__week
+ , subq_16.ds__month AS metric_time__month
+ , subq_16.ds__quarter AS metric_time__quarter
+ , subq_16.ds__year AS metric_time__year
+ , subq_16.ds__extract_year AS metric_time__extract_year
+ , subq_16.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_16.ds__extract_month AS metric_time__extract_month
+ , subq_16.ds__extract_day AS metric_time__extract_day
+ , subq_16.ds__extract_dow AS metric_time__extract_dow
+ , subq_16.ds__extract_doy AS metric_time__extract_doy
+ , subq_16.user
+ , subq_16.session_id
+ , subq_16.buy__user
+ , subq_16.buy__session_id
+ , subq_16.buys
+ , subq_16.buyers
FROM (
-- Read Elements From Semantic Model 'buys_source'
SELECT
1 AS buys
- , buys_source_src_28002.user_id AS buyers
- , DATE_TRUNC('day', buys_source_src_28002.ds) AS ds__day
- , DATE_TRUNC('week', buys_source_src_28002.ds) AS ds__week
- , DATE_TRUNC('month', buys_source_src_28002.ds) AS ds__month
- , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS ds__quarter
- , DATE_TRUNC('year', buys_source_src_28002.ds) AS ds__year
- , EXTRACT(year FROM buys_source_src_28002.ds) AS ds__extract_year
- , EXTRACT(quarter FROM buys_source_src_28002.ds) AS ds__extract_quarter
- , EXTRACT(month FROM buys_source_src_28002.ds) AS ds__extract_month
- , EXTRACT(day FROM buys_source_src_28002.ds) AS ds__extract_day
- , EXTRACT(dayofweekiso FROM buys_source_src_28002.ds) AS ds__extract_dow
- , EXTRACT(doy FROM buys_source_src_28002.ds) AS ds__extract_doy
- , DATE_TRUNC('day', buys_source_src_28002.ds) AS buy__ds__day
- , DATE_TRUNC('week', buys_source_src_28002.ds) AS buy__ds__week
- , DATE_TRUNC('month', buys_source_src_28002.ds) AS buy__ds__month
- , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS buy__ds__quarter
- , DATE_TRUNC('year', buys_source_src_28002.ds) AS buy__ds__year
- , EXTRACT(year FROM buys_source_src_28002.ds) AS buy__ds__extract_year
- , EXTRACT(quarter FROM buys_source_src_28002.ds) AS buy__ds__extract_quarter
- , EXTRACT(month FROM buys_source_src_28002.ds) AS buy__ds__extract_month
- , EXTRACT(day FROM buys_source_src_28002.ds) AS buy__ds__extract_day
- , EXTRACT(dayofweekiso FROM buys_source_src_28002.ds) AS buy__ds__extract_dow
- , EXTRACT(doy FROM buys_source_src_28002.ds) AS buy__ds__extract_doy
- , buys_source_src_28002.user_id AS user
- , buys_source_src_28002.session_id
- , buys_source_src_28002.user_id AS buy__user
- , buys_source_src_28002.session_id AS buy__session_id
- FROM ***************************.fct_buys buys_source_src_28002
- ) subq_7
- ) subq_8
- ) subq_9
+ , buys_source_src_28000.user_id AS buyers
+ , DATE_TRUNC('day', buys_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', buys_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', buys_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', buys_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', buys_source_src_28000.ds) 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
+ , EXTRACT(dayofweekiso FROM buys_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM buys_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', buys_source_src_28000.ds) AS buy__ds__day
+ , DATE_TRUNC('week', buys_source_src_28000.ds) AS buy__ds__week
+ , DATE_TRUNC('month', buys_source_src_28000.ds) AS buy__ds__month
+ , DATE_TRUNC('quarter', buys_source_src_28000.ds) AS buy__ds__quarter
+ , DATE_TRUNC('year', buys_source_src_28000.ds) 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
+ , EXTRACT(day FROM buys_source_src_28000.ds) AS buy__ds__extract_day
+ , EXTRACT(dayofweekiso FROM buys_source_src_28000.ds) AS buy__ds__extract_dow
+ , EXTRACT(doy FROM buys_source_src_28000.ds) AS buy__ds__extract_doy
+ , buys_source_src_28000.user_id AS user
+ , buys_source_src_28000.session_id
+ , buys_source_src_28000.user_id AS buy__user
+ , buys_source_src_28000.session_id AS buy__session_id
+ FROM ***************************.fct_buys buys_source_src_28000
+ ) subq_16
+ ) subq_17
+ ) subq_18
ON
(
- subq_6.user = subq_9.user
+ subq_15.user = subq_18.user
) AND (
(
- subq_6.ds__day <= subq_9.ds__day
+ subq_15.ds__day <= subq_18.ds__day
) AND (
- subq_6.ds__day > DATEADD(day, -7, subq_9.ds__day)
+ subq_15.ds__day > DATEADD(day, -7, subq_18.ds__day)
)
)
- ) subq_10
- ) subq_11
- ) subq_12
- ) subq_13
-) subq_14
+ ) subq_19
+ ) subq_20
+ ) subq_21
+ ) subq_22
+) subq_23
diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Snowflake/test_conversion_rate_with_no_group_by__plan0_optimized.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Snowflake/test_conversion_rate_with_no_group_by__plan0_optimized.sql
index fbabe42a69..ce240491c7 100644
--- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Snowflake/test_conversion_rate_with_no_group_by__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Snowflake/test_conversion_rate_with_no_group_by__plan0_optimized.sql
@@ -1,7 +1,7 @@
-- Combine Aggregated Outputs
-- Compute Metrics via Expressions
SELECT
- CAST(MAX(subq_28.buys) AS DOUBLE) / CAST(NULLIF(MAX(subq_18.visits), 0) AS DOUBLE) AS visit_buy_conversion_rate_7days
+ CAST(MAX(subq_37.buys) AS DOUBLE) / CAST(NULLIF(MAX(subq_27.visits), 0) AS DOUBLE) AS visit_buy_conversion_rate_7days
FROM (
-- Read Elements From Semantic Model 'visits_source'
-- Metric Time Dimension 'ds'
@@ -9,8 +9,8 @@ FROM (
-- Aggregate Measures
SELECT
SUM(1) AS visits
- FROM ***************************.fct_visits visits_source_src_28011
-) subq_18
+ FROM ***************************.fct_visits visits_source_src_28000
+) subq_27
CROSS JOIN (
-- Find conversions for user within the range of 7 day
-- Pass Only Elements: ['buys',]
@@ -20,11 +20,11 @@ CROSS JOIN (
FROM (
-- Dedupe the fanout with mf_internal_uuid in the conversion data set
SELECT DISTINCT
- first_value(subq_21.visits) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
- , first_value(subq_21.ds__day) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
- , first_value(subq_21.user) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
- , subq_24.mf_internal_uuid AS mf_internal_uuid
- , subq_24.buys AS buys
+ first_value(subq_30.visits) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
+ , first_value(subq_30.ds__day) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
+ , first_value(subq_30.user) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
+ , subq_33.mf_internal_uuid AS mf_internal_uuid
+ , subq_33.buys AS buys
FROM (
-- Read Elements From Semantic Model 'visits_source'
-- Metric Time Dimension 'ds'
@@ -33,8 +33,8 @@ CROSS JOIN (
DATE_TRUNC('day', ds) AS ds__day
, user_id AS user
, 1 AS visits
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_21
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_30
INNER JOIN (
-- Read Elements From Semantic Model 'buys_source'
-- Metric Time Dimension 'ds'
@@ -44,17 +44,17 @@ CROSS JOIN (
, user_id AS user
, 1 AS buys
, UUID_STRING() AS mf_internal_uuid
- FROM ***************************.fct_buys buys_source_src_28002
- ) subq_24
+ FROM ***************************.fct_buys buys_source_src_28000
+ ) subq_33
ON
(
- subq_21.user = subq_24.user
+ subq_30.user = subq_33.user
) AND (
(
- subq_21.ds__day <= subq_24.ds__day
+ subq_30.ds__day <= subq_33.ds__day
) AND (
- subq_21.ds__day > DATEADD(day, -7, subq_24.ds__day)
+ subq_30.ds__day > DATEADD(day, -7, subq_33.ds__day)
)
)
- ) subq_25
-) subq_28
+ ) subq_34
+) subq_37
diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Snowflake/test_conversion_rate_with_window__plan0.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Snowflake/test_conversion_rate_with_window__plan0.sql
index fa3e3e894a..97965eede6 100644
--- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Snowflake/test_conversion_rate_with_window__plan0.sql
+++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Snowflake/test_conversion_rate_with_window__plan0.sql
@@ -1,376 +1,376 @@
-- Compute Metrics via Expressions
SELECT
- subq_14.metric_time__day
- , subq_14.visit__referrer_id
- , CAST(subq_14.buys AS DOUBLE) / CAST(NULLIF(subq_14.visits, 0) AS DOUBLE) AS visit_buy_conversion_rate_7days
+ subq_23.metric_time__day
+ , subq_23.visit__referrer_id
+ , CAST(subq_23.buys AS DOUBLE) / CAST(NULLIF(subq_23.visits, 0) AS DOUBLE) AS visit_buy_conversion_rate_7days
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_3.metric_time__day, subq_13.metric_time__day) AS metric_time__day
- , COALESCE(subq_3.visit__referrer_id, subq_13.visit__referrer_id) AS visit__referrer_id
- , MAX(subq_3.visits) AS visits
- , MAX(subq_13.buys) AS buys
+ COALESCE(subq_12.metric_time__day, subq_22.metric_time__day) AS metric_time__day
+ , COALESCE(subq_12.visit__referrer_id, subq_22.visit__referrer_id) AS visit__referrer_id
+ , MAX(subq_12.visits) AS visits
+ , MAX(subq_22.buys) AS buys
FROM (
-- Aggregate Measures
SELECT
- subq_2.metric_time__day
- , subq_2.visit__referrer_id
- , SUM(subq_2.visits) AS visits
+ subq_11.metric_time__day
+ , subq_11.visit__referrer_id
+ , SUM(subq_11.visits) AS visits
FROM (
-- Pass Only Elements: ['visits', 'visit__referrer_id', 'metric_time__day']
SELECT
- subq_1.metric_time__day
- , subq_1.visit__referrer_id
- , subq_1.visits
+ subq_10.metric_time__day
+ , subq_10.visit__referrer_id
+ , subq_10.visits
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.visit__ds__day
- , subq_0.visit__ds__week
- , subq_0.visit__ds__month
- , subq_0.visit__ds__quarter
- , subq_0.visit__ds__year
- , subq_0.visit__ds__extract_year
- , subq_0.visit__ds__extract_quarter
- , subq_0.visit__ds__extract_month
- , subq_0.visit__ds__extract_day
- , subq_0.visit__ds__extract_dow
- , subq_0.visit__ds__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.user
- , subq_0.session
- , subq_0.visit__user
- , subq_0.visit__session
- , subq_0.referrer_id
- , subq_0.visit__referrer_id
- , subq_0.visits
- , subq_0.visitors
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.visit__ds__day
+ , subq_9.visit__ds__week
+ , subq_9.visit__ds__month
+ , subq_9.visit__ds__quarter
+ , subq_9.visit__ds__year
+ , subq_9.visit__ds__extract_year
+ , subq_9.visit__ds__extract_quarter
+ , subq_9.visit__ds__extract_month
+ , subq_9.visit__ds__extract_day
+ , subq_9.visit__ds__extract_dow
+ , subq_9.visit__ds__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.user
+ , subq_9.session
+ , subq_9.visit__user
+ , subq_9.visit__session
+ , subq_9.referrer_id
+ , subq_9.visit__referrer_id
+ , subq_9.visits
+ , subq_9.visitors
FROM (
-- Read Elements From Semantic Model 'visits_source'
SELECT
1 AS visits
- , visits_source_src_28011.user_id AS visitors
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day
- , EXTRACT(dayofweekiso FROM visits_source_src_28011.ds) AS ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy
- , visits_source_src_28011.referrer_id
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day
- , EXTRACT(dayofweekiso FROM visits_source_src_28011.ds) AS visit__ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy
- , visits_source_src_28011.referrer_id AS visit__referrer_id
- , visits_source_src_28011.user_id AS user
- , visits_source_src_28011.session_id AS session
- , visits_source_src_28011.user_id AS visit__user
- , visits_source_src_28011.session_id AS visit__session
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_0
- ) subq_1
- ) subq_2
+ , visits_source_src_28000.user_id AS visitors
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS ds__extract_day
+ , EXTRACT(dayofweekiso FROM visits_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS ds__extract_doy
+ , visits_source_src_28000.referrer_id
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS visit__ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS visit__ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS visit__ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS visit__ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS visit__ds__extract_day
+ , EXTRACT(dayofweekiso FROM visits_source_src_28000.ds) AS visit__ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS visit__ds__extract_doy
+ , visits_source_src_28000.referrer_id AS visit__referrer_id
+ , visits_source_src_28000.user_id AS user
+ , visits_source_src_28000.session_id AS session
+ , visits_source_src_28000.user_id AS visit__user
+ , visits_source_src_28000.session_id AS visit__session
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
GROUP BY
- subq_2.metric_time__day
- , subq_2.visit__referrer_id
- ) subq_3
+ subq_11.metric_time__day
+ , subq_11.visit__referrer_id
+ ) subq_12
FULL OUTER JOIN (
-- Aggregate Measures
SELECT
- subq_12.metric_time__day
- , subq_12.visit__referrer_id
- , SUM(subq_12.buys) AS buys
+ subq_21.metric_time__day
+ , subq_21.visit__referrer_id
+ , SUM(subq_21.buys) AS buys
FROM (
-- Pass Only Elements: ['buys', 'visit__referrer_id', 'metric_time__day']
SELECT
- subq_11.metric_time__day
- , subq_11.visit__referrer_id
- , subq_11.buys
+ subq_20.metric_time__day
+ , subq_20.visit__referrer_id
+ , subq_20.buys
FROM (
-- Find conversions for user within the range of 7 day
SELECT
- subq_10.ds__day
- , subq_10.metric_time__day
- , subq_10.user
- , subq_10.visit__referrer_id
- , subq_10.buys
- , subq_10.visits
+ subq_19.ds__day
+ , subq_19.metric_time__day
+ , subq_19.user
+ , subq_19.visit__referrer_id
+ , subq_19.buys
+ , subq_19.visits
FROM (
-- Dedupe the fanout with mf_internal_uuid in the conversion data set
SELECT DISTINCT
- first_value(subq_6.visits) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
- , first_value(subq_6.visit__referrer_id) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visit__referrer_id
- , first_value(subq_6.ds__day) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
- , first_value(subq_6.metric_time__day) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS metric_time__day
- , first_value(subq_6.user) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
- , subq_9.mf_internal_uuid AS mf_internal_uuid
- , subq_9.buys AS buys
+ first_value(subq_15.visits) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
+ , first_value(subq_15.visit__referrer_id) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visit__referrer_id
+ , first_value(subq_15.ds__day) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
+ , first_value(subq_15.metric_time__day) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS metric_time__day
+ , first_value(subq_15.user) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
+ , subq_18.mf_internal_uuid AS mf_internal_uuid
+ , subq_18.buys AS buys
FROM (
-- Pass Only Elements: ['visits', 'visit__referrer_id', 'ds__day', 'metric_time__day', 'user']
SELECT
- subq_5.ds__day
- , subq_5.metric_time__day
- , subq_5.user
- , subq_5.visit__referrer_id
- , subq_5.visits
+ subq_14.ds__day
+ , subq_14.metric_time__day
+ , subq_14.user
+ , subq_14.visit__referrer_id
+ , subq_14.visits
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_4.ds__day
- , subq_4.ds__week
- , subq_4.ds__month
- , subq_4.ds__quarter
- , subq_4.ds__year
- , subq_4.ds__extract_year
- , subq_4.ds__extract_quarter
- , subq_4.ds__extract_month
- , subq_4.ds__extract_day
- , subq_4.ds__extract_dow
- , subq_4.ds__extract_doy
- , subq_4.visit__ds__day
- , subq_4.visit__ds__week
- , subq_4.visit__ds__month
- , subq_4.visit__ds__quarter
- , subq_4.visit__ds__year
- , subq_4.visit__ds__extract_year
- , subq_4.visit__ds__extract_quarter
- , subq_4.visit__ds__extract_month
- , subq_4.visit__ds__extract_day
- , subq_4.visit__ds__extract_dow
- , subq_4.visit__ds__extract_doy
- , subq_4.ds__day AS metric_time__day
- , subq_4.ds__week AS metric_time__week
- , subq_4.ds__month AS metric_time__month
- , subq_4.ds__quarter AS metric_time__quarter
- , subq_4.ds__year AS metric_time__year
- , subq_4.ds__extract_year AS metric_time__extract_year
- , subq_4.ds__extract_quarter AS metric_time__extract_quarter
- , subq_4.ds__extract_month AS metric_time__extract_month
- , subq_4.ds__extract_day AS metric_time__extract_day
- , subq_4.ds__extract_dow AS metric_time__extract_dow
- , subq_4.ds__extract_doy AS metric_time__extract_doy
- , subq_4.user
- , subq_4.session
- , subq_4.visit__user
- , subq_4.visit__session
- , subq_4.referrer_id
- , subq_4.visit__referrer_id
- , subq_4.visits
- , subq_4.visitors
+ subq_13.ds__day
+ , subq_13.ds__week
+ , subq_13.ds__month
+ , subq_13.ds__quarter
+ , subq_13.ds__year
+ , subq_13.ds__extract_year
+ , subq_13.ds__extract_quarter
+ , subq_13.ds__extract_month
+ , subq_13.ds__extract_day
+ , subq_13.ds__extract_dow
+ , subq_13.ds__extract_doy
+ , subq_13.visit__ds__day
+ , subq_13.visit__ds__week
+ , subq_13.visit__ds__month
+ , subq_13.visit__ds__quarter
+ , subq_13.visit__ds__year
+ , subq_13.visit__ds__extract_year
+ , subq_13.visit__ds__extract_quarter
+ , subq_13.visit__ds__extract_month
+ , subq_13.visit__ds__extract_day
+ , subq_13.visit__ds__extract_dow
+ , subq_13.visit__ds__extract_doy
+ , subq_13.ds__day AS metric_time__day
+ , subq_13.ds__week AS metric_time__week
+ , subq_13.ds__month AS metric_time__month
+ , subq_13.ds__quarter AS metric_time__quarter
+ , subq_13.ds__year AS metric_time__year
+ , subq_13.ds__extract_year AS metric_time__extract_year
+ , subq_13.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_13.ds__extract_month AS metric_time__extract_month
+ , subq_13.ds__extract_day AS metric_time__extract_day
+ , subq_13.ds__extract_dow AS metric_time__extract_dow
+ , subq_13.ds__extract_doy AS metric_time__extract_doy
+ , subq_13.user
+ , subq_13.session
+ , subq_13.visit__user
+ , subq_13.visit__session
+ , subq_13.referrer_id
+ , subq_13.visit__referrer_id
+ , subq_13.visits
+ , subq_13.visitors
FROM (
-- Read Elements From Semantic Model 'visits_source'
SELECT
1 AS visits
- , visits_source_src_28011.user_id AS visitors
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day
- , EXTRACT(dayofweekiso FROM visits_source_src_28011.ds) AS ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy
- , visits_source_src_28011.referrer_id
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day
- , EXTRACT(dayofweekiso FROM visits_source_src_28011.ds) AS visit__ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy
- , visits_source_src_28011.referrer_id AS visit__referrer_id
- , visits_source_src_28011.user_id AS user
- , visits_source_src_28011.session_id AS session
- , visits_source_src_28011.user_id AS visit__user
- , visits_source_src_28011.session_id AS visit__session
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_4
- ) subq_5
- ) subq_6
+ , visits_source_src_28000.user_id AS visitors
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS ds__extract_day
+ , EXTRACT(dayofweekiso FROM visits_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS ds__extract_doy
+ , visits_source_src_28000.referrer_id
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS visit__ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS visit__ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS visit__ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS visit__ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS visit__ds__extract_day
+ , EXTRACT(dayofweekiso FROM visits_source_src_28000.ds) AS visit__ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS visit__ds__extract_doy
+ , visits_source_src_28000.referrer_id AS visit__referrer_id
+ , visits_source_src_28000.user_id AS user
+ , visits_source_src_28000.session_id AS session
+ , visits_source_src_28000.user_id AS visit__user
+ , visits_source_src_28000.session_id AS visit__session
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_13
+ ) subq_14
+ ) subq_15
INNER JOIN (
-- Add column with generated UUID
SELECT
- subq_8.ds__day
- , subq_8.ds__week
- , subq_8.ds__month
- , subq_8.ds__quarter
- , subq_8.ds__year
- , subq_8.ds__extract_year
- , subq_8.ds__extract_quarter
- , subq_8.ds__extract_month
- , subq_8.ds__extract_day
- , subq_8.ds__extract_dow
- , subq_8.ds__extract_doy
- , subq_8.buy__ds__day
- , subq_8.buy__ds__week
- , subq_8.buy__ds__month
- , subq_8.buy__ds__quarter
- , subq_8.buy__ds__year
- , subq_8.buy__ds__extract_year
- , subq_8.buy__ds__extract_quarter
- , subq_8.buy__ds__extract_month
- , subq_8.buy__ds__extract_day
- , subq_8.buy__ds__extract_dow
- , subq_8.buy__ds__extract_doy
- , subq_8.metric_time__day
- , subq_8.metric_time__week
- , subq_8.metric_time__month
- , subq_8.metric_time__quarter
- , subq_8.metric_time__year
- , subq_8.metric_time__extract_year
- , subq_8.metric_time__extract_quarter
- , subq_8.metric_time__extract_month
- , subq_8.metric_time__extract_day
- , subq_8.metric_time__extract_dow
- , subq_8.metric_time__extract_doy
- , subq_8.user
- , subq_8.session_id
- , subq_8.buy__user
- , subq_8.buy__session_id
- , subq_8.buys
- , subq_8.buyers
+ subq_17.ds__day
+ , subq_17.ds__week
+ , subq_17.ds__month
+ , subq_17.ds__quarter
+ , subq_17.ds__year
+ , subq_17.ds__extract_year
+ , subq_17.ds__extract_quarter
+ , subq_17.ds__extract_month
+ , subq_17.ds__extract_day
+ , subq_17.ds__extract_dow
+ , subq_17.ds__extract_doy
+ , subq_17.buy__ds__day
+ , subq_17.buy__ds__week
+ , subq_17.buy__ds__month
+ , subq_17.buy__ds__quarter
+ , subq_17.buy__ds__year
+ , subq_17.buy__ds__extract_year
+ , subq_17.buy__ds__extract_quarter
+ , subq_17.buy__ds__extract_month
+ , subq_17.buy__ds__extract_day
+ , subq_17.buy__ds__extract_dow
+ , subq_17.buy__ds__extract_doy
+ , subq_17.metric_time__day
+ , subq_17.metric_time__week
+ , subq_17.metric_time__month
+ , subq_17.metric_time__quarter
+ , subq_17.metric_time__year
+ , subq_17.metric_time__extract_year
+ , subq_17.metric_time__extract_quarter
+ , subq_17.metric_time__extract_month
+ , subq_17.metric_time__extract_day
+ , subq_17.metric_time__extract_dow
+ , subq_17.metric_time__extract_doy
+ , subq_17.user
+ , subq_17.session_id
+ , subq_17.buy__user
+ , subq_17.buy__session_id
+ , subq_17.buys
+ , subq_17.buyers
, UUID_STRING() AS mf_internal_uuid
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_7.ds__day
- , subq_7.ds__week
- , subq_7.ds__month
- , subq_7.ds__quarter
- , subq_7.ds__year
- , subq_7.ds__extract_year
- , subq_7.ds__extract_quarter
- , subq_7.ds__extract_month
- , subq_7.ds__extract_day
- , subq_7.ds__extract_dow
- , subq_7.ds__extract_doy
- , subq_7.buy__ds__day
- , subq_7.buy__ds__week
- , subq_7.buy__ds__month
- , subq_7.buy__ds__quarter
- , subq_7.buy__ds__year
- , subq_7.buy__ds__extract_year
- , subq_7.buy__ds__extract_quarter
- , subq_7.buy__ds__extract_month
- , subq_7.buy__ds__extract_day
- , subq_7.buy__ds__extract_dow
- , subq_7.buy__ds__extract_doy
- , subq_7.ds__day AS metric_time__day
- , subq_7.ds__week AS metric_time__week
- , subq_7.ds__month AS metric_time__month
- , subq_7.ds__quarter AS metric_time__quarter
- , subq_7.ds__year AS metric_time__year
- , subq_7.ds__extract_year AS metric_time__extract_year
- , subq_7.ds__extract_quarter AS metric_time__extract_quarter
- , subq_7.ds__extract_month AS metric_time__extract_month
- , subq_7.ds__extract_day AS metric_time__extract_day
- , subq_7.ds__extract_dow AS metric_time__extract_dow
- , subq_7.ds__extract_doy AS metric_time__extract_doy
- , subq_7.user
- , subq_7.session_id
- , subq_7.buy__user
- , subq_7.buy__session_id
- , subq_7.buys
- , subq_7.buyers
+ subq_16.ds__day
+ , subq_16.ds__week
+ , subq_16.ds__month
+ , subq_16.ds__quarter
+ , subq_16.ds__year
+ , subq_16.ds__extract_year
+ , subq_16.ds__extract_quarter
+ , subq_16.ds__extract_month
+ , subq_16.ds__extract_day
+ , subq_16.ds__extract_dow
+ , subq_16.ds__extract_doy
+ , subq_16.buy__ds__day
+ , subq_16.buy__ds__week
+ , subq_16.buy__ds__month
+ , subq_16.buy__ds__quarter
+ , subq_16.buy__ds__year
+ , subq_16.buy__ds__extract_year
+ , subq_16.buy__ds__extract_quarter
+ , subq_16.buy__ds__extract_month
+ , subq_16.buy__ds__extract_day
+ , subq_16.buy__ds__extract_dow
+ , subq_16.buy__ds__extract_doy
+ , subq_16.ds__day AS metric_time__day
+ , subq_16.ds__week AS metric_time__week
+ , subq_16.ds__month AS metric_time__month
+ , subq_16.ds__quarter AS metric_time__quarter
+ , subq_16.ds__year AS metric_time__year
+ , subq_16.ds__extract_year AS metric_time__extract_year
+ , subq_16.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_16.ds__extract_month AS metric_time__extract_month
+ , subq_16.ds__extract_day AS metric_time__extract_day
+ , subq_16.ds__extract_dow AS metric_time__extract_dow
+ , subq_16.ds__extract_doy AS metric_time__extract_doy
+ , subq_16.user
+ , subq_16.session_id
+ , subq_16.buy__user
+ , subq_16.buy__session_id
+ , subq_16.buys
+ , subq_16.buyers
FROM (
-- Read Elements From Semantic Model 'buys_source'
SELECT
1 AS buys
- , buys_source_src_28002.user_id AS buyers
- , DATE_TRUNC('day', buys_source_src_28002.ds) AS ds__day
- , DATE_TRUNC('week', buys_source_src_28002.ds) AS ds__week
- , DATE_TRUNC('month', buys_source_src_28002.ds) AS ds__month
- , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS ds__quarter
- , DATE_TRUNC('year', buys_source_src_28002.ds) AS ds__year
- , EXTRACT(year FROM buys_source_src_28002.ds) AS ds__extract_year
- , EXTRACT(quarter FROM buys_source_src_28002.ds) AS ds__extract_quarter
- , EXTRACT(month FROM buys_source_src_28002.ds) AS ds__extract_month
- , EXTRACT(day FROM buys_source_src_28002.ds) AS ds__extract_day
- , EXTRACT(dayofweekiso FROM buys_source_src_28002.ds) AS ds__extract_dow
- , EXTRACT(doy FROM buys_source_src_28002.ds) AS ds__extract_doy
- , DATE_TRUNC('day', buys_source_src_28002.ds) AS buy__ds__day
- , DATE_TRUNC('week', buys_source_src_28002.ds) AS buy__ds__week
- , DATE_TRUNC('month', buys_source_src_28002.ds) AS buy__ds__month
- , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS buy__ds__quarter
- , DATE_TRUNC('year', buys_source_src_28002.ds) AS buy__ds__year
- , EXTRACT(year FROM buys_source_src_28002.ds) AS buy__ds__extract_year
- , EXTRACT(quarter FROM buys_source_src_28002.ds) AS buy__ds__extract_quarter
- , EXTRACT(month FROM buys_source_src_28002.ds) AS buy__ds__extract_month
- , EXTRACT(day FROM buys_source_src_28002.ds) AS buy__ds__extract_day
- , EXTRACT(dayofweekiso FROM buys_source_src_28002.ds) AS buy__ds__extract_dow
- , EXTRACT(doy FROM buys_source_src_28002.ds) AS buy__ds__extract_doy
- , buys_source_src_28002.user_id AS user
- , buys_source_src_28002.session_id
- , buys_source_src_28002.user_id AS buy__user
- , buys_source_src_28002.session_id AS buy__session_id
- FROM ***************************.fct_buys buys_source_src_28002
- ) subq_7
- ) subq_8
- ) subq_9
+ , buys_source_src_28000.user_id AS buyers
+ , DATE_TRUNC('day', buys_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', buys_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', buys_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', buys_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', buys_source_src_28000.ds) 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
+ , EXTRACT(dayofweekiso FROM buys_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM buys_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', buys_source_src_28000.ds) AS buy__ds__day
+ , DATE_TRUNC('week', buys_source_src_28000.ds) AS buy__ds__week
+ , DATE_TRUNC('month', buys_source_src_28000.ds) AS buy__ds__month
+ , DATE_TRUNC('quarter', buys_source_src_28000.ds) AS buy__ds__quarter
+ , DATE_TRUNC('year', buys_source_src_28000.ds) 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
+ , EXTRACT(day FROM buys_source_src_28000.ds) AS buy__ds__extract_day
+ , EXTRACT(dayofweekiso FROM buys_source_src_28000.ds) AS buy__ds__extract_dow
+ , EXTRACT(doy FROM buys_source_src_28000.ds) AS buy__ds__extract_doy
+ , buys_source_src_28000.user_id AS user
+ , buys_source_src_28000.session_id
+ , buys_source_src_28000.user_id AS buy__user
+ , buys_source_src_28000.session_id AS buy__session_id
+ FROM ***************************.fct_buys buys_source_src_28000
+ ) subq_16
+ ) subq_17
+ ) subq_18
ON
(
- subq_6.user = subq_9.user
+ subq_15.user = subq_18.user
) AND (
(
- subq_6.ds__day <= subq_9.ds__day
+ subq_15.ds__day <= subq_18.ds__day
) AND (
- subq_6.ds__day > DATEADD(day, -7, subq_9.ds__day)
+ subq_15.ds__day > DATEADD(day, -7, subq_18.ds__day)
)
)
- ) subq_10
- ) subq_11
- ) subq_12
+ ) subq_19
+ ) subq_20
+ ) subq_21
GROUP BY
- subq_12.metric_time__day
- , subq_12.visit__referrer_id
- ) subq_13
+ subq_21.metric_time__day
+ , subq_21.visit__referrer_id
+ ) subq_22
ON
(
- subq_3.visit__referrer_id = subq_13.visit__referrer_id
+ subq_12.visit__referrer_id = subq_22.visit__referrer_id
) AND (
- subq_3.metric_time__day = subq_13.metric_time__day
+ subq_12.metric_time__day = subq_22.metric_time__day
)
GROUP BY
- COALESCE(subq_3.metric_time__day, subq_13.metric_time__day)
- , COALESCE(subq_3.visit__referrer_id, subq_13.visit__referrer_id)
-) subq_14
+ COALESCE(subq_12.metric_time__day, subq_22.metric_time__day)
+ , COALESCE(subq_12.visit__referrer_id, subq_22.visit__referrer_id)
+) subq_23
diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Snowflake/test_conversion_rate_with_window__plan0_optimized.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Snowflake/test_conversion_rate_with_window__plan0_optimized.sql
index e90128a078..5875f64bfb 100644
--- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Snowflake/test_conversion_rate_with_window__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Snowflake/test_conversion_rate_with_window__plan0_optimized.sql
@@ -6,10 +6,10 @@ SELECT
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_18.metric_time__day, subq_28.metric_time__day) AS metric_time__day
- , COALESCE(subq_18.visit__referrer_id, subq_28.visit__referrer_id) AS visit__referrer_id
- , MAX(subq_18.visits) AS visits
- , MAX(subq_28.buys) AS buys
+ COALESCE(subq_27.metric_time__day, subq_37.metric_time__day) AS metric_time__day
+ , COALESCE(subq_27.visit__referrer_id, subq_37.visit__referrer_id) AS visit__referrer_id
+ , MAX(subq_27.visits) AS visits
+ , MAX(subq_37.buys) AS buys
FROM (
-- Aggregate Measures
SELECT
@@ -24,12 +24,12 @@ FROM (
DATE_TRUNC('day', ds) AS metric_time__day
, referrer_id AS visit__referrer_id
, 1 AS visits
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_17
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_26
GROUP BY
metric_time__day
, visit__referrer_id
- ) subq_18
+ ) subq_27
FULL OUTER JOIN (
-- Find conversions for user within the range of 7 day
-- Pass Only Elements: ['buys', 'visit__referrer_id', 'metric_time__day']
@@ -41,13 +41,13 @@ FROM (
FROM (
-- Dedupe the fanout with mf_internal_uuid in the conversion data set
SELECT DISTINCT
- first_value(subq_21.visits) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
- , first_value(subq_21.visit__referrer_id) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visit__referrer_id
- , first_value(subq_21.ds__day) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
- , first_value(subq_21.metric_time__day) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS metric_time__day
- , first_value(subq_21.user) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
- , subq_24.mf_internal_uuid AS mf_internal_uuid
- , subq_24.buys AS buys
+ first_value(subq_30.visits) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
+ , first_value(subq_30.visit__referrer_id) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visit__referrer_id
+ , first_value(subq_30.ds__day) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
+ , first_value(subq_30.metric_time__day) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS metric_time__day
+ , first_value(subq_30.user) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
+ , subq_33.mf_internal_uuid AS mf_internal_uuid
+ , subq_33.buys AS buys
FROM (
-- Read Elements From Semantic Model 'visits_source'
-- Metric Time Dimension 'ds'
@@ -58,8 +58,8 @@ FROM (
, user_id AS user
, referrer_id AS visit__referrer_id
, 1 AS visits
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_21
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_30
INNER JOIN (
-- Read Elements From Semantic Model 'buys_source'
-- Metric Time Dimension 'ds'
@@ -69,30 +69,30 @@ FROM (
, user_id AS user
, 1 AS buys
, UUID_STRING() AS mf_internal_uuid
- FROM ***************************.fct_buys buys_source_src_28002
- ) subq_24
+ FROM ***************************.fct_buys buys_source_src_28000
+ ) subq_33
ON
(
- subq_21.user = subq_24.user
+ subq_30.user = subq_33.user
) AND (
(
- subq_21.ds__day <= subq_24.ds__day
+ subq_30.ds__day <= subq_33.ds__day
) AND (
- subq_21.ds__day > DATEADD(day, -7, subq_24.ds__day)
+ subq_30.ds__day > DATEADD(day, -7, subq_33.ds__day)
)
)
- ) subq_25
+ ) subq_34
GROUP BY
metric_time__day
, visit__referrer_id
- ) subq_28
+ ) subq_37
ON
(
- subq_18.visit__referrer_id = subq_28.visit__referrer_id
+ subq_27.visit__referrer_id = subq_37.visit__referrer_id
) AND (
- subq_18.metric_time__day = subq_28.metric_time__day
+ subq_27.metric_time__day = subq_37.metric_time__day
)
GROUP BY
- COALESCE(subq_18.metric_time__day, subq_28.metric_time__day)
- , COALESCE(subq_18.visit__referrer_id, subq_28.visit__referrer_id)
-) subq_29
+ COALESCE(subq_27.metric_time__day, subq_37.metric_time__day)
+ , COALESCE(subq_27.visit__referrer_id, subq_37.visit__referrer_id)
+) subq_38
diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Trino/test_conversion_count_with_no_group_by__plan0.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Trino/test_conversion_count_with_no_group_by__plan0.sql
index bde01927ff..bd284f3160 100644
--- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Trino/test_conversion_count_with_no_group_by__plan0.sql
+++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Trino/test_conversion_count_with_no_group_by__plan0.sql
@@ -1,343 +1,343 @@
-- Compute Metrics via Expressions
SELECT
- subq_14.buys AS visit_buy_conversions
+ subq_23.buys AS visit_buy_conversions
FROM (
-- Combine Aggregated Outputs
SELECT
- MAX(subq_3.visits) AS visits
- , COALESCE(MAX(subq_13.buys), 0) AS buys
+ MAX(subq_12.visits) AS visits
+ , COALESCE(MAX(subq_22.buys), 0) AS buys
FROM (
-- Aggregate Measures
SELECT
- SUM(subq_2.visits) AS visits
+ SUM(subq_11.visits) AS visits
FROM (
-- Pass Only Elements: ['visits',]
SELECT
- subq_1.visits
+ subq_10.visits
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.visit__ds__day
- , subq_0.visit__ds__week
- , subq_0.visit__ds__month
- , subq_0.visit__ds__quarter
- , subq_0.visit__ds__year
- , subq_0.visit__ds__extract_year
- , subq_0.visit__ds__extract_quarter
- , subq_0.visit__ds__extract_month
- , subq_0.visit__ds__extract_day
- , subq_0.visit__ds__extract_dow
- , subq_0.visit__ds__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.user
- , subq_0.session
- , subq_0.visit__user
- , subq_0.visit__session
- , subq_0.referrer_id
- , subq_0.visit__referrer_id
- , subq_0.visits
- , subq_0.visitors
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.visit__ds__day
+ , subq_9.visit__ds__week
+ , subq_9.visit__ds__month
+ , subq_9.visit__ds__quarter
+ , subq_9.visit__ds__year
+ , subq_9.visit__ds__extract_year
+ , subq_9.visit__ds__extract_quarter
+ , subq_9.visit__ds__extract_month
+ , subq_9.visit__ds__extract_day
+ , subq_9.visit__ds__extract_dow
+ , subq_9.visit__ds__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.user
+ , subq_9.session
+ , subq_9.visit__user
+ , subq_9.visit__session
+ , subq_9.referrer_id
+ , subq_9.visit__referrer_id
+ , subq_9.visits
+ , subq_9.visitors
FROM (
-- Read Elements From Semantic Model 'visits_source'
SELECT
1 AS visits
- , visits_source_src_28011.user_id AS visitors
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM visits_source_src_28011.ds) AS ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy
- , visits_source_src_28011.referrer_id
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM visits_source_src_28011.ds) AS visit__ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy
- , visits_source_src_28011.referrer_id AS visit__referrer_id
- , visits_source_src_28011.user_id AS user
- , visits_source_src_28011.session_id AS session
- , visits_source_src_28011.user_id AS visit__user
- , visits_source_src_28011.session_id AS visit__session
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_0
- ) subq_1
- ) subq_2
- ) subq_3
+ , visits_source_src_28000.user_id AS visitors
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS ds__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM visits_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS ds__extract_doy
+ , visits_source_src_28000.referrer_id
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS visit__ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS visit__ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS visit__ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS visit__ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS visit__ds__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM visits_source_src_28000.ds) AS visit__ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS visit__ds__extract_doy
+ , visits_source_src_28000.referrer_id AS visit__referrer_id
+ , visits_source_src_28000.user_id AS user
+ , visits_source_src_28000.session_id AS session
+ , visits_source_src_28000.user_id AS visit__user
+ , visits_source_src_28000.session_id AS visit__session
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
+ ) subq_12
CROSS JOIN (
-- Aggregate Measures
SELECT
- SUM(subq_12.buys) AS buys
+ SUM(subq_21.buys) AS buys
FROM (
-- Pass Only Elements: ['buys',]
SELECT
- subq_11.buys
+ subq_20.buys
FROM (
-- Find conversions for user within the range of 7 day
SELECT
- subq_10.ds__day
- , subq_10.user
- , subq_10.buys
- , subq_10.visits
+ subq_19.ds__day
+ , subq_19.user
+ , subq_19.buys
+ , subq_19.visits
FROM (
-- Dedupe the fanout with mf_internal_uuid in the conversion data set
SELECT DISTINCT
- first_value(subq_6.visits) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
- , first_value(subq_6.ds__day) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
- , first_value(subq_6.user) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
- , subq_9.mf_internal_uuid AS mf_internal_uuid
- , subq_9.buys AS buys
+ first_value(subq_15.visits) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
+ , first_value(subq_15.ds__day) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
+ , first_value(subq_15.user) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
+ , subq_18.mf_internal_uuid AS mf_internal_uuid
+ , subq_18.buys AS buys
FROM (
-- Pass Only Elements: ['visits', 'ds__day', 'user']
SELECT
- subq_5.ds__day
- , subq_5.user
- , subq_5.visits
+ subq_14.ds__day
+ , subq_14.user
+ , subq_14.visits
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_4.ds__day
- , subq_4.ds__week
- , subq_4.ds__month
- , subq_4.ds__quarter
- , subq_4.ds__year
- , subq_4.ds__extract_year
- , subq_4.ds__extract_quarter
- , subq_4.ds__extract_month
- , subq_4.ds__extract_day
- , subq_4.ds__extract_dow
- , subq_4.ds__extract_doy
- , subq_4.visit__ds__day
- , subq_4.visit__ds__week
- , subq_4.visit__ds__month
- , subq_4.visit__ds__quarter
- , subq_4.visit__ds__year
- , subq_4.visit__ds__extract_year
- , subq_4.visit__ds__extract_quarter
- , subq_4.visit__ds__extract_month
- , subq_4.visit__ds__extract_day
- , subq_4.visit__ds__extract_dow
- , subq_4.visit__ds__extract_doy
- , subq_4.ds__day AS metric_time__day
- , subq_4.ds__week AS metric_time__week
- , subq_4.ds__month AS metric_time__month
- , subq_4.ds__quarter AS metric_time__quarter
- , subq_4.ds__year AS metric_time__year
- , subq_4.ds__extract_year AS metric_time__extract_year
- , subq_4.ds__extract_quarter AS metric_time__extract_quarter
- , subq_4.ds__extract_month AS metric_time__extract_month
- , subq_4.ds__extract_day AS metric_time__extract_day
- , subq_4.ds__extract_dow AS metric_time__extract_dow
- , subq_4.ds__extract_doy AS metric_time__extract_doy
- , subq_4.user
- , subq_4.session
- , subq_4.visit__user
- , subq_4.visit__session
- , subq_4.referrer_id
- , subq_4.visit__referrer_id
- , subq_4.visits
- , subq_4.visitors
+ subq_13.ds__day
+ , subq_13.ds__week
+ , subq_13.ds__month
+ , subq_13.ds__quarter
+ , subq_13.ds__year
+ , subq_13.ds__extract_year
+ , subq_13.ds__extract_quarter
+ , subq_13.ds__extract_month
+ , subq_13.ds__extract_day
+ , subq_13.ds__extract_dow
+ , subq_13.ds__extract_doy
+ , subq_13.visit__ds__day
+ , subq_13.visit__ds__week
+ , subq_13.visit__ds__month
+ , subq_13.visit__ds__quarter
+ , subq_13.visit__ds__year
+ , subq_13.visit__ds__extract_year
+ , subq_13.visit__ds__extract_quarter
+ , subq_13.visit__ds__extract_month
+ , subq_13.visit__ds__extract_day
+ , subq_13.visit__ds__extract_dow
+ , subq_13.visit__ds__extract_doy
+ , subq_13.ds__day AS metric_time__day
+ , subq_13.ds__week AS metric_time__week
+ , subq_13.ds__month AS metric_time__month
+ , subq_13.ds__quarter AS metric_time__quarter
+ , subq_13.ds__year AS metric_time__year
+ , subq_13.ds__extract_year AS metric_time__extract_year
+ , subq_13.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_13.ds__extract_month AS metric_time__extract_month
+ , subq_13.ds__extract_day AS metric_time__extract_day
+ , subq_13.ds__extract_dow AS metric_time__extract_dow
+ , subq_13.ds__extract_doy AS metric_time__extract_doy
+ , subq_13.user
+ , subq_13.session
+ , subq_13.visit__user
+ , subq_13.visit__session
+ , subq_13.referrer_id
+ , subq_13.visit__referrer_id
+ , subq_13.visits
+ , subq_13.visitors
FROM (
-- Read Elements From Semantic Model 'visits_source'
SELECT
1 AS visits
- , visits_source_src_28011.user_id AS visitors
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM visits_source_src_28011.ds) AS ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy
- , visits_source_src_28011.referrer_id
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM visits_source_src_28011.ds) AS visit__ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy
- , visits_source_src_28011.referrer_id AS visit__referrer_id
- , visits_source_src_28011.user_id AS user
- , visits_source_src_28011.session_id AS session
- , visits_source_src_28011.user_id AS visit__user
- , visits_source_src_28011.session_id AS visit__session
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_4
- ) subq_5
- ) subq_6
+ , visits_source_src_28000.user_id AS visitors
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS ds__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM visits_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS ds__extract_doy
+ , visits_source_src_28000.referrer_id
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS visit__ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS visit__ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS visit__ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS visit__ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS visit__ds__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM visits_source_src_28000.ds) AS visit__ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS visit__ds__extract_doy
+ , visits_source_src_28000.referrer_id AS visit__referrer_id
+ , visits_source_src_28000.user_id AS user
+ , visits_source_src_28000.session_id AS session
+ , visits_source_src_28000.user_id AS visit__user
+ , visits_source_src_28000.session_id AS visit__session
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_13
+ ) subq_14
+ ) subq_15
INNER JOIN (
-- Add column with generated UUID
SELECT
- subq_8.ds__day
- , subq_8.ds__week
- , subq_8.ds__month
- , subq_8.ds__quarter
- , subq_8.ds__year
- , subq_8.ds__extract_year
- , subq_8.ds__extract_quarter
- , subq_8.ds__extract_month
- , subq_8.ds__extract_day
- , subq_8.ds__extract_dow
- , subq_8.ds__extract_doy
- , subq_8.buy__ds__day
- , subq_8.buy__ds__week
- , subq_8.buy__ds__month
- , subq_8.buy__ds__quarter
- , subq_8.buy__ds__year
- , subq_8.buy__ds__extract_year
- , subq_8.buy__ds__extract_quarter
- , subq_8.buy__ds__extract_month
- , subq_8.buy__ds__extract_day
- , subq_8.buy__ds__extract_dow
- , subq_8.buy__ds__extract_doy
- , subq_8.metric_time__day
- , subq_8.metric_time__week
- , subq_8.metric_time__month
- , subq_8.metric_time__quarter
- , subq_8.metric_time__year
- , subq_8.metric_time__extract_year
- , subq_8.metric_time__extract_quarter
- , subq_8.metric_time__extract_month
- , subq_8.metric_time__extract_day
- , subq_8.metric_time__extract_dow
- , subq_8.metric_time__extract_doy
- , subq_8.user
- , subq_8.session_id
- , subq_8.buy__user
- , subq_8.buy__session_id
- , subq_8.buys
- , subq_8.buyers
+ subq_17.ds__day
+ , subq_17.ds__week
+ , subq_17.ds__month
+ , subq_17.ds__quarter
+ , subq_17.ds__year
+ , subq_17.ds__extract_year
+ , subq_17.ds__extract_quarter
+ , subq_17.ds__extract_month
+ , subq_17.ds__extract_day
+ , subq_17.ds__extract_dow
+ , subq_17.ds__extract_doy
+ , subq_17.buy__ds__day
+ , subq_17.buy__ds__week
+ , subq_17.buy__ds__month
+ , subq_17.buy__ds__quarter
+ , subq_17.buy__ds__year
+ , subq_17.buy__ds__extract_year
+ , subq_17.buy__ds__extract_quarter
+ , subq_17.buy__ds__extract_month
+ , subq_17.buy__ds__extract_day
+ , subq_17.buy__ds__extract_dow
+ , subq_17.buy__ds__extract_doy
+ , subq_17.metric_time__day
+ , subq_17.metric_time__week
+ , subq_17.metric_time__month
+ , subq_17.metric_time__quarter
+ , subq_17.metric_time__year
+ , subq_17.metric_time__extract_year
+ , subq_17.metric_time__extract_quarter
+ , subq_17.metric_time__extract_month
+ , subq_17.metric_time__extract_day
+ , subq_17.metric_time__extract_dow
+ , subq_17.metric_time__extract_doy
+ , subq_17.user
+ , subq_17.session_id
+ , subq_17.buy__user
+ , subq_17.buy__session_id
+ , subq_17.buys
+ , subq_17.buyers
, uuid() AS mf_internal_uuid
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_7.ds__day
- , subq_7.ds__week
- , subq_7.ds__month
- , subq_7.ds__quarter
- , subq_7.ds__year
- , subq_7.ds__extract_year
- , subq_7.ds__extract_quarter
- , subq_7.ds__extract_month
- , subq_7.ds__extract_day
- , subq_7.ds__extract_dow
- , subq_7.ds__extract_doy
- , subq_7.buy__ds__day
- , subq_7.buy__ds__week
- , subq_7.buy__ds__month
- , subq_7.buy__ds__quarter
- , subq_7.buy__ds__year
- , subq_7.buy__ds__extract_year
- , subq_7.buy__ds__extract_quarter
- , subq_7.buy__ds__extract_month
- , subq_7.buy__ds__extract_day
- , subq_7.buy__ds__extract_dow
- , subq_7.buy__ds__extract_doy
- , subq_7.ds__day AS metric_time__day
- , subq_7.ds__week AS metric_time__week
- , subq_7.ds__month AS metric_time__month
- , subq_7.ds__quarter AS metric_time__quarter
- , subq_7.ds__year AS metric_time__year
- , subq_7.ds__extract_year AS metric_time__extract_year
- , subq_7.ds__extract_quarter AS metric_time__extract_quarter
- , subq_7.ds__extract_month AS metric_time__extract_month
- , subq_7.ds__extract_day AS metric_time__extract_day
- , subq_7.ds__extract_dow AS metric_time__extract_dow
- , subq_7.ds__extract_doy AS metric_time__extract_doy
- , subq_7.user
- , subq_7.session_id
- , subq_7.buy__user
- , subq_7.buy__session_id
- , subq_7.buys
- , subq_7.buyers
+ subq_16.ds__day
+ , subq_16.ds__week
+ , subq_16.ds__month
+ , subq_16.ds__quarter
+ , subq_16.ds__year
+ , subq_16.ds__extract_year
+ , subq_16.ds__extract_quarter
+ , subq_16.ds__extract_month
+ , subq_16.ds__extract_day
+ , subq_16.ds__extract_dow
+ , subq_16.ds__extract_doy
+ , subq_16.buy__ds__day
+ , subq_16.buy__ds__week
+ , subq_16.buy__ds__month
+ , subq_16.buy__ds__quarter
+ , subq_16.buy__ds__year
+ , subq_16.buy__ds__extract_year
+ , subq_16.buy__ds__extract_quarter
+ , subq_16.buy__ds__extract_month
+ , subq_16.buy__ds__extract_day
+ , subq_16.buy__ds__extract_dow
+ , subq_16.buy__ds__extract_doy
+ , subq_16.ds__day AS metric_time__day
+ , subq_16.ds__week AS metric_time__week
+ , subq_16.ds__month AS metric_time__month
+ , subq_16.ds__quarter AS metric_time__quarter
+ , subq_16.ds__year AS metric_time__year
+ , subq_16.ds__extract_year AS metric_time__extract_year
+ , subq_16.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_16.ds__extract_month AS metric_time__extract_month
+ , subq_16.ds__extract_day AS metric_time__extract_day
+ , subq_16.ds__extract_dow AS metric_time__extract_dow
+ , subq_16.ds__extract_doy AS metric_time__extract_doy
+ , subq_16.user
+ , subq_16.session_id
+ , subq_16.buy__user
+ , subq_16.buy__session_id
+ , subq_16.buys
+ , subq_16.buyers
FROM (
-- Read Elements From Semantic Model 'buys_source'
SELECT
1 AS buys
- , buys_source_src_28002.user_id AS buyers
- , DATE_TRUNC('day', buys_source_src_28002.ds) AS ds__day
- , DATE_TRUNC('week', buys_source_src_28002.ds) AS ds__week
- , DATE_TRUNC('month', buys_source_src_28002.ds) AS ds__month
- , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS ds__quarter
- , DATE_TRUNC('year', buys_source_src_28002.ds) AS ds__year
- , EXTRACT(year FROM buys_source_src_28002.ds) AS ds__extract_year
- , EXTRACT(quarter FROM buys_source_src_28002.ds) AS ds__extract_quarter
- , EXTRACT(month FROM buys_source_src_28002.ds) AS ds__extract_month
- , EXTRACT(day FROM buys_source_src_28002.ds) AS ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM buys_source_src_28002.ds) AS ds__extract_dow
- , EXTRACT(doy FROM buys_source_src_28002.ds) AS ds__extract_doy
- , DATE_TRUNC('day', buys_source_src_28002.ds) AS buy__ds__day
- , DATE_TRUNC('week', buys_source_src_28002.ds) AS buy__ds__week
- , DATE_TRUNC('month', buys_source_src_28002.ds) AS buy__ds__month
- , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS buy__ds__quarter
- , DATE_TRUNC('year', buys_source_src_28002.ds) AS buy__ds__year
- , EXTRACT(year FROM buys_source_src_28002.ds) AS buy__ds__extract_year
- , EXTRACT(quarter FROM buys_source_src_28002.ds) AS buy__ds__extract_quarter
- , EXTRACT(month FROM buys_source_src_28002.ds) AS buy__ds__extract_month
- , EXTRACT(day FROM buys_source_src_28002.ds) AS buy__ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM buys_source_src_28002.ds) AS buy__ds__extract_dow
- , EXTRACT(doy FROM buys_source_src_28002.ds) AS buy__ds__extract_doy
- , buys_source_src_28002.user_id AS user
- , buys_source_src_28002.session_id
- , buys_source_src_28002.user_id AS buy__user
- , buys_source_src_28002.session_id AS buy__session_id
- FROM ***************************.fct_buys buys_source_src_28002
- ) subq_7
- ) subq_8
- ) subq_9
+ , buys_source_src_28000.user_id AS buyers
+ , DATE_TRUNC('day', buys_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', buys_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', buys_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', buys_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', buys_source_src_28000.ds) 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
+ , EXTRACT(DAY_OF_WEEK FROM buys_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM buys_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', buys_source_src_28000.ds) AS buy__ds__day
+ , DATE_TRUNC('week', buys_source_src_28000.ds) AS buy__ds__week
+ , DATE_TRUNC('month', buys_source_src_28000.ds) AS buy__ds__month
+ , DATE_TRUNC('quarter', buys_source_src_28000.ds) AS buy__ds__quarter
+ , DATE_TRUNC('year', buys_source_src_28000.ds) 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
+ , EXTRACT(day FROM buys_source_src_28000.ds) AS buy__ds__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM buys_source_src_28000.ds) AS buy__ds__extract_dow
+ , EXTRACT(doy FROM buys_source_src_28000.ds) AS buy__ds__extract_doy
+ , buys_source_src_28000.user_id AS user
+ , buys_source_src_28000.session_id
+ , buys_source_src_28000.user_id AS buy__user
+ , buys_source_src_28000.session_id AS buy__session_id
+ FROM ***************************.fct_buys buys_source_src_28000
+ ) subq_16
+ ) subq_17
+ ) subq_18
ON
(
- subq_6.user = subq_9.user
+ subq_15.user = subq_18.user
) AND (
(
- subq_6.ds__day <= subq_9.ds__day
+ subq_15.ds__day <= subq_18.ds__day
) AND (
- subq_6.ds__day > DATE_ADD('day', -7, subq_9.ds__day)
+ subq_15.ds__day > DATE_ADD('day', -7, subq_18.ds__day)
)
)
- ) subq_10
- ) subq_11
- ) subq_12
- ) subq_13
-) subq_14
+ ) subq_19
+ ) subq_20
+ ) subq_21
+ ) subq_22
+) subq_23
diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Trino/test_conversion_count_with_no_group_by__plan0_optimized.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Trino/test_conversion_count_with_no_group_by__plan0_optimized.sql
index 0e456f0b75..93122a23dd 100644
--- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Trino/test_conversion_count_with_no_group_by__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Trino/test_conversion_count_with_no_group_by__plan0_optimized.sql
@@ -1,7 +1,7 @@
-- Combine Aggregated Outputs
-- Compute Metrics via Expressions
SELECT
- COALESCE(MAX(subq_28.buys), 0) AS visit_buy_conversions
+ COALESCE(MAX(subq_37.buys), 0) AS visit_buy_conversions
FROM (
-- Read Elements From Semantic Model 'visits_source'
-- Metric Time Dimension 'ds'
@@ -9,8 +9,8 @@ FROM (
-- Aggregate Measures
SELECT
SUM(1) AS visits
- FROM ***************************.fct_visits visits_source_src_28011
-) subq_18
+ FROM ***************************.fct_visits visits_source_src_28000
+) subq_27
CROSS JOIN (
-- Find conversions for user within the range of 7 day
-- Pass Only Elements: ['buys',]
@@ -20,11 +20,11 @@ CROSS JOIN (
FROM (
-- Dedupe the fanout with mf_internal_uuid in the conversion data set
SELECT DISTINCT
- first_value(subq_21.visits) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
- , first_value(subq_21.ds__day) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
- , first_value(subq_21.user) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
- , subq_24.mf_internal_uuid AS mf_internal_uuid
- , subq_24.buys AS buys
+ first_value(subq_30.visits) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
+ , first_value(subq_30.ds__day) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
+ , first_value(subq_30.user) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
+ , subq_33.mf_internal_uuid AS mf_internal_uuid
+ , subq_33.buys AS buys
FROM (
-- Read Elements From Semantic Model 'visits_source'
-- Metric Time Dimension 'ds'
@@ -33,8 +33,8 @@ CROSS JOIN (
DATE_TRUNC('day', ds) AS ds__day
, user_id AS user
, 1 AS visits
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_21
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_30
INNER JOIN (
-- Read Elements From Semantic Model 'buys_source'
-- Metric Time Dimension 'ds'
@@ -44,17 +44,17 @@ CROSS JOIN (
, user_id AS user
, 1 AS buys
, uuid() AS mf_internal_uuid
- FROM ***************************.fct_buys buys_source_src_28002
- ) subq_24
+ FROM ***************************.fct_buys buys_source_src_28000
+ ) subq_33
ON
(
- subq_21.user = subq_24.user
+ subq_30.user = subq_33.user
) AND (
(
- subq_21.ds__day <= subq_24.ds__day
+ subq_30.ds__day <= subq_33.ds__day
) AND (
- subq_21.ds__day > DATE_ADD('day', -7, subq_24.ds__day)
+ subq_30.ds__day > DATE_ADD('day', -7, subq_33.ds__day)
)
)
- ) subq_25
-) subq_28
+ ) subq_34
+) subq_37
diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Trino/test_conversion_rate__plan0.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Trino/test_conversion_rate__plan0.sql
index c8f7ec4221..56179a58c0 100644
--- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Trino/test_conversion_rate__plan0.sql
+++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Trino/test_conversion_rate__plan0.sql
@@ -1,352 +1,356 @@
-- Compute Metrics via Expressions
SELECT
- subq_14.visit__referrer_id
- , CAST(subq_14.buys AS DOUBLE) / CAST(NULLIF(subq_14.visits, 0) AS DOUBLE) AS visit_buy_conversion_rate
+ subq_23.visit__referrer_id
+ , CAST(subq_23.buys AS DOUBLE) / CAST(NULLIF(subq_23.visits, 0) AS DOUBLE) AS visit_buy_conversion_rate
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_3.visit__referrer_id, subq_13.visit__referrer_id) AS visit__referrer_id
- , MAX(subq_3.visits) AS visits
- , MAX(subq_13.buys) AS buys
+ COALESCE(subq_12.visit__referrer_id, subq_22.visit__referrer_id) AS visit__referrer_id
+ , MAX(subq_12.visits) AS visits
+ , MAX(subq_22.buys) AS buys
FROM (
-- Aggregate Measures
SELECT
- subq_2.visit__referrer_id
- , SUM(subq_2.visits) AS visits
+ subq_11.visit__referrer_id
+ , SUM(subq_11.visits) AS visits
FROM (
-- Pass Only Elements: ['visits', 'visit__referrer_id']
SELECT
- subq_1.visit__referrer_id
- , subq_1.visits
+ subq_10.visit__referrer_id
+ , subq_10.visits
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.visit__ds__day
- , subq_0.visit__ds__week
- , subq_0.visit__ds__month
- , subq_0.visit__ds__quarter
- , subq_0.visit__ds__year
- , subq_0.visit__ds__extract_year
- , subq_0.visit__ds__extract_quarter
- , subq_0.visit__ds__extract_month
- , subq_0.visit__ds__extract_day
- , subq_0.visit__ds__extract_dow
- , subq_0.visit__ds__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.user
- , subq_0.session
- , subq_0.visit__user
- , subq_0.visit__session
- , subq_0.referrer_id
- , subq_0.visit__referrer_id
- , subq_0.visits
- , subq_0.visitors
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.visit__ds__day
+ , subq_9.visit__ds__week
+ , subq_9.visit__ds__month
+ , subq_9.visit__ds__quarter
+ , subq_9.visit__ds__year
+ , subq_9.visit__ds__extract_year
+ , subq_9.visit__ds__extract_quarter
+ , subq_9.visit__ds__extract_month
+ , subq_9.visit__ds__extract_day
+ , subq_9.visit__ds__extract_dow
+ , subq_9.visit__ds__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.user
+ , subq_9.session
+ , subq_9.visit__user
+ , subq_9.visit__session
+ , subq_9.referrer_id
+ , subq_9.visit__referrer_id
+ , subq_9.visits
+ , subq_9.visitors
FROM (
-- Read Elements From Semantic Model 'visits_source'
SELECT
1 AS visits
- , visits_source_src_28011.user_id AS visitors
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM visits_source_src_28011.ds) AS ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy
- , visits_source_src_28011.referrer_id
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM visits_source_src_28011.ds) AS visit__ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy
- , visits_source_src_28011.referrer_id AS visit__referrer_id
- , visits_source_src_28011.user_id AS user
- , visits_source_src_28011.session_id AS session
- , visits_source_src_28011.user_id AS visit__user
- , visits_source_src_28011.session_id AS visit__session
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_0
- ) subq_1
- ) subq_2
+ , visits_source_src_28000.user_id AS visitors
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS ds__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM visits_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS ds__extract_doy
+ , visits_source_src_28000.referrer_id
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS visit__ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS visit__ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS visit__ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS visit__ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS visit__ds__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM visits_source_src_28000.ds) AS visit__ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS visit__ds__extract_doy
+ , visits_source_src_28000.referrer_id AS visit__referrer_id
+ , visits_source_src_28000.user_id AS user
+ , visits_source_src_28000.session_id AS session
+ , visits_source_src_28000.user_id AS visit__user
+ , visits_source_src_28000.session_id AS visit__session
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
GROUP BY
- subq_2.visit__referrer_id
- ) subq_3
+ subq_11.visit__referrer_id
+ ) subq_12
FULL OUTER JOIN (
-- Aggregate Measures
SELECT
- subq_12.visit__referrer_id
- , SUM(subq_12.buys) AS buys
+ subq_21.visit__referrer_id
+ , SUM(subq_21.buys) AS buys
FROM (
-- Pass Only Elements: ['buys', 'visit__referrer_id']
SELECT
- subq_11.visit__referrer_id
- , subq_11.buys
+ subq_20.visit__referrer_id
+ , subq_20.buys
FROM (
-- Find conversions for user within the range of INF
SELECT
- subq_10.ds__day
- , subq_10.user
- , subq_10.visit__referrer_id
- , subq_10.buys
- , subq_10.visits
+ subq_19.ds__day
+ , subq_19.user
+ , subq_19.visit__referrer_id
+ , subq_19.buys
+ , subq_19.visits
FROM (
-- Dedupe the fanout with mf_internal_uuid in the conversion data set
SELECT DISTINCT
- first_value(subq_6.visits) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
- , first_value(subq_6.visit__referrer_id) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visit__referrer_id
- , first_value(subq_6.ds__day) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
- , first_value(subq_6.user) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
- , subq_9.mf_internal_uuid AS mf_internal_uuid
- , subq_9.buys AS buys
+ first_value(subq_15.visits) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
+ , first_value(subq_15.visit__referrer_id) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visit__referrer_id
+ , first_value(subq_15.ds__day) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
+ , first_value(subq_15.user) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
+ , subq_18.mf_internal_uuid AS mf_internal_uuid
+ , subq_18.buys AS buys
FROM (
-- Pass Only Elements: ['visits', 'visit__referrer_id', 'ds__day', 'user']
SELECT
- subq_5.ds__day
- , subq_5.user
- , subq_5.visit__referrer_id
- , subq_5.visits
+ subq_14.ds__day
+ , subq_14.user
+ , subq_14.visit__referrer_id
+ , subq_14.visits
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_4.ds__day
- , subq_4.ds__week
- , subq_4.ds__month
- , subq_4.ds__quarter
- , subq_4.ds__year
- , subq_4.ds__extract_year
- , subq_4.ds__extract_quarter
- , subq_4.ds__extract_month
- , subq_4.ds__extract_day
- , subq_4.ds__extract_dow
- , subq_4.ds__extract_doy
- , subq_4.visit__ds__day
- , subq_4.visit__ds__week
- , subq_4.visit__ds__month
- , subq_4.visit__ds__quarter
- , subq_4.visit__ds__year
- , subq_4.visit__ds__extract_year
- , subq_4.visit__ds__extract_quarter
- , subq_4.visit__ds__extract_month
- , subq_4.visit__ds__extract_day
- , subq_4.visit__ds__extract_dow
- , subq_4.visit__ds__extract_doy
- , subq_4.ds__day AS metric_time__day
- , subq_4.ds__week AS metric_time__week
- , subq_4.ds__month AS metric_time__month
- , subq_4.ds__quarter AS metric_time__quarter
- , subq_4.ds__year AS metric_time__year
- , subq_4.ds__extract_year AS metric_time__extract_year
- , subq_4.ds__extract_quarter AS metric_time__extract_quarter
- , subq_4.ds__extract_month AS metric_time__extract_month
- , subq_4.ds__extract_day AS metric_time__extract_day
- , subq_4.ds__extract_dow AS metric_time__extract_dow
- , subq_4.ds__extract_doy AS metric_time__extract_doy
- , subq_4.user
- , subq_4.session
- , subq_4.visit__user
- , subq_4.visit__session
- , subq_4.referrer_id
- , subq_4.visit__referrer_id
- , subq_4.visits
- , subq_4.visitors
+ subq_13.ds__day
+ , subq_13.ds__week
+ , subq_13.ds__month
+ , subq_13.ds__quarter
+ , subq_13.ds__year
+ , subq_13.ds__extract_year
+ , subq_13.ds__extract_quarter
+ , subq_13.ds__extract_month
+ , subq_13.ds__extract_day
+ , subq_13.ds__extract_dow
+ , subq_13.ds__extract_doy
+ , subq_13.visit__ds__day
+ , subq_13.visit__ds__week
+ , subq_13.visit__ds__month
+ , subq_13.visit__ds__quarter
+ , subq_13.visit__ds__year
+ , subq_13.visit__ds__extract_year
+ , subq_13.visit__ds__extract_quarter
+ , subq_13.visit__ds__extract_month
+ , subq_13.visit__ds__extract_day
+ , subq_13.visit__ds__extract_dow
+ , subq_13.visit__ds__extract_doy
+ , subq_13.ds__day AS metric_time__day
+ , subq_13.ds__week AS metric_time__week
+ , subq_13.ds__month AS metric_time__month
+ , subq_13.ds__quarter AS metric_time__quarter
+ , subq_13.ds__year AS metric_time__year
+ , subq_13.ds__extract_year AS metric_time__extract_year
+ , subq_13.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_13.ds__extract_month AS metric_time__extract_month
+ , subq_13.ds__extract_day AS metric_time__extract_day
+ , subq_13.ds__extract_dow AS metric_time__extract_dow
+ , subq_13.ds__extract_doy AS metric_time__extract_doy
+ , subq_13.user
+ , subq_13.session
+ , subq_13.visit__user
+ , subq_13.visit__session
+ , subq_13.referrer_id
+ , subq_13.visit__referrer_id
+ , subq_13.visits
+ , subq_13.visitors
FROM (
-- Read Elements From Semantic Model 'visits_source'
SELECT
1 AS visits
- , visits_source_src_28011.user_id AS visitors
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM visits_source_src_28011.ds) AS ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy
- , visits_source_src_28011.referrer_id
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM visits_source_src_28011.ds) AS visit__ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy
- , visits_source_src_28011.referrer_id AS visit__referrer_id
- , visits_source_src_28011.user_id AS user
- , visits_source_src_28011.session_id AS session
- , visits_source_src_28011.user_id AS visit__user
- , visits_source_src_28011.session_id AS visit__session
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_4
- ) subq_5
- ) subq_6
+ , visits_source_src_28000.user_id AS visitors
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS ds__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM visits_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS ds__extract_doy
+ , visits_source_src_28000.referrer_id
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS visit__ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS visit__ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS visit__ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS visit__ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS visit__ds__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM visits_source_src_28000.ds) AS visit__ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS visit__ds__extract_doy
+ , visits_source_src_28000.referrer_id AS visit__referrer_id
+ , visits_source_src_28000.user_id AS user
+ , visits_source_src_28000.session_id AS session
+ , visits_source_src_28000.user_id AS visit__user
+ , visits_source_src_28000.session_id AS visit__session
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_13
+ ) subq_14
+ ) subq_15
INNER JOIN (
-- Add column with generated UUID
SELECT
- subq_8.ds__day
- , subq_8.ds__week
- , subq_8.ds__month
- , subq_8.ds__quarter
- , subq_8.ds__year
- , subq_8.ds__extract_year
- , subq_8.ds__extract_quarter
- , subq_8.ds__extract_month
- , subq_8.ds__extract_day
- , subq_8.ds__extract_dow
- , subq_8.ds__extract_doy
- , subq_8.buy__ds__day
- , subq_8.buy__ds__week
- , subq_8.buy__ds__month
- , subq_8.buy__ds__quarter
- , subq_8.buy__ds__year
- , subq_8.buy__ds__extract_year
- , subq_8.buy__ds__extract_quarter
- , subq_8.buy__ds__extract_month
- , subq_8.buy__ds__extract_day
- , subq_8.buy__ds__extract_dow
- , subq_8.buy__ds__extract_doy
- , subq_8.metric_time__day
- , subq_8.metric_time__week
- , subq_8.metric_time__month
- , subq_8.metric_time__quarter
- , subq_8.metric_time__year
- , subq_8.metric_time__extract_year
- , subq_8.metric_time__extract_quarter
- , subq_8.metric_time__extract_month
- , subq_8.metric_time__extract_day
- , subq_8.metric_time__extract_dow
- , subq_8.metric_time__extract_doy
- , subq_8.user
- , subq_8.session_id
- , subq_8.buy__user
- , subq_8.buy__session_id
- , subq_8.buys
- , subq_8.buyers
+ subq_17.ds__day
+ , subq_17.ds__week
+ , subq_17.ds__month
+ , subq_17.ds__quarter
+ , subq_17.ds__year
+ , subq_17.ds__extract_year
+ , subq_17.ds__extract_quarter
+ , subq_17.ds__extract_month
+ , subq_17.ds__extract_day
+ , subq_17.ds__extract_dow
+ , subq_17.ds__extract_doy
+ , subq_17.buy__ds__day
+ , subq_17.buy__ds__week
+ , subq_17.buy__ds__month
+ , subq_17.buy__ds__quarter
+ , subq_17.buy__ds__year
+ , subq_17.buy__ds__extract_year
+ , subq_17.buy__ds__extract_quarter
+ , subq_17.buy__ds__extract_month
+ , subq_17.buy__ds__extract_day
+ , subq_17.buy__ds__extract_dow
+ , subq_17.buy__ds__extract_doy
+ , subq_17.metric_time__day
+ , subq_17.metric_time__week
+ , subq_17.metric_time__month
+ , subq_17.metric_time__quarter
+ , subq_17.metric_time__year
+ , subq_17.metric_time__extract_year
+ , subq_17.metric_time__extract_quarter
+ , subq_17.metric_time__extract_month
+ , subq_17.metric_time__extract_day
+ , subq_17.metric_time__extract_dow
+ , subq_17.metric_time__extract_doy
+ , subq_17.user
+ , subq_17.session_id
+ , subq_17.buy__user
+ , subq_17.buy__session_id
+ , subq_17.buys
+ , subq_17.buyers
, uuid() AS mf_internal_uuid
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_7.ds__day
- , subq_7.ds__week
- , subq_7.ds__month
- , subq_7.ds__quarter
- , subq_7.ds__year
- , subq_7.ds__extract_year
- , subq_7.ds__extract_quarter
- , subq_7.ds__extract_month
- , subq_7.ds__extract_day
- , subq_7.ds__extract_dow
- , subq_7.ds__extract_doy
- , subq_7.buy__ds__day
- , subq_7.buy__ds__week
- , subq_7.buy__ds__month
- , subq_7.buy__ds__quarter
- , subq_7.buy__ds__year
- , subq_7.buy__ds__extract_year
- , subq_7.buy__ds__extract_quarter
- , subq_7.buy__ds__extract_month
- , subq_7.buy__ds__extract_day
- , subq_7.buy__ds__extract_dow
- , subq_7.buy__ds__extract_doy
- , subq_7.ds__day AS metric_time__day
- , subq_7.ds__week AS metric_time__week
- , subq_7.ds__month AS metric_time__month
- , subq_7.ds__quarter AS metric_time__quarter
- , subq_7.ds__year AS metric_time__year
- , subq_7.ds__extract_year AS metric_time__extract_year
- , subq_7.ds__extract_quarter AS metric_time__extract_quarter
- , subq_7.ds__extract_month AS metric_time__extract_month
- , subq_7.ds__extract_day AS metric_time__extract_day
- , subq_7.ds__extract_dow AS metric_time__extract_dow
- , subq_7.ds__extract_doy AS metric_time__extract_doy
- , subq_7.user
- , subq_7.session_id
- , subq_7.buy__user
- , subq_7.buy__session_id
- , subq_7.buys
- , subq_7.buyers
+ subq_16.ds__day
+ , subq_16.ds__week
+ , subq_16.ds__month
+ , subq_16.ds__quarter
+ , subq_16.ds__year
+ , subq_16.ds__extract_year
+ , subq_16.ds__extract_quarter
+ , subq_16.ds__extract_month
+ , subq_16.ds__extract_day
+ , subq_16.ds__extract_dow
+ , subq_16.ds__extract_doy
+ , subq_16.buy__ds__day
+ , subq_16.buy__ds__week
+ , subq_16.buy__ds__month
+ , subq_16.buy__ds__quarter
+ , subq_16.buy__ds__year
+ , subq_16.buy__ds__extract_year
+ , subq_16.buy__ds__extract_quarter
+ , subq_16.buy__ds__extract_month
+ , subq_16.buy__ds__extract_day
+ , subq_16.buy__ds__extract_dow
+ , subq_16.buy__ds__extract_doy
+ , subq_16.ds__day AS metric_time__day
+ , subq_16.ds__week AS metric_time__week
+ , subq_16.ds__month AS metric_time__month
+ , subq_16.ds__quarter AS metric_time__quarter
+ , subq_16.ds__year AS metric_time__year
+ , subq_16.ds__extract_year AS metric_time__extract_year
+ , subq_16.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_16.ds__extract_month AS metric_time__extract_month
+ , subq_16.ds__extract_day AS metric_time__extract_day
+ , subq_16.ds__extract_dow AS metric_time__extract_dow
+ , subq_16.ds__extract_doy AS metric_time__extract_doy
+ , subq_16.user
+ , subq_16.session_id
+ , subq_16.buy__user
+ , subq_16.buy__session_id
+ , subq_16.buys
+ , subq_16.buyers
FROM (
-- Read Elements From Semantic Model 'buys_source'
SELECT
1 AS buys
- , buys_source_src_28002.user_id AS buyers
- , DATE_TRUNC('day', buys_source_src_28002.ds) AS ds__day
- , DATE_TRUNC('week', buys_source_src_28002.ds) AS ds__week
- , DATE_TRUNC('month', buys_source_src_28002.ds) AS ds__month
- , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS ds__quarter
- , DATE_TRUNC('year', buys_source_src_28002.ds) AS ds__year
- , EXTRACT(year FROM buys_source_src_28002.ds) AS ds__extract_year
- , EXTRACT(quarter FROM buys_source_src_28002.ds) AS ds__extract_quarter
- , EXTRACT(month FROM buys_source_src_28002.ds) AS ds__extract_month
- , EXTRACT(day FROM buys_source_src_28002.ds) AS ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM buys_source_src_28002.ds) AS ds__extract_dow
- , EXTRACT(doy FROM buys_source_src_28002.ds) AS ds__extract_doy
- , DATE_TRUNC('day', buys_source_src_28002.ds) AS buy__ds__day
- , DATE_TRUNC('week', buys_source_src_28002.ds) AS buy__ds__week
- , DATE_TRUNC('month', buys_source_src_28002.ds) AS buy__ds__month
- , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS buy__ds__quarter
- , DATE_TRUNC('year', buys_source_src_28002.ds) AS buy__ds__year
- , EXTRACT(year FROM buys_source_src_28002.ds) AS buy__ds__extract_year
- , EXTRACT(quarter FROM buys_source_src_28002.ds) AS buy__ds__extract_quarter
- , EXTRACT(month FROM buys_source_src_28002.ds) AS buy__ds__extract_month
- , EXTRACT(day FROM buys_source_src_28002.ds) AS buy__ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM buys_source_src_28002.ds) AS buy__ds__extract_dow
- , EXTRACT(doy FROM buys_source_src_28002.ds) AS buy__ds__extract_doy
- , buys_source_src_28002.user_id AS user
- , buys_source_src_28002.session_id
- , buys_source_src_28002.user_id AS buy__user
- , buys_source_src_28002.session_id AS buy__session_id
- FROM ***************************.fct_buys buys_source_src_28002
- ) subq_7
- ) subq_8
- ) subq_9
+ , buys_source_src_28000.user_id AS buyers
+ , DATE_TRUNC('day', buys_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', buys_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', buys_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', buys_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', buys_source_src_28000.ds) 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
+ , EXTRACT(DAY_OF_WEEK FROM buys_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM buys_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', buys_source_src_28000.ds) AS buy__ds__day
+ , DATE_TRUNC('week', buys_source_src_28000.ds) AS buy__ds__week
+ , DATE_TRUNC('month', buys_source_src_28000.ds) AS buy__ds__month
+ , DATE_TRUNC('quarter', buys_source_src_28000.ds) AS buy__ds__quarter
+ , DATE_TRUNC('year', buys_source_src_28000.ds) 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
+ , EXTRACT(day FROM buys_source_src_28000.ds) AS buy__ds__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM buys_source_src_28000.ds) AS buy__ds__extract_dow
+ , EXTRACT(doy FROM buys_source_src_28000.ds) AS buy__ds__extract_doy
+ , buys_source_src_28000.user_id AS user
+ , buys_source_src_28000.session_id
+ , buys_source_src_28000.user_id AS buy__user
+ , buys_source_src_28000.session_id AS buy__session_id
+ FROM ***************************.fct_buys buys_source_src_28000
+ ) subq_16
+ ) subq_17
+ ) subq_18
ON
- (subq_6.user = subq_9.user) AND ((subq_6.ds__day <= subq_9.ds__day))
- ) subq_10
- ) subq_11
- ) subq_12
+ (
+ subq_15.user = subq_18.user
+ ) AND (
+ (subq_15.ds__day <= subq_18.ds__day)
+ )
+ ) subq_19
+ ) subq_20
+ ) subq_21
GROUP BY
- subq_12.visit__referrer_id
- ) subq_13
+ subq_21.visit__referrer_id
+ ) subq_22
ON
- subq_3.visit__referrer_id = subq_13.visit__referrer_id
+ subq_12.visit__referrer_id = subq_22.visit__referrer_id
GROUP BY
- COALESCE(subq_3.visit__referrer_id, subq_13.visit__referrer_id)
-) subq_14
+ COALESCE(subq_12.visit__referrer_id, subq_22.visit__referrer_id)
+) subq_23
diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Trino/test_conversion_rate__plan0_optimized.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Trino/test_conversion_rate__plan0_optimized.sql
index c2d5f1e7d3..c893747aae 100644
--- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Trino/test_conversion_rate__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Trino/test_conversion_rate__plan0_optimized.sql
@@ -5,9 +5,9 @@ SELECT
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_18.visit__referrer_id, subq_28.visit__referrer_id) AS visit__referrer_id
- , MAX(subq_18.visits) AS visits
- , MAX(subq_28.buys) AS buys
+ COALESCE(subq_27.visit__referrer_id, subq_37.visit__referrer_id) AS visit__referrer_id
+ , MAX(subq_27.visits) AS visits
+ , MAX(subq_37.buys) AS buys
FROM (
-- Aggregate Measures
SELECT
@@ -20,11 +20,11 @@ FROM (
SELECT
referrer_id AS visit__referrer_id
, 1 AS visits
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_17
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_26
GROUP BY
visit__referrer_id
- ) subq_18
+ ) subq_27
FULL OUTER JOIN (
-- Find conversions for user within the range of INF
-- Pass Only Elements: ['buys', 'visit__referrer_id']
@@ -35,12 +35,12 @@ FROM (
FROM (
-- Dedupe the fanout with mf_internal_uuid in the conversion data set
SELECT DISTINCT
- first_value(subq_21.visits) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
- , first_value(subq_21.visit__referrer_id) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visit__referrer_id
- , first_value(subq_21.ds__day) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
- , first_value(subq_21.user) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
- , subq_24.mf_internal_uuid AS mf_internal_uuid
- , subq_24.buys AS buys
+ first_value(subq_30.visits) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
+ , first_value(subq_30.visit__referrer_id) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visit__referrer_id
+ , first_value(subq_30.ds__day) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
+ , first_value(subq_30.user) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
+ , subq_33.mf_internal_uuid AS mf_internal_uuid
+ , subq_33.buys AS buys
FROM (
-- Read Elements From Semantic Model 'visits_source'
-- Metric Time Dimension 'ds'
@@ -50,8 +50,8 @@ FROM (
, user_id AS user
, referrer_id AS visit__referrer_id
, 1 AS visits
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_21
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_30
INNER JOIN (
-- Read Elements From Semantic Model 'buys_source'
-- Metric Time Dimension 'ds'
@@ -61,20 +61,20 @@ FROM (
, user_id AS user
, 1 AS buys
, uuid() AS mf_internal_uuid
- FROM ***************************.fct_buys buys_source_src_28002
- ) subq_24
+ FROM ***************************.fct_buys buys_source_src_28000
+ ) subq_33
ON
(
- subq_21.user = subq_24.user
+ subq_30.user = subq_33.user
) AND (
- (subq_21.ds__day <= subq_24.ds__day)
+ (subq_30.ds__day <= subq_33.ds__day)
)
- ) subq_25
+ ) subq_34
GROUP BY
visit__referrer_id
- ) subq_28
+ ) subq_37
ON
- subq_18.visit__referrer_id = subq_28.visit__referrer_id
+ subq_27.visit__referrer_id = subq_37.visit__referrer_id
GROUP BY
- COALESCE(subq_18.visit__referrer_id, subq_28.visit__referrer_id)
-) subq_29
+ COALESCE(subq_27.visit__referrer_id, subq_37.visit__referrer_id)
+) subq_38
diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Trino/test_conversion_rate_with_constant_properties__plan0.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Trino/test_conversion_rate_with_constant_properties__plan0.sql
index 430ed15ad4..9999b30328 100644
--- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Trino/test_conversion_rate_with_constant_properties__plan0.sql
+++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Trino/test_conversion_rate_with_constant_properties__plan0.sql
@@ -1,381 +1,381 @@
-- Compute Metrics via Expressions
SELECT
- subq_14.metric_time__day
- , subq_14.visit__referrer_id
- , CAST(subq_14.buys AS DOUBLE) / CAST(NULLIF(subq_14.visits, 0) AS DOUBLE) AS visit_buy_conversion_rate_by_session
+ subq_23.metric_time__day
+ , subq_23.visit__referrer_id
+ , CAST(subq_23.buys AS DOUBLE) / CAST(NULLIF(subq_23.visits, 0) AS DOUBLE) AS visit_buy_conversion_rate_by_session
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_3.metric_time__day, subq_13.metric_time__day) AS metric_time__day
- , COALESCE(subq_3.visit__referrer_id, subq_13.visit__referrer_id) AS visit__referrer_id
- , MAX(subq_3.visits) AS visits
- , MAX(subq_13.buys) AS buys
+ COALESCE(subq_12.metric_time__day, subq_22.metric_time__day) AS metric_time__day
+ , COALESCE(subq_12.visit__referrer_id, subq_22.visit__referrer_id) AS visit__referrer_id
+ , MAX(subq_12.visits) AS visits
+ , MAX(subq_22.buys) AS buys
FROM (
-- Aggregate Measures
SELECT
- subq_2.metric_time__day
- , subq_2.visit__referrer_id
- , SUM(subq_2.visits) AS visits
+ subq_11.metric_time__day
+ , subq_11.visit__referrer_id
+ , SUM(subq_11.visits) AS visits
FROM (
-- Pass Only Elements: ['visits', 'visit__referrer_id', 'metric_time__day']
SELECT
- subq_1.metric_time__day
- , subq_1.visit__referrer_id
- , subq_1.visits
+ subq_10.metric_time__day
+ , subq_10.visit__referrer_id
+ , subq_10.visits
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.visit__ds__day
- , subq_0.visit__ds__week
- , subq_0.visit__ds__month
- , subq_0.visit__ds__quarter
- , subq_0.visit__ds__year
- , subq_0.visit__ds__extract_year
- , subq_0.visit__ds__extract_quarter
- , subq_0.visit__ds__extract_month
- , subq_0.visit__ds__extract_day
- , subq_0.visit__ds__extract_dow
- , subq_0.visit__ds__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.user
- , subq_0.session
- , subq_0.visit__user
- , subq_0.visit__session
- , subq_0.referrer_id
- , subq_0.visit__referrer_id
- , subq_0.visits
- , subq_0.visitors
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.visit__ds__day
+ , subq_9.visit__ds__week
+ , subq_9.visit__ds__month
+ , subq_9.visit__ds__quarter
+ , subq_9.visit__ds__year
+ , subq_9.visit__ds__extract_year
+ , subq_9.visit__ds__extract_quarter
+ , subq_9.visit__ds__extract_month
+ , subq_9.visit__ds__extract_day
+ , subq_9.visit__ds__extract_dow
+ , subq_9.visit__ds__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.user
+ , subq_9.session
+ , subq_9.visit__user
+ , subq_9.visit__session
+ , subq_9.referrer_id
+ , subq_9.visit__referrer_id
+ , subq_9.visits
+ , subq_9.visitors
FROM (
-- Read Elements From Semantic Model 'visits_source'
SELECT
1 AS visits
- , visits_source_src_28011.user_id AS visitors
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM visits_source_src_28011.ds) AS ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy
- , visits_source_src_28011.referrer_id
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM visits_source_src_28011.ds) AS visit__ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy
- , visits_source_src_28011.referrer_id AS visit__referrer_id
- , visits_source_src_28011.user_id AS user
- , visits_source_src_28011.session_id AS session
- , visits_source_src_28011.user_id AS visit__user
- , visits_source_src_28011.session_id AS visit__session
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_0
- ) subq_1
- ) subq_2
+ , visits_source_src_28000.user_id AS visitors
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS ds__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM visits_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS ds__extract_doy
+ , visits_source_src_28000.referrer_id
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS visit__ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS visit__ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS visit__ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS visit__ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS visit__ds__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM visits_source_src_28000.ds) AS visit__ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS visit__ds__extract_doy
+ , visits_source_src_28000.referrer_id AS visit__referrer_id
+ , visits_source_src_28000.user_id AS user
+ , visits_source_src_28000.session_id AS session
+ , visits_source_src_28000.user_id AS visit__user
+ , visits_source_src_28000.session_id AS visit__session
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
GROUP BY
- subq_2.metric_time__day
- , subq_2.visit__referrer_id
- ) subq_3
+ subq_11.metric_time__day
+ , subq_11.visit__referrer_id
+ ) subq_12
FULL OUTER JOIN (
-- Aggregate Measures
SELECT
- subq_12.metric_time__day
- , subq_12.visit__referrer_id
- , SUM(subq_12.buys) AS buys
+ subq_21.metric_time__day
+ , subq_21.visit__referrer_id
+ , SUM(subq_21.buys) AS buys
FROM (
-- Pass Only Elements: ['buys', 'visit__referrer_id', 'metric_time__day']
SELECT
- subq_11.metric_time__day
- , subq_11.visit__referrer_id
- , subq_11.buys
+ subq_20.metric_time__day
+ , subq_20.visit__referrer_id
+ , subq_20.buys
FROM (
-- Find conversions for user within the range of 7 day
SELECT
- subq_10.ds__day
- , subq_10.metric_time__day
- , subq_10.user
- , subq_10.session
- , subq_10.visit__referrer_id
- , subq_10.buys
- , subq_10.visits
+ subq_19.ds__day
+ , subq_19.metric_time__day
+ , subq_19.user
+ , subq_19.session
+ , subq_19.visit__referrer_id
+ , subq_19.buys
+ , subq_19.visits
FROM (
-- Dedupe the fanout with mf_internal_uuid in the conversion data set
SELECT DISTINCT
- first_value(subq_6.visits) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid, subq_9.session_id ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
- , first_value(subq_6.visit__referrer_id) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid, subq_9.session_id ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visit__referrer_id
- , first_value(subq_6.ds__day) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid, subq_9.session_id ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
- , first_value(subq_6.metric_time__day) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid, subq_9.session_id ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS metric_time__day
- , first_value(subq_6.user) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid, subq_9.session_id ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
- , first_value(subq_6.session) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid, subq_9.session_id ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS session
- , subq_9.mf_internal_uuid AS mf_internal_uuid
- , subq_9.buys AS buys
+ first_value(subq_15.visits) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid, subq_18.session_id ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
+ , first_value(subq_15.visit__referrer_id) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid, subq_18.session_id ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visit__referrer_id
+ , first_value(subq_15.ds__day) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid, subq_18.session_id ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
+ , first_value(subq_15.metric_time__day) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid, subq_18.session_id ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS metric_time__day
+ , first_value(subq_15.user) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid, subq_18.session_id ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
+ , first_value(subq_15.session) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid, subq_18.session_id ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS session
+ , subq_18.mf_internal_uuid AS mf_internal_uuid
+ , subq_18.buys AS buys
FROM (
-- Pass Only Elements: ['visits', 'visit__referrer_id', 'ds__day', 'metric_time__day', 'user', 'session']
SELECT
- subq_5.ds__day
- , subq_5.metric_time__day
- , subq_5.user
- , subq_5.session
- , subq_5.visit__referrer_id
- , subq_5.visits
+ subq_14.ds__day
+ , subq_14.metric_time__day
+ , subq_14.user
+ , subq_14.session
+ , subq_14.visit__referrer_id
+ , subq_14.visits
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_4.ds__day
- , subq_4.ds__week
- , subq_4.ds__month
- , subq_4.ds__quarter
- , subq_4.ds__year
- , subq_4.ds__extract_year
- , subq_4.ds__extract_quarter
- , subq_4.ds__extract_month
- , subq_4.ds__extract_day
- , subq_4.ds__extract_dow
- , subq_4.ds__extract_doy
- , subq_4.visit__ds__day
- , subq_4.visit__ds__week
- , subq_4.visit__ds__month
- , subq_4.visit__ds__quarter
- , subq_4.visit__ds__year
- , subq_4.visit__ds__extract_year
- , subq_4.visit__ds__extract_quarter
- , subq_4.visit__ds__extract_month
- , subq_4.visit__ds__extract_day
- , subq_4.visit__ds__extract_dow
- , subq_4.visit__ds__extract_doy
- , subq_4.ds__day AS metric_time__day
- , subq_4.ds__week AS metric_time__week
- , subq_4.ds__month AS metric_time__month
- , subq_4.ds__quarter AS metric_time__quarter
- , subq_4.ds__year AS metric_time__year
- , subq_4.ds__extract_year AS metric_time__extract_year
- , subq_4.ds__extract_quarter AS metric_time__extract_quarter
- , subq_4.ds__extract_month AS metric_time__extract_month
- , subq_4.ds__extract_day AS metric_time__extract_day
- , subq_4.ds__extract_dow AS metric_time__extract_dow
- , subq_4.ds__extract_doy AS metric_time__extract_doy
- , subq_4.user
- , subq_4.session
- , subq_4.visit__user
- , subq_4.visit__session
- , subq_4.referrer_id
- , subq_4.visit__referrer_id
- , subq_4.visits
- , subq_4.visitors
+ subq_13.ds__day
+ , subq_13.ds__week
+ , subq_13.ds__month
+ , subq_13.ds__quarter
+ , subq_13.ds__year
+ , subq_13.ds__extract_year
+ , subq_13.ds__extract_quarter
+ , subq_13.ds__extract_month
+ , subq_13.ds__extract_day
+ , subq_13.ds__extract_dow
+ , subq_13.ds__extract_doy
+ , subq_13.visit__ds__day
+ , subq_13.visit__ds__week
+ , subq_13.visit__ds__month
+ , subq_13.visit__ds__quarter
+ , subq_13.visit__ds__year
+ , subq_13.visit__ds__extract_year
+ , subq_13.visit__ds__extract_quarter
+ , subq_13.visit__ds__extract_month
+ , subq_13.visit__ds__extract_day
+ , subq_13.visit__ds__extract_dow
+ , subq_13.visit__ds__extract_doy
+ , subq_13.ds__day AS metric_time__day
+ , subq_13.ds__week AS metric_time__week
+ , subq_13.ds__month AS metric_time__month
+ , subq_13.ds__quarter AS metric_time__quarter
+ , subq_13.ds__year AS metric_time__year
+ , subq_13.ds__extract_year AS metric_time__extract_year
+ , subq_13.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_13.ds__extract_month AS metric_time__extract_month
+ , subq_13.ds__extract_day AS metric_time__extract_day
+ , subq_13.ds__extract_dow AS metric_time__extract_dow
+ , subq_13.ds__extract_doy AS metric_time__extract_doy
+ , subq_13.user
+ , subq_13.session
+ , subq_13.visit__user
+ , subq_13.visit__session
+ , subq_13.referrer_id
+ , subq_13.visit__referrer_id
+ , subq_13.visits
+ , subq_13.visitors
FROM (
-- Read Elements From Semantic Model 'visits_source'
SELECT
1 AS visits
- , visits_source_src_28011.user_id AS visitors
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM visits_source_src_28011.ds) AS ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy
- , visits_source_src_28011.referrer_id
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM visits_source_src_28011.ds) AS visit__ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy
- , visits_source_src_28011.referrer_id AS visit__referrer_id
- , visits_source_src_28011.user_id AS user
- , visits_source_src_28011.session_id AS session
- , visits_source_src_28011.user_id AS visit__user
- , visits_source_src_28011.session_id AS visit__session
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_4
- ) subq_5
- ) subq_6
+ , visits_source_src_28000.user_id AS visitors
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS ds__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM visits_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS ds__extract_doy
+ , visits_source_src_28000.referrer_id
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS visit__ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS visit__ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS visit__ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS visit__ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS visit__ds__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM visits_source_src_28000.ds) AS visit__ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS visit__ds__extract_doy
+ , visits_source_src_28000.referrer_id AS visit__referrer_id
+ , visits_source_src_28000.user_id AS user
+ , visits_source_src_28000.session_id AS session
+ , visits_source_src_28000.user_id AS visit__user
+ , visits_source_src_28000.session_id AS visit__session
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_13
+ ) subq_14
+ ) subq_15
INNER JOIN (
-- Add column with generated UUID
SELECT
- subq_8.ds__day
- , subq_8.ds__week
- , subq_8.ds__month
- , subq_8.ds__quarter
- , subq_8.ds__year
- , subq_8.ds__extract_year
- , subq_8.ds__extract_quarter
- , subq_8.ds__extract_month
- , subq_8.ds__extract_day
- , subq_8.ds__extract_dow
- , subq_8.ds__extract_doy
- , subq_8.buy__ds__day
- , subq_8.buy__ds__week
- , subq_8.buy__ds__month
- , subq_8.buy__ds__quarter
- , subq_8.buy__ds__year
- , subq_8.buy__ds__extract_year
- , subq_8.buy__ds__extract_quarter
- , subq_8.buy__ds__extract_month
- , subq_8.buy__ds__extract_day
- , subq_8.buy__ds__extract_dow
- , subq_8.buy__ds__extract_doy
- , subq_8.metric_time__day
- , subq_8.metric_time__week
- , subq_8.metric_time__month
- , subq_8.metric_time__quarter
- , subq_8.metric_time__year
- , subq_8.metric_time__extract_year
- , subq_8.metric_time__extract_quarter
- , subq_8.metric_time__extract_month
- , subq_8.metric_time__extract_day
- , subq_8.metric_time__extract_dow
- , subq_8.metric_time__extract_doy
- , subq_8.user
- , subq_8.session_id
- , subq_8.buy__user
- , subq_8.buy__session_id
- , subq_8.buys
- , subq_8.buyers
+ subq_17.ds__day
+ , subq_17.ds__week
+ , subq_17.ds__month
+ , subq_17.ds__quarter
+ , subq_17.ds__year
+ , subq_17.ds__extract_year
+ , subq_17.ds__extract_quarter
+ , subq_17.ds__extract_month
+ , subq_17.ds__extract_day
+ , subq_17.ds__extract_dow
+ , subq_17.ds__extract_doy
+ , subq_17.buy__ds__day
+ , subq_17.buy__ds__week
+ , subq_17.buy__ds__month
+ , subq_17.buy__ds__quarter
+ , subq_17.buy__ds__year
+ , subq_17.buy__ds__extract_year
+ , subq_17.buy__ds__extract_quarter
+ , subq_17.buy__ds__extract_month
+ , subq_17.buy__ds__extract_day
+ , subq_17.buy__ds__extract_dow
+ , subq_17.buy__ds__extract_doy
+ , subq_17.metric_time__day
+ , subq_17.metric_time__week
+ , subq_17.metric_time__month
+ , subq_17.metric_time__quarter
+ , subq_17.metric_time__year
+ , subq_17.metric_time__extract_year
+ , subq_17.metric_time__extract_quarter
+ , subq_17.metric_time__extract_month
+ , subq_17.metric_time__extract_day
+ , subq_17.metric_time__extract_dow
+ , subq_17.metric_time__extract_doy
+ , subq_17.user
+ , subq_17.session_id
+ , subq_17.buy__user
+ , subq_17.buy__session_id
+ , subq_17.buys
+ , subq_17.buyers
, uuid() AS mf_internal_uuid
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_7.ds__day
- , subq_7.ds__week
- , subq_7.ds__month
- , subq_7.ds__quarter
- , subq_7.ds__year
- , subq_7.ds__extract_year
- , subq_7.ds__extract_quarter
- , subq_7.ds__extract_month
- , subq_7.ds__extract_day
- , subq_7.ds__extract_dow
- , subq_7.ds__extract_doy
- , subq_7.buy__ds__day
- , subq_7.buy__ds__week
- , subq_7.buy__ds__month
- , subq_7.buy__ds__quarter
- , subq_7.buy__ds__year
- , subq_7.buy__ds__extract_year
- , subq_7.buy__ds__extract_quarter
- , subq_7.buy__ds__extract_month
- , subq_7.buy__ds__extract_day
- , subq_7.buy__ds__extract_dow
- , subq_7.buy__ds__extract_doy
- , subq_7.ds__day AS metric_time__day
- , subq_7.ds__week AS metric_time__week
- , subq_7.ds__month AS metric_time__month
- , subq_7.ds__quarter AS metric_time__quarter
- , subq_7.ds__year AS metric_time__year
- , subq_7.ds__extract_year AS metric_time__extract_year
- , subq_7.ds__extract_quarter AS metric_time__extract_quarter
- , subq_7.ds__extract_month AS metric_time__extract_month
- , subq_7.ds__extract_day AS metric_time__extract_day
- , subq_7.ds__extract_dow AS metric_time__extract_dow
- , subq_7.ds__extract_doy AS metric_time__extract_doy
- , subq_7.user
- , subq_7.session_id
- , subq_7.buy__user
- , subq_7.buy__session_id
- , subq_7.buys
- , subq_7.buyers
+ subq_16.ds__day
+ , subq_16.ds__week
+ , subq_16.ds__month
+ , subq_16.ds__quarter
+ , subq_16.ds__year
+ , subq_16.ds__extract_year
+ , subq_16.ds__extract_quarter
+ , subq_16.ds__extract_month
+ , subq_16.ds__extract_day
+ , subq_16.ds__extract_dow
+ , subq_16.ds__extract_doy
+ , subq_16.buy__ds__day
+ , subq_16.buy__ds__week
+ , subq_16.buy__ds__month
+ , subq_16.buy__ds__quarter
+ , subq_16.buy__ds__year
+ , subq_16.buy__ds__extract_year
+ , subq_16.buy__ds__extract_quarter
+ , subq_16.buy__ds__extract_month
+ , subq_16.buy__ds__extract_day
+ , subq_16.buy__ds__extract_dow
+ , subq_16.buy__ds__extract_doy
+ , subq_16.ds__day AS metric_time__day
+ , subq_16.ds__week AS metric_time__week
+ , subq_16.ds__month AS metric_time__month
+ , subq_16.ds__quarter AS metric_time__quarter
+ , subq_16.ds__year AS metric_time__year
+ , subq_16.ds__extract_year AS metric_time__extract_year
+ , subq_16.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_16.ds__extract_month AS metric_time__extract_month
+ , subq_16.ds__extract_day AS metric_time__extract_day
+ , subq_16.ds__extract_dow AS metric_time__extract_dow
+ , subq_16.ds__extract_doy AS metric_time__extract_doy
+ , subq_16.user
+ , subq_16.session_id
+ , subq_16.buy__user
+ , subq_16.buy__session_id
+ , subq_16.buys
+ , subq_16.buyers
FROM (
-- Read Elements From Semantic Model 'buys_source'
SELECT
1 AS buys
- , buys_source_src_28002.user_id AS buyers
- , DATE_TRUNC('day', buys_source_src_28002.ds) AS ds__day
- , DATE_TRUNC('week', buys_source_src_28002.ds) AS ds__week
- , DATE_TRUNC('month', buys_source_src_28002.ds) AS ds__month
- , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS ds__quarter
- , DATE_TRUNC('year', buys_source_src_28002.ds) AS ds__year
- , EXTRACT(year FROM buys_source_src_28002.ds) AS ds__extract_year
- , EXTRACT(quarter FROM buys_source_src_28002.ds) AS ds__extract_quarter
- , EXTRACT(month FROM buys_source_src_28002.ds) AS ds__extract_month
- , EXTRACT(day FROM buys_source_src_28002.ds) AS ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM buys_source_src_28002.ds) AS ds__extract_dow
- , EXTRACT(doy FROM buys_source_src_28002.ds) AS ds__extract_doy
- , DATE_TRUNC('day', buys_source_src_28002.ds) AS buy__ds__day
- , DATE_TRUNC('week', buys_source_src_28002.ds) AS buy__ds__week
- , DATE_TRUNC('month', buys_source_src_28002.ds) AS buy__ds__month
- , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS buy__ds__quarter
- , DATE_TRUNC('year', buys_source_src_28002.ds) AS buy__ds__year
- , EXTRACT(year FROM buys_source_src_28002.ds) AS buy__ds__extract_year
- , EXTRACT(quarter FROM buys_source_src_28002.ds) AS buy__ds__extract_quarter
- , EXTRACT(month FROM buys_source_src_28002.ds) AS buy__ds__extract_month
- , EXTRACT(day FROM buys_source_src_28002.ds) AS buy__ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM buys_source_src_28002.ds) AS buy__ds__extract_dow
- , EXTRACT(doy FROM buys_source_src_28002.ds) AS buy__ds__extract_doy
- , buys_source_src_28002.user_id AS user
- , buys_source_src_28002.session_id
- , buys_source_src_28002.user_id AS buy__user
- , buys_source_src_28002.session_id AS buy__session_id
- FROM ***************************.fct_buys buys_source_src_28002
- ) subq_7
- ) subq_8
- ) subq_9
+ , buys_source_src_28000.user_id AS buyers
+ , DATE_TRUNC('day', buys_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', buys_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', buys_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', buys_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', buys_source_src_28000.ds) 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
+ , EXTRACT(DAY_OF_WEEK FROM buys_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM buys_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', buys_source_src_28000.ds) AS buy__ds__day
+ , DATE_TRUNC('week', buys_source_src_28000.ds) AS buy__ds__week
+ , DATE_TRUNC('month', buys_source_src_28000.ds) AS buy__ds__month
+ , DATE_TRUNC('quarter', buys_source_src_28000.ds) AS buy__ds__quarter
+ , DATE_TRUNC('year', buys_source_src_28000.ds) 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
+ , EXTRACT(day FROM buys_source_src_28000.ds) AS buy__ds__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM buys_source_src_28000.ds) AS buy__ds__extract_dow
+ , EXTRACT(doy FROM buys_source_src_28000.ds) AS buy__ds__extract_doy
+ , buys_source_src_28000.user_id AS user
+ , buys_source_src_28000.session_id
+ , buys_source_src_28000.user_id AS buy__user
+ , buys_source_src_28000.session_id AS buy__session_id
+ FROM ***************************.fct_buys buys_source_src_28000
+ ) subq_16
+ ) subq_17
+ ) subq_18
ON
(
- subq_6.user = subq_9.user
+ subq_15.user = subq_18.user
) AND (
- subq_6.session = subq_9.session_id
+ subq_15.session = subq_18.session_id
) AND (
(
- subq_6.ds__day <= subq_9.ds__day
+ subq_15.ds__day <= subq_18.ds__day
) AND (
- subq_6.ds__day > DATE_ADD('day', -7, subq_9.ds__day)
+ subq_15.ds__day > DATE_ADD('day', -7, subq_18.ds__day)
)
)
- ) subq_10
- ) subq_11
- ) subq_12
+ ) subq_19
+ ) subq_20
+ ) subq_21
GROUP BY
- subq_12.metric_time__day
- , subq_12.visit__referrer_id
- ) subq_13
+ subq_21.metric_time__day
+ , subq_21.visit__referrer_id
+ ) subq_22
ON
(
- subq_3.visit__referrer_id = subq_13.visit__referrer_id
+ subq_12.visit__referrer_id = subq_22.visit__referrer_id
) AND (
- subq_3.metric_time__day = subq_13.metric_time__day
+ subq_12.metric_time__day = subq_22.metric_time__day
)
GROUP BY
- COALESCE(subq_3.metric_time__day, subq_13.metric_time__day)
- , COALESCE(subq_3.visit__referrer_id, subq_13.visit__referrer_id)
-) subq_14
+ COALESCE(subq_12.metric_time__day, subq_22.metric_time__day)
+ , COALESCE(subq_12.visit__referrer_id, subq_22.visit__referrer_id)
+) subq_23
diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Trino/test_conversion_rate_with_constant_properties__plan0_optimized.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Trino/test_conversion_rate_with_constant_properties__plan0_optimized.sql
index 5e9b77c8ca..f2c83ba8a1 100644
--- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Trino/test_conversion_rate_with_constant_properties__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Trino/test_conversion_rate_with_constant_properties__plan0_optimized.sql
@@ -6,10 +6,10 @@ SELECT
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_18.metric_time__day, subq_28.metric_time__day) AS metric_time__day
- , COALESCE(subq_18.visit__referrer_id, subq_28.visit__referrer_id) AS visit__referrer_id
- , MAX(subq_18.visits) AS visits
- , MAX(subq_28.buys) AS buys
+ COALESCE(subq_27.metric_time__day, subq_37.metric_time__day) AS metric_time__day
+ , COALESCE(subq_27.visit__referrer_id, subq_37.visit__referrer_id) AS visit__referrer_id
+ , MAX(subq_27.visits) AS visits
+ , MAX(subq_37.buys) AS buys
FROM (
-- Aggregate Measures
SELECT
@@ -24,12 +24,12 @@ FROM (
DATE_TRUNC('day', ds) AS metric_time__day
, referrer_id AS visit__referrer_id
, 1 AS visits
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_17
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_26
GROUP BY
metric_time__day
, visit__referrer_id
- ) subq_18
+ ) subq_27
FULL OUTER JOIN (
-- Find conversions for user within the range of 7 day
-- Pass Only Elements: ['buys', 'visit__referrer_id', 'metric_time__day']
@@ -41,14 +41,14 @@ FROM (
FROM (
-- Dedupe the fanout with mf_internal_uuid in the conversion data set
SELECT DISTINCT
- first_value(subq_21.visits) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid, subq_24.session_id ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
- , first_value(subq_21.visit__referrer_id) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid, subq_24.session_id ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visit__referrer_id
- , first_value(subq_21.ds__day) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid, subq_24.session_id ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
- , first_value(subq_21.metric_time__day) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid, subq_24.session_id ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS metric_time__day
- , first_value(subq_21.user) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid, subq_24.session_id ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
- , first_value(subq_21.session) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid, subq_24.session_id ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS session
- , subq_24.mf_internal_uuid AS mf_internal_uuid
- , subq_24.buys AS buys
+ first_value(subq_30.visits) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid, subq_33.session_id ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
+ , first_value(subq_30.visit__referrer_id) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid, subq_33.session_id ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visit__referrer_id
+ , first_value(subq_30.ds__day) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid, subq_33.session_id ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
+ , first_value(subq_30.metric_time__day) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid, subq_33.session_id ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS metric_time__day
+ , first_value(subq_30.user) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid, subq_33.session_id ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
+ , first_value(subq_30.session) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid, subq_33.session_id ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS session
+ , subq_33.mf_internal_uuid AS mf_internal_uuid
+ , subq_33.buys AS buys
FROM (
-- Read Elements From Semantic Model 'visits_source'
-- Metric Time Dimension 'ds'
@@ -60,8 +60,8 @@ FROM (
, session_id AS session
, referrer_id AS visit__referrer_id
, 1 AS visits
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_21
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_30
INNER JOIN (
-- Read Elements From Semantic Model 'buys_source'
-- Metric Time Dimension 'ds'
@@ -72,32 +72,32 @@ FROM (
, session_id
, 1 AS buys
, uuid() AS mf_internal_uuid
- FROM ***************************.fct_buys buys_source_src_28002
- ) subq_24
+ FROM ***************************.fct_buys buys_source_src_28000
+ ) subq_33
ON
(
- subq_21.user = subq_24.user
+ subq_30.user = subq_33.user
) AND (
- subq_21.session = subq_24.session_id
+ subq_30.session = subq_33.session_id
) AND (
(
- subq_21.ds__day <= subq_24.ds__day
+ subq_30.ds__day <= subq_33.ds__day
) AND (
- subq_21.ds__day > DATE_ADD('day', -7, subq_24.ds__day)
+ subq_30.ds__day > DATE_ADD('day', -7, subq_33.ds__day)
)
)
- ) subq_25
+ ) subq_34
GROUP BY
metric_time__day
, visit__referrer_id
- ) subq_28
+ ) subq_37
ON
(
- subq_18.visit__referrer_id = subq_28.visit__referrer_id
+ subq_27.visit__referrer_id = subq_37.visit__referrer_id
) AND (
- subq_18.metric_time__day = subq_28.metric_time__day
+ subq_27.metric_time__day = subq_37.metric_time__day
)
GROUP BY
- COALESCE(subq_18.metric_time__day, subq_28.metric_time__day)
- , COALESCE(subq_18.visit__referrer_id, subq_28.visit__referrer_id)
-) subq_29
+ COALESCE(subq_27.metric_time__day, subq_37.metric_time__day)
+ , COALESCE(subq_27.visit__referrer_id, subq_37.visit__referrer_id)
+) subq_38
diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Trino/test_conversion_rate_with_no_group_by__plan0.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Trino/test_conversion_rate_with_no_group_by__plan0.sql
index 995a089d04..5794883bd1 100644
--- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Trino/test_conversion_rate_with_no_group_by__plan0.sql
+++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Trino/test_conversion_rate_with_no_group_by__plan0.sql
@@ -1,343 +1,343 @@
-- Compute Metrics via Expressions
SELECT
- CAST(subq_14.buys AS DOUBLE) / CAST(NULLIF(subq_14.visits, 0) AS DOUBLE) AS visit_buy_conversion_rate_7days
+ CAST(subq_23.buys AS DOUBLE) / CAST(NULLIF(subq_23.visits, 0) AS DOUBLE) AS visit_buy_conversion_rate_7days
FROM (
-- Combine Aggregated Outputs
SELECT
- MAX(subq_3.visits) AS visits
- , MAX(subq_13.buys) AS buys
+ MAX(subq_12.visits) AS visits
+ , MAX(subq_22.buys) AS buys
FROM (
-- Aggregate Measures
SELECT
- SUM(subq_2.visits) AS visits
+ SUM(subq_11.visits) AS visits
FROM (
-- Pass Only Elements: ['visits',]
SELECT
- subq_1.visits
+ subq_10.visits
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.visit__ds__day
- , subq_0.visit__ds__week
- , subq_0.visit__ds__month
- , subq_0.visit__ds__quarter
- , subq_0.visit__ds__year
- , subq_0.visit__ds__extract_year
- , subq_0.visit__ds__extract_quarter
- , subq_0.visit__ds__extract_month
- , subq_0.visit__ds__extract_day
- , subq_0.visit__ds__extract_dow
- , subq_0.visit__ds__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.user
- , subq_0.session
- , subq_0.visit__user
- , subq_0.visit__session
- , subq_0.referrer_id
- , subq_0.visit__referrer_id
- , subq_0.visits
- , subq_0.visitors
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.visit__ds__day
+ , subq_9.visit__ds__week
+ , subq_9.visit__ds__month
+ , subq_9.visit__ds__quarter
+ , subq_9.visit__ds__year
+ , subq_9.visit__ds__extract_year
+ , subq_9.visit__ds__extract_quarter
+ , subq_9.visit__ds__extract_month
+ , subq_9.visit__ds__extract_day
+ , subq_9.visit__ds__extract_dow
+ , subq_9.visit__ds__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.user
+ , subq_9.session
+ , subq_9.visit__user
+ , subq_9.visit__session
+ , subq_9.referrer_id
+ , subq_9.visit__referrer_id
+ , subq_9.visits
+ , subq_9.visitors
FROM (
-- Read Elements From Semantic Model 'visits_source'
SELECT
1 AS visits
- , visits_source_src_28011.user_id AS visitors
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM visits_source_src_28011.ds) AS ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy
- , visits_source_src_28011.referrer_id
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM visits_source_src_28011.ds) AS visit__ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy
- , visits_source_src_28011.referrer_id AS visit__referrer_id
- , visits_source_src_28011.user_id AS user
- , visits_source_src_28011.session_id AS session
- , visits_source_src_28011.user_id AS visit__user
- , visits_source_src_28011.session_id AS visit__session
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_0
- ) subq_1
- ) subq_2
- ) subq_3
+ , visits_source_src_28000.user_id AS visitors
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS ds__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM visits_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS ds__extract_doy
+ , visits_source_src_28000.referrer_id
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS visit__ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS visit__ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS visit__ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS visit__ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS visit__ds__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM visits_source_src_28000.ds) AS visit__ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS visit__ds__extract_doy
+ , visits_source_src_28000.referrer_id AS visit__referrer_id
+ , visits_source_src_28000.user_id AS user
+ , visits_source_src_28000.session_id AS session
+ , visits_source_src_28000.user_id AS visit__user
+ , visits_source_src_28000.session_id AS visit__session
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
+ ) subq_12
CROSS JOIN (
-- Aggregate Measures
SELECT
- SUM(subq_12.buys) AS buys
+ SUM(subq_21.buys) AS buys
FROM (
-- Pass Only Elements: ['buys',]
SELECT
- subq_11.buys
+ subq_20.buys
FROM (
-- Find conversions for user within the range of 7 day
SELECT
- subq_10.ds__day
- , subq_10.user
- , subq_10.buys
- , subq_10.visits
+ subq_19.ds__day
+ , subq_19.user
+ , subq_19.buys
+ , subq_19.visits
FROM (
-- Dedupe the fanout with mf_internal_uuid in the conversion data set
SELECT DISTINCT
- first_value(subq_6.visits) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
- , first_value(subq_6.ds__day) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
- , first_value(subq_6.user) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
- , subq_9.mf_internal_uuid AS mf_internal_uuid
- , subq_9.buys AS buys
+ first_value(subq_15.visits) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
+ , first_value(subq_15.ds__day) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
+ , first_value(subq_15.user) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
+ , subq_18.mf_internal_uuid AS mf_internal_uuid
+ , subq_18.buys AS buys
FROM (
-- Pass Only Elements: ['visits', 'ds__day', 'user']
SELECT
- subq_5.ds__day
- , subq_5.user
- , subq_5.visits
+ subq_14.ds__day
+ , subq_14.user
+ , subq_14.visits
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_4.ds__day
- , subq_4.ds__week
- , subq_4.ds__month
- , subq_4.ds__quarter
- , subq_4.ds__year
- , subq_4.ds__extract_year
- , subq_4.ds__extract_quarter
- , subq_4.ds__extract_month
- , subq_4.ds__extract_day
- , subq_4.ds__extract_dow
- , subq_4.ds__extract_doy
- , subq_4.visit__ds__day
- , subq_4.visit__ds__week
- , subq_4.visit__ds__month
- , subq_4.visit__ds__quarter
- , subq_4.visit__ds__year
- , subq_4.visit__ds__extract_year
- , subq_4.visit__ds__extract_quarter
- , subq_4.visit__ds__extract_month
- , subq_4.visit__ds__extract_day
- , subq_4.visit__ds__extract_dow
- , subq_4.visit__ds__extract_doy
- , subq_4.ds__day AS metric_time__day
- , subq_4.ds__week AS metric_time__week
- , subq_4.ds__month AS metric_time__month
- , subq_4.ds__quarter AS metric_time__quarter
- , subq_4.ds__year AS metric_time__year
- , subq_4.ds__extract_year AS metric_time__extract_year
- , subq_4.ds__extract_quarter AS metric_time__extract_quarter
- , subq_4.ds__extract_month AS metric_time__extract_month
- , subq_4.ds__extract_day AS metric_time__extract_day
- , subq_4.ds__extract_dow AS metric_time__extract_dow
- , subq_4.ds__extract_doy AS metric_time__extract_doy
- , subq_4.user
- , subq_4.session
- , subq_4.visit__user
- , subq_4.visit__session
- , subq_4.referrer_id
- , subq_4.visit__referrer_id
- , subq_4.visits
- , subq_4.visitors
+ subq_13.ds__day
+ , subq_13.ds__week
+ , subq_13.ds__month
+ , subq_13.ds__quarter
+ , subq_13.ds__year
+ , subq_13.ds__extract_year
+ , subq_13.ds__extract_quarter
+ , subq_13.ds__extract_month
+ , subq_13.ds__extract_day
+ , subq_13.ds__extract_dow
+ , subq_13.ds__extract_doy
+ , subq_13.visit__ds__day
+ , subq_13.visit__ds__week
+ , subq_13.visit__ds__month
+ , subq_13.visit__ds__quarter
+ , subq_13.visit__ds__year
+ , subq_13.visit__ds__extract_year
+ , subq_13.visit__ds__extract_quarter
+ , subq_13.visit__ds__extract_month
+ , subq_13.visit__ds__extract_day
+ , subq_13.visit__ds__extract_dow
+ , subq_13.visit__ds__extract_doy
+ , subq_13.ds__day AS metric_time__day
+ , subq_13.ds__week AS metric_time__week
+ , subq_13.ds__month AS metric_time__month
+ , subq_13.ds__quarter AS metric_time__quarter
+ , subq_13.ds__year AS metric_time__year
+ , subq_13.ds__extract_year AS metric_time__extract_year
+ , subq_13.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_13.ds__extract_month AS metric_time__extract_month
+ , subq_13.ds__extract_day AS metric_time__extract_day
+ , subq_13.ds__extract_dow AS metric_time__extract_dow
+ , subq_13.ds__extract_doy AS metric_time__extract_doy
+ , subq_13.user
+ , subq_13.session
+ , subq_13.visit__user
+ , subq_13.visit__session
+ , subq_13.referrer_id
+ , subq_13.visit__referrer_id
+ , subq_13.visits
+ , subq_13.visitors
FROM (
-- Read Elements From Semantic Model 'visits_source'
SELECT
1 AS visits
- , visits_source_src_28011.user_id AS visitors
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM visits_source_src_28011.ds) AS ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy
- , visits_source_src_28011.referrer_id
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM visits_source_src_28011.ds) AS visit__ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy
- , visits_source_src_28011.referrer_id AS visit__referrer_id
- , visits_source_src_28011.user_id AS user
- , visits_source_src_28011.session_id AS session
- , visits_source_src_28011.user_id AS visit__user
- , visits_source_src_28011.session_id AS visit__session
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_4
- ) subq_5
- ) subq_6
+ , visits_source_src_28000.user_id AS visitors
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS ds__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM visits_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS ds__extract_doy
+ , visits_source_src_28000.referrer_id
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS visit__ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS visit__ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS visit__ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS visit__ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS visit__ds__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM visits_source_src_28000.ds) AS visit__ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS visit__ds__extract_doy
+ , visits_source_src_28000.referrer_id AS visit__referrer_id
+ , visits_source_src_28000.user_id AS user
+ , visits_source_src_28000.session_id AS session
+ , visits_source_src_28000.user_id AS visit__user
+ , visits_source_src_28000.session_id AS visit__session
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_13
+ ) subq_14
+ ) subq_15
INNER JOIN (
-- Add column with generated UUID
SELECT
- subq_8.ds__day
- , subq_8.ds__week
- , subq_8.ds__month
- , subq_8.ds__quarter
- , subq_8.ds__year
- , subq_8.ds__extract_year
- , subq_8.ds__extract_quarter
- , subq_8.ds__extract_month
- , subq_8.ds__extract_day
- , subq_8.ds__extract_dow
- , subq_8.ds__extract_doy
- , subq_8.buy__ds__day
- , subq_8.buy__ds__week
- , subq_8.buy__ds__month
- , subq_8.buy__ds__quarter
- , subq_8.buy__ds__year
- , subq_8.buy__ds__extract_year
- , subq_8.buy__ds__extract_quarter
- , subq_8.buy__ds__extract_month
- , subq_8.buy__ds__extract_day
- , subq_8.buy__ds__extract_dow
- , subq_8.buy__ds__extract_doy
- , subq_8.metric_time__day
- , subq_8.metric_time__week
- , subq_8.metric_time__month
- , subq_8.metric_time__quarter
- , subq_8.metric_time__year
- , subq_8.metric_time__extract_year
- , subq_8.metric_time__extract_quarter
- , subq_8.metric_time__extract_month
- , subq_8.metric_time__extract_day
- , subq_8.metric_time__extract_dow
- , subq_8.metric_time__extract_doy
- , subq_8.user
- , subq_8.session_id
- , subq_8.buy__user
- , subq_8.buy__session_id
- , subq_8.buys
- , subq_8.buyers
+ subq_17.ds__day
+ , subq_17.ds__week
+ , subq_17.ds__month
+ , subq_17.ds__quarter
+ , subq_17.ds__year
+ , subq_17.ds__extract_year
+ , subq_17.ds__extract_quarter
+ , subq_17.ds__extract_month
+ , subq_17.ds__extract_day
+ , subq_17.ds__extract_dow
+ , subq_17.ds__extract_doy
+ , subq_17.buy__ds__day
+ , subq_17.buy__ds__week
+ , subq_17.buy__ds__month
+ , subq_17.buy__ds__quarter
+ , subq_17.buy__ds__year
+ , subq_17.buy__ds__extract_year
+ , subq_17.buy__ds__extract_quarter
+ , subq_17.buy__ds__extract_month
+ , subq_17.buy__ds__extract_day
+ , subq_17.buy__ds__extract_dow
+ , subq_17.buy__ds__extract_doy
+ , subq_17.metric_time__day
+ , subq_17.metric_time__week
+ , subq_17.metric_time__month
+ , subq_17.metric_time__quarter
+ , subq_17.metric_time__year
+ , subq_17.metric_time__extract_year
+ , subq_17.metric_time__extract_quarter
+ , subq_17.metric_time__extract_month
+ , subq_17.metric_time__extract_day
+ , subq_17.metric_time__extract_dow
+ , subq_17.metric_time__extract_doy
+ , subq_17.user
+ , subq_17.session_id
+ , subq_17.buy__user
+ , subq_17.buy__session_id
+ , subq_17.buys
+ , subq_17.buyers
, uuid() AS mf_internal_uuid
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_7.ds__day
- , subq_7.ds__week
- , subq_7.ds__month
- , subq_7.ds__quarter
- , subq_7.ds__year
- , subq_7.ds__extract_year
- , subq_7.ds__extract_quarter
- , subq_7.ds__extract_month
- , subq_7.ds__extract_day
- , subq_7.ds__extract_dow
- , subq_7.ds__extract_doy
- , subq_7.buy__ds__day
- , subq_7.buy__ds__week
- , subq_7.buy__ds__month
- , subq_7.buy__ds__quarter
- , subq_7.buy__ds__year
- , subq_7.buy__ds__extract_year
- , subq_7.buy__ds__extract_quarter
- , subq_7.buy__ds__extract_month
- , subq_7.buy__ds__extract_day
- , subq_7.buy__ds__extract_dow
- , subq_7.buy__ds__extract_doy
- , subq_7.ds__day AS metric_time__day
- , subq_7.ds__week AS metric_time__week
- , subq_7.ds__month AS metric_time__month
- , subq_7.ds__quarter AS metric_time__quarter
- , subq_7.ds__year AS metric_time__year
- , subq_7.ds__extract_year AS metric_time__extract_year
- , subq_7.ds__extract_quarter AS metric_time__extract_quarter
- , subq_7.ds__extract_month AS metric_time__extract_month
- , subq_7.ds__extract_day AS metric_time__extract_day
- , subq_7.ds__extract_dow AS metric_time__extract_dow
- , subq_7.ds__extract_doy AS metric_time__extract_doy
- , subq_7.user
- , subq_7.session_id
- , subq_7.buy__user
- , subq_7.buy__session_id
- , subq_7.buys
- , subq_7.buyers
+ subq_16.ds__day
+ , subq_16.ds__week
+ , subq_16.ds__month
+ , subq_16.ds__quarter
+ , subq_16.ds__year
+ , subq_16.ds__extract_year
+ , subq_16.ds__extract_quarter
+ , subq_16.ds__extract_month
+ , subq_16.ds__extract_day
+ , subq_16.ds__extract_dow
+ , subq_16.ds__extract_doy
+ , subq_16.buy__ds__day
+ , subq_16.buy__ds__week
+ , subq_16.buy__ds__month
+ , subq_16.buy__ds__quarter
+ , subq_16.buy__ds__year
+ , subq_16.buy__ds__extract_year
+ , subq_16.buy__ds__extract_quarter
+ , subq_16.buy__ds__extract_month
+ , subq_16.buy__ds__extract_day
+ , subq_16.buy__ds__extract_dow
+ , subq_16.buy__ds__extract_doy
+ , subq_16.ds__day AS metric_time__day
+ , subq_16.ds__week AS metric_time__week
+ , subq_16.ds__month AS metric_time__month
+ , subq_16.ds__quarter AS metric_time__quarter
+ , subq_16.ds__year AS metric_time__year
+ , subq_16.ds__extract_year AS metric_time__extract_year
+ , subq_16.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_16.ds__extract_month AS metric_time__extract_month
+ , subq_16.ds__extract_day AS metric_time__extract_day
+ , subq_16.ds__extract_dow AS metric_time__extract_dow
+ , subq_16.ds__extract_doy AS metric_time__extract_doy
+ , subq_16.user
+ , subq_16.session_id
+ , subq_16.buy__user
+ , subq_16.buy__session_id
+ , subq_16.buys
+ , subq_16.buyers
FROM (
-- Read Elements From Semantic Model 'buys_source'
SELECT
1 AS buys
- , buys_source_src_28002.user_id AS buyers
- , DATE_TRUNC('day', buys_source_src_28002.ds) AS ds__day
- , DATE_TRUNC('week', buys_source_src_28002.ds) AS ds__week
- , DATE_TRUNC('month', buys_source_src_28002.ds) AS ds__month
- , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS ds__quarter
- , DATE_TRUNC('year', buys_source_src_28002.ds) AS ds__year
- , EXTRACT(year FROM buys_source_src_28002.ds) AS ds__extract_year
- , EXTRACT(quarter FROM buys_source_src_28002.ds) AS ds__extract_quarter
- , EXTRACT(month FROM buys_source_src_28002.ds) AS ds__extract_month
- , EXTRACT(day FROM buys_source_src_28002.ds) AS ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM buys_source_src_28002.ds) AS ds__extract_dow
- , EXTRACT(doy FROM buys_source_src_28002.ds) AS ds__extract_doy
- , DATE_TRUNC('day', buys_source_src_28002.ds) AS buy__ds__day
- , DATE_TRUNC('week', buys_source_src_28002.ds) AS buy__ds__week
- , DATE_TRUNC('month', buys_source_src_28002.ds) AS buy__ds__month
- , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS buy__ds__quarter
- , DATE_TRUNC('year', buys_source_src_28002.ds) AS buy__ds__year
- , EXTRACT(year FROM buys_source_src_28002.ds) AS buy__ds__extract_year
- , EXTRACT(quarter FROM buys_source_src_28002.ds) AS buy__ds__extract_quarter
- , EXTRACT(month FROM buys_source_src_28002.ds) AS buy__ds__extract_month
- , EXTRACT(day FROM buys_source_src_28002.ds) AS buy__ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM buys_source_src_28002.ds) AS buy__ds__extract_dow
- , EXTRACT(doy FROM buys_source_src_28002.ds) AS buy__ds__extract_doy
- , buys_source_src_28002.user_id AS user
- , buys_source_src_28002.session_id
- , buys_source_src_28002.user_id AS buy__user
- , buys_source_src_28002.session_id AS buy__session_id
- FROM ***************************.fct_buys buys_source_src_28002
- ) subq_7
- ) subq_8
- ) subq_9
+ , buys_source_src_28000.user_id AS buyers
+ , DATE_TRUNC('day', buys_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', buys_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', buys_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', buys_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', buys_source_src_28000.ds) 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
+ , EXTRACT(DAY_OF_WEEK FROM buys_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM buys_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', buys_source_src_28000.ds) AS buy__ds__day
+ , DATE_TRUNC('week', buys_source_src_28000.ds) AS buy__ds__week
+ , DATE_TRUNC('month', buys_source_src_28000.ds) AS buy__ds__month
+ , DATE_TRUNC('quarter', buys_source_src_28000.ds) AS buy__ds__quarter
+ , DATE_TRUNC('year', buys_source_src_28000.ds) 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
+ , EXTRACT(day FROM buys_source_src_28000.ds) AS buy__ds__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM buys_source_src_28000.ds) AS buy__ds__extract_dow
+ , EXTRACT(doy FROM buys_source_src_28000.ds) AS buy__ds__extract_doy
+ , buys_source_src_28000.user_id AS user
+ , buys_source_src_28000.session_id
+ , buys_source_src_28000.user_id AS buy__user
+ , buys_source_src_28000.session_id AS buy__session_id
+ FROM ***************************.fct_buys buys_source_src_28000
+ ) subq_16
+ ) subq_17
+ ) subq_18
ON
(
- subq_6.user = subq_9.user
+ subq_15.user = subq_18.user
) AND (
(
- subq_6.ds__day <= subq_9.ds__day
+ subq_15.ds__day <= subq_18.ds__day
) AND (
- subq_6.ds__day > DATE_ADD('day', -7, subq_9.ds__day)
+ subq_15.ds__day > DATE_ADD('day', -7, subq_18.ds__day)
)
)
- ) subq_10
- ) subq_11
- ) subq_12
- ) subq_13
-) subq_14
+ ) subq_19
+ ) subq_20
+ ) subq_21
+ ) subq_22
+) subq_23
diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Trino/test_conversion_rate_with_no_group_by__plan0_optimized.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Trino/test_conversion_rate_with_no_group_by__plan0_optimized.sql
index 682b934bef..1e00e0579a 100644
--- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Trino/test_conversion_rate_with_no_group_by__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Trino/test_conversion_rate_with_no_group_by__plan0_optimized.sql
@@ -1,7 +1,7 @@
-- Combine Aggregated Outputs
-- Compute Metrics via Expressions
SELECT
- CAST(MAX(subq_28.buys) AS DOUBLE) / CAST(NULLIF(MAX(subq_18.visits), 0) AS DOUBLE) AS visit_buy_conversion_rate_7days
+ CAST(MAX(subq_37.buys) AS DOUBLE) / CAST(NULLIF(MAX(subq_27.visits), 0) AS DOUBLE) AS visit_buy_conversion_rate_7days
FROM (
-- Read Elements From Semantic Model 'visits_source'
-- Metric Time Dimension 'ds'
@@ -9,8 +9,8 @@ FROM (
-- Aggregate Measures
SELECT
SUM(1) AS visits
- FROM ***************************.fct_visits visits_source_src_28011
-) subq_18
+ FROM ***************************.fct_visits visits_source_src_28000
+) subq_27
CROSS JOIN (
-- Find conversions for user within the range of 7 day
-- Pass Only Elements: ['buys',]
@@ -20,11 +20,11 @@ CROSS JOIN (
FROM (
-- Dedupe the fanout with mf_internal_uuid in the conversion data set
SELECT DISTINCT
- first_value(subq_21.visits) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
- , first_value(subq_21.ds__day) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
- , first_value(subq_21.user) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
- , subq_24.mf_internal_uuid AS mf_internal_uuid
- , subq_24.buys AS buys
+ first_value(subq_30.visits) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
+ , first_value(subq_30.ds__day) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
+ , first_value(subq_30.user) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
+ , subq_33.mf_internal_uuid AS mf_internal_uuid
+ , subq_33.buys AS buys
FROM (
-- Read Elements From Semantic Model 'visits_source'
-- Metric Time Dimension 'ds'
@@ -33,8 +33,8 @@ CROSS JOIN (
DATE_TRUNC('day', ds) AS ds__day
, user_id AS user
, 1 AS visits
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_21
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_30
INNER JOIN (
-- Read Elements From Semantic Model 'buys_source'
-- Metric Time Dimension 'ds'
@@ -44,17 +44,17 @@ CROSS JOIN (
, user_id AS user
, 1 AS buys
, uuid() AS mf_internal_uuid
- FROM ***************************.fct_buys buys_source_src_28002
- ) subq_24
+ FROM ***************************.fct_buys buys_source_src_28000
+ ) subq_33
ON
(
- subq_21.user = subq_24.user
+ subq_30.user = subq_33.user
) AND (
(
- subq_21.ds__day <= subq_24.ds__day
+ subq_30.ds__day <= subq_33.ds__day
) AND (
- subq_21.ds__day > DATE_ADD('day', -7, subq_24.ds__day)
+ subq_30.ds__day > DATE_ADD('day', -7, subq_33.ds__day)
)
)
- ) subq_25
-) subq_28
+ ) subq_34
+) subq_37
diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Trino/test_conversion_rate_with_window__plan0.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Trino/test_conversion_rate_with_window__plan0.sql
index 7057a05216..a6a2646be3 100644
--- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Trino/test_conversion_rate_with_window__plan0.sql
+++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Trino/test_conversion_rate_with_window__plan0.sql
@@ -1,376 +1,376 @@
-- Compute Metrics via Expressions
SELECT
- subq_14.metric_time__day
- , subq_14.visit__referrer_id
- , CAST(subq_14.buys AS DOUBLE) / CAST(NULLIF(subq_14.visits, 0) AS DOUBLE) AS visit_buy_conversion_rate_7days
+ subq_23.metric_time__day
+ , subq_23.visit__referrer_id
+ , CAST(subq_23.buys AS DOUBLE) / CAST(NULLIF(subq_23.visits, 0) AS DOUBLE) AS visit_buy_conversion_rate_7days
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_3.metric_time__day, subq_13.metric_time__day) AS metric_time__day
- , COALESCE(subq_3.visit__referrer_id, subq_13.visit__referrer_id) AS visit__referrer_id
- , MAX(subq_3.visits) AS visits
- , MAX(subq_13.buys) AS buys
+ COALESCE(subq_12.metric_time__day, subq_22.metric_time__day) AS metric_time__day
+ , COALESCE(subq_12.visit__referrer_id, subq_22.visit__referrer_id) AS visit__referrer_id
+ , MAX(subq_12.visits) AS visits
+ , MAX(subq_22.buys) AS buys
FROM (
-- Aggregate Measures
SELECT
- subq_2.metric_time__day
- , subq_2.visit__referrer_id
- , SUM(subq_2.visits) AS visits
+ subq_11.metric_time__day
+ , subq_11.visit__referrer_id
+ , SUM(subq_11.visits) AS visits
FROM (
-- Pass Only Elements: ['visits', 'visit__referrer_id', 'metric_time__day']
SELECT
- subq_1.metric_time__day
- , subq_1.visit__referrer_id
- , subq_1.visits
+ subq_10.metric_time__day
+ , subq_10.visit__referrer_id
+ , subq_10.visits
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.visit__ds__day
- , subq_0.visit__ds__week
- , subq_0.visit__ds__month
- , subq_0.visit__ds__quarter
- , subq_0.visit__ds__year
- , subq_0.visit__ds__extract_year
- , subq_0.visit__ds__extract_quarter
- , subq_0.visit__ds__extract_month
- , subq_0.visit__ds__extract_day
- , subq_0.visit__ds__extract_dow
- , subq_0.visit__ds__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.user
- , subq_0.session
- , subq_0.visit__user
- , subq_0.visit__session
- , subq_0.referrer_id
- , subq_0.visit__referrer_id
- , subq_0.visits
- , subq_0.visitors
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.visit__ds__day
+ , subq_9.visit__ds__week
+ , subq_9.visit__ds__month
+ , subq_9.visit__ds__quarter
+ , subq_9.visit__ds__year
+ , subq_9.visit__ds__extract_year
+ , subq_9.visit__ds__extract_quarter
+ , subq_9.visit__ds__extract_month
+ , subq_9.visit__ds__extract_day
+ , subq_9.visit__ds__extract_dow
+ , subq_9.visit__ds__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.user
+ , subq_9.session
+ , subq_9.visit__user
+ , subq_9.visit__session
+ , subq_9.referrer_id
+ , subq_9.visit__referrer_id
+ , subq_9.visits
+ , subq_9.visitors
FROM (
-- Read Elements From Semantic Model 'visits_source'
SELECT
1 AS visits
- , visits_source_src_28011.user_id AS visitors
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM visits_source_src_28011.ds) AS ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy
- , visits_source_src_28011.referrer_id
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM visits_source_src_28011.ds) AS visit__ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy
- , visits_source_src_28011.referrer_id AS visit__referrer_id
- , visits_source_src_28011.user_id AS user
- , visits_source_src_28011.session_id AS session
- , visits_source_src_28011.user_id AS visit__user
- , visits_source_src_28011.session_id AS visit__session
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_0
- ) subq_1
- ) subq_2
+ , visits_source_src_28000.user_id AS visitors
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS ds__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM visits_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS ds__extract_doy
+ , visits_source_src_28000.referrer_id
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS visit__ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS visit__ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS visit__ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS visit__ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS visit__ds__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM visits_source_src_28000.ds) AS visit__ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS visit__ds__extract_doy
+ , visits_source_src_28000.referrer_id AS visit__referrer_id
+ , visits_source_src_28000.user_id AS user
+ , visits_source_src_28000.session_id AS session
+ , visits_source_src_28000.user_id AS visit__user
+ , visits_source_src_28000.session_id AS visit__session
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
GROUP BY
- subq_2.metric_time__day
- , subq_2.visit__referrer_id
- ) subq_3
+ subq_11.metric_time__day
+ , subq_11.visit__referrer_id
+ ) subq_12
FULL OUTER JOIN (
-- Aggregate Measures
SELECT
- subq_12.metric_time__day
- , subq_12.visit__referrer_id
- , SUM(subq_12.buys) AS buys
+ subq_21.metric_time__day
+ , subq_21.visit__referrer_id
+ , SUM(subq_21.buys) AS buys
FROM (
-- Pass Only Elements: ['buys', 'visit__referrer_id', 'metric_time__day']
SELECT
- subq_11.metric_time__day
- , subq_11.visit__referrer_id
- , subq_11.buys
+ subq_20.metric_time__day
+ , subq_20.visit__referrer_id
+ , subq_20.buys
FROM (
-- Find conversions for user within the range of 7 day
SELECT
- subq_10.ds__day
- , subq_10.metric_time__day
- , subq_10.user
- , subq_10.visit__referrer_id
- , subq_10.buys
- , subq_10.visits
+ subq_19.ds__day
+ , subq_19.metric_time__day
+ , subq_19.user
+ , subq_19.visit__referrer_id
+ , subq_19.buys
+ , subq_19.visits
FROM (
-- Dedupe the fanout with mf_internal_uuid in the conversion data set
SELECT DISTINCT
- first_value(subq_6.visits) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
- , first_value(subq_6.visit__referrer_id) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visit__referrer_id
- , first_value(subq_6.ds__day) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
- , first_value(subq_6.metric_time__day) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS metric_time__day
- , first_value(subq_6.user) OVER (PARTITION BY subq_9.user, subq_9.ds__day, subq_9.mf_internal_uuid ORDER BY subq_6.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
- , subq_9.mf_internal_uuid AS mf_internal_uuid
- , subq_9.buys AS buys
+ first_value(subq_15.visits) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
+ , first_value(subq_15.visit__referrer_id) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visit__referrer_id
+ , first_value(subq_15.ds__day) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
+ , first_value(subq_15.metric_time__day) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS metric_time__day
+ , first_value(subq_15.user) OVER (PARTITION BY subq_18.user, subq_18.ds__day, subq_18.mf_internal_uuid ORDER BY subq_15.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
+ , subq_18.mf_internal_uuid AS mf_internal_uuid
+ , subq_18.buys AS buys
FROM (
-- Pass Only Elements: ['visits', 'visit__referrer_id', 'ds__day', 'metric_time__day', 'user']
SELECT
- subq_5.ds__day
- , subq_5.metric_time__day
- , subq_5.user
- , subq_5.visit__referrer_id
- , subq_5.visits
+ subq_14.ds__day
+ , subq_14.metric_time__day
+ , subq_14.user
+ , subq_14.visit__referrer_id
+ , subq_14.visits
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_4.ds__day
- , subq_4.ds__week
- , subq_4.ds__month
- , subq_4.ds__quarter
- , subq_4.ds__year
- , subq_4.ds__extract_year
- , subq_4.ds__extract_quarter
- , subq_4.ds__extract_month
- , subq_4.ds__extract_day
- , subq_4.ds__extract_dow
- , subq_4.ds__extract_doy
- , subq_4.visit__ds__day
- , subq_4.visit__ds__week
- , subq_4.visit__ds__month
- , subq_4.visit__ds__quarter
- , subq_4.visit__ds__year
- , subq_4.visit__ds__extract_year
- , subq_4.visit__ds__extract_quarter
- , subq_4.visit__ds__extract_month
- , subq_4.visit__ds__extract_day
- , subq_4.visit__ds__extract_dow
- , subq_4.visit__ds__extract_doy
- , subq_4.ds__day AS metric_time__day
- , subq_4.ds__week AS metric_time__week
- , subq_4.ds__month AS metric_time__month
- , subq_4.ds__quarter AS metric_time__quarter
- , subq_4.ds__year AS metric_time__year
- , subq_4.ds__extract_year AS metric_time__extract_year
- , subq_4.ds__extract_quarter AS metric_time__extract_quarter
- , subq_4.ds__extract_month AS metric_time__extract_month
- , subq_4.ds__extract_day AS metric_time__extract_day
- , subq_4.ds__extract_dow AS metric_time__extract_dow
- , subq_4.ds__extract_doy AS metric_time__extract_doy
- , subq_4.user
- , subq_4.session
- , subq_4.visit__user
- , subq_4.visit__session
- , subq_4.referrer_id
- , subq_4.visit__referrer_id
- , subq_4.visits
- , subq_4.visitors
+ subq_13.ds__day
+ , subq_13.ds__week
+ , subq_13.ds__month
+ , subq_13.ds__quarter
+ , subq_13.ds__year
+ , subq_13.ds__extract_year
+ , subq_13.ds__extract_quarter
+ , subq_13.ds__extract_month
+ , subq_13.ds__extract_day
+ , subq_13.ds__extract_dow
+ , subq_13.ds__extract_doy
+ , subq_13.visit__ds__day
+ , subq_13.visit__ds__week
+ , subq_13.visit__ds__month
+ , subq_13.visit__ds__quarter
+ , subq_13.visit__ds__year
+ , subq_13.visit__ds__extract_year
+ , subq_13.visit__ds__extract_quarter
+ , subq_13.visit__ds__extract_month
+ , subq_13.visit__ds__extract_day
+ , subq_13.visit__ds__extract_dow
+ , subq_13.visit__ds__extract_doy
+ , subq_13.ds__day AS metric_time__day
+ , subq_13.ds__week AS metric_time__week
+ , subq_13.ds__month AS metric_time__month
+ , subq_13.ds__quarter AS metric_time__quarter
+ , subq_13.ds__year AS metric_time__year
+ , subq_13.ds__extract_year AS metric_time__extract_year
+ , subq_13.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_13.ds__extract_month AS metric_time__extract_month
+ , subq_13.ds__extract_day AS metric_time__extract_day
+ , subq_13.ds__extract_dow AS metric_time__extract_dow
+ , subq_13.ds__extract_doy AS metric_time__extract_doy
+ , subq_13.user
+ , subq_13.session
+ , subq_13.visit__user
+ , subq_13.visit__session
+ , subq_13.referrer_id
+ , subq_13.visit__referrer_id
+ , subq_13.visits
+ , subq_13.visitors
FROM (
-- Read Elements From Semantic Model 'visits_source'
SELECT
1 AS visits
- , visits_source_src_28011.user_id AS visitors
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM visits_source_src_28011.ds) AS ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS ds__extract_doy
- , visits_source_src_28011.referrer_id
- , DATE_TRUNC('day', visits_source_src_28011.ds) AS visit__ds__day
- , DATE_TRUNC('week', visits_source_src_28011.ds) AS visit__ds__week
- , DATE_TRUNC('month', visits_source_src_28011.ds) AS visit__ds__month
- , DATE_TRUNC('quarter', visits_source_src_28011.ds) AS visit__ds__quarter
- , DATE_TRUNC('year', visits_source_src_28011.ds) AS visit__ds__year
- , EXTRACT(year FROM visits_source_src_28011.ds) AS visit__ds__extract_year
- , EXTRACT(quarter FROM visits_source_src_28011.ds) AS visit__ds__extract_quarter
- , EXTRACT(month FROM visits_source_src_28011.ds) AS visit__ds__extract_month
- , EXTRACT(day FROM visits_source_src_28011.ds) AS visit__ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM visits_source_src_28011.ds) AS visit__ds__extract_dow
- , EXTRACT(doy FROM visits_source_src_28011.ds) AS visit__ds__extract_doy
- , visits_source_src_28011.referrer_id AS visit__referrer_id
- , visits_source_src_28011.user_id AS user
- , visits_source_src_28011.session_id AS session
- , visits_source_src_28011.user_id AS visit__user
- , visits_source_src_28011.session_id AS visit__session
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_4
- ) subq_5
- ) subq_6
+ , visits_source_src_28000.user_id AS visitors
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS ds__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM visits_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS ds__extract_doy
+ , visits_source_src_28000.referrer_id
+ , DATE_TRUNC('day', visits_source_src_28000.ds) AS visit__ds__day
+ , DATE_TRUNC('week', visits_source_src_28000.ds) AS visit__ds__week
+ , DATE_TRUNC('month', visits_source_src_28000.ds) AS visit__ds__month
+ , DATE_TRUNC('quarter', visits_source_src_28000.ds) AS visit__ds__quarter
+ , DATE_TRUNC('year', visits_source_src_28000.ds) 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
+ , EXTRACT(day FROM visits_source_src_28000.ds) AS visit__ds__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM visits_source_src_28000.ds) AS visit__ds__extract_dow
+ , EXTRACT(doy FROM visits_source_src_28000.ds) AS visit__ds__extract_doy
+ , visits_source_src_28000.referrer_id AS visit__referrer_id
+ , visits_source_src_28000.user_id AS user
+ , visits_source_src_28000.session_id AS session
+ , visits_source_src_28000.user_id AS visit__user
+ , visits_source_src_28000.session_id AS visit__session
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_13
+ ) subq_14
+ ) subq_15
INNER JOIN (
-- Add column with generated UUID
SELECT
- subq_8.ds__day
- , subq_8.ds__week
- , subq_8.ds__month
- , subq_8.ds__quarter
- , subq_8.ds__year
- , subq_8.ds__extract_year
- , subq_8.ds__extract_quarter
- , subq_8.ds__extract_month
- , subq_8.ds__extract_day
- , subq_8.ds__extract_dow
- , subq_8.ds__extract_doy
- , subq_8.buy__ds__day
- , subq_8.buy__ds__week
- , subq_8.buy__ds__month
- , subq_8.buy__ds__quarter
- , subq_8.buy__ds__year
- , subq_8.buy__ds__extract_year
- , subq_8.buy__ds__extract_quarter
- , subq_8.buy__ds__extract_month
- , subq_8.buy__ds__extract_day
- , subq_8.buy__ds__extract_dow
- , subq_8.buy__ds__extract_doy
- , subq_8.metric_time__day
- , subq_8.metric_time__week
- , subq_8.metric_time__month
- , subq_8.metric_time__quarter
- , subq_8.metric_time__year
- , subq_8.metric_time__extract_year
- , subq_8.metric_time__extract_quarter
- , subq_8.metric_time__extract_month
- , subq_8.metric_time__extract_day
- , subq_8.metric_time__extract_dow
- , subq_8.metric_time__extract_doy
- , subq_8.user
- , subq_8.session_id
- , subq_8.buy__user
- , subq_8.buy__session_id
- , subq_8.buys
- , subq_8.buyers
+ subq_17.ds__day
+ , subq_17.ds__week
+ , subq_17.ds__month
+ , subq_17.ds__quarter
+ , subq_17.ds__year
+ , subq_17.ds__extract_year
+ , subq_17.ds__extract_quarter
+ , subq_17.ds__extract_month
+ , subq_17.ds__extract_day
+ , subq_17.ds__extract_dow
+ , subq_17.ds__extract_doy
+ , subq_17.buy__ds__day
+ , subq_17.buy__ds__week
+ , subq_17.buy__ds__month
+ , subq_17.buy__ds__quarter
+ , subq_17.buy__ds__year
+ , subq_17.buy__ds__extract_year
+ , subq_17.buy__ds__extract_quarter
+ , subq_17.buy__ds__extract_month
+ , subq_17.buy__ds__extract_day
+ , subq_17.buy__ds__extract_dow
+ , subq_17.buy__ds__extract_doy
+ , subq_17.metric_time__day
+ , subq_17.metric_time__week
+ , subq_17.metric_time__month
+ , subq_17.metric_time__quarter
+ , subq_17.metric_time__year
+ , subq_17.metric_time__extract_year
+ , subq_17.metric_time__extract_quarter
+ , subq_17.metric_time__extract_month
+ , subq_17.metric_time__extract_day
+ , subq_17.metric_time__extract_dow
+ , subq_17.metric_time__extract_doy
+ , subq_17.user
+ , subq_17.session_id
+ , subq_17.buy__user
+ , subq_17.buy__session_id
+ , subq_17.buys
+ , subq_17.buyers
, uuid() AS mf_internal_uuid
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_7.ds__day
- , subq_7.ds__week
- , subq_7.ds__month
- , subq_7.ds__quarter
- , subq_7.ds__year
- , subq_7.ds__extract_year
- , subq_7.ds__extract_quarter
- , subq_7.ds__extract_month
- , subq_7.ds__extract_day
- , subq_7.ds__extract_dow
- , subq_7.ds__extract_doy
- , subq_7.buy__ds__day
- , subq_7.buy__ds__week
- , subq_7.buy__ds__month
- , subq_7.buy__ds__quarter
- , subq_7.buy__ds__year
- , subq_7.buy__ds__extract_year
- , subq_7.buy__ds__extract_quarter
- , subq_7.buy__ds__extract_month
- , subq_7.buy__ds__extract_day
- , subq_7.buy__ds__extract_dow
- , subq_7.buy__ds__extract_doy
- , subq_7.ds__day AS metric_time__day
- , subq_7.ds__week AS metric_time__week
- , subq_7.ds__month AS metric_time__month
- , subq_7.ds__quarter AS metric_time__quarter
- , subq_7.ds__year AS metric_time__year
- , subq_7.ds__extract_year AS metric_time__extract_year
- , subq_7.ds__extract_quarter AS metric_time__extract_quarter
- , subq_7.ds__extract_month AS metric_time__extract_month
- , subq_7.ds__extract_day AS metric_time__extract_day
- , subq_7.ds__extract_dow AS metric_time__extract_dow
- , subq_7.ds__extract_doy AS metric_time__extract_doy
- , subq_7.user
- , subq_7.session_id
- , subq_7.buy__user
- , subq_7.buy__session_id
- , subq_7.buys
- , subq_7.buyers
+ subq_16.ds__day
+ , subq_16.ds__week
+ , subq_16.ds__month
+ , subq_16.ds__quarter
+ , subq_16.ds__year
+ , subq_16.ds__extract_year
+ , subq_16.ds__extract_quarter
+ , subq_16.ds__extract_month
+ , subq_16.ds__extract_day
+ , subq_16.ds__extract_dow
+ , subq_16.ds__extract_doy
+ , subq_16.buy__ds__day
+ , subq_16.buy__ds__week
+ , subq_16.buy__ds__month
+ , subq_16.buy__ds__quarter
+ , subq_16.buy__ds__year
+ , subq_16.buy__ds__extract_year
+ , subq_16.buy__ds__extract_quarter
+ , subq_16.buy__ds__extract_month
+ , subq_16.buy__ds__extract_day
+ , subq_16.buy__ds__extract_dow
+ , subq_16.buy__ds__extract_doy
+ , subq_16.ds__day AS metric_time__day
+ , subq_16.ds__week AS metric_time__week
+ , subq_16.ds__month AS metric_time__month
+ , subq_16.ds__quarter AS metric_time__quarter
+ , subq_16.ds__year AS metric_time__year
+ , subq_16.ds__extract_year AS metric_time__extract_year
+ , subq_16.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_16.ds__extract_month AS metric_time__extract_month
+ , subq_16.ds__extract_day AS metric_time__extract_day
+ , subq_16.ds__extract_dow AS metric_time__extract_dow
+ , subq_16.ds__extract_doy AS metric_time__extract_doy
+ , subq_16.user
+ , subq_16.session_id
+ , subq_16.buy__user
+ , subq_16.buy__session_id
+ , subq_16.buys
+ , subq_16.buyers
FROM (
-- Read Elements From Semantic Model 'buys_source'
SELECT
1 AS buys
- , buys_source_src_28002.user_id AS buyers
- , DATE_TRUNC('day', buys_source_src_28002.ds) AS ds__day
- , DATE_TRUNC('week', buys_source_src_28002.ds) AS ds__week
- , DATE_TRUNC('month', buys_source_src_28002.ds) AS ds__month
- , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS ds__quarter
- , DATE_TRUNC('year', buys_source_src_28002.ds) AS ds__year
- , EXTRACT(year FROM buys_source_src_28002.ds) AS ds__extract_year
- , EXTRACT(quarter FROM buys_source_src_28002.ds) AS ds__extract_quarter
- , EXTRACT(month FROM buys_source_src_28002.ds) AS ds__extract_month
- , EXTRACT(day FROM buys_source_src_28002.ds) AS ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM buys_source_src_28002.ds) AS ds__extract_dow
- , EXTRACT(doy FROM buys_source_src_28002.ds) AS ds__extract_doy
- , DATE_TRUNC('day', buys_source_src_28002.ds) AS buy__ds__day
- , DATE_TRUNC('week', buys_source_src_28002.ds) AS buy__ds__week
- , DATE_TRUNC('month', buys_source_src_28002.ds) AS buy__ds__month
- , DATE_TRUNC('quarter', buys_source_src_28002.ds) AS buy__ds__quarter
- , DATE_TRUNC('year', buys_source_src_28002.ds) AS buy__ds__year
- , EXTRACT(year FROM buys_source_src_28002.ds) AS buy__ds__extract_year
- , EXTRACT(quarter FROM buys_source_src_28002.ds) AS buy__ds__extract_quarter
- , EXTRACT(month FROM buys_source_src_28002.ds) AS buy__ds__extract_month
- , EXTRACT(day FROM buys_source_src_28002.ds) AS buy__ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM buys_source_src_28002.ds) AS buy__ds__extract_dow
- , EXTRACT(doy FROM buys_source_src_28002.ds) AS buy__ds__extract_doy
- , buys_source_src_28002.user_id AS user
- , buys_source_src_28002.session_id
- , buys_source_src_28002.user_id AS buy__user
- , buys_source_src_28002.session_id AS buy__session_id
- FROM ***************************.fct_buys buys_source_src_28002
- ) subq_7
- ) subq_8
- ) subq_9
+ , buys_source_src_28000.user_id AS buyers
+ , DATE_TRUNC('day', buys_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', buys_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', buys_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', buys_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', buys_source_src_28000.ds) 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
+ , EXTRACT(DAY_OF_WEEK FROM buys_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM buys_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', buys_source_src_28000.ds) AS buy__ds__day
+ , DATE_TRUNC('week', buys_source_src_28000.ds) AS buy__ds__week
+ , DATE_TRUNC('month', buys_source_src_28000.ds) AS buy__ds__month
+ , DATE_TRUNC('quarter', buys_source_src_28000.ds) AS buy__ds__quarter
+ , DATE_TRUNC('year', buys_source_src_28000.ds) 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
+ , EXTRACT(day FROM buys_source_src_28000.ds) AS buy__ds__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM buys_source_src_28000.ds) AS buy__ds__extract_dow
+ , EXTRACT(doy FROM buys_source_src_28000.ds) AS buy__ds__extract_doy
+ , buys_source_src_28000.user_id AS user
+ , buys_source_src_28000.session_id
+ , buys_source_src_28000.user_id AS buy__user
+ , buys_source_src_28000.session_id AS buy__session_id
+ FROM ***************************.fct_buys buys_source_src_28000
+ ) subq_16
+ ) subq_17
+ ) subq_18
ON
(
- subq_6.user = subq_9.user
+ subq_15.user = subq_18.user
) AND (
(
- subq_6.ds__day <= subq_9.ds__day
+ subq_15.ds__day <= subq_18.ds__day
) AND (
- subq_6.ds__day > DATE_ADD('day', -7, subq_9.ds__day)
+ subq_15.ds__day > DATE_ADD('day', -7, subq_18.ds__day)
)
)
- ) subq_10
- ) subq_11
- ) subq_12
+ ) subq_19
+ ) subq_20
+ ) subq_21
GROUP BY
- subq_12.metric_time__day
- , subq_12.visit__referrer_id
- ) subq_13
+ subq_21.metric_time__day
+ , subq_21.visit__referrer_id
+ ) subq_22
ON
(
- subq_3.visit__referrer_id = subq_13.visit__referrer_id
+ subq_12.visit__referrer_id = subq_22.visit__referrer_id
) AND (
- subq_3.metric_time__day = subq_13.metric_time__day
+ subq_12.metric_time__day = subq_22.metric_time__day
)
GROUP BY
- COALESCE(subq_3.metric_time__day, subq_13.metric_time__day)
- , COALESCE(subq_3.visit__referrer_id, subq_13.visit__referrer_id)
-) subq_14
+ COALESCE(subq_12.metric_time__day, subq_22.metric_time__day)
+ , COALESCE(subq_12.visit__referrer_id, subq_22.visit__referrer_id)
+) subq_23
diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Trino/test_conversion_rate_with_window__plan0_optimized.sql b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Trino/test_conversion_rate_with_window__plan0_optimized.sql
index 8eb1daea87..6452e95658 100644
--- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Trino/test_conversion_rate_with_window__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/Trino/test_conversion_rate_with_window__plan0_optimized.sql
@@ -6,10 +6,10 @@ SELECT
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_18.metric_time__day, subq_28.metric_time__day) AS metric_time__day
- , COALESCE(subq_18.visit__referrer_id, subq_28.visit__referrer_id) AS visit__referrer_id
- , MAX(subq_18.visits) AS visits
- , MAX(subq_28.buys) AS buys
+ COALESCE(subq_27.metric_time__day, subq_37.metric_time__day) AS metric_time__day
+ , COALESCE(subq_27.visit__referrer_id, subq_37.visit__referrer_id) AS visit__referrer_id
+ , MAX(subq_27.visits) AS visits
+ , MAX(subq_37.buys) AS buys
FROM (
-- Aggregate Measures
SELECT
@@ -24,12 +24,12 @@ FROM (
DATE_TRUNC('day', ds) AS metric_time__day
, referrer_id AS visit__referrer_id
, 1 AS visits
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_17
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_26
GROUP BY
metric_time__day
, visit__referrer_id
- ) subq_18
+ ) subq_27
FULL OUTER JOIN (
-- Find conversions for user within the range of 7 day
-- Pass Only Elements: ['buys', 'visit__referrer_id', 'metric_time__day']
@@ -41,13 +41,13 @@ FROM (
FROM (
-- Dedupe the fanout with mf_internal_uuid in the conversion data set
SELECT DISTINCT
- first_value(subq_21.visits) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
- , first_value(subq_21.visit__referrer_id) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visit__referrer_id
- , first_value(subq_21.ds__day) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
- , first_value(subq_21.metric_time__day) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS metric_time__day
- , first_value(subq_21.user) OVER (PARTITION BY subq_24.user, subq_24.ds__day, subq_24.mf_internal_uuid ORDER BY subq_21.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
- , subq_24.mf_internal_uuid AS mf_internal_uuid
- , subq_24.buys AS buys
+ first_value(subq_30.visits) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visits
+ , first_value(subq_30.visit__referrer_id) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS visit__referrer_id
+ , first_value(subq_30.ds__day) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS ds__day
+ , first_value(subq_30.metric_time__day) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS metric_time__day
+ , first_value(subq_30.user) OVER (PARTITION BY subq_33.user, subq_33.ds__day, subq_33.mf_internal_uuid ORDER BY subq_30.ds__day DESC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS user
+ , subq_33.mf_internal_uuid AS mf_internal_uuid
+ , subq_33.buys AS buys
FROM (
-- Read Elements From Semantic Model 'visits_source'
-- Metric Time Dimension 'ds'
@@ -58,8 +58,8 @@ FROM (
, user_id AS user
, referrer_id AS visit__referrer_id
, 1 AS visits
- FROM ***************************.fct_visits visits_source_src_28011
- ) subq_21
+ FROM ***************************.fct_visits visits_source_src_28000
+ ) subq_30
INNER JOIN (
-- Read Elements From Semantic Model 'buys_source'
-- Metric Time Dimension 'ds'
@@ -69,30 +69,30 @@ FROM (
, user_id AS user
, 1 AS buys
, uuid() AS mf_internal_uuid
- FROM ***************************.fct_buys buys_source_src_28002
- ) subq_24
+ FROM ***************************.fct_buys buys_source_src_28000
+ ) subq_33
ON
(
- subq_21.user = subq_24.user
+ subq_30.user = subq_33.user
) AND (
(
- subq_21.ds__day <= subq_24.ds__day
+ subq_30.ds__day <= subq_33.ds__day
) AND (
- subq_21.ds__day > DATE_ADD('day', -7, subq_24.ds__day)
+ subq_30.ds__day > DATE_ADD('day', -7, subq_33.ds__day)
)
)
- ) subq_25
+ ) subq_34
GROUP BY
metric_time__day
, visit__referrer_id
- ) subq_28
+ ) subq_37
ON
(
- subq_18.visit__referrer_id = subq_28.visit__referrer_id
+ subq_27.visit__referrer_id = subq_37.visit__referrer_id
) AND (
- subq_18.metric_time__day = subq_28.metric_time__day
+ subq_27.metric_time__day = subq_37.metric_time__day
)
GROUP BY
- COALESCE(subq_18.metric_time__day, subq_28.metric_time__day)
- , COALESCE(subq_18.visit__referrer_id, subq_28.visit__referrer_id)
-) subq_29
+ COALESCE(subq_27.metric_time__day, subq_37.metric_time__day)
+ , COALESCE(subq_27.visit__referrer_id, subq_37.visit__referrer_id)
+) subq_38
diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/test_conversion_count_with_no_group_by__plan0.xml b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/test_conversion_count_with_no_group_by__plan0.xml
index 40cac96747..5902310e23 100644
--- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/test_conversion_count_with_no_group_by__plan0.xml
+++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/test_conversion_count_with_no_group_by__plan0.xml
@@ -24,7 +24,7 @@
-
+
@@ -455,7 +455,7 @@
-
+
diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/test_conversion_rate__plan0.xml b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/test_conversion_rate__plan0.xml
index 4ac7e33117..42b580d16d 100644
--- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/test_conversion_rate__plan0.xml
+++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/test_conversion_rate__plan0.xml
@@ -31,7 +31,7 @@
-
+
@@ -508,7 +508,7 @@
-
+
diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/test_conversion_rate_with_constant_properties__plan0.xml b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/test_conversion_rate_with_constant_properties__plan0.xml
index 736288efbe..399c26d29e 100644
--- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/test_conversion_rate_with_constant_properties__plan0.xml
+++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/test_conversion_rate_with_constant_properties__plan0.xml
@@ -40,7 +40,7 @@
-
+
@@ -557,7 +557,7 @@
-
+
diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/test_conversion_rate_with_no_group_by__plan0.xml b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/test_conversion_rate_with_no_group_by__plan0.xml
index 43bf25c535..39b10525f7 100644
--- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/test_conversion_rate_with_no_group_by__plan0.xml
+++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/test_conversion_rate_with_no_group_by__plan0.xml
@@ -27,7 +27,7 @@
-
+
@@ -458,7 +458,7 @@
-
+
diff --git a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/test_conversion_rate_with_window__plan0.xml b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/test_conversion_rate_with_window__plan0.xml
index 0256177bd2..d4e40a289d 100644
--- a/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/test_conversion_rate_with_window__plan0.xml
+++ b/metricflow/test/snapshots/test_conversion_metrics_to_sql.py/SqlQueryPlan/test_conversion_rate_with_window__plan0.xml
@@ -40,7 +40,7 @@
-
+
@@ -550,7 +550,7 @@
-
+
diff --git a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/BigQuery/test_convert_query_semantic_model__plan0.sql b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/BigQuery/test_convert_query_semantic_model__plan0.sql
index 4e4162cf69..62bd3fea5e 100644
--- a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/BigQuery/test_convert_query_semantic_model__plan0.sql
+++ b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/BigQuery/test_convert_query_semantic_model__plan0.sql
@@ -1,28 +1,28 @@
-- Read Elements From Semantic Model 'revenue'
SELECT
- revenue_src_28007.revenue AS txn_revenue
- , DATE_TRUNC(revenue_src_28007.created_at, day) AS ds__day
- , DATE_TRUNC(revenue_src_28007.created_at, isoweek) AS ds__week
- , DATE_TRUNC(revenue_src_28007.created_at, month) AS ds__month
- , DATE_TRUNC(revenue_src_28007.created_at, quarter) AS ds__quarter
- , DATE_TRUNC(revenue_src_28007.created_at, year) AS ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM revenue_src_28007.created_at) = 1, 7, EXTRACT(dayofweek FROM revenue_src_28007.created_at) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM revenue_src_28007.created_at) AS ds__extract_doy
- , DATE_TRUNC(revenue_src_28007.created_at, day) AS revenue_instance__ds__day
- , DATE_TRUNC(revenue_src_28007.created_at, isoweek) AS revenue_instance__ds__week
- , DATE_TRUNC(revenue_src_28007.created_at, month) AS revenue_instance__ds__month
- , DATE_TRUNC(revenue_src_28007.created_at, quarter) AS revenue_instance__ds__quarter
- , DATE_TRUNC(revenue_src_28007.created_at, year) AS revenue_instance__ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day
- , IF(EXTRACT(dayofweek FROM revenue_src_28007.created_at) = 1, 7, EXTRACT(dayofweek FROM revenue_src_28007.created_at) - 1) AS revenue_instance__ds__extract_dow
- , EXTRACT(dayofyear FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy
- , revenue_src_28007.user_id AS user
- , revenue_src_28007.user_id AS revenue_instance__user
-FROM ***************************.fct_revenue revenue_src_28007
+ 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
+ , 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
+ , 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
+ , EXTRACT(day FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_day
+ , IF(EXTRACT(dayofweek FROM revenue_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM revenue_src_28000.created_at) - 1) AS revenue_instance__ds__extract_dow
+ , EXTRACT(dayofyear FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_doy
+ , revenue_src_28000.user_id AS user
+ , revenue_src_28000.user_id AS revenue_instance__user
+FROM ***************************.fct_revenue revenue_src_28000
diff --git a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/BigQuery/test_convert_table_semantic_model_with_measures__plan0.sql b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/BigQuery/test_convert_table_semantic_model_with_measures__plan0.sql
index becf4eae22..879c6b43f7 100644
--- a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/BigQuery/test_convert_table_semantic_model_with_measures__plan0.sql
+++ b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/BigQuery/test_convert_table_semantic_model_with_measures__plan0.sql
@@ -1,53 +1,53 @@
-- Read Elements From Semantic Model 'id_verifications'
SELECT
1 AS identity_verifications
- , DATE_TRUNC(id_verifications_src_28004.ds, day) AS ds__day
- , DATE_TRUNC(id_verifications_src_28004.ds, isoweek) AS ds__week
- , DATE_TRUNC(id_verifications_src_28004.ds, month) AS ds__month
- , DATE_TRUNC(id_verifications_src_28004.ds, quarter) AS ds__quarter
- , DATE_TRUNC(id_verifications_src_28004.ds, year) AS ds__year
- , EXTRACT(year FROM id_verifications_src_28004.ds) AS ds__extract_year
- , EXTRACT(quarter FROM id_verifications_src_28004.ds) AS ds__extract_quarter
- , EXTRACT(month FROM id_verifications_src_28004.ds) AS ds__extract_month
- , EXTRACT(day FROM id_verifications_src_28004.ds) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM id_verifications_src_28004.ds) = 1, 7, EXTRACT(dayofweek FROM id_verifications_src_28004.ds) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM id_verifications_src_28004.ds) AS ds__extract_doy
- , DATE_TRUNC(id_verifications_src_28004.ds_partitioned, day) AS ds_partitioned__day
- , DATE_TRUNC(id_verifications_src_28004.ds_partitioned, isoweek) AS ds_partitioned__week
- , DATE_TRUNC(id_verifications_src_28004.ds_partitioned, month) AS ds_partitioned__month
- , DATE_TRUNC(id_verifications_src_28004.ds_partitioned, quarter) AS ds_partitioned__quarter
- , DATE_TRUNC(id_verifications_src_28004.ds_partitioned, year) AS ds_partitioned__year
- , EXTRACT(year FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM id_verifications_src_28004.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM id_verifications_src_28004.ds_partitioned) - 1) AS ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_doy
- , id_verifications_src_28004.verification_type
- , DATE_TRUNC(id_verifications_src_28004.ds, day) AS verification__ds__day
- , DATE_TRUNC(id_verifications_src_28004.ds, isoweek) AS verification__ds__week
- , DATE_TRUNC(id_verifications_src_28004.ds, month) AS verification__ds__month
- , DATE_TRUNC(id_verifications_src_28004.ds, quarter) AS verification__ds__quarter
- , DATE_TRUNC(id_verifications_src_28004.ds, year) AS verification__ds__year
- , EXTRACT(year FROM id_verifications_src_28004.ds) AS verification__ds__extract_year
- , EXTRACT(quarter FROM id_verifications_src_28004.ds) AS verification__ds__extract_quarter
- , EXTRACT(month FROM id_verifications_src_28004.ds) AS verification__ds__extract_month
- , EXTRACT(day FROM id_verifications_src_28004.ds) AS verification__ds__extract_day
- , IF(EXTRACT(dayofweek FROM id_verifications_src_28004.ds) = 1, 7, EXTRACT(dayofweek FROM id_verifications_src_28004.ds) - 1) AS verification__ds__extract_dow
- , EXTRACT(dayofyear FROM id_verifications_src_28004.ds) AS verification__ds__extract_doy
- , DATE_TRUNC(id_verifications_src_28004.ds_partitioned, day) AS verification__ds_partitioned__day
- , DATE_TRUNC(id_verifications_src_28004.ds_partitioned, isoweek) AS verification__ds_partitioned__week
- , DATE_TRUNC(id_verifications_src_28004.ds_partitioned, month) AS verification__ds_partitioned__month
- , DATE_TRUNC(id_verifications_src_28004.ds_partitioned, quarter) AS verification__ds_partitioned__quarter
- , DATE_TRUNC(id_verifications_src_28004.ds_partitioned, year) AS verification__ds_partitioned__year
- , EXTRACT(year FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_year
- , EXTRACT(quarter FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_quarter
- , EXTRACT(month FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_month
- , EXTRACT(day FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM id_verifications_src_28004.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM id_verifications_src_28004.ds_partitioned) - 1) AS verification__ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_doy
- , id_verifications_src_28004.verification_type AS verification__verification_type
- , id_verifications_src_28004.verification_id AS verification
- , id_verifications_src_28004.user_id AS user
- , id_verifications_src_28004.user_id AS verification__user
-FROM ***************************.fct_id_verifications id_verifications_src_28004
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM id_verifications_src_28000.ds_partitioned) AS ds_partitioned__extract_day
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM id_verifications_src_28000.ds_partitioned) AS verification__ds_partitioned__extract_day
+ , IF(EXTRACT(dayofweek FROM id_verifications_src_28000.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM id_verifications_src_28000.ds_partitioned) - 1) AS verification__ds_partitioned__extract_dow
+ , EXTRACT(dayofyear FROM id_verifications_src_28000.ds_partitioned) AS verification__ds_partitioned__extract_doy
+ , id_verifications_src_28000.verification_type AS verification__verification_type
+ , id_verifications_src_28000.verification_id AS verification
+ , id_verifications_src_28000.user_id AS user
+ , id_verifications_src_28000.user_id AS verification__user
+FROM ***************************.fct_id_verifications id_verifications_src_28000
diff --git a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/BigQuery/test_convert_table_semantic_model_without_measures__plan0.sql b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/BigQuery/test_convert_table_semantic_model_without_measures__plan0.sql
index e9fce66c32..20f253203a 100644
--- a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/BigQuery/test_convert_table_semantic_model_without_measures__plan0.sql
+++ b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/BigQuery/test_convert_table_semantic_model_without_measures__plan0.sql
@@ -1,28 +1,28 @@
-- Read Elements From Semantic Model 'users_latest'
SELECT
- DATE_TRUNC(users_latest_src_28009.ds, day) AS ds_latest__day
- , DATE_TRUNC(users_latest_src_28009.ds, isoweek) AS ds_latest__week
- , DATE_TRUNC(users_latest_src_28009.ds, month) AS ds_latest__month
- , DATE_TRUNC(users_latest_src_28009.ds, quarter) AS ds_latest__quarter
- , DATE_TRUNC(users_latest_src_28009.ds, year) AS ds_latest__year
- , EXTRACT(year FROM users_latest_src_28009.ds) AS ds_latest__extract_year
- , EXTRACT(quarter FROM users_latest_src_28009.ds) AS ds_latest__extract_quarter
- , EXTRACT(month FROM users_latest_src_28009.ds) AS ds_latest__extract_month
- , EXTRACT(day FROM users_latest_src_28009.ds) AS ds_latest__extract_day
- , IF(EXTRACT(dayofweek FROM users_latest_src_28009.ds) = 1, 7, EXTRACT(dayofweek FROM users_latest_src_28009.ds) - 1) AS ds_latest__extract_dow
- , EXTRACT(dayofyear FROM users_latest_src_28009.ds) AS ds_latest__extract_doy
- , users_latest_src_28009.home_state_latest
- , DATE_TRUNC(users_latest_src_28009.ds, day) AS user__ds_latest__day
- , DATE_TRUNC(users_latest_src_28009.ds, isoweek) AS user__ds_latest__week
- , DATE_TRUNC(users_latest_src_28009.ds, month) AS user__ds_latest__month
- , DATE_TRUNC(users_latest_src_28009.ds, quarter) AS user__ds_latest__quarter
- , DATE_TRUNC(users_latest_src_28009.ds, year) AS user__ds_latest__year
- , EXTRACT(year FROM users_latest_src_28009.ds) AS user__ds_latest__extract_year
- , EXTRACT(quarter FROM users_latest_src_28009.ds) AS user__ds_latest__extract_quarter
- , EXTRACT(month FROM users_latest_src_28009.ds) AS user__ds_latest__extract_month
- , EXTRACT(day FROM users_latest_src_28009.ds) AS user__ds_latest__extract_day
- , IF(EXTRACT(dayofweek FROM users_latest_src_28009.ds) = 1, 7, EXTRACT(dayofweek FROM users_latest_src_28009.ds) - 1) AS user__ds_latest__extract_dow
- , EXTRACT(dayofyear FROM users_latest_src_28009.ds) AS user__ds_latest__extract_doy
- , users_latest_src_28009.home_state_latest AS user__home_state_latest
- , users_latest_src_28009.user_id AS user
-FROM ***************************.dim_users_latest users_latest_src_28009
+ 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
+ , 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
+ , EXTRACT(day FROM users_latest_src_28000.ds) AS ds_latest__extract_day
+ , 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
+ , 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
+ , EXTRACT(day FROM users_latest_src_28000.ds) AS user__ds_latest__extract_day
+ , IF(EXTRACT(dayofweek FROM users_latest_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM users_latest_src_28000.ds) - 1) AS user__ds_latest__extract_dow
+ , EXTRACT(dayofyear FROM users_latest_src_28000.ds) AS user__ds_latest__extract_doy
+ , users_latest_src_28000.home_state_latest AS user__home_state_latest
+ , users_latest_src_28000.user_id AS user
+FROM ***************************.dim_users_latest users_latest_src_28000
diff --git a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Databricks/test_convert_query_semantic_model__plan0.sql b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Databricks/test_convert_query_semantic_model__plan0.sql
index da22c65a68..2d90fd9d75 100644
--- a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Databricks/test_convert_query_semantic_model__plan0.sql
+++ b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Databricks/test_convert_query_semantic_model__plan0.sql
@@ -1,28 +1,28 @@
-- Read Elements From Semantic Model 'revenue'
SELECT
- revenue_src_28007.revenue AS txn_revenue
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM revenue_src_28007.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy
- , revenue_src_28007.user_id AS user
- , revenue_src_28007.user_id AS revenue_instance__user
-FROM ***************************.fct_revenue revenue_src_28007
+ revenue_src_28000.revenue AS txn_revenue
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM revenue_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS revenue_instance__ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS revenue_instance__ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS revenue_instance__ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS revenue_instance__ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , EXTRACT(day FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_doy
+ , revenue_src_28000.user_id AS user
+ , revenue_src_28000.user_id AS revenue_instance__user
+FROM ***************************.fct_revenue revenue_src_28000
diff --git a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Databricks/test_convert_table_semantic_model_with_measures__plan0.sql b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Databricks/test_convert_table_semantic_model_with_measures__plan0.sql
index b8aab0fa4f..69baac5f43 100644
--- a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Databricks/test_convert_table_semantic_model_with_measures__plan0.sql
+++ b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Databricks/test_convert_table_semantic_model_with_measures__plan0.sql
@@ -1,53 +1,53 @@
-- Read Elements From Semantic Model 'id_verifications'
SELECT
1 AS identity_verifications
- , DATE_TRUNC('day', id_verifications_src_28004.ds) AS ds__day
- , DATE_TRUNC('week', id_verifications_src_28004.ds) AS ds__week
- , DATE_TRUNC('month', id_verifications_src_28004.ds) AS ds__month
- , DATE_TRUNC('quarter', id_verifications_src_28004.ds) AS ds__quarter
- , DATE_TRUNC('year', id_verifications_src_28004.ds) AS ds__year
- , EXTRACT(year FROM id_verifications_src_28004.ds) AS ds__extract_year
- , EXTRACT(quarter FROM id_verifications_src_28004.ds) AS ds__extract_quarter
- , EXTRACT(month FROM id_verifications_src_28004.ds) AS ds__extract_month
- , EXTRACT(day FROM id_verifications_src_28004.ds) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM id_verifications_src_28004.ds) AS ds__extract_dow
- , EXTRACT(doy FROM id_verifications_src_28004.ds) AS ds__extract_doy
- , DATE_TRUNC('day', id_verifications_src_28004.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', id_verifications_src_28004.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', id_verifications_src_28004.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', id_verifications_src_28004.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', id_verifications_src_28004.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_doy
- , id_verifications_src_28004.verification_type
- , DATE_TRUNC('day', id_verifications_src_28004.ds) AS verification__ds__day
- , DATE_TRUNC('week', id_verifications_src_28004.ds) AS verification__ds__week
- , DATE_TRUNC('month', id_verifications_src_28004.ds) AS verification__ds__month
- , DATE_TRUNC('quarter', id_verifications_src_28004.ds) AS verification__ds__quarter
- , DATE_TRUNC('year', id_verifications_src_28004.ds) AS verification__ds__year
- , EXTRACT(year FROM id_verifications_src_28004.ds) AS verification__ds__extract_year
- , EXTRACT(quarter FROM id_verifications_src_28004.ds) AS verification__ds__extract_quarter
- , EXTRACT(month FROM id_verifications_src_28004.ds) AS verification__ds__extract_month
- , EXTRACT(day FROM id_verifications_src_28004.ds) AS verification__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM id_verifications_src_28004.ds) AS verification__ds__extract_dow
- , EXTRACT(doy FROM id_verifications_src_28004.ds) AS verification__ds__extract_doy
- , DATE_TRUNC('day', id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__day
- , DATE_TRUNC('week', id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__week
- , DATE_TRUNC('month', id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__month
- , DATE_TRUNC('quarter', id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__quarter
- , DATE_TRUNC('year', id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__year
- , EXTRACT(year FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_year
- , EXTRACT(quarter FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_quarter
- , EXTRACT(month FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_month
- , EXTRACT(day FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_dow
- , EXTRACT(doy FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_doy
- , id_verifications_src_28004.verification_type AS verification__verification_type
- , id_verifications_src_28004.verification_id AS verification
- , id_verifications_src_28004.user_id AS user
- , id_verifications_src_28004.user_id AS verification__user
-FROM ***************************.fct_id_verifications id_verifications_src_28004
+ , DATE_TRUNC('day', id_verifications_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', id_verifications_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', id_verifications_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', id_verifications_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', id_verifications_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM id_verifications_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM id_verifications_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', id_verifications_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', id_verifications_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', id_verifications_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', id_verifications_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', id_verifications_src_28000.ds_partitioned) 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
+ , EXTRACT(day FROM id_verifications_src_28000.ds_partitioned) AS ds_partitioned__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM id_verifications_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM id_verifications_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , id_verifications_src_28000.verification_type
+ , DATE_TRUNC('day', id_verifications_src_28000.ds) AS verification__ds__day
+ , DATE_TRUNC('week', id_verifications_src_28000.ds) AS verification__ds__week
+ , DATE_TRUNC('month', id_verifications_src_28000.ds) AS verification__ds__month
+ , DATE_TRUNC('quarter', id_verifications_src_28000.ds) AS verification__ds__quarter
+ , DATE_TRUNC('year', id_verifications_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM id_verifications_src_28000.ds) AS verification__ds__extract_dow
+ , EXTRACT(doy FROM id_verifications_src_28000.ds) AS verification__ds__extract_doy
+ , DATE_TRUNC('day', id_verifications_src_28000.ds_partitioned) AS verification__ds_partitioned__day
+ , DATE_TRUNC('week', id_verifications_src_28000.ds_partitioned) AS verification__ds_partitioned__week
+ , DATE_TRUNC('month', id_verifications_src_28000.ds_partitioned) AS verification__ds_partitioned__month
+ , DATE_TRUNC('quarter', id_verifications_src_28000.ds_partitioned) AS verification__ds_partitioned__quarter
+ , DATE_TRUNC('year', id_verifications_src_28000.ds_partitioned) 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
+ , EXTRACT(day FROM id_verifications_src_28000.ds_partitioned) AS verification__ds_partitioned__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM id_verifications_src_28000.ds_partitioned) AS verification__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM id_verifications_src_28000.ds_partitioned) AS verification__ds_partitioned__extract_doy
+ , id_verifications_src_28000.verification_type AS verification__verification_type
+ , id_verifications_src_28000.verification_id AS verification
+ , id_verifications_src_28000.user_id AS user
+ , id_verifications_src_28000.user_id AS verification__user
+FROM ***************************.fct_id_verifications id_verifications_src_28000
diff --git a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Databricks/test_convert_table_semantic_model_without_measures__plan0.sql b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Databricks/test_convert_table_semantic_model_without_measures__plan0.sql
index b5f9e4bc6c..565bd5f4f0 100644
--- a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Databricks/test_convert_table_semantic_model_without_measures__plan0.sql
+++ b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Databricks/test_convert_table_semantic_model_without_measures__plan0.sql
@@ -1,28 +1,28 @@
-- Read Elements From Semantic Model 'users_latest'
SELECT
- DATE_TRUNC('day', users_latest_src_28009.ds) AS ds_latest__day
- , DATE_TRUNC('week', users_latest_src_28009.ds) AS ds_latest__week
- , DATE_TRUNC('month', users_latest_src_28009.ds) AS ds_latest__month
- , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS ds_latest__quarter
- , DATE_TRUNC('year', users_latest_src_28009.ds) AS ds_latest__year
- , EXTRACT(year FROM users_latest_src_28009.ds) AS ds_latest__extract_year
- , EXTRACT(quarter FROM users_latest_src_28009.ds) AS ds_latest__extract_quarter
- , EXTRACT(month FROM users_latest_src_28009.ds) AS ds_latest__extract_month
- , EXTRACT(day FROM users_latest_src_28009.ds) AS ds_latest__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM users_latest_src_28009.ds) AS ds_latest__extract_dow
- , EXTRACT(doy FROM users_latest_src_28009.ds) AS ds_latest__extract_doy
- , users_latest_src_28009.home_state_latest
- , DATE_TRUNC('day', users_latest_src_28009.ds) AS user__ds_latest__day
- , DATE_TRUNC('week', users_latest_src_28009.ds) AS user__ds_latest__week
- , DATE_TRUNC('month', users_latest_src_28009.ds) AS user__ds_latest__month
- , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS user__ds_latest__quarter
- , DATE_TRUNC('year', users_latest_src_28009.ds) AS user__ds_latest__year
- , EXTRACT(year FROM users_latest_src_28009.ds) AS user__ds_latest__extract_year
- , EXTRACT(quarter FROM users_latest_src_28009.ds) AS user__ds_latest__extract_quarter
- , EXTRACT(month FROM users_latest_src_28009.ds) AS user__ds_latest__extract_month
- , EXTRACT(day FROM users_latest_src_28009.ds) AS user__ds_latest__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM users_latest_src_28009.ds) AS user__ds_latest__extract_dow
- , EXTRACT(doy FROM users_latest_src_28009.ds) AS user__ds_latest__extract_doy
- , users_latest_src_28009.home_state_latest AS user__home_state_latest
- , users_latest_src_28009.user_id AS user
-FROM ***************************.dim_users_latest users_latest_src_28009
+ DATE_TRUNC('day', users_latest_src_28000.ds) AS ds_latest__day
+ , DATE_TRUNC('week', users_latest_src_28000.ds) AS ds_latest__week
+ , DATE_TRUNC('month', users_latest_src_28000.ds) AS ds_latest__month
+ , DATE_TRUNC('quarter', users_latest_src_28000.ds) AS ds_latest__quarter
+ , DATE_TRUNC('year', users_latest_src_28000.ds) 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
+ , EXTRACT(day FROM users_latest_src_28000.ds) AS ds_latest__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM users_latest_src_28000.ds) AS ds_latest__extract_dow
+ , EXTRACT(doy FROM users_latest_src_28000.ds) AS ds_latest__extract_doy
+ , users_latest_src_28000.home_state_latest
+ , DATE_TRUNC('day', users_latest_src_28000.ds) AS user__ds_latest__day
+ , DATE_TRUNC('week', users_latest_src_28000.ds) AS user__ds_latest__week
+ , DATE_TRUNC('month', users_latest_src_28000.ds) AS user__ds_latest__month
+ , DATE_TRUNC('quarter', users_latest_src_28000.ds) AS user__ds_latest__quarter
+ , DATE_TRUNC('year', users_latest_src_28000.ds) 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
+ , EXTRACT(day FROM users_latest_src_28000.ds) AS user__ds_latest__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM users_latest_src_28000.ds) AS user__ds_latest__extract_dow
+ , EXTRACT(doy FROM users_latest_src_28000.ds) AS user__ds_latest__extract_doy
+ , users_latest_src_28000.home_state_latest AS user__home_state_latest
+ , users_latest_src_28000.user_id AS user
+FROM ***************************.dim_users_latest users_latest_src_28000
diff --git a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/DuckDB/test_convert_query_semantic_model__plan0.sql b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/DuckDB/test_convert_query_semantic_model__plan0.sql
index 93878ce423..fb7e89c2c9 100644
--- a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/DuckDB/test_convert_query_semantic_model__plan0.sql
+++ b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/DuckDB/test_convert_query_semantic_model__plan0.sql
@@ -1,28 +1,28 @@
-- Read Elements From Semantic Model 'revenue'
SELECT
- revenue_src_28007.revenue AS txn_revenue
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day
- , EXTRACT(isodow FROM revenue_src_28007.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day
- , EXTRACT(isodow FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy
- , revenue_src_28007.user_id AS user
- , revenue_src_28007.user_id AS revenue_instance__user
-FROM ***************************.fct_revenue revenue_src_28007
+ revenue_src_28000.revenue AS txn_revenue
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , EXTRACT(isodow FROM revenue_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS revenue_instance__ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS revenue_instance__ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS revenue_instance__ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS revenue_instance__ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , EXTRACT(day FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_day
+ , EXTRACT(isodow FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_doy
+ , revenue_src_28000.user_id AS user
+ , revenue_src_28000.user_id AS revenue_instance__user
+FROM ***************************.fct_revenue revenue_src_28000
diff --git a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/DuckDB/test_convert_table_semantic_model_with_measures__plan0.sql b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/DuckDB/test_convert_table_semantic_model_with_measures__plan0.sql
index b98864646d..e05f176f0d 100644
--- a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/DuckDB/test_convert_table_semantic_model_with_measures__plan0.sql
+++ b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/DuckDB/test_convert_table_semantic_model_with_measures__plan0.sql
@@ -1,53 +1,53 @@
-- Read Elements From Semantic Model 'id_verifications'
SELECT
1 AS identity_verifications
- , DATE_TRUNC('day', id_verifications_src_28004.ds) AS ds__day
- , DATE_TRUNC('week', id_verifications_src_28004.ds) AS ds__week
- , DATE_TRUNC('month', id_verifications_src_28004.ds) AS ds__month
- , DATE_TRUNC('quarter', id_verifications_src_28004.ds) AS ds__quarter
- , DATE_TRUNC('year', id_verifications_src_28004.ds) AS ds__year
- , EXTRACT(year FROM id_verifications_src_28004.ds) AS ds__extract_year
- , EXTRACT(quarter FROM id_verifications_src_28004.ds) AS ds__extract_quarter
- , EXTRACT(month FROM id_verifications_src_28004.ds) AS ds__extract_month
- , EXTRACT(day FROM id_verifications_src_28004.ds) AS ds__extract_day
- , EXTRACT(isodow FROM id_verifications_src_28004.ds) AS ds__extract_dow
- , EXTRACT(doy FROM id_verifications_src_28004.ds) AS ds__extract_doy
- , DATE_TRUNC('day', id_verifications_src_28004.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', id_verifications_src_28004.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', id_verifications_src_28004.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', id_verifications_src_28004.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', id_verifications_src_28004.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_doy
- , id_verifications_src_28004.verification_type
- , DATE_TRUNC('day', id_verifications_src_28004.ds) AS verification__ds__day
- , DATE_TRUNC('week', id_verifications_src_28004.ds) AS verification__ds__week
- , DATE_TRUNC('month', id_verifications_src_28004.ds) AS verification__ds__month
- , DATE_TRUNC('quarter', id_verifications_src_28004.ds) AS verification__ds__quarter
- , DATE_TRUNC('year', id_verifications_src_28004.ds) AS verification__ds__year
- , EXTRACT(year FROM id_verifications_src_28004.ds) AS verification__ds__extract_year
- , EXTRACT(quarter FROM id_verifications_src_28004.ds) AS verification__ds__extract_quarter
- , EXTRACT(month FROM id_verifications_src_28004.ds) AS verification__ds__extract_month
- , EXTRACT(day FROM id_verifications_src_28004.ds) AS verification__ds__extract_day
- , EXTRACT(isodow FROM id_verifications_src_28004.ds) AS verification__ds__extract_dow
- , EXTRACT(doy FROM id_verifications_src_28004.ds) AS verification__ds__extract_doy
- , DATE_TRUNC('day', id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__day
- , DATE_TRUNC('week', id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__week
- , DATE_TRUNC('month', id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__month
- , DATE_TRUNC('quarter', id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__quarter
- , DATE_TRUNC('year', id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__year
- , EXTRACT(year FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_year
- , EXTRACT(quarter FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_quarter
- , EXTRACT(month FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_month
- , EXTRACT(day FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_day
- , EXTRACT(isodow FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_dow
- , EXTRACT(doy FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_doy
- , id_verifications_src_28004.verification_type AS verification__verification_type
- , id_verifications_src_28004.verification_id AS verification
- , id_verifications_src_28004.user_id AS user
- , id_verifications_src_28004.user_id AS verification__user
-FROM ***************************.fct_id_verifications id_verifications_src_28004
+ , DATE_TRUNC('day', id_verifications_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', id_verifications_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', id_verifications_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', id_verifications_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', id_verifications_src_28000.ds) 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
+ , EXTRACT(isodow FROM id_verifications_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM id_verifications_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', id_verifications_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', id_verifications_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', id_verifications_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', id_verifications_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', id_verifications_src_28000.ds_partitioned) 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
+ , EXTRACT(day FROM id_verifications_src_28000.ds_partitioned) AS ds_partitioned__extract_day
+ , EXTRACT(isodow FROM id_verifications_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM id_verifications_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , id_verifications_src_28000.verification_type
+ , DATE_TRUNC('day', id_verifications_src_28000.ds) AS verification__ds__day
+ , DATE_TRUNC('week', id_verifications_src_28000.ds) AS verification__ds__week
+ , DATE_TRUNC('month', id_verifications_src_28000.ds) AS verification__ds__month
+ , DATE_TRUNC('quarter', id_verifications_src_28000.ds) AS verification__ds__quarter
+ , DATE_TRUNC('year', id_verifications_src_28000.ds) 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
+ , EXTRACT(isodow FROM id_verifications_src_28000.ds) AS verification__ds__extract_dow
+ , EXTRACT(doy FROM id_verifications_src_28000.ds) AS verification__ds__extract_doy
+ , DATE_TRUNC('day', id_verifications_src_28000.ds_partitioned) AS verification__ds_partitioned__day
+ , DATE_TRUNC('week', id_verifications_src_28000.ds_partitioned) AS verification__ds_partitioned__week
+ , DATE_TRUNC('month', id_verifications_src_28000.ds_partitioned) AS verification__ds_partitioned__month
+ , DATE_TRUNC('quarter', id_verifications_src_28000.ds_partitioned) AS verification__ds_partitioned__quarter
+ , DATE_TRUNC('year', id_verifications_src_28000.ds_partitioned) 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
+ , EXTRACT(day FROM id_verifications_src_28000.ds_partitioned) AS verification__ds_partitioned__extract_day
+ , EXTRACT(isodow FROM id_verifications_src_28000.ds_partitioned) AS verification__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM id_verifications_src_28000.ds_partitioned) AS verification__ds_partitioned__extract_doy
+ , id_verifications_src_28000.verification_type AS verification__verification_type
+ , id_verifications_src_28000.verification_id AS verification
+ , id_verifications_src_28000.user_id AS user
+ , id_verifications_src_28000.user_id AS verification__user
+FROM ***************************.fct_id_verifications id_verifications_src_28000
diff --git a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/DuckDB/test_convert_table_semantic_model_without_measures__plan0.sql b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/DuckDB/test_convert_table_semantic_model_without_measures__plan0.sql
index f0423bde3c..ac68907b77 100644
--- a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/DuckDB/test_convert_table_semantic_model_without_measures__plan0.sql
+++ b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/DuckDB/test_convert_table_semantic_model_without_measures__plan0.sql
@@ -1,28 +1,28 @@
-- Read Elements From Semantic Model 'users_latest'
SELECT
- DATE_TRUNC('day', users_latest_src_28009.ds) AS ds_latest__day
- , DATE_TRUNC('week', users_latest_src_28009.ds) AS ds_latest__week
- , DATE_TRUNC('month', users_latest_src_28009.ds) AS ds_latest__month
- , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS ds_latest__quarter
- , DATE_TRUNC('year', users_latest_src_28009.ds) AS ds_latest__year
- , EXTRACT(year FROM users_latest_src_28009.ds) AS ds_latest__extract_year
- , EXTRACT(quarter FROM users_latest_src_28009.ds) AS ds_latest__extract_quarter
- , EXTRACT(month FROM users_latest_src_28009.ds) AS ds_latest__extract_month
- , EXTRACT(day FROM users_latest_src_28009.ds) AS ds_latest__extract_day
- , EXTRACT(isodow FROM users_latest_src_28009.ds) AS ds_latest__extract_dow
- , EXTRACT(doy FROM users_latest_src_28009.ds) AS ds_latest__extract_doy
- , users_latest_src_28009.home_state_latest
- , DATE_TRUNC('day', users_latest_src_28009.ds) AS user__ds_latest__day
- , DATE_TRUNC('week', users_latest_src_28009.ds) AS user__ds_latest__week
- , DATE_TRUNC('month', users_latest_src_28009.ds) AS user__ds_latest__month
- , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS user__ds_latest__quarter
- , DATE_TRUNC('year', users_latest_src_28009.ds) AS user__ds_latest__year
- , EXTRACT(year FROM users_latest_src_28009.ds) AS user__ds_latest__extract_year
- , EXTRACT(quarter FROM users_latest_src_28009.ds) AS user__ds_latest__extract_quarter
- , EXTRACT(month FROM users_latest_src_28009.ds) AS user__ds_latest__extract_month
- , EXTRACT(day FROM users_latest_src_28009.ds) AS user__ds_latest__extract_day
- , EXTRACT(isodow FROM users_latest_src_28009.ds) AS user__ds_latest__extract_dow
- , EXTRACT(doy FROM users_latest_src_28009.ds) AS user__ds_latest__extract_doy
- , users_latest_src_28009.home_state_latest AS user__home_state_latest
- , users_latest_src_28009.user_id AS user
-FROM ***************************.dim_users_latest users_latest_src_28009
+ DATE_TRUNC('day', users_latest_src_28000.ds) AS ds_latest__day
+ , DATE_TRUNC('week', users_latest_src_28000.ds) AS ds_latest__week
+ , DATE_TRUNC('month', users_latest_src_28000.ds) AS ds_latest__month
+ , DATE_TRUNC('quarter', users_latest_src_28000.ds) AS ds_latest__quarter
+ , DATE_TRUNC('year', users_latest_src_28000.ds) 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
+ , EXTRACT(day FROM users_latest_src_28000.ds) AS ds_latest__extract_day
+ , EXTRACT(isodow FROM users_latest_src_28000.ds) AS ds_latest__extract_dow
+ , EXTRACT(doy FROM users_latest_src_28000.ds) AS ds_latest__extract_doy
+ , users_latest_src_28000.home_state_latest
+ , DATE_TRUNC('day', users_latest_src_28000.ds) AS user__ds_latest__day
+ , DATE_TRUNC('week', users_latest_src_28000.ds) AS user__ds_latest__week
+ , DATE_TRUNC('month', users_latest_src_28000.ds) AS user__ds_latest__month
+ , DATE_TRUNC('quarter', users_latest_src_28000.ds) AS user__ds_latest__quarter
+ , DATE_TRUNC('year', users_latest_src_28000.ds) 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
+ , EXTRACT(day FROM users_latest_src_28000.ds) AS user__ds_latest__extract_day
+ , EXTRACT(isodow FROM users_latest_src_28000.ds) AS user__ds_latest__extract_dow
+ , EXTRACT(doy FROM users_latest_src_28000.ds) AS user__ds_latest__extract_doy
+ , users_latest_src_28000.home_state_latest AS user__home_state_latest
+ , users_latest_src_28000.user_id AS user
+FROM ***************************.dim_users_latest users_latest_src_28000
diff --git a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Postgres/test_convert_query_semantic_model__plan0.sql b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Postgres/test_convert_query_semantic_model__plan0.sql
index 93878ce423..fb7e89c2c9 100644
--- a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Postgres/test_convert_query_semantic_model__plan0.sql
+++ b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Postgres/test_convert_query_semantic_model__plan0.sql
@@ -1,28 +1,28 @@
-- Read Elements From Semantic Model 'revenue'
SELECT
- revenue_src_28007.revenue AS txn_revenue
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day
- , EXTRACT(isodow FROM revenue_src_28007.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day
- , EXTRACT(isodow FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy
- , revenue_src_28007.user_id AS user
- , revenue_src_28007.user_id AS revenue_instance__user
-FROM ***************************.fct_revenue revenue_src_28007
+ revenue_src_28000.revenue AS txn_revenue
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , EXTRACT(isodow FROM revenue_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS revenue_instance__ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS revenue_instance__ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS revenue_instance__ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS revenue_instance__ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , EXTRACT(day FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_day
+ , EXTRACT(isodow FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_doy
+ , revenue_src_28000.user_id AS user
+ , revenue_src_28000.user_id AS revenue_instance__user
+FROM ***************************.fct_revenue revenue_src_28000
diff --git a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Postgres/test_convert_table_semantic_model_with_measures__plan0.sql b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Postgres/test_convert_table_semantic_model_with_measures__plan0.sql
index b98864646d..e05f176f0d 100644
--- a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Postgres/test_convert_table_semantic_model_with_measures__plan0.sql
+++ b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Postgres/test_convert_table_semantic_model_with_measures__plan0.sql
@@ -1,53 +1,53 @@
-- Read Elements From Semantic Model 'id_verifications'
SELECT
1 AS identity_verifications
- , DATE_TRUNC('day', id_verifications_src_28004.ds) AS ds__day
- , DATE_TRUNC('week', id_verifications_src_28004.ds) AS ds__week
- , DATE_TRUNC('month', id_verifications_src_28004.ds) AS ds__month
- , DATE_TRUNC('quarter', id_verifications_src_28004.ds) AS ds__quarter
- , DATE_TRUNC('year', id_verifications_src_28004.ds) AS ds__year
- , EXTRACT(year FROM id_verifications_src_28004.ds) AS ds__extract_year
- , EXTRACT(quarter FROM id_verifications_src_28004.ds) AS ds__extract_quarter
- , EXTRACT(month FROM id_verifications_src_28004.ds) AS ds__extract_month
- , EXTRACT(day FROM id_verifications_src_28004.ds) AS ds__extract_day
- , EXTRACT(isodow FROM id_verifications_src_28004.ds) AS ds__extract_dow
- , EXTRACT(doy FROM id_verifications_src_28004.ds) AS ds__extract_doy
- , DATE_TRUNC('day', id_verifications_src_28004.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', id_verifications_src_28004.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', id_verifications_src_28004.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', id_verifications_src_28004.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', id_verifications_src_28004.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_doy
- , id_verifications_src_28004.verification_type
- , DATE_TRUNC('day', id_verifications_src_28004.ds) AS verification__ds__day
- , DATE_TRUNC('week', id_verifications_src_28004.ds) AS verification__ds__week
- , DATE_TRUNC('month', id_verifications_src_28004.ds) AS verification__ds__month
- , DATE_TRUNC('quarter', id_verifications_src_28004.ds) AS verification__ds__quarter
- , DATE_TRUNC('year', id_verifications_src_28004.ds) AS verification__ds__year
- , EXTRACT(year FROM id_verifications_src_28004.ds) AS verification__ds__extract_year
- , EXTRACT(quarter FROM id_verifications_src_28004.ds) AS verification__ds__extract_quarter
- , EXTRACT(month FROM id_verifications_src_28004.ds) AS verification__ds__extract_month
- , EXTRACT(day FROM id_verifications_src_28004.ds) AS verification__ds__extract_day
- , EXTRACT(isodow FROM id_verifications_src_28004.ds) AS verification__ds__extract_dow
- , EXTRACT(doy FROM id_verifications_src_28004.ds) AS verification__ds__extract_doy
- , DATE_TRUNC('day', id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__day
- , DATE_TRUNC('week', id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__week
- , DATE_TRUNC('month', id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__month
- , DATE_TRUNC('quarter', id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__quarter
- , DATE_TRUNC('year', id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__year
- , EXTRACT(year FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_year
- , EXTRACT(quarter FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_quarter
- , EXTRACT(month FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_month
- , EXTRACT(day FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_day
- , EXTRACT(isodow FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_dow
- , EXTRACT(doy FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_doy
- , id_verifications_src_28004.verification_type AS verification__verification_type
- , id_verifications_src_28004.verification_id AS verification
- , id_verifications_src_28004.user_id AS user
- , id_verifications_src_28004.user_id AS verification__user
-FROM ***************************.fct_id_verifications id_verifications_src_28004
+ , DATE_TRUNC('day', id_verifications_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', id_verifications_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', id_verifications_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', id_verifications_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', id_verifications_src_28000.ds) 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
+ , EXTRACT(isodow FROM id_verifications_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM id_verifications_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', id_verifications_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', id_verifications_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', id_verifications_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', id_verifications_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', id_verifications_src_28000.ds_partitioned) 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
+ , EXTRACT(day FROM id_verifications_src_28000.ds_partitioned) AS ds_partitioned__extract_day
+ , EXTRACT(isodow FROM id_verifications_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM id_verifications_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , id_verifications_src_28000.verification_type
+ , DATE_TRUNC('day', id_verifications_src_28000.ds) AS verification__ds__day
+ , DATE_TRUNC('week', id_verifications_src_28000.ds) AS verification__ds__week
+ , DATE_TRUNC('month', id_verifications_src_28000.ds) AS verification__ds__month
+ , DATE_TRUNC('quarter', id_verifications_src_28000.ds) AS verification__ds__quarter
+ , DATE_TRUNC('year', id_verifications_src_28000.ds) 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
+ , EXTRACT(isodow FROM id_verifications_src_28000.ds) AS verification__ds__extract_dow
+ , EXTRACT(doy FROM id_verifications_src_28000.ds) AS verification__ds__extract_doy
+ , DATE_TRUNC('day', id_verifications_src_28000.ds_partitioned) AS verification__ds_partitioned__day
+ , DATE_TRUNC('week', id_verifications_src_28000.ds_partitioned) AS verification__ds_partitioned__week
+ , DATE_TRUNC('month', id_verifications_src_28000.ds_partitioned) AS verification__ds_partitioned__month
+ , DATE_TRUNC('quarter', id_verifications_src_28000.ds_partitioned) AS verification__ds_partitioned__quarter
+ , DATE_TRUNC('year', id_verifications_src_28000.ds_partitioned) 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
+ , EXTRACT(day FROM id_verifications_src_28000.ds_partitioned) AS verification__ds_partitioned__extract_day
+ , EXTRACT(isodow FROM id_verifications_src_28000.ds_partitioned) AS verification__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM id_verifications_src_28000.ds_partitioned) AS verification__ds_partitioned__extract_doy
+ , id_verifications_src_28000.verification_type AS verification__verification_type
+ , id_verifications_src_28000.verification_id AS verification
+ , id_verifications_src_28000.user_id AS user
+ , id_verifications_src_28000.user_id AS verification__user
+FROM ***************************.fct_id_verifications id_verifications_src_28000
diff --git a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Postgres/test_convert_table_semantic_model_without_measures__plan0.sql b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Postgres/test_convert_table_semantic_model_without_measures__plan0.sql
index f0423bde3c..ac68907b77 100644
--- a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Postgres/test_convert_table_semantic_model_without_measures__plan0.sql
+++ b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Postgres/test_convert_table_semantic_model_without_measures__plan0.sql
@@ -1,28 +1,28 @@
-- Read Elements From Semantic Model 'users_latest'
SELECT
- DATE_TRUNC('day', users_latest_src_28009.ds) AS ds_latest__day
- , DATE_TRUNC('week', users_latest_src_28009.ds) AS ds_latest__week
- , DATE_TRUNC('month', users_latest_src_28009.ds) AS ds_latest__month
- , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS ds_latest__quarter
- , DATE_TRUNC('year', users_latest_src_28009.ds) AS ds_latest__year
- , EXTRACT(year FROM users_latest_src_28009.ds) AS ds_latest__extract_year
- , EXTRACT(quarter FROM users_latest_src_28009.ds) AS ds_latest__extract_quarter
- , EXTRACT(month FROM users_latest_src_28009.ds) AS ds_latest__extract_month
- , EXTRACT(day FROM users_latest_src_28009.ds) AS ds_latest__extract_day
- , EXTRACT(isodow FROM users_latest_src_28009.ds) AS ds_latest__extract_dow
- , EXTRACT(doy FROM users_latest_src_28009.ds) AS ds_latest__extract_doy
- , users_latest_src_28009.home_state_latest
- , DATE_TRUNC('day', users_latest_src_28009.ds) AS user__ds_latest__day
- , DATE_TRUNC('week', users_latest_src_28009.ds) AS user__ds_latest__week
- , DATE_TRUNC('month', users_latest_src_28009.ds) AS user__ds_latest__month
- , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS user__ds_latest__quarter
- , DATE_TRUNC('year', users_latest_src_28009.ds) AS user__ds_latest__year
- , EXTRACT(year FROM users_latest_src_28009.ds) AS user__ds_latest__extract_year
- , EXTRACT(quarter FROM users_latest_src_28009.ds) AS user__ds_latest__extract_quarter
- , EXTRACT(month FROM users_latest_src_28009.ds) AS user__ds_latest__extract_month
- , EXTRACT(day FROM users_latest_src_28009.ds) AS user__ds_latest__extract_day
- , EXTRACT(isodow FROM users_latest_src_28009.ds) AS user__ds_latest__extract_dow
- , EXTRACT(doy FROM users_latest_src_28009.ds) AS user__ds_latest__extract_doy
- , users_latest_src_28009.home_state_latest AS user__home_state_latest
- , users_latest_src_28009.user_id AS user
-FROM ***************************.dim_users_latest users_latest_src_28009
+ DATE_TRUNC('day', users_latest_src_28000.ds) AS ds_latest__day
+ , DATE_TRUNC('week', users_latest_src_28000.ds) AS ds_latest__week
+ , DATE_TRUNC('month', users_latest_src_28000.ds) AS ds_latest__month
+ , DATE_TRUNC('quarter', users_latest_src_28000.ds) AS ds_latest__quarter
+ , DATE_TRUNC('year', users_latest_src_28000.ds) 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
+ , EXTRACT(day FROM users_latest_src_28000.ds) AS ds_latest__extract_day
+ , EXTRACT(isodow FROM users_latest_src_28000.ds) AS ds_latest__extract_dow
+ , EXTRACT(doy FROM users_latest_src_28000.ds) AS ds_latest__extract_doy
+ , users_latest_src_28000.home_state_latest
+ , DATE_TRUNC('day', users_latest_src_28000.ds) AS user__ds_latest__day
+ , DATE_TRUNC('week', users_latest_src_28000.ds) AS user__ds_latest__week
+ , DATE_TRUNC('month', users_latest_src_28000.ds) AS user__ds_latest__month
+ , DATE_TRUNC('quarter', users_latest_src_28000.ds) AS user__ds_latest__quarter
+ , DATE_TRUNC('year', users_latest_src_28000.ds) 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
+ , EXTRACT(day FROM users_latest_src_28000.ds) AS user__ds_latest__extract_day
+ , EXTRACT(isodow FROM users_latest_src_28000.ds) AS user__ds_latest__extract_dow
+ , EXTRACT(doy FROM users_latest_src_28000.ds) AS user__ds_latest__extract_doy
+ , users_latest_src_28000.home_state_latest AS user__home_state_latest
+ , users_latest_src_28000.user_id AS user
+FROM ***************************.dim_users_latest users_latest_src_28000
diff --git a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Redshift/test_convert_query_semantic_model__plan0.sql b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Redshift/test_convert_query_semantic_model__plan0.sql
index ca527146f8..111741670d 100644
--- a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Redshift/test_convert_query_semantic_model__plan0.sql
+++ b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Redshift/test_convert_query_semantic_model__plan0.sql
@@ -1,28 +1,28 @@
-- Read Elements From Semantic Model 'revenue'
SELECT
- revenue_src_28007.revenue AS txn_revenue
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day
- , CASE WHEN EXTRACT(dow FROM revenue_src_28007.created_at) = 0 THEN EXTRACT(dow FROM revenue_src_28007.created_at) + 7 ELSE EXTRACT(dow FROM revenue_src_28007.created_at) END AS ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day
- , CASE WHEN EXTRACT(dow FROM revenue_src_28007.created_at) = 0 THEN EXTRACT(dow FROM revenue_src_28007.created_at) + 7 ELSE EXTRACT(dow FROM revenue_src_28007.created_at) END AS revenue_instance__ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy
- , revenue_src_28007.user_id AS user
- , revenue_src_28007.user_id AS revenue_instance__user
-FROM ***************************.fct_revenue revenue_src_28007
+ revenue_src_28000.revenue AS txn_revenue
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , CASE WHEN EXTRACT(dow FROM revenue_src_28000.created_at) = 0 THEN EXTRACT(dow FROM revenue_src_28000.created_at) + 7 ELSE EXTRACT(dow FROM revenue_src_28000.created_at) END AS ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS revenue_instance__ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS revenue_instance__ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS revenue_instance__ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS revenue_instance__ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , EXTRACT(day FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_day
+ , CASE WHEN EXTRACT(dow FROM revenue_src_28000.created_at) = 0 THEN EXTRACT(dow FROM revenue_src_28000.created_at) + 7 ELSE EXTRACT(dow FROM revenue_src_28000.created_at) END AS revenue_instance__ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_doy
+ , revenue_src_28000.user_id AS user
+ , revenue_src_28000.user_id AS revenue_instance__user
+FROM ***************************.fct_revenue revenue_src_28000
diff --git a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Redshift/test_convert_table_semantic_model_with_measures__plan0.sql b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Redshift/test_convert_table_semantic_model_with_measures__plan0.sql
index 29b9a9ebb4..a447b8d7ee 100644
--- a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Redshift/test_convert_table_semantic_model_with_measures__plan0.sql
+++ b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Redshift/test_convert_table_semantic_model_with_measures__plan0.sql
@@ -1,53 +1,53 @@
-- Read Elements From Semantic Model 'id_verifications'
SELECT
1 AS identity_verifications
- , DATE_TRUNC('day', id_verifications_src_28004.ds) AS ds__day
- , DATE_TRUNC('week', id_verifications_src_28004.ds) AS ds__week
- , DATE_TRUNC('month', id_verifications_src_28004.ds) AS ds__month
- , DATE_TRUNC('quarter', id_verifications_src_28004.ds) AS ds__quarter
- , DATE_TRUNC('year', id_verifications_src_28004.ds) AS ds__year
- , EXTRACT(year FROM id_verifications_src_28004.ds) AS ds__extract_year
- , EXTRACT(quarter FROM id_verifications_src_28004.ds) AS ds__extract_quarter
- , EXTRACT(month FROM id_verifications_src_28004.ds) AS ds__extract_month
- , EXTRACT(day FROM id_verifications_src_28004.ds) AS ds__extract_day
- , CASE WHEN EXTRACT(dow FROM id_verifications_src_28004.ds) = 0 THEN EXTRACT(dow FROM id_verifications_src_28004.ds) + 7 ELSE EXTRACT(dow FROM id_verifications_src_28004.ds) END AS ds__extract_dow
- , EXTRACT(doy FROM id_verifications_src_28004.ds) AS ds__extract_doy
- , DATE_TRUNC('day', id_verifications_src_28004.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', id_verifications_src_28004.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', id_verifications_src_28004.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', id_verifications_src_28004.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', id_verifications_src_28004.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_day
- , CASE WHEN EXTRACT(dow FROM id_verifications_src_28004.ds_partitioned) = 0 THEN EXTRACT(dow FROM id_verifications_src_28004.ds_partitioned) + 7 ELSE EXTRACT(dow FROM id_verifications_src_28004.ds_partitioned) END AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_doy
- , id_verifications_src_28004.verification_type
- , DATE_TRUNC('day', id_verifications_src_28004.ds) AS verification__ds__day
- , DATE_TRUNC('week', id_verifications_src_28004.ds) AS verification__ds__week
- , DATE_TRUNC('month', id_verifications_src_28004.ds) AS verification__ds__month
- , DATE_TRUNC('quarter', id_verifications_src_28004.ds) AS verification__ds__quarter
- , DATE_TRUNC('year', id_verifications_src_28004.ds) AS verification__ds__year
- , EXTRACT(year FROM id_verifications_src_28004.ds) AS verification__ds__extract_year
- , EXTRACT(quarter FROM id_verifications_src_28004.ds) AS verification__ds__extract_quarter
- , EXTRACT(month FROM id_verifications_src_28004.ds) AS verification__ds__extract_month
- , EXTRACT(day FROM id_verifications_src_28004.ds) AS verification__ds__extract_day
- , CASE WHEN EXTRACT(dow FROM id_verifications_src_28004.ds) = 0 THEN EXTRACT(dow FROM id_verifications_src_28004.ds) + 7 ELSE EXTRACT(dow FROM id_verifications_src_28004.ds) END AS verification__ds__extract_dow
- , EXTRACT(doy FROM id_verifications_src_28004.ds) AS verification__ds__extract_doy
- , DATE_TRUNC('day', id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__day
- , DATE_TRUNC('week', id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__week
- , DATE_TRUNC('month', id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__month
- , DATE_TRUNC('quarter', id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__quarter
- , DATE_TRUNC('year', id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__year
- , EXTRACT(year FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_year
- , EXTRACT(quarter FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_quarter
- , EXTRACT(month FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_month
- , EXTRACT(day FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_day
- , CASE WHEN EXTRACT(dow FROM id_verifications_src_28004.ds_partitioned) = 0 THEN EXTRACT(dow FROM id_verifications_src_28004.ds_partitioned) + 7 ELSE EXTRACT(dow FROM id_verifications_src_28004.ds_partitioned) END AS verification__ds_partitioned__extract_dow
- , EXTRACT(doy FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_doy
- , id_verifications_src_28004.verification_type AS verification__verification_type
- , id_verifications_src_28004.verification_id AS verification
- , id_verifications_src_28004.user_id AS user
- , id_verifications_src_28004.user_id AS verification__user
-FROM ***************************.fct_id_verifications id_verifications_src_28004
+ , DATE_TRUNC('day', id_verifications_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', id_verifications_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', id_verifications_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', id_verifications_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', id_verifications_src_28000.ds) 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
+ , CASE WHEN EXTRACT(dow FROM id_verifications_src_28000.ds) = 0 THEN EXTRACT(dow FROM id_verifications_src_28000.ds) + 7 ELSE EXTRACT(dow FROM id_verifications_src_28000.ds) END AS ds__extract_dow
+ , EXTRACT(doy FROM id_verifications_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', id_verifications_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', id_verifications_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', id_verifications_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', id_verifications_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', id_verifications_src_28000.ds_partitioned) 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
+ , EXTRACT(day FROM id_verifications_src_28000.ds_partitioned) AS ds_partitioned__extract_day
+ , CASE WHEN EXTRACT(dow FROM id_verifications_src_28000.ds_partitioned) = 0 THEN EXTRACT(dow FROM id_verifications_src_28000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM id_verifications_src_28000.ds_partitioned) END AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM id_verifications_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , id_verifications_src_28000.verification_type
+ , DATE_TRUNC('day', id_verifications_src_28000.ds) AS verification__ds__day
+ , DATE_TRUNC('week', id_verifications_src_28000.ds) AS verification__ds__week
+ , DATE_TRUNC('month', id_verifications_src_28000.ds) AS verification__ds__month
+ , DATE_TRUNC('quarter', id_verifications_src_28000.ds) AS verification__ds__quarter
+ , DATE_TRUNC('year', id_verifications_src_28000.ds) 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
+ , CASE WHEN EXTRACT(dow FROM id_verifications_src_28000.ds) = 0 THEN EXTRACT(dow FROM id_verifications_src_28000.ds) + 7 ELSE EXTRACT(dow FROM id_verifications_src_28000.ds) END AS verification__ds__extract_dow
+ , EXTRACT(doy FROM id_verifications_src_28000.ds) AS verification__ds__extract_doy
+ , DATE_TRUNC('day', id_verifications_src_28000.ds_partitioned) AS verification__ds_partitioned__day
+ , DATE_TRUNC('week', id_verifications_src_28000.ds_partitioned) AS verification__ds_partitioned__week
+ , DATE_TRUNC('month', id_verifications_src_28000.ds_partitioned) AS verification__ds_partitioned__month
+ , DATE_TRUNC('quarter', id_verifications_src_28000.ds_partitioned) AS verification__ds_partitioned__quarter
+ , DATE_TRUNC('year', id_verifications_src_28000.ds_partitioned) 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
+ , EXTRACT(day FROM id_verifications_src_28000.ds_partitioned) AS verification__ds_partitioned__extract_day
+ , CASE WHEN EXTRACT(dow FROM id_verifications_src_28000.ds_partitioned) = 0 THEN EXTRACT(dow FROM id_verifications_src_28000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM id_verifications_src_28000.ds_partitioned) END AS verification__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM id_verifications_src_28000.ds_partitioned) AS verification__ds_partitioned__extract_doy
+ , id_verifications_src_28000.verification_type AS verification__verification_type
+ , id_verifications_src_28000.verification_id AS verification
+ , id_verifications_src_28000.user_id AS user
+ , id_verifications_src_28000.user_id AS verification__user
+FROM ***************************.fct_id_verifications id_verifications_src_28000
diff --git a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Redshift/test_convert_table_semantic_model_without_measures__plan0.sql b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Redshift/test_convert_table_semantic_model_without_measures__plan0.sql
index e6266dac25..462d46fffe 100644
--- a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Redshift/test_convert_table_semantic_model_without_measures__plan0.sql
+++ b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Redshift/test_convert_table_semantic_model_without_measures__plan0.sql
@@ -1,28 +1,28 @@
-- Read Elements From Semantic Model 'users_latest'
SELECT
- DATE_TRUNC('day', users_latest_src_28009.ds) AS ds_latest__day
- , DATE_TRUNC('week', users_latest_src_28009.ds) AS ds_latest__week
- , DATE_TRUNC('month', users_latest_src_28009.ds) AS ds_latest__month
- , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS ds_latest__quarter
- , DATE_TRUNC('year', users_latest_src_28009.ds) AS ds_latest__year
- , EXTRACT(year FROM users_latest_src_28009.ds) AS ds_latest__extract_year
- , EXTRACT(quarter FROM users_latest_src_28009.ds) AS ds_latest__extract_quarter
- , EXTRACT(month FROM users_latest_src_28009.ds) AS ds_latest__extract_month
- , EXTRACT(day FROM users_latest_src_28009.ds) AS ds_latest__extract_day
- , CASE WHEN EXTRACT(dow FROM users_latest_src_28009.ds) = 0 THEN EXTRACT(dow FROM users_latest_src_28009.ds) + 7 ELSE EXTRACT(dow FROM users_latest_src_28009.ds) END AS ds_latest__extract_dow
- , EXTRACT(doy FROM users_latest_src_28009.ds) AS ds_latest__extract_doy
- , users_latest_src_28009.home_state_latest
- , DATE_TRUNC('day', users_latest_src_28009.ds) AS user__ds_latest__day
- , DATE_TRUNC('week', users_latest_src_28009.ds) AS user__ds_latest__week
- , DATE_TRUNC('month', users_latest_src_28009.ds) AS user__ds_latest__month
- , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS user__ds_latest__quarter
- , DATE_TRUNC('year', users_latest_src_28009.ds) AS user__ds_latest__year
- , EXTRACT(year FROM users_latest_src_28009.ds) AS user__ds_latest__extract_year
- , EXTRACT(quarter FROM users_latest_src_28009.ds) AS user__ds_latest__extract_quarter
- , EXTRACT(month FROM users_latest_src_28009.ds) AS user__ds_latest__extract_month
- , EXTRACT(day FROM users_latest_src_28009.ds) AS user__ds_latest__extract_day
- , CASE WHEN EXTRACT(dow FROM users_latest_src_28009.ds) = 0 THEN EXTRACT(dow FROM users_latest_src_28009.ds) + 7 ELSE EXTRACT(dow FROM users_latest_src_28009.ds) END AS user__ds_latest__extract_dow
- , EXTRACT(doy FROM users_latest_src_28009.ds) AS user__ds_latest__extract_doy
- , users_latest_src_28009.home_state_latest AS user__home_state_latest
- , users_latest_src_28009.user_id AS user
-FROM ***************************.dim_users_latest users_latest_src_28009
+ DATE_TRUNC('day', users_latest_src_28000.ds) AS ds_latest__day
+ , DATE_TRUNC('week', users_latest_src_28000.ds) AS ds_latest__week
+ , DATE_TRUNC('month', users_latest_src_28000.ds) AS ds_latest__month
+ , DATE_TRUNC('quarter', users_latest_src_28000.ds) AS ds_latest__quarter
+ , DATE_TRUNC('year', users_latest_src_28000.ds) 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
+ , EXTRACT(day FROM users_latest_src_28000.ds) AS ds_latest__extract_day
+ , CASE WHEN EXTRACT(dow FROM users_latest_src_28000.ds) = 0 THEN EXTRACT(dow FROM users_latest_src_28000.ds) + 7 ELSE EXTRACT(dow FROM users_latest_src_28000.ds) END AS ds_latest__extract_dow
+ , EXTRACT(doy FROM users_latest_src_28000.ds) AS ds_latest__extract_doy
+ , users_latest_src_28000.home_state_latest
+ , DATE_TRUNC('day', users_latest_src_28000.ds) AS user__ds_latest__day
+ , DATE_TRUNC('week', users_latest_src_28000.ds) AS user__ds_latest__week
+ , DATE_TRUNC('month', users_latest_src_28000.ds) AS user__ds_latest__month
+ , DATE_TRUNC('quarter', users_latest_src_28000.ds) AS user__ds_latest__quarter
+ , DATE_TRUNC('year', users_latest_src_28000.ds) 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
+ , EXTRACT(day FROM users_latest_src_28000.ds) AS user__ds_latest__extract_day
+ , CASE WHEN EXTRACT(dow FROM users_latest_src_28000.ds) = 0 THEN EXTRACT(dow FROM users_latest_src_28000.ds) + 7 ELSE EXTRACT(dow FROM users_latest_src_28000.ds) END AS user__ds_latest__extract_dow
+ , EXTRACT(doy FROM users_latest_src_28000.ds) AS user__ds_latest__extract_doy
+ , users_latest_src_28000.home_state_latest AS user__home_state_latest
+ , users_latest_src_28000.user_id AS user
+FROM ***************************.dim_users_latest users_latest_src_28000
diff --git a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Snowflake/test_convert_query_semantic_model__plan0.sql b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Snowflake/test_convert_query_semantic_model__plan0.sql
index c6919f64f9..6b9b65c844 100644
--- a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Snowflake/test_convert_query_semantic_model__plan0.sql
+++ b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Snowflake/test_convert_query_semantic_model__plan0.sql
@@ -1,28 +1,28 @@
-- Read Elements From Semantic Model 'revenue'
SELECT
- revenue_src_28007.revenue AS txn_revenue
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day
- , EXTRACT(dayofweekiso FROM revenue_src_28007.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day
- , EXTRACT(dayofweekiso FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy
- , revenue_src_28007.user_id AS user
- , revenue_src_28007.user_id AS revenue_instance__user
-FROM ***************************.fct_revenue revenue_src_28007
+ revenue_src_28000.revenue AS txn_revenue
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , EXTRACT(dayofweekiso FROM revenue_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS revenue_instance__ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS revenue_instance__ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS revenue_instance__ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS revenue_instance__ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , EXTRACT(day FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_day
+ , EXTRACT(dayofweekiso FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_doy
+ , revenue_src_28000.user_id AS user
+ , revenue_src_28000.user_id AS revenue_instance__user
+FROM ***************************.fct_revenue revenue_src_28000
diff --git a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Snowflake/test_convert_table_semantic_model_with_measures__plan0.sql b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Snowflake/test_convert_table_semantic_model_with_measures__plan0.sql
index 638fa45049..48f4803c55 100644
--- a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Snowflake/test_convert_table_semantic_model_with_measures__plan0.sql
+++ b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Snowflake/test_convert_table_semantic_model_with_measures__plan0.sql
@@ -1,53 +1,53 @@
-- Read Elements From Semantic Model 'id_verifications'
SELECT
1 AS identity_verifications
- , DATE_TRUNC('day', id_verifications_src_28004.ds) AS ds__day
- , DATE_TRUNC('week', id_verifications_src_28004.ds) AS ds__week
- , DATE_TRUNC('month', id_verifications_src_28004.ds) AS ds__month
- , DATE_TRUNC('quarter', id_verifications_src_28004.ds) AS ds__quarter
- , DATE_TRUNC('year', id_verifications_src_28004.ds) AS ds__year
- , EXTRACT(year FROM id_verifications_src_28004.ds) AS ds__extract_year
- , EXTRACT(quarter FROM id_verifications_src_28004.ds) AS ds__extract_quarter
- , EXTRACT(month FROM id_verifications_src_28004.ds) AS ds__extract_month
- , EXTRACT(day FROM id_verifications_src_28004.ds) AS ds__extract_day
- , EXTRACT(dayofweekiso FROM id_verifications_src_28004.ds) AS ds__extract_dow
- , EXTRACT(doy FROM id_verifications_src_28004.ds) AS ds__extract_doy
- , DATE_TRUNC('day', id_verifications_src_28004.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', id_verifications_src_28004.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', id_verifications_src_28004.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', id_verifications_src_28004.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', id_verifications_src_28004.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(dayofweekiso FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_doy
- , id_verifications_src_28004.verification_type
- , DATE_TRUNC('day', id_verifications_src_28004.ds) AS verification__ds__day
- , DATE_TRUNC('week', id_verifications_src_28004.ds) AS verification__ds__week
- , DATE_TRUNC('month', id_verifications_src_28004.ds) AS verification__ds__month
- , DATE_TRUNC('quarter', id_verifications_src_28004.ds) AS verification__ds__quarter
- , DATE_TRUNC('year', id_verifications_src_28004.ds) AS verification__ds__year
- , EXTRACT(year FROM id_verifications_src_28004.ds) AS verification__ds__extract_year
- , EXTRACT(quarter FROM id_verifications_src_28004.ds) AS verification__ds__extract_quarter
- , EXTRACT(month FROM id_verifications_src_28004.ds) AS verification__ds__extract_month
- , EXTRACT(day FROM id_verifications_src_28004.ds) AS verification__ds__extract_day
- , EXTRACT(dayofweekiso FROM id_verifications_src_28004.ds) AS verification__ds__extract_dow
- , EXTRACT(doy FROM id_verifications_src_28004.ds) AS verification__ds__extract_doy
- , DATE_TRUNC('day', id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__day
- , DATE_TRUNC('week', id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__week
- , DATE_TRUNC('month', id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__month
- , DATE_TRUNC('quarter', id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__quarter
- , DATE_TRUNC('year', id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__year
- , EXTRACT(year FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_year
- , EXTRACT(quarter FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_quarter
- , EXTRACT(month FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_month
- , EXTRACT(day FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_day
- , EXTRACT(dayofweekiso FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_dow
- , EXTRACT(doy FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_doy
- , id_verifications_src_28004.verification_type AS verification__verification_type
- , id_verifications_src_28004.verification_id AS verification
- , id_verifications_src_28004.user_id AS user
- , id_verifications_src_28004.user_id AS verification__user
-FROM ***************************.fct_id_verifications id_verifications_src_28004
+ , DATE_TRUNC('day', id_verifications_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', id_verifications_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', id_verifications_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', id_verifications_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', id_verifications_src_28000.ds) 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
+ , EXTRACT(dayofweekiso FROM id_verifications_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM id_verifications_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', id_verifications_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', id_verifications_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', id_verifications_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', id_verifications_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', id_verifications_src_28000.ds_partitioned) 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
+ , EXTRACT(day FROM id_verifications_src_28000.ds_partitioned) AS ds_partitioned__extract_day
+ , EXTRACT(dayofweekiso FROM id_verifications_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM id_verifications_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , id_verifications_src_28000.verification_type
+ , DATE_TRUNC('day', id_verifications_src_28000.ds) AS verification__ds__day
+ , DATE_TRUNC('week', id_verifications_src_28000.ds) AS verification__ds__week
+ , DATE_TRUNC('month', id_verifications_src_28000.ds) AS verification__ds__month
+ , DATE_TRUNC('quarter', id_verifications_src_28000.ds) AS verification__ds__quarter
+ , DATE_TRUNC('year', id_verifications_src_28000.ds) 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
+ , EXTRACT(dayofweekiso FROM id_verifications_src_28000.ds) AS verification__ds__extract_dow
+ , EXTRACT(doy FROM id_verifications_src_28000.ds) AS verification__ds__extract_doy
+ , DATE_TRUNC('day', id_verifications_src_28000.ds_partitioned) AS verification__ds_partitioned__day
+ , DATE_TRUNC('week', id_verifications_src_28000.ds_partitioned) AS verification__ds_partitioned__week
+ , DATE_TRUNC('month', id_verifications_src_28000.ds_partitioned) AS verification__ds_partitioned__month
+ , DATE_TRUNC('quarter', id_verifications_src_28000.ds_partitioned) AS verification__ds_partitioned__quarter
+ , DATE_TRUNC('year', id_verifications_src_28000.ds_partitioned) 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
+ , EXTRACT(day FROM id_verifications_src_28000.ds_partitioned) AS verification__ds_partitioned__extract_day
+ , EXTRACT(dayofweekiso FROM id_verifications_src_28000.ds_partitioned) AS verification__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM id_verifications_src_28000.ds_partitioned) AS verification__ds_partitioned__extract_doy
+ , id_verifications_src_28000.verification_type AS verification__verification_type
+ , id_verifications_src_28000.verification_id AS verification
+ , id_verifications_src_28000.user_id AS user
+ , id_verifications_src_28000.user_id AS verification__user
+FROM ***************************.fct_id_verifications id_verifications_src_28000
diff --git a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Snowflake/test_convert_table_semantic_model_without_measures__plan0.sql b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Snowflake/test_convert_table_semantic_model_without_measures__plan0.sql
index bf82f0867b..fc332b8845 100644
--- a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Snowflake/test_convert_table_semantic_model_without_measures__plan0.sql
+++ b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Snowflake/test_convert_table_semantic_model_without_measures__plan0.sql
@@ -1,28 +1,28 @@
-- Read Elements From Semantic Model 'users_latest'
SELECT
- DATE_TRUNC('day', users_latest_src_28009.ds) AS ds_latest__day
- , DATE_TRUNC('week', users_latest_src_28009.ds) AS ds_latest__week
- , DATE_TRUNC('month', users_latest_src_28009.ds) AS ds_latest__month
- , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS ds_latest__quarter
- , DATE_TRUNC('year', users_latest_src_28009.ds) AS ds_latest__year
- , EXTRACT(year FROM users_latest_src_28009.ds) AS ds_latest__extract_year
- , EXTRACT(quarter FROM users_latest_src_28009.ds) AS ds_latest__extract_quarter
- , EXTRACT(month FROM users_latest_src_28009.ds) AS ds_latest__extract_month
- , EXTRACT(day FROM users_latest_src_28009.ds) AS ds_latest__extract_day
- , EXTRACT(dayofweekiso FROM users_latest_src_28009.ds) AS ds_latest__extract_dow
- , EXTRACT(doy FROM users_latest_src_28009.ds) AS ds_latest__extract_doy
- , users_latest_src_28009.home_state_latest
- , DATE_TRUNC('day', users_latest_src_28009.ds) AS user__ds_latest__day
- , DATE_TRUNC('week', users_latest_src_28009.ds) AS user__ds_latest__week
- , DATE_TRUNC('month', users_latest_src_28009.ds) AS user__ds_latest__month
- , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS user__ds_latest__quarter
- , DATE_TRUNC('year', users_latest_src_28009.ds) AS user__ds_latest__year
- , EXTRACT(year FROM users_latest_src_28009.ds) AS user__ds_latest__extract_year
- , EXTRACT(quarter FROM users_latest_src_28009.ds) AS user__ds_latest__extract_quarter
- , EXTRACT(month FROM users_latest_src_28009.ds) AS user__ds_latest__extract_month
- , EXTRACT(day FROM users_latest_src_28009.ds) AS user__ds_latest__extract_day
- , EXTRACT(dayofweekiso FROM users_latest_src_28009.ds) AS user__ds_latest__extract_dow
- , EXTRACT(doy FROM users_latest_src_28009.ds) AS user__ds_latest__extract_doy
- , users_latest_src_28009.home_state_latest AS user__home_state_latest
- , users_latest_src_28009.user_id AS user
-FROM ***************************.dim_users_latest users_latest_src_28009
+ DATE_TRUNC('day', users_latest_src_28000.ds) AS ds_latest__day
+ , DATE_TRUNC('week', users_latest_src_28000.ds) AS ds_latest__week
+ , DATE_TRUNC('month', users_latest_src_28000.ds) AS ds_latest__month
+ , DATE_TRUNC('quarter', users_latest_src_28000.ds) AS ds_latest__quarter
+ , DATE_TRUNC('year', users_latest_src_28000.ds) 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
+ , EXTRACT(day FROM users_latest_src_28000.ds) AS ds_latest__extract_day
+ , EXTRACT(dayofweekiso FROM users_latest_src_28000.ds) AS ds_latest__extract_dow
+ , EXTRACT(doy FROM users_latest_src_28000.ds) AS ds_latest__extract_doy
+ , users_latest_src_28000.home_state_latest
+ , DATE_TRUNC('day', users_latest_src_28000.ds) AS user__ds_latest__day
+ , DATE_TRUNC('week', users_latest_src_28000.ds) AS user__ds_latest__week
+ , DATE_TRUNC('month', users_latest_src_28000.ds) AS user__ds_latest__month
+ , DATE_TRUNC('quarter', users_latest_src_28000.ds) AS user__ds_latest__quarter
+ , DATE_TRUNC('year', users_latest_src_28000.ds) 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
+ , EXTRACT(day FROM users_latest_src_28000.ds) AS user__ds_latest__extract_day
+ , EXTRACT(dayofweekiso FROM users_latest_src_28000.ds) AS user__ds_latest__extract_dow
+ , EXTRACT(doy FROM users_latest_src_28000.ds) AS user__ds_latest__extract_doy
+ , users_latest_src_28000.home_state_latest AS user__home_state_latest
+ , users_latest_src_28000.user_id AS user
+FROM ***************************.dim_users_latest users_latest_src_28000
diff --git a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Trino/test_convert_query_semantic_model__plan0.sql b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Trino/test_convert_query_semantic_model__plan0.sql
index 4c1184dda1..92e117a564 100644
--- a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Trino/test_convert_query_semantic_model__plan0.sql
+++ b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Trino/test_convert_query_semantic_model__plan0.sql
@@ -1,28 +1,28 @@
-- Read Elements From Semantic Model 'revenue'
SELECT
- revenue_src_28007.revenue AS txn_revenue
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM revenue_src_28007.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy
- , revenue_src_28007.user_id AS user
- , revenue_src_28007.user_id AS revenue_instance__user
-FROM ***************************.fct_revenue revenue_src_28007
+ revenue_src_28000.revenue AS txn_revenue
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , EXTRACT(DAY_OF_WEEK FROM revenue_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS revenue_instance__ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS revenue_instance__ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS revenue_instance__ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS revenue_instance__ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , EXTRACT(day FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_doy
+ , revenue_src_28000.user_id AS user
+ , revenue_src_28000.user_id AS revenue_instance__user
+FROM ***************************.fct_revenue revenue_src_28000
diff --git a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Trino/test_convert_table_semantic_model_with_measures__plan0.sql b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Trino/test_convert_table_semantic_model_with_measures__plan0.sql
index 252f677446..1a6868177f 100644
--- a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Trino/test_convert_table_semantic_model_with_measures__plan0.sql
+++ b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Trino/test_convert_table_semantic_model_with_measures__plan0.sql
@@ -1,53 +1,53 @@
-- Read Elements From Semantic Model 'id_verifications'
SELECT
1 AS identity_verifications
- , DATE_TRUNC('day', id_verifications_src_28004.ds) AS ds__day
- , DATE_TRUNC('week', id_verifications_src_28004.ds) AS ds__week
- , DATE_TRUNC('month', id_verifications_src_28004.ds) AS ds__month
- , DATE_TRUNC('quarter', id_verifications_src_28004.ds) AS ds__quarter
- , DATE_TRUNC('year', id_verifications_src_28004.ds) AS ds__year
- , EXTRACT(year FROM id_verifications_src_28004.ds) AS ds__extract_year
- , EXTRACT(quarter FROM id_verifications_src_28004.ds) AS ds__extract_quarter
- , EXTRACT(month FROM id_verifications_src_28004.ds) AS ds__extract_month
- , EXTRACT(day FROM id_verifications_src_28004.ds) AS ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM id_verifications_src_28004.ds) AS ds__extract_dow
- , EXTRACT(doy FROM id_verifications_src_28004.ds) AS ds__extract_doy
- , DATE_TRUNC('day', id_verifications_src_28004.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', id_verifications_src_28004.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', id_verifications_src_28004.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', id_verifications_src_28004.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', id_verifications_src_28004.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(DAY_OF_WEEK FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM id_verifications_src_28004.ds_partitioned) AS ds_partitioned__extract_doy
- , id_verifications_src_28004.verification_type
- , DATE_TRUNC('day', id_verifications_src_28004.ds) AS verification__ds__day
- , DATE_TRUNC('week', id_verifications_src_28004.ds) AS verification__ds__week
- , DATE_TRUNC('month', id_verifications_src_28004.ds) AS verification__ds__month
- , DATE_TRUNC('quarter', id_verifications_src_28004.ds) AS verification__ds__quarter
- , DATE_TRUNC('year', id_verifications_src_28004.ds) AS verification__ds__year
- , EXTRACT(year FROM id_verifications_src_28004.ds) AS verification__ds__extract_year
- , EXTRACT(quarter FROM id_verifications_src_28004.ds) AS verification__ds__extract_quarter
- , EXTRACT(month FROM id_verifications_src_28004.ds) AS verification__ds__extract_month
- , EXTRACT(day FROM id_verifications_src_28004.ds) AS verification__ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM id_verifications_src_28004.ds) AS verification__ds__extract_dow
- , EXTRACT(doy FROM id_verifications_src_28004.ds) AS verification__ds__extract_doy
- , DATE_TRUNC('day', id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__day
- , DATE_TRUNC('week', id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__week
- , DATE_TRUNC('month', id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__month
- , DATE_TRUNC('quarter', id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__quarter
- , DATE_TRUNC('year', id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__year
- , EXTRACT(year FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_year
- , EXTRACT(quarter FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_quarter
- , EXTRACT(month FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_month
- , EXTRACT(day FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_day
- , EXTRACT(DAY_OF_WEEK FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_dow
- , EXTRACT(doy FROM id_verifications_src_28004.ds_partitioned) AS verification__ds_partitioned__extract_doy
- , id_verifications_src_28004.verification_type AS verification__verification_type
- , id_verifications_src_28004.verification_id AS verification
- , id_verifications_src_28004.user_id AS user
- , id_verifications_src_28004.user_id AS verification__user
-FROM ***************************.fct_id_verifications id_verifications_src_28004
+ , DATE_TRUNC('day', id_verifications_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', id_verifications_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', id_verifications_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', id_verifications_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', id_verifications_src_28000.ds) 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
+ , EXTRACT(DAY_OF_WEEK FROM id_verifications_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM id_verifications_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', id_verifications_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', id_verifications_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', id_verifications_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', id_verifications_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', id_verifications_src_28000.ds_partitioned) 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
+ , EXTRACT(day FROM id_verifications_src_28000.ds_partitioned) AS ds_partitioned__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM id_verifications_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM id_verifications_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , id_verifications_src_28000.verification_type
+ , DATE_TRUNC('day', id_verifications_src_28000.ds) AS verification__ds__day
+ , DATE_TRUNC('week', id_verifications_src_28000.ds) AS verification__ds__week
+ , DATE_TRUNC('month', id_verifications_src_28000.ds) AS verification__ds__month
+ , DATE_TRUNC('quarter', id_verifications_src_28000.ds) AS verification__ds__quarter
+ , DATE_TRUNC('year', id_verifications_src_28000.ds) 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
+ , EXTRACT(DAY_OF_WEEK FROM id_verifications_src_28000.ds) AS verification__ds__extract_dow
+ , EXTRACT(doy FROM id_verifications_src_28000.ds) AS verification__ds__extract_doy
+ , DATE_TRUNC('day', id_verifications_src_28000.ds_partitioned) AS verification__ds_partitioned__day
+ , DATE_TRUNC('week', id_verifications_src_28000.ds_partitioned) AS verification__ds_partitioned__week
+ , DATE_TRUNC('month', id_verifications_src_28000.ds_partitioned) AS verification__ds_partitioned__month
+ , DATE_TRUNC('quarter', id_verifications_src_28000.ds_partitioned) AS verification__ds_partitioned__quarter
+ , DATE_TRUNC('year', id_verifications_src_28000.ds_partitioned) 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
+ , EXTRACT(day FROM id_verifications_src_28000.ds_partitioned) AS verification__ds_partitioned__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM id_verifications_src_28000.ds_partitioned) AS verification__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM id_verifications_src_28000.ds_partitioned) AS verification__ds_partitioned__extract_doy
+ , id_verifications_src_28000.verification_type AS verification__verification_type
+ , id_verifications_src_28000.verification_id AS verification
+ , id_verifications_src_28000.user_id AS user
+ , id_verifications_src_28000.user_id AS verification__user
+FROM ***************************.fct_id_verifications id_verifications_src_28000
diff --git a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Trino/test_convert_table_semantic_model_without_measures__plan0.sql b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Trino/test_convert_table_semantic_model_without_measures__plan0.sql
index 32ccb4be82..23cdfc8a20 100644
--- a/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Trino/test_convert_table_semantic_model_without_measures__plan0.sql
+++ b/metricflow/test/snapshots/test_convert_semantic_model.py/SqlQueryPlan/Trino/test_convert_table_semantic_model_without_measures__plan0.sql
@@ -1,28 +1,28 @@
-- Read Elements From Semantic Model 'users_latest'
SELECT
- DATE_TRUNC('day', users_latest_src_28009.ds) AS ds_latest__day
- , DATE_TRUNC('week', users_latest_src_28009.ds) AS ds_latest__week
- , DATE_TRUNC('month', users_latest_src_28009.ds) AS ds_latest__month
- , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS ds_latest__quarter
- , DATE_TRUNC('year', users_latest_src_28009.ds) AS ds_latest__year
- , EXTRACT(year FROM users_latest_src_28009.ds) AS ds_latest__extract_year
- , EXTRACT(quarter FROM users_latest_src_28009.ds) AS ds_latest__extract_quarter
- , EXTRACT(month FROM users_latest_src_28009.ds) AS ds_latest__extract_month
- , EXTRACT(day FROM users_latest_src_28009.ds) AS ds_latest__extract_day
- , EXTRACT(DAY_OF_WEEK FROM users_latest_src_28009.ds) AS ds_latest__extract_dow
- , EXTRACT(doy FROM users_latest_src_28009.ds) AS ds_latest__extract_doy
- , users_latest_src_28009.home_state_latest
- , DATE_TRUNC('day', users_latest_src_28009.ds) AS user__ds_latest__day
- , DATE_TRUNC('week', users_latest_src_28009.ds) AS user__ds_latest__week
- , DATE_TRUNC('month', users_latest_src_28009.ds) AS user__ds_latest__month
- , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS user__ds_latest__quarter
- , DATE_TRUNC('year', users_latest_src_28009.ds) AS user__ds_latest__year
- , EXTRACT(year FROM users_latest_src_28009.ds) AS user__ds_latest__extract_year
- , EXTRACT(quarter FROM users_latest_src_28009.ds) AS user__ds_latest__extract_quarter
- , EXTRACT(month FROM users_latest_src_28009.ds) AS user__ds_latest__extract_month
- , EXTRACT(day FROM users_latest_src_28009.ds) AS user__ds_latest__extract_day
- , EXTRACT(DAY_OF_WEEK FROM users_latest_src_28009.ds) AS user__ds_latest__extract_dow
- , EXTRACT(doy FROM users_latest_src_28009.ds) AS user__ds_latest__extract_doy
- , users_latest_src_28009.home_state_latest AS user__home_state_latest
- , users_latest_src_28009.user_id AS user
-FROM ***************************.dim_users_latest users_latest_src_28009
+ DATE_TRUNC('day', users_latest_src_28000.ds) AS ds_latest__day
+ , DATE_TRUNC('week', users_latest_src_28000.ds) AS ds_latest__week
+ , DATE_TRUNC('month', users_latest_src_28000.ds) AS ds_latest__month
+ , DATE_TRUNC('quarter', users_latest_src_28000.ds) AS ds_latest__quarter
+ , DATE_TRUNC('year', users_latest_src_28000.ds) 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
+ , EXTRACT(day FROM users_latest_src_28000.ds) AS ds_latest__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM users_latest_src_28000.ds) AS ds_latest__extract_dow
+ , EXTRACT(doy FROM users_latest_src_28000.ds) AS ds_latest__extract_doy
+ , users_latest_src_28000.home_state_latest
+ , DATE_TRUNC('day', users_latest_src_28000.ds) AS user__ds_latest__day
+ , DATE_TRUNC('week', users_latest_src_28000.ds) AS user__ds_latest__week
+ , DATE_TRUNC('month', users_latest_src_28000.ds) AS user__ds_latest__month
+ , DATE_TRUNC('quarter', users_latest_src_28000.ds) AS user__ds_latest__quarter
+ , DATE_TRUNC('year', users_latest_src_28000.ds) 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
+ , EXTRACT(day FROM users_latest_src_28000.ds) AS user__ds_latest__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM users_latest_src_28000.ds) AS user__ds_latest__extract_dow
+ , EXTRACT(doy FROM users_latest_src_28000.ds) AS user__ds_latest__extract_doy
+ , users_latest_src_28000.home_state_latest AS user__home_state_latest
+ , users_latest_src_28000.user_id AS user
+FROM ***************************.dim_users_latest users_latest_src_28000
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric__plan0.sql
index ab613c63d2..97bee65651 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric__plan0.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric__plan0.sql
@@ -1,88 +1,88 @@
-- Compute Metrics via Expressions
SELECT
- subq_3.ds__day
- , subq_3.txn_revenue AS trailing_2_months_revenue
+ subq_12.ds__day
+ , subq_12.txn_revenue AS trailing_2_months_revenue
FROM (
-- Aggregate Measures
SELECT
- subq_2.ds__day
- , SUM(subq_2.txn_revenue) AS txn_revenue
+ subq_11.ds__day
+ , SUM(subq_11.txn_revenue) AS txn_revenue
FROM (
-- Pass Only Elements: ['txn_revenue', 'ds__day']
SELECT
- subq_1.ds__day
- , subq_1.txn_revenue
+ subq_10.ds__day
+ , subq_10.txn_revenue
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.revenue_instance__ds__day
- , subq_0.revenue_instance__ds__week
- , subq_0.revenue_instance__ds__month
- , subq_0.revenue_instance__ds__quarter
- , subq_0.revenue_instance__ds__year
- , subq_0.revenue_instance__ds__extract_year
- , subq_0.revenue_instance__ds__extract_quarter
- , subq_0.revenue_instance__ds__extract_month
- , subq_0.revenue_instance__ds__extract_day
- , subq_0.revenue_instance__ds__extract_dow
- , subq_0.revenue_instance__ds__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.user
- , subq_0.revenue_instance__user
- , subq_0.txn_revenue
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.revenue_instance__ds__day
+ , subq_9.revenue_instance__ds__week
+ , subq_9.revenue_instance__ds__month
+ , subq_9.revenue_instance__ds__quarter
+ , subq_9.revenue_instance__ds__year
+ , subq_9.revenue_instance__ds__extract_year
+ , subq_9.revenue_instance__ds__extract_quarter
+ , subq_9.revenue_instance__ds__extract_month
+ , subq_9.revenue_instance__ds__extract_day
+ , subq_9.revenue_instance__ds__extract_dow
+ , subq_9.revenue_instance__ds__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.user
+ , subq_9.revenue_instance__user
+ , subq_9.txn_revenue
FROM (
-- Read Elements From Semantic Model 'revenue'
SELECT
- revenue_src_28007.revenue AS txn_revenue
- , DATE_TRUNC(revenue_src_28007.created_at, day) AS ds__day
- , DATE_TRUNC(revenue_src_28007.created_at, isoweek) AS ds__week
- , DATE_TRUNC(revenue_src_28007.created_at, month) AS ds__month
- , DATE_TRUNC(revenue_src_28007.created_at, quarter) AS ds__quarter
- , DATE_TRUNC(revenue_src_28007.created_at, year) AS ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM revenue_src_28007.created_at) = 1, 7, EXTRACT(dayofweek FROM revenue_src_28007.created_at) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM revenue_src_28007.created_at) AS ds__extract_doy
- , DATE_TRUNC(revenue_src_28007.created_at, day) AS revenue_instance__ds__day
- , DATE_TRUNC(revenue_src_28007.created_at, isoweek) AS revenue_instance__ds__week
- , DATE_TRUNC(revenue_src_28007.created_at, month) AS revenue_instance__ds__month
- , DATE_TRUNC(revenue_src_28007.created_at, quarter) AS revenue_instance__ds__quarter
- , DATE_TRUNC(revenue_src_28007.created_at, year) AS revenue_instance__ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day
- , IF(EXTRACT(dayofweek FROM revenue_src_28007.created_at) = 1, 7, EXTRACT(dayofweek FROM revenue_src_28007.created_at) - 1) AS revenue_instance__ds__extract_dow
- , EXTRACT(dayofyear FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy
- , revenue_src_28007.user_id AS user
- , revenue_src_28007.user_id AS revenue_instance__user
- FROM ***************************.fct_revenue revenue_src_28007
- ) subq_0
- ) subq_1
- ) subq_2
+ 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
+ , 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
+ , 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
+ , EXTRACT(day FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_day
+ , IF(EXTRACT(dayofweek FROM revenue_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM revenue_src_28000.created_at) - 1) AS revenue_instance__ds__extract_dow
+ , EXTRACT(dayofyear FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_doy
+ , revenue_src_28000.user_id AS user
+ , revenue_src_28000.user_id AS revenue_instance__user
+ FROM ***************************.fct_revenue revenue_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
GROUP BY
ds__day
-) subq_3
+) subq_12
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric__plan0_optimized.sql
index 2c3fd2a2e6..f1006b1250 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric__plan0_optimized.sql
@@ -6,6 +6,6 @@
SELECT
DATE_TRUNC(created_at, day) AS ds__day
, SUM(revenue) AS trailing_2_months_revenue
-FROM ***************************.fct_revenue revenue_src_28007
+FROM ***************************.fct_revenue revenue_src_28000
GROUP BY
ds__day
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_grain_to_date__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_grain_to_date__plan0.sql
index d85715075b..6d61cf0538 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_grain_to_date__plan0.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_grain_to_date__plan0.sql
@@ -1,88 +1,88 @@
-- Compute Metrics via Expressions
SELECT
- subq_3.ds__month
- , subq_3.txn_revenue AS revenue_mtd
+ subq_12.ds__month
+ , subq_12.txn_revenue AS revenue_mtd
FROM (
-- Aggregate Measures
SELECT
- subq_2.ds__month
- , SUM(subq_2.txn_revenue) AS txn_revenue
+ subq_11.ds__month
+ , SUM(subq_11.txn_revenue) AS txn_revenue
FROM (
-- Pass Only Elements: ['txn_revenue', 'ds__month']
SELECT
- subq_1.ds__month
- , subq_1.txn_revenue
+ subq_10.ds__month
+ , subq_10.txn_revenue
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.revenue_instance__ds__day
- , subq_0.revenue_instance__ds__week
- , subq_0.revenue_instance__ds__month
- , subq_0.revenue_instance__ds__quarter
- , subq_0.revenue_instance__ds__year
- , subq_0.revenue_instance__ds__extract_year
- , subq_0.revenue_instance__ds__extract_quarter
- , subq_0.revenue_instance__ds__extract_month
- , subq_0.revenue_instance__ds__extract_day
- , subq_0.revenue_instance__ds__extract_dow
- , subq_0.revenue_instance__ds__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.user
- , subq_0.revenue_instance__user
- , subq_0.txn_revenue
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.revenue_instance__ds__day
+ , subq_9.revenue_instance__ds__week
+ , subq_9.revenue_instance__ds__month
+ , subq_9.revenue_instance__ds__quarter
+ , subq_9.revenue_instance__ds__year
+ , subq_9.revenue_instance__ds__extract_year
+ , subq_9.revenue_instance__ds__extract_quarter
+ , subq_9.revenue_instance__ds__extract_month
+ , subq_9.revenue_instance__ds__extract_day
+ , subq_9.revenue_instance__ds__extract_dow
+ , subq_9.revenue_instance__ds__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.user
+ , subq_9.revenue_instance__user
+ , subq_9.txn_revenue
FROM (
-- Read Elements From Semantic Model 'revenue'
SELECT
- revenue_src_28007.revenue AS txn_revenue
- , DATE_TRUNC(revenue_src_28007.created_at, day) AS ds__day
- , DATE_TRUNC(revenue_src_28007.created_at, isoweek) AS ds__week
- , DATE_TRUNC(revenue_src_28007.created_at, month) AS ds__month
- , DATE_TRUNC(revenue_src_28007.created_at, quarter) AS ds__quarter
- , DATE_TRUNC(revenue_src_28007.created_at, year) AS ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM revenue_src_28007.created_at) = 1, 7, EXTRACT(dayofweek FROM revenue_src_28007.created_at) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM revenue_src_28007.created_at) AS ds__extract_doy
- , DATE_TRUNC(revenue_src_28007.created_at, day) AS revenue_instance__ds__day
- , DATE_TRUNC(revenue_src_28007.created_at, isoweek) AS revenue_instance__ds__week
- , DATE_TRUNC(revenue_src_28007.created_at, month) AS revenue_instance__ds__month
- , DATE_TRUNC(revenue_src_28007.created_at, quarter) AS revenue_instance__ds__quarter
- , DATE_TRUNC(revenue_src_28007.created_at, year) AS revenue_instance__ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day
- , IF(EXTRACT(dayofweek FROM revenue_src_28007.created_at) = 1, 7, EXTRACT(dayofweek FROM revenue_src_28007.created_at) - 1) AS revenue_instance__ds__extract_dow
- , EXTRACT(dayofyear FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy
- , revenue_src_28007.user_id AS user
- , revenue_src_28007.user_id AS revenue_instance__user
- FROM ***************************.fct_revenue revenue_src_28007
- ) subq_0
- ) subq_1
- ) subq_2
+ 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
+ , 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
+ , 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
+ , EXTRACT(day FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_day
+ , IF(EXTRACT(dayofweek FROM revenue_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM revenue_src_28000.created_at) - 1) AS revenue_instance__ds__extract_dow
+ , EXTRACT(dayofyear FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_doy
+ , revenue_src_28000.user_id AS user
+ , revenue_src_28000.user_id AS revenue_instance__user
+ FROM ***************************.fct_revenue revenue_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
GROUP BY
ds__month
-) subq_3
+) subq_12
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_grain_to_date__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_grain_to_date__plan0_optimized.sql
index 5e75a43a4b..db69f59081 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_grain_to_date__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_grain_to_date__plan0_optimized.sql
@@ -6,6 +6,6 @@
SELECT
DATE_TRUNC(created_at, month) AS ds__month
, SUM(revenue) AS revenue_mtd
-FROM ***************************.fct_revenue revenue_src_28007
+FROM ***************************.fct_revenue revenue_src_28000
GROUP BY
ds__month
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_month__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_month__plan0.sql
index 2cf65b5d0d..ab1e0be55f 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_month__plan0.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_month__plan0.sql
@@ -1,103 +1,103 @@
-- Compute Metrics via Expressions
SELECT
- subq_8.metric_time__month
- , subq_8.bookings_monthly AS trailing_3_months_bookings
+ subq_12.metric_time__month
+ , subq_12.bookings_monthly AS trailing_3_months_bookings
FROM (
-- Aggregate Measures
SELECT
- subq_7.metric_time__month
- , SUM(subq_7.bookings_monthly) AS bookings_monthly
+ subq_11.metric_time__month
+ , SUM(subq_11.bookings_monthly) AS bookings_monthly
FROM (
-- Constrain Time Range to [2020-03-05T00:00:00, 2021-01-04T00:00:00]
SELECT
- subq_6.metric_time__month
- , subq_6.bookings_monthly
+ subq_10.metric_time__month
+ , subq_10.bookings_monthly
FROM (
-- Pass Only Elements: ['bookings_monthly', 'metric_time__month']
SELECT
- subq_5.metric_time__month
- , subq_5.bookings_monthly
+ subq_9.metric_time__month
+ , subq_9.bookings_monthly
FROM (
-- Join Self Over Time Range
SELECT
- subq_3.metric_time__month AS metric_time__month
- , subq_2.monthly_ds__month AS monthly_ds__month
- , subq_2.monthly_ds__quarter AS monthly_ds__quarter
- , subq_2.monthly_ds__year AS monthly_ds__year
- , subq_2.monthly_ds__extract_year AS monthly_ds__extract_year
- , subq_2.monthly_ds__extract_quarter AS monthly_ds__extract_quarter
- , subq_2.monthly_ds__extract_month AS monthly_ds__extract_month
- , subq_2.booking__monthly_ds__month AS booking__monthly_ds__month
- , subq_2.booking__monthly_ds__quarter AS booking__monthly_ds__quarter
- , subq_2.booking__monthly_ds__year AS booking__monthly_ds__year
- , subq_2.booking__monthly_ds__extract_year AS booking__monthly_ds__extract_year
- , subq_2.booking__monthly_ds__extract_quarter AS booking__monthly_ds__extract_quarter
- , subq_2.booking__monthly_ds__extract_month AS booking__monthly_ds__extract_month
- , subq_2.metric_time__quarter AS metric_time__quarter
- , subq_2.metric_time__year AS metric_time__year
- , subq_2.metric_time__extract_year AS metric_time__extract_year
- , subq_2.metric_time__extract_quarter AS metric_time__extract_quarter
- , subq_2.metric_time__extract_month AS metric_time__extract_month
- , subq_2.listing AS listing
- , subq_2.booking__listing AS booking__listing
- , subq_2.bookings_monthly AS bookings_monthly
+ subq_7.metric_time__month AS metric_time__month
+ , subq_6.monthly_ds__month AS monthly_ds__month
+ , subq_6.monthly_ds__quarter AS monthly_ds__quarter
+ , subq_6.monthly_ds__year AS monthly_ds__year
+ , subq_6.monthly_ds__extract_year AS monthly_ds__extract_year
+ , subq_6.monthly_ds__extract_quarter AS monthly_ds__extract_quarter
+ , subq_6.monthly_ds__extract_month AS monthly_ds__extract_month
+ , subq_6.booking__monthly_ds__month AS booking__monthly_ds__month
+ , subq_6.booking__monthly_ds__quarter AS booking__monthly_ds__quarter
+ , subq_6.booking__monthly_ds__year AS booking__monthly_ds__year
+ , subq_6.booking__monthly_ds__extract_year AS booking__monthly_ds__extract_year
+ , subq_6.booking__monthly_ds__extract_quarter AS booking__monthly_ds__extract_quarter
+ , subq_6.booking__monthly_ds__extract_month AS booking__monthly_ds__extract_month
+ , subq_6.metric_time__quarter AS metric_time__quarter
+ , subq_6.metric_time__year AS metric_time__year
+ , subq_6.metric_time__extract_year AS metric_time__extract_year
+ , subq_6.metric_time__extract_quarter AS metric_time__extract_quarter
+ , subq_6.metric_time__extract_month AS metric_time__extract_month
+ , subq_6.listing AS listing
+ , subq_6.booking__listing AS booking__listing
+ , subq_6.bookings_monthly AS bookings_monthly
FROM (
-- Time Spine
SELECT
- DATE_TRUNC(subq_4.ds, month) AS metric_time__month
- FROM ***************************.mf_time_spine subq_4
- WHERE subq_4.ds BETWEEN '2020-03-05' AND '2021-01-04'
+ DATE_TRUNC(subq_8.ds, month) AS metric_time__month
+ FROM ***************************.mf_time_spine subq_8
+ WHERE subq_8.ds BETWEEN '2020-03-05' AND '2021-01-04'
GROUP BY
metric_time__month
- ) subq_3
+ ) subq_7
INNER JOIN (
-- Constrain Time Range to [2019-12-05T00:00:00, 2021-01-04T00:00:00]
SELECT
- subq_1.monthly_ds__month
- , subq_1.monthly_ds__quarter
- , subq_1.monthly_ds__year
- , subq_1.monthly_ds__extract_year
- , subq_1.monthly_ds__extract_quarter
- , subq_1.monthly_ds__extract_month
- , subq_1.booking__monthly_ds__month
- , subq_1.booking__monthly_ds__quarter
- , subq_1.booking__monthly_ds__year
- , subq_1.booking__monthly_ds__extract_year
- , subq_1.booking__monthly_ds__extract_quarter
- , subq_1.booking__monthly_ds__extract_month
- , subq_1.metric_time__month
- , subq_1.metric_time__quarter
- , subq_1.metric_time__year
- , subq_1.metric_time__extract_year
- , subq_1.metric_time__extract_quarter
- , subq_1.metric_time__extract_month
- , subq_1.listing
- , subq_1.booking__listing
- , subq_1.bookings_monthly
+ subq_5.monthly_ds__month
+ , subq_5.monthly_ds__quarter
+ , subq_5.monthly_ds__year
+ , subq_5.monthly_ds__extract_year
+ , subq_5.monthly_ds__extract_quarter
+ , subq_5.monthly_ds__extract_month
+ , subq_5.booking__monthly_ds__month
+ , subq_5.booking__monthly_ds__quarter
+ , subq_5.booking__monthly_ds__year
+ , subq_5.booking__monthly_ds__extract_year
+ , subq_5.booking__monthly_ds__extract_quarter
+ , subq_5.booking__monthly_ds__extract_month
+ , subq_5.metric_time__month
+ , subq_5.metric_time__quarter
+ , subq_5.metric_time__year
+ , subq_5.metric_time__extract_year
+ , subq_5.metric_time__extract_quarter
+ , subq_5.metric_time__extract_month
+ , subq_5.listing
+ , subq_5.booking__listing
+ , subq_5.bookings_monthly
FROM (
-- Metric Time Dimension 'monthly_ds'
SELECT
- subq_0.monthly_ds__month
- , subq_0.monthly_ds__quarter
- , subq_0.monthly_ds__year
- , subq_0.monthly_ds__extract_year
- , subq_0.monthly_ds__extract_quarter
- , subq_0.monthly_ds__extract_month
- , subq_0.booking__monthly_ds__month
- , subq_0.booking__monthly_ds__quarter
- , subq_0.booking__monthly_ds__year
- , subq_0.booking__monthly_ds__extract_year
- , subq_0.booking__monthly_ds__extract_quarter
- , subq_0.booking__monthly_ds__extract_month
- , subq_0.monthly_ds__month AS metric_time__month
- , subq_0.monthly_ds__quarter AS metric_time__quarter
- , subq_0.monthly_ds__year AS metric_time__year
- , subq_0.monthly_ds__extract_year AS metric_time__extract_year
- , subq_0.monthly_ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.monthly_ds__extract_month AS metric_time__extract_month
- , subq_0.listing
- , subq_0.booking__listing
- , subq_0.bookings_monthly
+ subq_4.monthly_ds__month
+ , subq_4.monthly_ds__quarter
+ , subq_4.monthly_ds__year
+ , subq_4.monthly_ds__extract_year
+ , subq_4.monthly_ds__extract_quarter
+ , subq_4.monthly_ds__extract_month
+ , subq_4.booking__monthly_ds__month
+ , subq_4.booking__monthly_ds__quarter
+ , subq_4.booking__monthly_ds__year
+ , subq_4.booking__monthly_ds__extract_year
+ , subq_4.booking__monthly_ds__extract_quarter
+ , subq_4.booking__monthly_ds__extract_month
+ , subq_4.monthly_ds__month AS metric_time__month
+ , subq_4.monthly_ds__quarter AS metric_time__quarter
+ , subq_4.monthly_ds__year AS metric_time__year
+ , subq_4.monthly_ds__extract_year AS metric_time__extract_year
+ , subq_4.monthly_ds__extract_quarter AS metric_time__extract_quarter
+ , subq_4.monthly_ds__extract_month AS metric_time__extract_month
+ , subq_4.listing
+ , subq_4.booking__listing
+ , subq_4.bookings_monthly
FROM (
-- Read Elements From Semantic Model 'bookings_monthly_source'
SELECT
@@ -117,20 +117,20 @@ FROM (
, bookings_monthly_source_src_16000.listing_id AS listing
, bookings_monthly_source_src_16000.listing_id AS booking__listing
FROM ***************************.fct_bookings_extended_monthly bookings_monthly_source_src_16000
- ) subq_0
- ) subq_1
- WHERE subq_1.metric_time__month BETWEEN '2019-12-05' AND '2021-01-04'
- ) subq_2
+ ) subq_4
+ ) subq_5
+ WHERE subq_5.metric_time__month BETWEEN '2019-12-05' AND '2021-01-04'
+ ) subq_6
ON
(
- subq_2.metric_time__month <= subq_3.metric_time__month
+ subq_6.metric_time__month <= subq_7.metric_time__month
) AND (
- subq_2.metric_time__month > DATE_SUB(CAST(subq_3.metric_time__month AS DATETIME), INTERVAL 3 month)
+ subq_6.metric_time__month > DATE_SUB(CAST(subq_7.metric_time__month AS DATETIME), INTERVAL 3 month)
)
- ) subq_5
- ) subq_6
- WHERE subq_6.metric_time__month BETWEEN '2020-03-05' AND '2021-01-04'
- ) subq_7
+ ) subq_9
+ ) subq_10
+ WHERE subq_10.metric_time__month BETWEEN '2020-03-05' AND '2021-01-04'
+ ) subq_11
GROUP BY
metric_time__month
-) subq_8
+) subq_12
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_month__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_month__plan0_optimized.sql
index cebaf3f59a..245aa03a19 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_month__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_month__plan0_optimized.sql
@@ -4,17 +4,17 @@
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_12.metric_time__month AS metric_time__month
- , SUM(subq_11.bookings_monthly) AS trailing_3_months_bookings
+ subq_16.metric_time__month AS metric_time__month
+ , SUM(subq_15.bookings_monthly) AS trailing_3_months_bookings
FROM (
-- Time Spine
SELECT
DATE_TRUNC(ds, month) AS metric_time__month
- FROM ***************************.mf_time_spine subq_13
+ FROM ***************************.mf_time_spine subq_17
WHERE ds BETWEEN '2020-03-05' AND '2021-01-04'
GROUP BY
metric_time__month
-) subq_12
+) subq_16
INNER JOIN (
-- Read Elements From Semantic Model 'bookings_monthly_source'
-- Metric Time Dimension 'monthly_ds'
@@ -24,13 +24,13 @@ INNER JOIN (
, 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'
-) subq_11
+) subq_15
ON
(
- subq_11.metric_time__month <= subq_12.metric_time__month
+ subq_15.metric_time__month <= subq_16.metric_time__month
) AND (
- subq_11.metric_time__month > DATE_SUB(CAST(subq_12.metric_time__month AS DATETIME), INTERVAL 3 month)
+ subq_15.metric_time__month > DATE_SUB(CAST(subq_16.metric_time__month AS DATETIME), INTERVAL 3 month)
)
-WHERE subq_12.metric_time__month BETWEEN '2020-03-05' AND '2021-01-04'
+WHERE subq_16.metric_time__month BETWEEN '2020-03-05' AND '2021-01-04'
GROUP BY
metric_time__month
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_no_ds__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_no_ds__plan0.sql
index 556e45ac8a..ce5bdd3d39 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_no_ds__plan0.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_no_ds__plan0.sql
@@ -1,83 +1,83 @@
-- Compute Metrics via Expressions
SELECT
- subq_3.txn_revenue AS trailing_2_months_revenue
+ subq_12.txn_revenue AS trailing_2_months_revenue
FROM (
-- Aggregate Measures
SELECT
- SUM(subq_2.txn_revenue) AS txn_revenue
+ SUM(subq_11.txn_revenue) AS txn_revenue
FROM (
-- Pass Only Elements: ['txn_revenue',]
SELECT
- subq_1.txn_revenue
+ subq_10.txn_revenue
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.revenue_instance__ds__day
- , subq_0.revenue_instance__ds__week
- , subq_0.revenue_instance__ds__month
- , subq_0.revenue_instance__ds__quarter
- , subq_0.revenue_instance__ds__year
- , subq_0.revenue_instance__ds__extract_year
- , subq_0.revenue_instance__ds__extract_quarter
- , subq_0.revenue_instance__ds__extract_month
- , subq_0.revenue_instance__ds__extract_day
- , subq_0.revenue_instance__ds__extract_dow
- , subq_0.revenue_instance__ds__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.user
- , subq_0.revenue_instance__user
- , subq_0.txn_revenue
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.revenue_instance__ds__day
+ , subq_9.revenue_instance__ds__week
+ , subq_9.revenue_instance__ds__month
+ , subq_9.revenue_instance__ds__quarter
+ , subq_9.revenue_instance__ds__year
+ , subq_9.revenue_instance__ds__extract_year
+ , subq_9.revenue_instance__ds__extract_quarter
+ , subq_9.revenue_instance__ds__extract_month
+ , subq_9.revenue_instance__ds__extract_day
+ , subq_9.revenue_instance__ds__extract_dow
+ , subq_9.revenue_instance__ds__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.user
+ , subq_9.revenue_instance__user
+ , subq_9.txn_revenue
FROM (
-- Read Elements From Semantic Model 'revenue'
SELECT
- revenue_src_28007.revenue AS txn_revenue
- , DATE_TRUNC(revenue_src_28007.created_at, day) AS ds__day
- , DATE_TRUNC(revenue_src_28007.created_at, isoweek) AS ds__week
- , DATE_TRUNC(revenue_src_28007.created_at, month) AS ds__month
- , DATE_TRUNC(revenue_src_28007.created_at, quarter) AS ds__quarter
- , DATE_TRUNC(revenue_src_28007.created_at, year) AS ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM revenue_src_28007.created_at) = 1, 7, EXTRACT(dayofweek FROM revenue_src_28007.created_at) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM revenue_src_28007.created_at) AS ds__extract_doy
- , DATE_TRUNC(revenue_src_28007.created_at, day) AS revenue_instance__ds__day
- , DATE_TRUNC(revenue_src_28007.created_at, isoweek) AS revenue_instance__ds__week
- , DATE_TRUNC(revenue_src_28007.created_at, month) AS revenue_instance__ds__month
- , DATE_TRUNC(revenue_src_28007.created_at, quarter) AS revenue_instance__ds__quarter
- , DATE_TRUNC(revenue_src_28007.created_at, year) AS revenue_instance__ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day
- , IF(EXTRACT(dayofweek FROM revenue_src_28007.created_at) = 1, 7, EXTRACT(dayofweek FROM revenue_src_28007.created_at) - 1) AS revenue_instance__ds__extract_dow
- , EXTRACT(dayofyear FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy
- , revenue_src_28007.user_id AS user
- , revenue_src_28007.user_id AS revenue_instance__user
- FROM ***************************.fct_revenue revenue_src_28007
- ) subq_0
- ) subq_1
- ) subq_2
-) subq_3
+ 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
+ , 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
+ , 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
+ , EXTRACT(day FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_day
+ , IF(EXTRACT(dayofweek FROM revenue_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM revenue_src_28000.created_at) - 1) AS revenue_instance__ds__extract_dow
+ , EXTRACT(dayofyear FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_doy
+ , revenue_src_28000.user_id AS user
+ , revenue_src_28000.user_id AS revenue_instance__user
+ FROM ***************************.fct_revenue revenue_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
+) subq_12
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_no_ds__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_no_ds__plan0_optimized.sql
index e26a1bdb3d..4a0d5baff3 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_no_ds__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_no_ds__plan0_optimized.sql
@@ -5,4 +5,4 @@
-- Compute Metrics via Expressions
SELECT
SUM(revenue) AS trailing_2_months_revenue
-FROM ***************************.fct_revenue revenue_src_28007
+FROM ***************************.fct_revenue revenue_src_28000
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_no_window__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_no_window__plan0.sql
index 5b266bf166..5e199eb346 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_no_window__plan0.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_no_window__plan0.sql
@@ -1,88 +1,88 @@
-- Compute Metrics via Expressions
SELECT
- subq_3.ds__month
- , subq_3.txn_revenue AS revenue_all_time
+ subq_12.ds__month
+ , subq_12.txn_revenue AS revenue_all_time
FROM (
-- Aggregate Measures
SELECT
- subq_2.ds__month
- , SUM(subq_2.txn_revenue) AS txn_revenue
+ subq_11.ds__month
+ , SUM(subq_11.txn_revenue) AS txn_revenue
FROM (
-- Pass Only Elements: ['txn_revenue', 'ds__month']
SELECT
- subq_1.ds__month
- , subq_1.txn_revenue
+ subq_10.ds__month
+ , subq_10.txn_revenue
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.revenue_instance__ds__day
- , subq_0.revenue_instance__ds__week
- , subq_0.revenue_instance__ds__month
- , subq_0.revenue_instance__ds__quarter
- , subq_0.revenue_instance__ds__year
- , subq_0.revenue_instance__ds__extract_year
- , subq_0.revenue_instance__ds__extract_quarter
- , subq_0.revenue_instance__ds__extract_month
- , subq_0.revenue_instance__ds__extract_day
- , subq_0.revenue_instance__ds__extract_dow
- , subq_0.revenue_instance__ds__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.user
- , subq_0.revenue_instance__user
- , subq_0.txn_revenue
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.revenue_instance__ds__day
+ , subq_9.revenue_instance__ds__week
+ , subq_9.revenue_instance__ds__month
+ , subq_9.revenue_instance__ds__quarter
+ , subq_9.revenue_instance__ds__year
+ , subq_9.revenue_instance__ds__extract_year
+ , subq_9.revenue_instance__ds__extract_quarter
+ , subq_9.revenue_instance__ds__extract_month
+ , subq_9.revenue_instance__ds__extract_day
+ , subq_9.revenue_instance__ds__extract_dow
+ , subq_9.revenue_instance__ds__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.user
+ , subq_9.revenue_instance__user
+ , subq_9.txn_revenue
FROM (
-- Read Elements From Semantic Model 'revenue'
SELECT
- revenue_src_28007.revenue AS txn_revenue
- , DATE_TRUNC(revenue_src_28007.created_at, day) AS ds__day
- , DATE_TRUNC(revenue_src_28007.created_at, isoweek) AS ds__week
- , DATE_TRUNC(revenue_src_28007.created_at, month) AS ds__month
- , DATE_TRUNC(revenue_src_28007.created_at, quarter) AS ds__quarter
- , DATE_TRUNC(revenue_src_28007.created_at, year) AS ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM revenue_src_28007.created_at) = 1, 7, EXTRACT(dayofweek FROM revenue_src_28007.created_at) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM revenue_src_28007.created_at) AS ds__extract_doy
- , DATE_TRUNC(revenue_src_28007.created_at, day) AS revenue_instance__ds__day
- , DATE_TRUNC(revenue_src_28007.created_at, isoweek) AS revenue_instance__ds__week
- , DATE_TRUNC(revenue_src_28007.created_at, month) AS revenue_instance__ds__month
- , DATE_TRUNC(revenue_src_28007.created_at, quarter) AS revenue_instance__ds__quarter
- , DATE_TRUNC(revenue_src_28007.created_at, year) AS revenue_instance__ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day
- , IF(EXTRACT(dayofweek FROM revenue_src_28007.created_at) = 1, 7, EXTRACT(dayofweek FROM revenue_src_28007.created_at) - 1) AS revenue_instance__ds__extract_dow
- , EXTRACT(dayofyear FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy
- , revenue_src_28007.user_id AS user
- , revenue_src_28007.user_id AS revenue_instance__user
- FROM ***************************.fct_revenue revenue_src_28007
- ) subq_0
- ) subq_1
- ) subq_2
+ 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
+ , 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
+ , 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
+ , EXTRACT(day FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_day
+ , IF(EXTRACT(dayofweek FROM revenue_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM revenue_src_28000.created_at) - 1) AS revenue_instance__ds__extract_dow
+ , EXTRACT(dayofyear FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_doy
+ , revenue_src_28000.user_id AS user
+ , revenue_src_28000.user_id AS revenue_instance__user
+ FROM ***************************.fct_revenue revenue_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
GROUP BY
ds__month
-) subq_3
+) subq_12
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_no_window__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_no_window__plan0_optimized.sql
index facf505f90..0bea520ecc 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_no_window__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_no_window__plan0_optimized.sql
@@ -6,6 +6,6 @@
SELECT
DATE_TRUNC(created_at, month) AS ds__month
, SUM(revenue) AS revenue_all_time
-FROM ***************************.fct_revenue revenue_src_28007
+FROM ***************************.fct_revenue revenue_src_28000
GROUP BY
ds__month
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_no_window_with_time_constraint__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_no_window_with_time_constraint__plan0.sql
index 9f6add1096..8a592ea090 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_no_window_with_time_constraint__plan0.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_no_window_with_time_constraint__plan0.sql
@@ -1,187 +1,187 @@
-- Compute Metrics via Expressions
SELECT
- subq_8.metric_time__month
- , subq_8.txn_revenue AS revenue_all_time
+ subq_19.metric_time__month
+ , subq_19.txn_revenue AS revenue_all_time
FROM (
-- Aggregate Measures
SELECT
- subq_7.metric_time__month
- , SUM(subq_7.txn_revenue) AS txn_revenue
+ subq_18.metric_time__month
+ , SUM(subq_18.txn_revenue) AS txn_revenue
FROM (
-- Constrain Time Range to [2020-01-01T00:00:00, 2020-01-01T00:00:00]
SELECT
- subq_6.metric_time__month
- , subq_6.txn_revenue
+ subq_17.metric_time__month
+ , subq_17.txn_revenue
FROM (
-- Pass Only Elements: ['txn_revenue', 'metric_time__month']
SELECT
- subq_5.metric_time__month
- , subq_5.txn_revenue
+ subq_16.metric_time__month
+ , subq_16.txn_revenue
FROM (
-- Join Self Over Time Range
SELECT
- subq_3.metric_time__month AS metric_time__month
- , subq_2.ds__day AS ds__day
- , subq_2.ds__week AS ds__week
- , subq_2.ds__month AS ds__month
- , subq_2.ds__quarter AS ds__quarter
- , subq_2.ds__year AS ds__year
- , subq_2.ds__extract_year AS ds__extract_year
- , subq_2.ds__extract_quarter AS ds__extract_quarter
- , subq_2.ds__extract_month AS ds__extract_month
- , subq_2.ds__extract_day AS ds__extract_day
- , subq_2.ds__extract_dow AS ds__extract_dow
- , subq_2.ds__extract_doy AS ds__extract_doy
- , subq_2.revenue_instance__ds__day AS revenue_instance__ds__day
- , subq_2.revenue_instance__ds__week AS revenue_instance__ds__week
- , subq_2.revenue_instance__ds__month AS revenue_instance__ds__month
- , subq_2.revenue_instance__ds__quarter AS revenue_instance__ds__quarter
- , subq_2.revenue_instance__ds__year AS revenue_instance__ds__year
- , subq_2.revenue_instance__ds__extract_year AS revenue_instance__ds__extract_year
- , subq_2.revenue_instance__ds__extract_quarter AS revenue_instance__ds__extract_quarter
- , subq_2.revenue_instance__ds__extract_month AS revenue_instance__ds__extract_month
- , subq_2.revenue_instance__ds__extract_day AS revenue_instance__ds__extract_day
- , subq_2.revenue_instance__ds__extract_dow AS revenue_instance__ds__extract_dow
- , subq_2.revenue_instance__ds__extract_doy AS revenue_instance__ds__extract_doy
- , subq_2.metric_time__day AS metric_time__day
- , subq_2.metric_time__week AS metric_time__week
- , subq_2.metric_time__quarter AS metric_time__quarter
- , subq_2.metric_time__year AS metric_time__year
- , subq_2.metric_time__extract_year AS metric_time__extract_year
- , subq_2.metric_time__extract_quarter AS metric_time__extract_quarter
- , subq_2.metric_time__extract_month AS metric_time__extract_month
- , subq_2.metric_time__extract_day AS metric_time__extract_day
- , subq_2.metric_time__extract_dow AS metric_time__extract_dow
- , subq_2.metric_time__extract_doy AS metric_time__extract_doy
- , subq_2.user AS user
- , subq_2.revenue_instance__user AS revenue_instance__user
- , subq_2.txn_revenue AS txn_revenue
+ subq_14.metric_time__month AS metric_time__month
+ , subq_13.ds__day AS ds__day
+ , subq_13.ds__week AS ds__week
+ , subq_13.ds__month AS ds__month
+ , subq_13.ds__quarter AS ds__quarter
+ , subq_13.ds__year AS ds__year
+ , subq_13.ds__extract_year AS ds__extract_year
+ , subq_13.ds__extract_quarter AS ds__extract_quarter
+ , subq_13.ds__extract_month AS ds__extract_month
+ , subq_13.ds__extract_day AS ds__extract_day
+ , subq_13.ds__extract_dow AS ds__extract_dow
+ , subq_13.ds__extract_doy AS ds__extract_doy
+ , subq_13.revenue_instance__ds__day AS revenue_instance__ds__day
+ , subq_13.revenue_instance__ds__week AS revenue_instance__ds__week
+ , subq_13.revenue_instance__ds__month AS revenue_instance__ds__month
+ , subq_13.revenue_instance__ds__quarter AS revenue_instance__ds__quarter
+ , subq_13.revenue_instance__ds__year AS revenue_instance__ds__year
+ , subq_13.revenue_instance__ds__extract_year AS revenue_instance__ds__extract_year
+ , subq_13.revenue_instance__ds__extract_quarter AS revenue_instance__ds__extract_quarter
+ , subq_13.revenue_instance__ds__extract_month AS revenue_instance__ds__extract_month
+ , subq_13.revenue_instance__ds__extract_day AS revenue_instance__ds__extract_day
+ , subq_13.revenue_instance__ds__extract_dow AS revenue_instance__ds__extract_dow
+ , subq_13.revenue_instance__ds__extract_doy AS revenue_instance__ds__extract_doy
+ , subq_13.metric_time__day AS metric_time__day
+ , subq_13.metric_time__week AS metric_time__week
+ , subq_13.metric_time__quarter AS metric_time__quarter
+ , subq_13.metric_time__year AS metric_time__year
+ , subq_13.metric_time__extract_year AS metric_time__extract_year
+ , subq_13.metric_time__extract_quarter AS metric_time__extract_quarter
+ , subq_13.metric_time__extract_month AS metric_time__extract_month
+ , subq_13.metric_time__extract_day AS metric_time__extract_day
+ , subq_13.metric_time__extract_dow AS metric_time__extract_dow
+ , subq_13.metric_time__extract_doy AS metric_time__extract_doy
+ , subq_13.user AS user
+ , subq_13.revenue_instance__user AS revenue_instance__user
+ , subq_13.txn_revenue AS txn_revenue
FROM (
-- Time Spine
SELECT
- DATE_TRUNC(subq_4.ds, month) AS metric_time__month
- FROM ***************************.mf_time_spine subq_4
- WHERE subq_4.ds BETWEEN '2020-01-01' AND '2020-01-01'
+ DATE_TRUNC(subq_15.ds, month) AS metric_time__month
+ FROM ***************************.mf_time_spine subq_15
+ WHERE subq_15.ds BETWEEN '2020-01-01' AND '2020-01-01'
GROUP BY
metric_time__month
- ) subq_3
+ ) subq_14
INNER JOIN (
-- Constrain Time Range to [2000-01-01T00:00:00, 2020-01-01T00:00:00]
SELECT
- subq_1.ds__day
- , subq_1.ds__week
- , subq_1.ds__month
- , subq_1.ds__quarter
- , subq_1.ds__year
- , subq_1.ds__extract_year
- , subq_1.ds__extract_quarter
- , subq_1.ds__extract_month
- , subq_1.ds__extract_day
- , subq_1.ds__extract_dow
- , subq_1.ds__extract_doy
- , subq_1.revenue_instance__ds__day
- , subq_1.revenue_instance__ds__week
- , subq_1.revenue_instance__ds__month
- , subq_1.revenue_instance__ds__quarter
- , subq_1.revenue_instance__ds__year
- , subq_1.revenue_instance__ds__extract_year
- , subq_1.revenue_instance__ds__extract_quarter
- , subq_1.revenue_instance__ds__extract_month
- , subq_1.revenue_instance__ds__extract_day
- , subq_1.revenue_instance__ds__extract_dow
- , subq_1.revenue_instance__ds__extract_doy
- , subq_1.metric_time__day
- , subq_1.metric_time__week
- , subq_1.metric_time__month
- , subq_1.metric_time__quarter
- , subq_1.metric_time__year
- , subq_1.metric_time__extract_year
- , subq_1.metric_time__extract_quarter
- , subq_1.metric_time__extract_month
- , subq_1.metric_time__extract_day
- , subq_1.metric_time__extract_dow
- , subq_1.metric_time__extract_doy
- , subq_1.user
- , subq_1.revenue_instance__user
- , subq_1.txn_revenue
+ subq_12.ds__day
+ , subq_12.ds__week
+ , subq_12.ds__month
+ , subq_12.ds__quarter
+ , subq_12.ds__year
+ , subq_12.ds__extract_year
+ , subq_12.ds__extract_quarter
+ , subq_12.ds__extract_month
+ , subq_12.ds__extract_day
+ , subq_12.ds__extract_dow
+ , subq_12.ds__extract_doy
+ , subq_12.revenue_instance__ds__day
+ , subq_12.revenue_instance__ds__week
+ , subq_12.revenue_instance__ds__month
+ , subq_12.revenue_instance__ds__quarter
+ , subq_12.revenue_instance__ds__year
+ , subq_12.revenue_instance__ds__extract_year
+ , subq_12.revenue_instance__ds__extract_quarter
+ , subq_12.revenue_instance__ds__extract_month
+ , subq_12.revenue_instance__ds__extract_day
+ , subq_12.revenue_instance__ds__extract_dow
+ , subq_12.revenue_instance__ds__extract_doy
+ , subq_12.metric_time__day
+ , subq_12.metric_time__week
+ , subq_12.metric_time__month
+ , subq_12.metric_time__quarter
+ , subq_12.metric_time__year
+ , subq_12.metric_time__extract_year
+ , subq_12.metric_time__extract_quarter
+ , subq_12.metric_time__extract_month
+ , subq_12.metric_time__extract_day
+ , subq_12.metric_time__extract_dow
+ , subq_12.metric_time__extract_doy
+ , subq_12.user
+ , subq_12.revenue_instance__user
+ , subq_12.txn_revenue
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.revenue_instance__ds__day
- , subq_0.revenue_instance__ds__week
- , subq_0.revenue_instance__ds__month
- , subq_0.revenue_instance__ds__quarter
- , subq_0.revenue_instance__ds__year
- , subq_0.revenue_instance__ds__extract_year
- , subq_0.revenue_instance__ds__extract_quarter
- , subq_0.revenue_instance__ds__extract_month
- , subq_0.revenue_instance__ds__extract_day
- , subq_0.revenue_instance__ds__extract_dow
- , subq_0.revenue_instance__ds__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.user
- , subq_0.revenue_instance__user
- , subq_0.txn_revenue
+ subq_11.ds__day
+ , subq_11.ds__week
+ , subq_11.ds__month
+ , subq_11.ds__quarter
+ , subq_11.ds__year
+ , subq_11.ds__extract_year
+ , subq_11.ds__extract_quarter
+ , subq_11.ds__extract_month
+ , subq_11.ds__extract_day
+ , subq_11.ds__extract_dow
+ , subq_11.ds__extract_doy
+ , subq_11.revenue_instance__ds__day
+ , subq_11.revenue_instance__ds__week
+ , subq_11.revenue_instance__ds__month
+ , subq_11.revenue_instance__ds__quarter
+ , subq_11.revenue_instance__ds__year
+ , subq_11.revenue_instance__ds__extract_year
+ , subq_11.revenue_instance__ds__extract_quarter
+ , subq_11.revenue_instance__ds__extract_month
+ , subq_11.revenue_instance__ds__extract_day
+ , subq_11.revenue_instance__ds__extract_dow
+ , subq_11.revenue_instance__ds__extract_doy
+ , subq_11.ds__day AS metric_time__day
+ , subq_11.ds__week AS metric_time__week
+ , subq_11.ds__month AS metric_time__month
+ , subq_11.ds__quarter AS metric_time__quarter
+ , subq_11.ds__year AS metric_time__year
+ , subq_11.ds__extract_year AS metric_time__extract_year
+ , subq_11.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_11.ds__extract_month AS metric_time__extract_month
+ , subq_11.ds__extract_day AS metric_time__extract_day
+ , subq_11.ds__extract_dow AS metric_time__extract_dow
+ , subq_11.ds__extract_doy AS metric_time__extract_doy
+ , subq_11.user
+ , subq_11.revenue_instance__user
+ , subq_11.txn_revenue
FROM (
-- Read Elements From Semantic Model 'revenue'
SELECT
- revenue_src_28007.revenue AS txn_revenue
- , DATE_TRUNC(revenue_src_28007.created_at, day) AS ds__day
- , DATE_TRUNC(revenue_src_28007.created_at, isoweek) AS ds__week
- , DATE_TRUNC(revenue_src_28007.created_at, month) AS ds__month
- , DATE_TRUNC(revenue_src_28007.created_at, quarter) AS ds__quarter
- , DATE_TRUNC(revenue_src_28007.created_at, year) AS ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM revenue_src_28007.created_at) = 1, 7, EXTRACT(dayofweek FROM revenue_src_28007.created_at) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM revenue_src_28007.created_at) AS ds__extract_doy
- , DATE_TRUNC(revenue_src_28007.created_at, day) AS revenue_instance__ds__day
- , DATE_TRUNC(revenue_src_28007.created_at, isoweek) AS revenue_instance__ds__week
- , DATE_TRUNC(revenue_src_28007.created_at, month) AS revenue_instance__ds__month
- , DATE_TRUNC(revenue_src_28007.created_at, quarter) AS revenue_instance__ds__quarter
- , DATE_TRUNC(revenue_src_28007.created_at, year) AS revenue_instance__ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day
- , IF(EXTRACT(dayofweek FROM revenue_src_28007.created_at) = 1, 7, EXTRACT(dayofweek FROM revenue_src_28007.created_at) - 1) AS revenue_instance__ds__extract_dow
- , EXTRACT(dayofyear FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy
- , revenue_src_28007.user_id AS user
- , revenue_src_28007.user_id AS revenue_instance__user
- FROM ***************************.fct_revenue revenue_src_28007
- ) subq_0
- ) subq_1
- WHERE subq_1.metric_time__day BETWEEN '2000-01-01' AND '2020-01-01'
- ) subq_2
+ 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
+ , 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
+ , 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
+ , EXTRACT(day FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_day
+ , IF(EXTRACT(dayofweek FROM revenue_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM revenue_src_28000.created_at) - 1) AS revenue_instance__ds__extract_dow
+ , EXTRACT(dayofyear FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_doy
+ , revenue_src_28000.user_id AS user
+ , revenue_src_28000.user_id AS revenue_instance__user
+ FROM ***************************.fct_revenue revenue_src_28000
+ ) subq_11
+ ) subq_12
+ WHERE subq_12.metric_time__day BETWEEN '2000-01-01' AND '2020-01-01'
+ ) subq_13
ON
- (subq_2.metric_time__month <= subq_3.metric_time__month)
- ) subq_5
- ) subq_6
- WHERE subq_6.metric_time__month BETWEEN '2020-01-01' AND '2020-01-01'
- ) subq_7
+ (subq_13.metric_time__month <= subq_14.metric_time__month)
+ ) subq_16
+ ) subq_17
+ WHERE subq_17.metric_time__month BETWEEN '2020-01-01' AND '2020-01-01'
+ ) subq_18
GROUP BY
metric_time__month
-) subq_8
+) subq_19
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_no_window_with_time_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_no_window_with_time_constraint__plan0_optimized.sql
index 588064f322..380b81d94a 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_no_window_with_time_constraint__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_no_window_with_time_constraint__plan0_optimized.sql
@@ -4,17 +4,17 @@
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_12.metric_time__month AS metric_time__month
- , SUM(subq_11.txn_revenue) AS revenue_all_time
+ subq_23.metric_time__month AS metric_time__month
+ , SUM(subq_22.txn_revenue) AS revenue_all_time
FROM (
-- Time Spine
SELECT
DATE_TRUNC(ds, month) AS metric_time__month
- FROM ***************************.mf_time_spine subq_13
+ FROM ***************************.mf_time_spine subq_24
WHERE ds BETWEEN '2020-01-01' AND '2020-01-01'
GROUP BY
metric_time__month
-) subq_12
+) subq_23
INNER JOIN (
-- Read Elements From Semantic Model 'revenue'
-- Metric Time Dimension 'ds'
@@ -22,11 +22,11 @@ INNER JOIN (
SELECT
DATE_TRUNC(created_at, month) AS metric_time__month
, revenue AS txn_revenue
- FROM ***************************.fct_revenue revenue_src_28007
+ FROM ***************************.fct_revenue revenue_src_28000
WHERE DATE_TRUNC(created_at, day) BETWEEN '2000-01-01' AND '2020-01-01'
-) subq_11
+) subq_22
ON
- (subq_11.metric_time__month <= subq_12.metric_time__month)
-WHERE subq_12.metric_time__month BETWEEN '2020-01-01' AND '2020-01-01'
+ (subq_22.metric_time__month <= subq_23.metric_time__month)
+WHERE subq_23.metric_time__month BETWEEN '2020-01-01' AND '2020-01-01'
GROUP BY
metric_time__month
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_with_agg_time_dimension__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_with_agg_time_dimension__plan0.sql
index fc1a7fcd07..58aad0e832 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_with_agg_time_dimension__plan0.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_with_agg_time_dimension__plan0.sql
@@ -1,140 +1,140 @@
-- Compute Metrics via Expressions
SELECT
- subq_6.revenue_instance__ds__day
- , subq_6.txn_revenue AS trailing_2_months_revenue
+ subq_15.revenue_instance__ds__day
+ , subq_15.txn_revenue AS trailing_2_months_revenue
FROM (
-- Aggregate Measures
SELECT
- subq_5.revenue_instance__ds__day
- , SUM(subq_5.txn_revenue) AS txn_revenue
+ subq_14.revenue_instance__ds__day
+ , SUM(subq_14.txn_revenue) AS txn_revenue
FROM (
-- Pass Only Elements: ['txn_revenue', 'revenue_instance__ds__day']
SELECT
- subq_4.revenue_instance__ds__day
- , subq_4.txn_revenue
+ subq_13.revenue_instance__ds__day
+ , subq_13.txn_revenue
FROM (
-- Join Self Over Time Range
SELECT
- subq_2.revenue_instance__ds__day AS revenue_instance__ds__day
- , subq_1.ds__day AS ds__day
- , subq_1.ds__week AS ds__week
- , subq_1.ds__month AS ds__month
- , subq_1.ds__quarter AS ds__quarter
- , subq_1.ds__year AS ds__year
- , subq_1.ds__extract_year AS ds__extract_year
- , subq_1.ds__extract_quarter AS ds__extract_quarter
- , subq_1.ds__extract_month AS ds__extract_month
- , subq_1.ds__extract_day AS ds__extract_day
- , subq_1.ds__extract_dow AS ds__extract_dow
- , subq_1.ds__extract_doy AS ds__extract_doy
- , subq_1.revenue_instance__ds__week AS revenue_instance__ds__week
- , subq_1.revenue_instance__ds__month AS revenue_instance__ds__month
- , subq_1.revenue_instance__ds__quarter AS revenue_instance__ds__quarter
- , subq_1.revenue_instance__ds__year AS revenue_instance__ds__year
- , subq_1.revenue_instance__ds__extract_year AS revenue_instance__ds__extract_year
- , subq_1.revenue_instance__ds__extract_quarter AS revenue_instance__ds__extract_quarter
- , subq_1.revenue_instance__ds__extract_month AS revenue_instance__ds__extract_month
- , subq_1.revenue_instance__ds__extract_day AS revenue_instance__ds__extract_day
- , subq_1.revenue_instance__ds__extract_dow AS revenue_instance__ds__extract_dow
- , subq_1.revenue_instance__ds__extract_doy AS revenue_instance__ds__extract_doy
- , subq_1.metric_time__day AS metric_time__day
- , subq_1.metric_time__week AS metric_time__week
- , subq_1.metric_time__month AS metric_time__month
- , subq_1.metric_time__quarter AS metric_time__quarter
- , subq_1.metric_time__year AS metric_time__year
- , subq_1.metric_time__extract_year AS metric_time__extract_year
- , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter
- , subq_1.metric_time__extract_month AS metric_time__extract_month
- , subq_1.metric_time__extract_day AS metric_time__extract_day
- , subq_1.metric_time__extract_dow AS metric_time__extract_dow
- , subq_1.metric_time__extract_doy AS metric_time__extract_doy
- , subq_1.user AS user
- , subq_1.revenue_instance__user AS revenue_instance__user
- , subq_1.txn_revenue AS txn_revenue
+ subq_11.revenue_instance__ds__day AS revenue_instance__ds__day
+ , subq_10.ds__day AS ds__day
+ , subq_10.ds__week AS ds__week
+ , subq_10.ds__month AS ds__month
+ , subq_10.ds__quarter AS ds__quarter
+ , subq_10.ds__year AS ds__year
+ , subq_10.ds__extract_year AS ds__extract_year
+ , subq_10.ds__extract_quarter AS ds__extract_quarter
+ , subq_10.ds__extract_month AS ds__extract_month
+ , subq_10.ds__extract_day AS ds__extract_day
+ , subq_10.ds__extract_dow AS ds__extract_dow
+ , subq_10.ds__extract_doy AS ds__extract_doy
+ , subq_10.revenue_instance__ds__week AS revenue_instance__ds__week
+ , subq_10.revenue_instance__ds__month AS revenue_instance__ds__month
+ , subq_10.revenue_instance__ds__quarter AS revenue_instance__ds__quarter
+ , subq_10.revenue_instance__ds__year AS revenue_instance__ds__year
+ , subq_10.revenue_instance__ds__extract_year AS revenue_instance__ds__extract_year
+ , subq_10.revenue_instance__ds__extract_quarter AS revenue_instance__ds__extract_quarter
+ , subq_10.revenue_instance__ds__extract_month AS revenue_instance__ds__extract_month
+ , subq_10.revenue_instance__ds__extract_day AS revenue_instance__ds__extract_day
+ , subq_10.revenue_instance__ds__extract_dow AS revenue_instance__ds__extract_dow
+ , subq_10.revenue_instance__ds__extract_doy AS revenue_instance__ds__extract_doy
+ , subq_10.metric_time__day AS metric_time__day
+ , subq_10.metric_time__week AS metric_time__week
+ , subq_10.metric_time__month AS metric_time__month
+ , subq_10.metric_time__quarter AS metric_time__quarter
+ , subq_10.metric_time__year AS metric_time__year
+ , subq_10.metric_time__extract_year AS metric_time__extract_year
+ , subq_10.metric_time__extract_quarter AS metric_time__extract_quarter
+ , subq_10.metric_time__extract_month AS metric_time__extract_month
+ , subq_10.metric_time__extract_day AS metric_time__extract_day
+ , subq_10.metric_time__extract_dow AS metric_time__extract_dow
+ , subq_10.metric_time__extract_doy AS metric_time__extract_doy
+ , subq_10.user AS user
+ , subq_10.revenue_instance__user AS revenue_instance__user
+ , subq_10.txn_revenue AS txn_revenue
FROM (
-- Time Spine
SELECT
- subq_3.ds AS revenue_instance__ds__day
- FROM ***************************.mf_time_spine subq_3
- ) subq_2
+ subq_12.ds AS revenue_instance__ds__day
+ FROM ***************************.mf_time_spine subq_12
+ ) subq_11
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.revenue_instance__ds__day
- , subq_0.revenue_instance__ds__week
- , subq_0.revenue_instance__ds__month
- , subq_0.revenue_instance__ds__quarter
- , subq_0.revenue_instance__ds__year
- , subq_0.revenue_instance__ds__extract_year
- , subq_0.revenue_instance__ds__extract_quarter
- , subq_0.revenue_instance__ds__extract_month
- , subq_0.revenue_instance__ds__extract_day
- , subq_0.revenue_instance__ds__extract_dow
- , subq_0.revenue_instance__ds__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.user
- , subq_0.revenue_instance__user
- , subq_0.txn_revenue
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.revenue_instance__ds__day
+ , subq_9.revenue_instance__ds__week
+ , subq_9.revenue_instance__ds__month
+ , subq_9.revenue_instance__ds__quarter
+ , subq_9.revenue_instance__ds__year
+ , subq_9.revenue_instance__ds__extract_year
+ , subq_9.revenue_instance__ds__extract_quarter
+ , subq_9.revenue_instance__ds__extract_month
+ , subq_9.revenue_instance__ds__extract_day
+ , subq_9.revenue_instance__ds__extract_dow
+ , subq_9.revenue_instance__ds__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.user
+ , subq_9.revenue_instance__user
+ , subq_9.txn_revenue
FROM (
-- Read Elements From Semantic Model 'revenue'
SELECT
- revenue_src_28007.revenue AS txn_revenue
- , DATE_TRUNC(revenue_src_28007.created_at, day) AS ds__day
- , DATE_TRUNC(revenue_src_28007.created_at, isoweek) AS ds__week
- , DATE_TRUNC(revenue_src_28007.created_at, month) AS ds__month
- , DATE_TRUNC(revenue_src_28007.created_at, quarter) AS ds__quarter
- , DATE_TRUNC(revenue_src_28007.created_at, year) AS ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM revenue_src_28007.created_at) = 1, 7, EXTRACT(dayofweek FROM revenue_src_28007.created_at) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM revenue_src_28007.created_at) AS ds__extract_doy
- , DATE_TRUNC(revenue_src_28007.created_at, day) AS revenue_instance__ds__day
- , DATE_TRUNC(revenue_src_28007.created_at, isoweek) AS revenue_instance__ds__week
- , DATE_TRUNC(revenue_src_28007.created_at, month) AS revenue_instance__ds__month
- , DATE_TRUNC(revenue_src_28007.created_at, quarter) AS revenue_instance__ds__quarter
- , DATE_TRUNC(revenue_src_28007.created_at, year) AS revenue_instance__ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day
- , IF(EXTRACT(dayofweek FROM revenue_src_28007.created_at) = 1, 7, EXTRACT(dayofweek FROM revenue_src_28007.created_at) - 1) AS revenue_instance__ds__extract_dow
- , EXTRACT(dayofyear FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy
- , revenue_src_28007.user_id AS user
- , revenue_src_28007.user_id AS revenue_instance__user
- FROM ***************************.fct_revenue revenue_src_28007
- ) subq_0
- ) subq_1
+ 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
+ , 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
+ , 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
+ , EXTRACT(day FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_day
+ , IF(EXTRACT(dayofweek FROM revenue_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM revenue_src_28000.created_at) - 1) AS revenue_instance__ds__extract_dow
+ , EXTRACT(dayofyear FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_doy
+ , revenue_src_28000.user_id AS user
+ , revenue_src_28000.user_id AS revenue_instance__user
+ FROM ***************************.fct_revenue revenue_src_28000
+ ) subq_9
+ ) subq_10
ON
(
- subq_1.revenue_instance__ds__day <= subq_2.revenue_instance__ds__day
+ subq_10.revenue_instance__ds__day <= subq_11.revenue_instance__ds__day
) AND (
- subq_1.revenue_instance__ds__day > DATE_SUB(CAST(subq_2.revenue_instance__ds__day AS DATETIME), INTERVAL 2 month)
+ subq_10.revenue_instance__ds__day > DATE_SUB(CAST(subq_11.revenue_instance__ds__day AS DATETIME), INTERVAL 2 month)
)
- ) subq_4
- ) subq_5
+ ) subq_13
+ ) subq_14
GROUP BY
revenue_instance__ds__day
-) subq_6
+) subq_15
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_with_agg_time_dimension__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_with_agg_time_dimension__plan0_optimized.sql
index 1f114b5424..6f50935572 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_with_agg_time_dimension__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_with_agg_time_dimension__plan0_optimized.sql
@@ -3,16 +3,16 @@
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_10.ds AS revenue_instance__ds__day
- , SUM(revenue_src_28007.revenue) AS trailing_2_months_revenue
-FROM ***************************.mf_time_spine subq_10
+ subq_19.ds AS revenue_instance__ds__day
+ , SUM(revenue_src_28000.revenue) AS trailing_2_months_revenue
+FROM ***************************.mf_time_spine subq_19
INNER JOIN
- ***************************.fct_revenue revenue_src_28007
+ ***************************.fct_revenue revenue_src_28000
ON
(
- DATE_TRUNC(revenue_src_28007.created_at, day) <= subq_10.ds
+ DATE_TRUNC(revenue_src_28000.created_at, day) <= subq_19.ds
) AND (
- DATE_TRUNC(revenue_src_28007.created_at, day) > DATE_SUB(CAST(subq_10.ds AS DATETIME), INTERVAL 2 month)
+ DATE_TRUNC(revenue_src_28000.created_at, day) > DATE_SUB(CAST(subq_19.ds AS DATETIME), INTERVAL 2 month)
)
GROUP BY
revenue_instance__ds__day
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_with_non_adjustable_time_filter__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_with_non_adjustable_time_filter__plan0.sql
index 8c3004f444..70bcdf123e 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_with_non_adjustable_time_filter__plan0.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_with_non_adjustable_time_filter__plan0.sql
@@ -1,334 +1,334 @@
-- Compute Metrics via Expressions
SELECT
- subq_7.metric_time__day
- , subq_7.bookers AS every_two_days_bookers
+ subq_16.metric_time__day
+ , subq_16.bookers AS every_two_days_bookers
FROM (
-- Aggregate Measures
SELECT
- subq_6.metric_time__day
- , COUNT(DISTINCT subq_6.bookers) AS bookers
+ subq_15.metric_time__day
+ , COUNT(DISTINCT subq_15.bookers) AS bookers
FROM (
-- Constrain Output with WHERE
SELECT
- subq_5.metric_time__day
- , subq_5.bookers
+ subq_14.metric_time__day
+ , subq_14.bookers
FROM (
-- Pass Only Elements: ['bookers', 'metric_time__day']
SELECT
- subq_4.metric_time__day
- , subq_4.bookers
+ subq_13.metric_time__day
+ , subq_13.bookers
FROM (
-- Join Self Over Time Range
SELECT
- subq_2.metric_time__day AS metric_time__day
- , subq_1.ds__day AS ds__day
- , subq_1.ds__week AS ds__week
- , subq_1.ds__month AS ds__month
- , subq_1.ds__quarter AS ds__quarter
- , subq_1.ds__year AS ds__year
- , subq_1.ds__extract_year AS ds__extract_year
- , subq_1.ds__extract_quarter AS ds__extract_quarter
- , subq_1.ds__extract_month AS ds__extract_month
- , subq_1.ds__extract_day AS ds__extract_day
- , subq_1.ds__extract_dow AS ds__extract_dow
- , subq_1.ds__extract_doy AS ds__extract_doy
- , subq_1.ds_partitioned__day AS ds_partitioned__day
- , subq_1.ds_partitioned__week AS ds_partitioned__week
- , subq_1.ds_partitioned__month AS ds_partitioned__month
- , subq_1.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_1.ds_partitioned__year AS ds_partitioned__year
- , subq_1.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_1.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_1.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_1.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_1.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_1.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_1.paid_at__day AS paid_at__day
- , subq_1.paid_at__week AS paid_at__week
- , subq_1.paid_at__month AS paid_at__month
- , subq_1.paid_at__quarter AS paid_at__quarter
- , subq_1.paid_at__year AS paid_at__year
- , subq_1.paid_at__extract_year AS paid_at__extract_year
- , subq_1.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_1.paid_at__extract_month AS paid_at__extract_month
- , subq_1.paid_at__extract_day AS paid_at__extract_day
- , subq_1.paid_at__extract_dow AS paid_at__extract_dow
- , subq_1.paid_at__extract_doy AS paid_at__extract_doy
- , subq_1.booking__ds__day AS booking__ds__day
- , subq_1.booking__ds__week AS booking__ds__week
- , subq_1.booking__ds__month AS booking__ds__month
- , subq_1.booking__ds__quarter AS booking__ds__quarter
- , subq_1.booking__ds__year AS booking__ds__year
- , subq_1.booking__ds__extract_year AS booking__ds__extract_year
- , subq_1.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_1.booking__ds__extract_month AS booking__ds__extract_month
- , subq_1.booking__ds__extract_day AS booking__ds__extract_day
- , subq_1.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_1.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_1.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_1.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_1.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_1.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_1.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_1.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_1.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_1.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_1.booking__paid_at__day AS booking__paid_at__day
- , subq_1.booking__paid_at__week AS booking__paid_at__week
- , subq_1.booking__paid_at__month AS booking__paid_at__month
- , subq_1.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_1.booking__paid_at__year AS booking__paid_at__year
- , subq_1.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_1.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_1.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_1.metric_time__week AS metric_time__week
- , subq_1.metric_time__month AS metric_time__month
- , subq_1.metric_time__quarter AS metric_time__quarter
- , subq_1.metric_time__year AS metric_time__year
- , subq_1.metric_time__extract_year AS metric_time__extract_year
- , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter
- , subq_1.metric_time__extract_month AS metric_time__extract_month
- , subq_1.metric_time__extract_day AS metric_time__extract_day
- , subq_1.metric_time__extract_dow AS metric_time__extract_dow
- , subq_1.metric_time__extract_doy AS metric_time__extract_doy
- , subq_1.listing AS listing
- , subq_1.guest AS guest
- , subq_1.host AS host
- , subq_1.booking__listing AS booking__listing
- , subq_1.booking__guest AS booking__guest
- , subq_1.booking__host AS booking__host
- , subq_1.is_instant AS is_instant
- , subq_1.booking__is_instant AS booking__is_instant
- , subq_1.bookings AS bookings
- , subq_1.instant_bookings AS instant_bookings
- , subq_1.booking_value AS booking_value
- , subq_1.max_booking_value AS max_booking_value
- , subq_1.min_booking_value AS min_booking_value
- , subq_1.bookers AS bookers
- , subq_1.average_booking_value AS average_booking_value
- , subq_1.referred_bookings AS referred_bookings
- , subq_1.median_booking_value AS median_booking_value
- , subq_1.booking_value_p99 AS booking_value_p99
- , subq_1.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_1.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_1.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ subq_11.metric_time__day AS metric_time__day
+ , subq_10.ds__day AS ds__day
+ , subq_10.ds__week AS ds__week
+ , subq_10.ds__month AS ds__month
+ , subq_10.ds__quarter AS ds__quarter
+ , subq_10.ds__year AS ds__year
+ , subq_10.ds__extract_year AS ds__extract_year
+ , subq_10.ds__extract_quarter AS ds__extract_quarter
+ , subq_10.ds__extract_month AS ds__extract_month
+ , subq_10.ds__extract_day AS ds__extract_day
+ , subq_10.ds__extract_dow AS ds__extract_dow
+ , subq_10.ds__extract_doy AS ds__extract_doy
+ , subq_10.ds_partitioned__day AS ds_partitioned__day
+ , subq_10.ds_partitioned__week AS ds_partitioned__week
+ , subq_10.ds_partitioned__month AS ds_partitioned__month
+ , subq_10.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_10.ds_partitioned__year AS ds_partitioned__year
+ , subq_10.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_10.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_10.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_10.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_10.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_10.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_10.paid_at__day AS paid_at__day
+ , subq_10.paid_at__week AS paid_at__week
+ , subq_10.paid_at__month AS paid_at__month
+ , subq_10.paid_at__quarter AS paid_at__quarter
+ , subq_10.paid_at__year AS paid_at__year
+ , subq_10.paid_at__extract_year AS paid_at__extract_year
+ , subq_10.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_10.paid_at__extract_month AS paid_at__extract_month
+ , subq_10.paid_at__extract_day AS paid_at__extract_day
+ , subq_10.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_10.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_10.booking__ds__day AS booking__ds__day
+ , subq_10.booking__ds__week AS booking__ds__week
+ , subq_10.booking__ds__month AS booking__ds__month
+ , subq_10.booking__ds__quarter AS booking__ds__quarter
+ , subq_10.booking__ds__year AS booking__ds__year
+ , subq_10.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_10.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_10.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_10.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_10.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_10.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_10.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_10.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_10.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_10.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_10.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_10.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_10.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_10.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_10.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_10.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_10.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_10.booking__paid_at__day AS booking__paid_at__day
+ , subq_10.booking__paid_at__week AS booking__paid_at__week
+ , subq_10.booking__paid_at__month AS booking__paid_at__month
+ , subq_10.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_10.booking__paid_at__year AS booking__paid_at__year
+ , subq_10.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_10.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_10.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_10.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_10.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_10.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_10.metric_time__week AS metric_time__week
+ , subq_10.metric_time__month AS metric_time__month
+ , subq_10.metric_time__quarter AS metric_time__quarter
+ , subq_10.metric_time__year AS metric_time__year
+ , subq_10.metric_time__extract_year AS metric_time__extract_year
+ , subq_10.metric_time__extract_quarter AS metric_time__extract_quarter
+ , subq_10.metric_time__extract_month AS metric_time__extract_month
+ , subq_10.metric_time__extract_day AS metric_time__extract_day
+ , subq_10.metric_time__extract_dow AS metric_time__extract_dow
+ , subq_10.metric_time__extract_doy AS metric_time__extract_doy
+ , subq_10.listing AS listing
+ , subq_10.guest AS guest
+ , subq_10.host AS host
+ , subq_10.booking__listing AS booking__listing
+ , subq_10.booking__guest AS booking__guest
+ , subq_10.booking__host AS booking__host
+ , subq_10.is_instant AS is_instant
+ , subq_10.booking__is_instant AS booking__is_instant
+ , subq_10.bookings AS bookings
+ , subq_10.instant_bookings AS instant_bookings
+ , subq_10.booking_value AS booking_value
+ , subq_10.max_booking_value AS max_booking_value
+ , subq_10.min_booking_value AS min_booking_value
+ , subq_10.bookers AS bookers
+ , subq_10.average_booking_value AS average_booking_value
+ , subq_10.referred_bookings AS referred_bookings
+ , subq_10.median_booking_value AS median_booking_value
+ , subq_10.booking_value_p99 AS booking_value_p99
+ , subq_10.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_10.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_10.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_3.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_3
- ) subq_2
+ subq_12.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_12
+ ) subq_11
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS booking__paid_at__extract_dow
+ , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
ON
(
- subq_1.metric_time__day <= subq_2.metric_time__day
+ subq_10.metric_time__day <= subq_11.metric_time__day
) AND (
- subq_1.metric_time__day > DATE_SUB(CAST(subq_2.metric_time__day AS DATETIME), INTERVAL 2 day)
+ subq_10.metric_time__day > DATE_SUB(CAST(subq_11.metric_time__day AS DATETIME), INTERVAL 2 day)
)
- ) subq_4
- ) subq_5
+ ) subq_13
+ ) subq_14
WHERE metric_time__day = '2020-01-03' or metric_time__day = '2020-01-07'
- ) subq_6
+ ) subq_15
GROUP BY
metric_time__day
-) subq_7
+) subq_16
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_with_non_adjustable_time_filter__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_with_non_adjustable_time_filter__plan0_optimized.sql
index 48c38d8b33..cd07357409 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_with_non_adjustable_time_filter__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_with_non_adjustable_time_filter__plan0_optimized.sql
@@ -8,18 +8,18 @@ FROM (
-- Join Self Over Time Range
-- Pass Only Elements: ['bookers', 'metric_time__day']
SELECT
- subq_11.ds AS metric_time__day
- , bookings_source_src_28001.guest_id AS bookers
- FROM ***************************.mf_time_spine subq_11
+ subq_20.ds AS metric_time__day
+ , bookings_source_src_28000.guest_id AS bookers
+ FROM ***************************.mf_time_spine subq_20
INNER JOIN
- ***************************.fct_bookings bookings_source_src_28001
+ ***************************.fct_bookings bookings_source_src_28000
ON
(
- DATE_TRUNC(bookings_source_src_28001.ds, day) <= subq_11.ds
+ DATE_TRUNC(bookings_source_src_28000.ds, day) <= subq_20.ds
) AND (
- DATE_TRUNC(bookings_source_src_28001.ds, day) > DATE_SUB(CAST(subq_11.ds AS DATETIME), INTERVAL 2 day)
+ DATE_TRUNC(bookings_source_src_28000.ds, day) > DATE_SUB(CAST(subq_20.ds AS DATETIME), INTERVAL 2 day)
)
-) subq_13
+) subq_22
WHERE metric_time__day = '2020-01-03' or metric_time__day = '2020-01-07'
GROUP BY
metric_time__day
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_with_time_constraint__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_with_time_constraint__plan0.sql
index a59b1c6bd7..34d08d65d9 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_with_time_constraint__plan0.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_with_time_constraint__plan0.sql
@@ -1,189 +1,189 @@
-- Compute Metrics via Expressions
SELECT
- subq_8.metric_time__day
- , subq_8.txn_revenue AS trailing_2_months_revenue
+ subq_19.metric_time__day
+ , subq_19.txn_revenue AS trailing_2_months_revenue
FROM (
-- Aggregate Measures
SELECT
- subq_7.metric_time__day
- , SUM(subq_7.txn_revenue) AS txn_revenue
+ subq_18.metric_time__day
+ , SUM(subq_18.txn_revenue) AS txn_revenue
FROM (
-- Constrain Time Range to [2020-01-01T00:00:00, 2020-01-01T00:00:00]
SELECT
- subq_6.metric_time__day
- , subq_6.txn_revenue
+ subq_17.metric_time__day
+ , subq_17.txn_revenue
FROM (
-- Pass Only Elements: ['txn_revenue', 'metric_time__day']
SELECT
- subq_5.metric_time__day
- , subq_5.txn_revenue
+ subq_16.metric_time__day
+ , subq_16.txn_revenue
FROM (
-- Join Self Over Time Range
SELECT
- subq_3.metric_time__day AS metric_time__day
- , subq_2.ds__day AS ds__day
- , subq_2.ds__week AS ds__week
- , subq_2.ds__month AS ds__month
- , subq_2.ds__quarter AS ds__quarter
- , subq_2.ds__year AS ds__year
- , subq_2.ds__extract_year AS ds__extract_year
- , subq_2.ds__extract_quarter AS ds__extract_quarter
- , subq_2.ds__extract_month AS ds__extract_month
- , subq_2.ds__extract_day AS ds__extract_day
- , subq_2.ds__extract_dow AS ds__extract_dow
- , subq_2.ds__extract_doy AS ds__extract_doy
- , subq_2.revenue_instance__ds__day AS revenue_instance__ds__day
- , subq_2.revenue_instance__ds__week AS revenue_instance__ds__week
- , subq_2.revenue_instance__ds__month AS revenue_instance__ds__month
- , subq_2.revenue_instance__ds__quarter AS revenue_instance__ds__quarter
- , subq_2.revenue_instance__ds__year AS revenue_instance__ds__year
- , subq_2.revenue_instance__ds__extract_year AS revenue_instance__ds__extract_year
- , subq_2.revenue_instance__ds__extract_quarter AS revenue_instance__ds__extract_quarter
- , subq_2.revenue_instance__ds__extract_month AS revenue_instance__ds__extract_month
- , subq_2.revenue_instance__ds__extract_day AS revenue_instance__ds__extract_day
- , subq_2.revenue_instance__ds__extract_dow AS revenue_instance__ds__extract_dow
- , subq_2.revenue_instance__ds__extract_doy AS revenue_instance__ds__extract_doy
- , subq_2.metric_time__week AS metric_time__week
- , subq_2.metric_time__month AS metric_time__month
- , subq_2.metric_time__quarter AS metric_time__quarter
- , subq_2.metric_time__year AS metric_time__year
- , subq_2.metric_time__extract_year AS metric_time__extract_year
- , subq_2.metric_time__extract_quarter AS metric_time__extract_quarter
- , subq_2.metric_time__extract_month AS metric_time__extract_month
- , subq_2.metric_time__extract_day AS metric_time__extract_day
- , subq_2.metric_time__extract_dow AS metric_time__extract_dow
- , subq_2.metric_time__extract_doy AS metric_time__extract_doy
- , subq_2.user AS user
- , subq_2.revenue_instance__user AS revenue_instance__user
- , subq_2.txn_revenue AS txn_revenue
+ subq_14.metric_time__day AS metric_time__day
+ , subq_13.ds__day AS ds__day
+ , subq_13.ds__week AS ds__week
+ , subq_13.ds__month AS ds__month
+ , subq_13.ds__quarter AS ds__quarter
+ , subq_13.ds__year AS ds__year
+ , subq_13.ds__extract_year AS ds__extract_year
+ , subq_13.ds__extract_quarter AS ds__extract_quarter
+ , subq_13.ds__extract_month AS ds__extract_month
+ , subq_13.ds__extract_day AS ds__extract_day
+ , subq_13.ds__extract_dow AS ds__extract_dow
+ , subq_13.ds__extract_doy AS ds__extract_doy
+ , subq_13.revenue_instance__ds__day AS revenue_instance__ds__day
+ , subq_13.revenue_instance__ds__week AS revenue_instance__ds__week
+ , subq_13.revenue_instance__ds__month AS revenue_instance__ds__month
+ , subq_13.revenue_instance__ds__quarter AS revenue_instance__ds__quarter
+ , subq_13.revenue_instance__ds__year AS revenue_instance__ds__year
+ , subq_13.revenue_instance__ds__extract_year AS revenue_instance__ds__extract_year
+ , subq_13.revenue_instance__ds__extract_quarter AS revenue_instance__ds__extract_quarter
+ , subq_13.revenue_instance__ds__extract_month AS revenue_instance__ds__extract_month
+ , subq_13.revenue_instance__ds__extract_day AS revenue_instance__ds__extract_day
+ , subq_13.revenue_instance__ds__extract_dow AS revenue_instance__ds__extract_dow
+ , subq_13.revenue_instance__ds__extract_doy AS revenue_instance__ds__extract_doy
+ , subq_13.metric_time__week AS metric_time__week
+ , subq_13.metric_time__month AS metric_time__month
+ , subq_13.metric_time__quarter AS metric_time__quarter
+ , subq_13.metric_time__year AS metric_time__year
+ , subq_13.metric_time__extract_year AS metric_time__extract_year
+ , subq_13.metric_time__extract_quarter AS metric_time__extract_quarter
+ , subq_13.metric_time__extract_month AS metric_time__extract_month
+ , subq_13.metric_time__extract_day AS metric_time__extract_day
+ , subq_13.metric_time__extract_dow AS metric_time__extract_dow
+ , subq_13.metric_time__extract_doy AS metric_time__extract_doy
+ , subq_13.user AS user
+ , subq_13.revenue_instance__user AS revenue_instance__user
+ , subq_13.txn_revenue AS txn_revenue
FROM (
-- Time Spine
SELECT
- subq_4.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_4
- WHERE subq_4.ds BETWEEN '2020-01-01' AND '2020-01-01'
- ) subq_3
+ subq_15.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_15
+ WHERE subq_15.ds BETWEEN '2020-01-01' AND '2020-01-01'
+ ) subq_14
INNER JOIN (
-- Constrain Time Range to [2019-11-01T00:00:00, 2020-01-01T00:00:00]
SELECT
- subq_1.ds__day
- , subq_1.ds__week
- , subq_1.ds__month
- , subq_1.ds__quarter
- , subq_1.ds__year
- , subq_1.ds__extract_year
- , subq_1.ds__extract_quarter
- , subq_1.ds__extract_month
- , subq_1.ds__extract_day
- , subq_1.ds__extract_dow
- , subq_1.ds__extract_doy
- , subq_1.revenue_instance__ds__day
- , subq_1.revenue_instance__ds__week
- , subq_1.revenue_instance__ds__month
- , subq_1.revenue_instance__ds__quarter
- , subq_1.revenue_instance__ds__year
- , subq_1.revenue_instance__ds__extract_year
- , subq_1.revenue_instance__ds__extract_quarter
- , subq_1.revenue_instance__ds__extract_month
- , subq_1.revenue_instance__ds__extract_day
- , subq_1.revenue_instance__ds__extract_dow
- , subq_1.revenue_instance__ds__extract_doy
- , subq_1.metric_time__day
- , subq_1.metric_time__week
- , subq_1.metric_time__month
- , subq_1.metric_time__quarter
- , subq_1.metric_time__year
- , subq_1.metric_time__extract_year
- , subq_1.metric_time__extract_quarter
- , subq_1.metric_time__extract_month
- , subq_1.metric_time__extract_day
- , subq_1.metric_time__extract_dow
- , subq_1.metric_time__extract_doy
- , subq_1.user
- , subq_1.revenue_instance__user
- , subq_1.txn_revenue
+ subq_12.ds__day
+ , subq_12.ds__week
+ , subq_12.ds__month
+ , subq_12.ds__quarter
+ , subq_12.ds__year
+ , subq_12.ds__extract_year
+ , subq_12.ds__extract_quarter
+ , subq_12.ds__extract_month
+ , subq_12.ds__extract_day
+ , subq_12.ds__extract_dow
+ , subq_12.ds__extract_doy
+ , subq_12.revenue_instance__ds__day
+ , subq_12.revenue_instance__ds__week
+ , subq_12.revenue_instance__ds__month
+ , subq_12.revenue_instance__ds__quarter
+ , subq_12.revenue_instance__ds__year
+ , subq_12.revenue_instance__ds__extract_year
+ , subq_12.revenue_instance__ds__extract_quarter
+ , subq_12.revenue_instance__ds__extract_month
+ , subq_12.revenue_instance__ds__extract_day
+ , subq_12.revenue_instance__ds__extract_dow
+ , subq_12.revenue_instance__ds__extract_doy
+ , subq_12.metric_time__day
+ , subq_12.metric_time__week
+ , subq_12.metric_time__month
+ , subq_12.metric_time__quarter
+ , subq_12.metric_time__year
+ , subq_12.metric_time__extract_year
+ , subq_12.metric_time__extract_quarter
+ , subq_12.metric_time__extract_month
+ , subq_12.metric_time__extract_day
+ , subq_12.metric_time__extract_dow
+ , subq_12.metric_time__extract_doy
+ , subq_12.user
+ , subq_12.revenue_instance__user
+ , subq_12.txn_revenue
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.revenue_instance__ds__day
- , subq_0.revenue_instance__ds__week
- , subq_0.revenue_instance__ds__month
- , subq_0.revenue_instance__ds__quarter
- , subq_0.revenue_instance__ds__year
- , subq_0.revenue_instance__ds__extract_year
- , subq_0.revenue_instance__ds__extract_quarter
- , subq_0.revenue_instance__ds__extract_month
- , subq_0.revenue_instance__ds__extract_day
- , subq_0.revenue_instance__ds__extract_dow
- , subq_0.revenue_instance__ds__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.user
- , subq_0.revenue_instance__user
- , subq_0.txn_revenue
+ subq_11.ds__day
+ , subq_11.ds__week
+ , subq_11.ds__month
+ , subq_11.ds__quarter
+ , subq_11.ds__year
+ , subq_11.ds__extract_year
+ , subq_11.ds__extract_quarter
+ , subq_11.ds__extract_month
+ , subq_11.ds__extract_day
+ , subq_11.ds__extract_dow
+ , subq_11.ds__extract_doy
+ , subq_11.revenue_instance__ds__day
+ , subq_11.revenue_instance__ds__week
+ , subq_11.revenue_instance__ds__month
+ , subq_11.revenue_instance__ds__quarter
+ , subq_11.revenue_instance__ds__year
+ , subq_11.revenue_instance__ds__extract_year
+ , subq_11.revenue_instance__ds__extract_quarter
+ , subq_11.revenue_instance__ds__extract_month
+ , subq_11.revenue_instance__ds__extract_day
+ , subq_11.revenue_instance__ds__extract_dow
+ , subq_11.revenue_instance__ds__extract_doy
+ , subq_11.ds__day AS metric_time__day
+ , subq_11.ds__week AS metric_time__week
+ , subq_11.ds__month AS metric_time__month
+ , subq_11.ds__quarter AS metric_time__quarter
+ , subq_11.ds__year AS metric_time__year
+ , subq_11.ds__extract_year AS metric_time__extract_year
+ , subq_11.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_11.ds__extract_month AS metric_time__extract_month
+ , subq_11.ds__extract_day AS metric_time__extract_day
+ , subq_11.ds__extract_dow AS metric_time__extract_dow
+ , subq_11.ds__extract_doy AS metric_time__extract_doy
+ , subq_11.user
+ , subq_11.revenue_instance__user
+ , subq_11.txn_revenue
FROM (
-- Read Elements From Semantic Model 'revenue'
SELECT
- revenue_src_28007.revenue AS txn_revenue
- , DATE_TRUNC(revenue_src_28007.created_at, day) AS ds__day
- , DATE_TRUNC(revenue_src_28007.created_at, isoweek) AS ds__week
- , DATE_TRUNC(revenue_src_28007.created_at, month) AS ds__month
- , DATE_TRUNC(revenue_src_28007.created_at, quarter) AS ds__quarter
- , DATE_TRUNC(revenue_src_28007.created_at, year) AS ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM revenue_src_28007.created_at) = 1, 7, EXTRACT(dayofweek FROM revenue_src_28007.created_at) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM revenue_src_28007.created_at) AS ds__extract_doy
- , DATE_TRUNC(revenue_src_28007.created_at, day) AS revenue_instance__ds__day
- , DATE_TRUNC(revenue_src_28007.created_at, isoweek) AS revenue_instance__ds__week
- , DATE_TRUNC(revenue_src_28007.created_at, month) AS revenue_instance__ds__month
- , DATE_TRUNC(revenue_src_28007.created_at, quarter) AS revenue_instance__ds__quarter
- , DATE_TRUNC(revenue_src_28007.created_at, year) AS revenue_instance__ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day
- , IF(EXTRACT(dayofweek FROM revenue_src_28007.created_at) = 1, 7, EXTRACT(dayofweek FROM revenue_src_28007.created_at) - 1) AS revenue_instance__ds__extract_dow
- , EXTRACT(dayofyear FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy
- , revenue_src_28007.user_id AS user
- , revenue_src_28007.user_id AS revenue_instance__user
- FROM ***************************.fct_revenue revenue_src_28007
- ) subq_0
- ) subq_1
- WHERE subq_1.metric_time__day BETWEEN '2019-11-01' AND '2020-01-01'
- ) subq_2
+ 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
+ , 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
+ , 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
+ , EXTRACT(day FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_day
+ , IF(EXTRACT(dayofweek FROM revenue_src_28000.created_at) = 1, 7, EXTRACT(dayofweek FROM revenue_src_28000.created_at) - 1) AS revenue_instance__ds__extract_dow
+ , EXTRACT(dayofyear FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_doy
+ , revenue_src_28000.user_id AS user
+ , revenue_src_28000.user_id AS revenue_instance__user
+ FROM ***************************.fct_revenue revenue_src_28000
+ ) subq_11
+ ) subq_12
+ WHERE subq_12.metric_time__day BETWEEN '2019-11-01' AND '2020-01-01'
+ ) subq_13
ON
(
- subq_2.metric_time__day <= subq_3.metric_time__day
+ subq_13.metric_time__day <= subq_14.metric_time__day
) AND (
- subq_2.metric_time__day > DATE_SUB(CAST(subq_3.metric_time__day AS DATETIME), INTERVAL 2 month)
+ subq_13.metric_time__day > DATE_SUB(CAST(subq_14.metric_time__day AS DATETIME), INTERVAL 2 month)
)
- ) subq_5
- ) subq_6
- WHERE subq_6.metric_time__day BETWEEN '2020-01-01' AND '2020-01-01'
- ) subq_7
+ ) subq_16
+ ) subq_17
+ WHERE subq_17.metric_time__day BETWEEN '2020-01-01' AND '2020-01-01'
+ ) subq_18
GROUP BY
metric_time__day
-) subq_8
+) subq_19
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_with_time_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_with_time_constraint__plan0_optimized.sql
index 0d30972ced..1e055c92db 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_with_time_constraint__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_metric_with_time_constraint__plan0_optimized.sql
@@ -4,15 +4,15 @@
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_12.metric_time__day AS metric_time__day
- , SUM(subq_11.txn_revenue) AS trailing_2_months_revenue
+ subq_23.metric_time__day AS metric_time__day
+ , SUM(subq_22.txn_revenue) AS trailing_2_months_revenue
FROM (
-- Time Spine
SELECT
ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_13
+ FROM ***************************.mf_time_spine subq_24
WHERE ds BETWEEN '2020-01-01' AND '2020-01-01'
-) subq_12
+) subq_23
INNER JOIN (
-- Read Elements From Semantic Model 'revenue'
-- Metric Time Dimension 'ds'
@@ -20,15 +20,15 @@ INNER JOIN (
SELECT
DATE_TRUNC(created_at, day) AS metric_time__day
, revenue AS txn_revenue
- FROM ***************************.fct_revenue revenue_src_28007
+ FROM ***************************.fct_revenue revenue_src_28000
WHERE DATE_TRUNC(created_at, day) BETWEEN '2019-11-01' AND '2020-01-01'
-) subq_11
+) subq_22
ON
(
- subq_11.metric_time__day <= subq_12.metric_time__day
+ subq_22.metric_time__day <= subq_23.metric_time__day
) AND (
- subq_11.metric_time__day > DATE_SUB(CAST(subq_12.metric_time__day AS DATETIME), INTERVAL 2 month)
+ subq_22.metric_time__day > DATE_SUB(CAST(subq_23.metric_time__day AS DATETIME), INTERVAL 2 month)
)
-WHERE subq_12.metric_time__day BETWEEN '2020-01-01' AND '2020-01-01'
+WHERE subq_23.metric_time__day BETWEEN '2020-01-01' AND '2020-01-01'
GROUP BY
metric_time__day
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric__plan0.sql
index e96f97bd79..0814ce4d52 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric__plan0.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric__plan0.sql
@@ -1,88 +1,88 @@
-- Compute Metrics via Expressions
SELECT
- subq_3.ds__day
- , subq_3.txn_revenue AS trailing_2_months_revenue
+ subq_12.ds__day
+ , subq_12.txn_revenue AS trailing_2_months_revenue
FROM (
-- Aggregate Measures
SELECT
- subq_2.ds__day
- , SUM(subq_2.txn_revenue) AS txn_revenue
+ subq_11.ds__day
+ , SUM(subq_11.txn_revenue) AS txn_revenue
FROM (
-- Pass Only Elements: ['txn_revenue', 'ds__day']
SELECT
- subq_1.ds__day
- , subq_1.txn_revenue
+ subq_10.ds__day
+ , subq_10.txn_revenue
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.revenue_instance__ds__day
- , subq_0.revenue_instance__ds__week
- , subq_0.revenue_instance__ds__month
- , subq_0.revenue_instance__ds__quarter
- , subq_0.revenue_instance__ds__year
- , subq_0.revenue_instance__ds__extract_year
- , subq_0.revenue_instance__ds__extract_quarter
- , subq_0.revenue_instance__ds__extract_month
- , subq_0.revenue_instance__ds__extract_day
- , subq_0.revenue_instance__ds__extract_dow
- , subq_0.revenue_instance__ds__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.user
- , subq_0.revenue_instance__user
- , subq_0.txn_revenue
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.revenue_instance__ds__day
+ , subq_9.revenue_instance__ds__week
+ , subq_9.revenue_instance__ds__month
+ , subq_9.revenue_instance__ds__quarter
+ , subq_9.revenue_instance__ds__year
+ , subq_9.revenue_instance__ds__extract_year
+ , subq_9.revenue_instance__ds__extract_quarter
+ , subq_9.revenue_instance__ds__extract_month
+ , subq_9.revenue_instance__ds__extract_day
+ , subq_9.revenue_instance__ds__extract_dow
+ , subq_9.revenue_instance__ds__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.user
+ , subq_9.revenue_instance__user
+ , subq_9.txn_revenue
FROM (
-- Read Elements From Semantic Model 'revenue'
SELECT
- revenue_src_28007.revenue AS txn_revenue
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM revenue_src_28007.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy
- , revenue_src_28007.user_id AS user
- , revenue_src_28007.user_id AS revenue_instance__user
- FROM ***************************.fct_revenue revenue_src_28007
- ) subq_0
- ) subq_1
- ) subq_2
+ revenue_src_28000.revenue AS txn_revenue
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM revenue_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS revenue_instance__ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS revenue_instance__ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS revenue_instance__ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS revenue_instance__ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , EXTRACT(day FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_doy
+ , revenue_src_28000.user_id AS user
+ , revenue_src_28000.user_id AS revenue_instance__user
+ FROM ***************************.fct_revenue revenue_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
GROUP BY
- subq_2.ds__day
-) subq_3
+ subq_11.ds__day
+) subq_12
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric__plan0_optimized.sql
index 749250c230..76e8f3252a 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric__plan0_optimized.sql
@@ -6,6 +6,6 @@
SELECT
DATE_TRUNC('day', created_at) AS ds__day
, SUM(revenue) AS trailing_2_months_revenue
-FROM ***************************.fct_revenue revenue_src_28007
+FROM ***************************.fct_revenue revenue_src_28000
GROUP BY
DATE_TRUNC('day', created_at)
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_grain_to_date__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_grain_to_date__plan0.sql
index 507f2d3739..5061775482 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_grain_to_date__plan0.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_grain_to_date__plan0.sql
@@ -1,88 +1,88 @@
-- Compute Metrics via Expressions
SELECT
- subq_3.ds__month
- , subq_3.txn_revenue AS revenue_mtd
+ subq_12.ds__month
+ , subq_12.txn_revenue AS revenue_mtd
FROM (
-- Aggregate Measures
SELECT
- subq_2.ds__month
- , SUM(subq_2.txn_revenue) AS txn_revenue
+ subq_11.ds__month
+ , SUM(subq_11.txn_revenue) AS txn_revenue
FROM (
-- Pass Only Elements: ['txn_revenue', 'ds__month']
SELECT
- subq_1.ds__month
- , subq_1.txn_revenue
+ subq_10.ds__month
+ , subq_10.txn_revenue
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.revenue_instance__ds__day
- , subq_0.revenue_instance__ds__week
- , subq_0.revenue_instance__ds__month
- , subq_0.revenue_instance__ds__quarter
- , subq_0.revenue_instance__ds__year
- , subq_0.revenue_instance__ds__extract_year
- , subq_0.revenue_instance__ds__extract_quarter
- , subq_0.revenue_instance__ds__extract_month
- , subq_0.revenue_instance__ds__extract_day
- , subq_0.revenue_instance__ds__extract_dow
- , subq_0.revenue_instance__ds__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.user
- , subq_0.revenue_instance__user
- , subq_0.txn_revenue
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.revenue_instance__ds__day
+ , subq_9.revenue_instance__ds__week
+ , subq_9.revenue_instance__ds__month
+ , subq_9.revenue_instance__ds__quarter
+ , subq_9.revenue_instance__ds__year
+ , subq_9.revenue_instance__ds__extract_year
+ , subq_9.revenue_instance__ds__extract_quarter
+ , subq_9.revenue_instance__ds__extract_month
+ , subq_9.revenue_instance__ds__extract_day
+ , subq_9.revenue_instance__ds__extract_dow
+ , subq_9.revenue_instance__ds__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.user
+ , subq_9.revenue_instance__user
+ , subq_9.txn_revenue
FROM (
-- Read Elements From Semantic Model 'revenue'
SELECT
- revenue_src_28007.revenue AS txn_revenue
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM revenue_src_28007.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy
- , revenue_src_28007.user_id AS user
- , revenue_src_28007.user_id AS revenue_instance__user
- FROM ***************************.fct_revenue revenue_src_28007
- ) subq_0
- ) subq_1
- ) subq_2
+ revenue_src_28000.revenue AS txn_revenue
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM revenue_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS revenue_instance__ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS revenue_instance__ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS revenue_instance__ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS revenue_instance__ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , EXTRACT(day FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_doy
+ , revenue_src_28000.user_id AS user
+ , revenue_src_28000.user_id AS revenue_instance__user
+ FROM ***************************.fct_revenue revenue_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
GROUP BY
- subq_2.ds__month
-) subq_3
+ subq_11.ds__month
+) subq_12
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_grain_to_date__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_grain_to_date__plan0_optimized.sql
index 6a6dbce8b9..e057084866 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_grain_to_date__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_grain_to_date__plan0_optimized.sql
@@ -6,6 +6,6 @@
SELECT
DATE_TRUNC('month', created_at) AS ds__month
, SUM(revenue) AS revenue_mtd
-FROM ***************************.fct_revenue revenue_src_28007
+FROM ***************************.fct_revenue revenue_src_28000
GROUP BY
DATE_TRUNC('month', created_at)
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_month__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_month__plan0.sql
index 5bc9116fc1..cc865b5b84 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_month__plan0.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_month__plan0.sql
@@ -1,103 +1,103 @@
-- Compute Metrics via Expressions
SELECT
- subq_8.metric_time__month
- , subq_8.bookings_monthly AS trailing_3_months_bookings
+ subq_12.metric_time__month
+ , subq_12.bookings_monthly AS trailing_3_months_bookings
FROM (
-- Aggregate Measures
SELECT
- subq_7.metric_time__month
- , SUM(subq_7.bookings_monthly) AS bookings_monthly
+ subq_11.metric_time__month
+ , SUM(subq_11.bookings_monthly) AS bookings_monthly
FROM (
-- Constrain Time Range to [2020-03-05T00:00:00, 2021-01-04T00:00:00]
SELECT
- subq_6.metric_time__month
- , subq_6.bookings_monthly
+ subq_10.metric_time__month
+ , subq_10.bookings_monthly
FROM (
-- Pass Only Elements: ['bookings_monthly', 'metric_time__month']
SELECT
- subq_5.metric_time__month
- , subq_5.bookings_monthly
+ subq_9.metric_time__month
+ , subq_9.bookings_monthly
FROM (
-- Join Self Over Time Range
SELECT
- subq_3.metric_time__month AS metric_time__month
- , subq_2.monthly_ds__month AS monthly_ds__month
- , subq_2.monthly_ds__quarter AS monthly_ds__quarter
- , subq_2.monthly_ds__year AS monthly_ds__year
- , subq_2.monthly_ds__extract_year AS monthly_ds__extract_year
- , subq_2.monthly_ds__extract_quarter AS monthly_ds__extract_quarter
- , subq_2.monthly_ds__extract_month AS monthly_ds__extract_month
- , subq_2.booking__monthly_ds__month AS booking__monthly_ds__month
- , subq_2.booking__monthly_ds__quarter AS booking__monthly_ds__quarter
- , subq_2.booking__monthly_ds__year AS booking__monthly_ds__year
- , subq_2.booking__monthly_ds__extract_year AS booking__monthly_ds__extract_year
- , subq_2.booking__monthly_ds__extract_quarter AS booking__monthly_ds__extract_quarter
- , subq_2.booking__monthly_ds__extract_month AS booking__monthly_ds__extract_month
- , subq_2.metric_time__quarter AS metric_time__quarter
- , subq_2.metric_time__year AS metric_time__year
- , subq_2.metric_time__extract_year AS metric_time__extract_year
- , subq_2.metric_time__extract_quarter AS metric_time__extract_quarter
- , subq_2.metric_time__extract_month AS metric_time__extract_month
- , subq_2.listing AS listing
- , subq_2.booking__listing AS booking__listing
- , subq_2.bookings_monthly AS bookings_monthly
+ subq_7.metric_time__month AS metric_time__month
+ , subq_6.monthly_ds__month AS monthly_ds__month
+ , subq_6.monthly_ds__quarter AS monthly_ds__quarter
+ , subq_6.monthly_ds__year AS monthly_ds__year
+ , subq_6.monthly_ds__extract_year AS monthly_ds__extract_year
+ , subq_6.monthly_ds__extract_quarter AS monthly_ds__extract_quarter
+ , subq_6.monthly_ds__extract_month AS monthly_ds__extract_month
+ , subq_6.booking__monthly_ds__month AS booking__monthly_ds__month
+ , subq_6.booking__monthly_ds__quarter AS booking__monthly_ds__quarter
+ , subq_6.booking__monthly_ds__year AS booking__monthly_ds__year
+ , subq_6.booking__monthly_ds__extract_year AS booking__monthly_ds__extract_year
+ , subq_6.booking__monthly_ds__extract_quarter AS booking__monthly_ds__extract_quarter
+ , subq_6.booking__monthly_ds__extract_month AS booking__monthly_ds__extract_month
+ , subq_6.metric_time__quarter AS metric_time__quarter
+ , subq_6.metric_time__year AS metric_time__year
+ , subq_6.metric_time__extract_year AS metric_time__extract_year
+ , subq_6.metric_time__extract_quarter AS metric_time__extract_quarter
+ , subq_6.metric_time__extract_month AS metric_time__extract_month
+ , subq_6.listing AS listing
+ , subq_6.booking__listing AS booking__listing
+ , subq_6.bookings_monthly AS bookings_monthly
FROM (
-- Time Spine
SELECT
- DATE_TRUNC('month', subq_4.ds) AS metric_time__month
- FROM ***************************.mf_time_spine subq_4
- WHERE subq_4.ds BETWEEN '2020-03-05' AND '2021-01-04'
+ DATE_TRUNC('month', subq_8.ds) AS metric_time__month
+ FROM ***************************.mf_time_spine subq_8
+ WHERE subq_8.ds BETWEEN '2020-03-05' AND '2021-01-04'
GROUP BY
- DATE_TRUNC('month', subq_4.ds)
- ) subq_3
+ DATE_TRUNC('month', subq_8.ds)
+ ) subq_7
INNER JOIN (
-- Constrain Time Range to [2019-12-05T00:00:00, 2021-01-04T00:00:00]
SELECT
- subq_1.monthly_ds__month
- , subq_1.monthly_ds__quarter
- , subq_1.monthly_ds__year
- , subq_1.monthly_ds__extract_year
- , subq_1.monthly_ds__extract_quarter
- , subq_1.monthly_ds__extract_month
- , subq_1.booking__monthly_ds__month
- , subq_1.booking__monthly_ds__quarter
- , subq_1.booking__monthly_ds__year
- , subq_1.booking__monthly_ds__extract_year
- , subq_1.booking__monthly_ds__extract_quarter
- , subq_1.booking__monthly_ds__extract_month
- , subq_1.metric_time__month
- , subq_1.metric_time__quarter
- , subq_1.metric_time__year
- , subq_1.metric_time__extract_year
- , subq_1.metric_time__extract_quarter
- , subq_1.metric_time__extract_month
- , subq_1.listing
- , subq_1.booking__listing
- , subq_1.bookings_monthly
+ subq_5.monthly_ds__month
+ , subq_5.monthly_ds__quarter
+ , subq_5.monthly_ds__year
+ , subq_5.monthly_ds__extract_year
+ , subq_5.monthly_ds__extract_quarter
+ , subq_5.monthly_ds__extract_month
+ , subq_5.booking__monthly_ds__month
+ , subq_5.booking__monthly_ds__quarter
+ , subq_5.booking__monthly_ds__year
+ , subq_5.booking__monthly_ds__extract_year
+ , subq_5.booking__monthly_ds__extract_quarter
+ , subq_5.booking__monthly_ds__extract_month
+ , subq_5.metric_time__month
+ , subq_5.metric_time__quarter
+ , subq_5.metric_time__year
+ , subq_5.metric_time__extract_year
+ , subq_5.metric_time__extract_quarter
+ , subq_5.metric_time__extract_month
+ , subq_5.listing
+ , subq_5.booking__listing
+ , subq_5.bookings_monthly
FROM (
-- Metric Time Dimension 'monthly_ds'
SELECT
- subq_0.monthly_ds__month
- , subq_0.monthly_ds__quarter
- , subq_0.monthly_ds__year
- , subq_0.monthly_ds__extract_year
- , subq_0.monthly_ds__extract_quarter
- , subq_0.monthly_ds__extract_month
- , subq_0.booking__monthly_ds__month
- , subq_0.booking__monthly_ds__quarter
- , subq_0.booking__monthly_ds__year
- , subq_0.booking__monthly_ds__extract_year
- , subq_0.booking__monthly_ds__extract_quarter
- , subq_0.booking__monthly_ds__extract_month
- , subq_0.monthly_ds__month AS metric_time__month
- , subq_0.monthly_ds__quarter AS metric_time__quarter
- , subq_0.monthly_ds__year AS metric_time__year
- , subq_0.monthly_ds__extract_year AS metric_time__extract_year
- , subq_0.monthly_ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.monthly_ds__extract_month AS metric_time__extract_month
- , subq_0.listing
- , subq_0.booking__listing
- , subq_0.bookings_monthly
+ subq_4.monthly_ds__month
+ , subq_4.monthly_ds__quarter
+ , subq_4.monthly_ds__year
+ , subq_4.monthly_ds__extract_year
+ , subq_4.monthly_ds__extract_quarter
+ , subq_4.monthly_ds__extract_month
+ , subq_4.booking__monthly_ds__month
+ , subq_4.booking__monthly_ds__quarter
+ , subq_4.booking__monthly_ds__year
+ , subq_4.booking__monthly_ds__extract_year
+ , subq_4.booking__monthly_ds__extract_quarter
+ , subq_4.booking__monthly_ds__extract_month
+ , subq_4.monthly_ds__month AS metric_time__month
+ , subq_4.monthly_ds__quarter AS metric_time__quarter
+ , subq_4.monthly_ds__year AS metric_time__year
+ , subq_4.monthly_ds__extract_year AS metric_time__extract_year
+ , subq_4.monthly_ds__extract_quarter AS metric_time__extract_quarter
+ , subq_4.monthly_ds__extract_month AS metric_time__extract_month
+ , subq_4.listing
+ , subq_4.booking__listing
+ , subq_4.bookings_monthly
FROM (
-- Read Elements From Semantic Model 'bookings_monthly_source'
SELECT
@@ -117,20 +117,20 @@ FROM (
, bookings_monthly_source_src_16000.listing_id AS listing
, bookings_monthly_source_src_16000.listing_id AS booking__listing
FROM ***************************.fct_bookings_extended_monthly bookings_monthly_source_src_16000
- ) subq_0
- ) subq_1
- WHERE subq_1.metric_time__month BETWEEN '2019-12-05' AND '2021-01-04'
- ) subq_2
+ ) subq_4
+ ) subq_5
+ WHERE subq_5.metric_time__month BETWEEN '2019-12-05' AND '2021-01-04'
+ ) subq_6
ON
(
- subq_2.metric_time__month <= subq_3.metric_time__month
+ subq_6.metric_time__month <= subq_7.metric_time__month
) AND (
- subq_2.metric_time__month > DATEADD(month, -3, subq_3.metric_time__month)
+ subq_6.metric_time__month > DATEADD(month, -3, subq_7.metric_time__month)
)
- ) subq_5
- ) subq_6
- WHERE subq_6.metric_time__month BETWEEN '2020-03-05' AND '2021-01-04'
- ) subq_7
+ ) subq_9
+ ) subq_10
+ WHERE subq_10.metric_time__month BETWEEN '2020-03-05' AND '2021-01-04'
+ ) subq_11
GROUP BY
- subq_7.metric_time__month
-) subq_8
+ subq_11.metric_time__month
+) subq_12
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_month__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_month__plan0_optimized.sql
index 4611f8316c..c9b1da3166 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_month__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_month__plan0_optimized.sql
@@ -4,17 +4,17 @@
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_12.metric_time__month AS metric_time__month
- , SUM(subq_11.bookings_monthly) AS trailing_3_months_bookings
+ subq_16.metric_time__month AS metric_time__month
+ , SUM(subq_15.bookings_monthly) AS trailing_3_months_bookings
FROM (
-- Time Spine
SELECT
DATE_TRUNC('month', ds) AS metric_time__month
- FROM ***************************.mf_time_spine subq_13
+ FROM ***************************.mf_time_spine subq_17
WHERE ds BETWEEN '2020-03-05' AND '2021-01-04'
GROUP BY
DATE_TRUNC('month', ds)
-) subq_12
+) subq_16
INNER JOIN (
-- Read Elements From Semantic Model 'bookings_monthly_source'
-- Metric Time Dimension 'monthly_ds'
@@ -24,13 +24,13 @@ INNER JOIN (
, bookings_monthly
FROM ***************************.fct_bookings_extended_monthly bookings_monthly_source_src_16000
WHERE DATE_TRUNC('month', ds) BETWEEN '2019-12-05' AND '2021-01-04'
-) subq_11
+) subq_15
ON
(
- subq_11.metric_time__month <= subq_12.metric_time__month
+ subq_15.metric_time__month <= subq_16.metric_time__month
) AND (
- subq_11.metric_time__month > DATEADD(month, -3, subq_12.metric_time__month)
+ subq_15.metric_time__month > DATEADD(month, -3, subq_16.metric_time__month)
)
-WHERE subq_12.metric_time__month BETWEEN '2020-03-05' AND '2021-01-04'
+WHERE subq_16.metric_time__month BETWEEN '2020-03-05' AND '2021-01-04'
GROUP BY
- subq_12.metric_time__month
+ subq_16.metric_time__month
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_no_ds__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_no_ds__plan0.sql
index 56e72d2eb4..58f997122b 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_no_ds__plan0.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_no_ds__plan0.sql
@@ -1,83 +1,83 @@
-- Compute Metrics via Expressions
SELECT
- subq_3.txn_revenue AS trailing_2_months_revenue
+ subq_12.txn_revenue AS trailing_2_months_revenue
FROM (
-- Aggregate Measures
SELECT
- SUM(subq_2.txn_revenue) AS txn_revenue
+ SUM(subq_11.txn_revenue) AS txn_revenue
FROM (
-- Pass Only Elements: ['txn_revenue',]
SELECT
- subq_1.txn_revenue
+ subq_10.txn_revenue
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.revenue_instance__ds__day
- , subq_0.revenue_instance__ds__week
- , subq_0.revenue_instance__ds__month
- , subq_0.revenue_instance__ds__quarter
- , subq_0.revenue_instance__ds__year
- , subq_0.revenue_instance__ds__extract_year
- , subq_0.revenue_instance__ds__extract_quarter
- , subq_0.revenue_instance__ds__extract_month
- , subq_0.revenue_instance__ds__extract_day
- , subq_0.revenue_instance__ds__extract_dow
- , subq_0.revenue_instance__ds__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.user
- , subq_0.revenue_instance__user
- , subq_0.txn_revenue
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.revenue_instance__ds__day
+ , subq_9.revenue_instance__ds__week
+ , subq_9.revenue_instance__ds__month
+ , subq_9.revenue_instance__ds__quarter
+ , subq_9.revenue_instance__ds__year
+ , subq_9.revenue_instance__ds__extract_year
+ , subq_9.revenue_instance__ds__extract_quarter
+ , subq_9.revenue_instance__ds__extract_month
+ , subq_9.revenue_instance__ds__extract_day
+ , subq_9.revenue_instance__ds__extract_dow
+ , subq_9.revenue_instance__ds__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.user
+ , subq_9.revenue_instance__user
+ , subq_9.txn_revenue
FROM (
-- Read Elements From Semantic Model 'revenue'
SELECT
- revenue_src_28007.revenue AS txn_revenue
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM revenue_src_28007.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy
- , revenue_src_28007.user_id AS user
- , revenue_src_28007.user_id AS revenue_instance__user
- FROM ***************************.fct_revenue revenue_src_28007
- ) subq_0
- ) subq_1
- ) subq_2
-) subq_3
+ revenue_src_28000.revenue AS txn_revenue
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM revenue_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS revenue_instance__ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS revenue_instance__ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS revenue_instance__ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS revenue_instance__ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , EXTRACT(day FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_doy
+ , revenue_src_28000.user_id AS user
+ , revenue_src_28000.user_id AS revenue_instance__user
+ FROM ***************************.fct_revenue revenue_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
+) subq_12
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_no_ds__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_no_ds__plan0_optimized.sql
index e26a1bdb3d..4a0d5baff3 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_no_ds__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_no_ds__plan0_optimized.sql
@@ -5,4 +5,4 @@
-- Compute Metrics via Expressions
SELECT
SUM(revenue) AS trailing_2_months_revenue
-FROM ***************************.fct_revenue revenue_src_28007
+FROM ***************************.fct_revenue revenue_src_28000
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_no_window__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_no_window__plan0.sql
index 3b1f31cc45..3de41e1670 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_no_window__plan0.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_no_window__plan0.sql
@@ -1,88 +1,88 @@
-- Compute Metrics via Expressions
SELECT
- subq_3.ds__month
- , subq_3.txn_revenue AS revenue_all_time
+ subq_12.ds__month
+ , subq_12.txn_revenue AS revenue_all_time
FROM (
-- Aggregate Measures
SELECT
- subq_2.ds__month
- , SUM(subq_2.txn_revenue) AS txn_revenue
+ subq_11.ds__month
+ , SUM(subq_11.txn_revenue) AS txn_revenue
FROM (
-- Pass Only Elements: ['txn_revenue', 'ds__month']
SELECT
- subq_1.ds__month
- , subq_1.txn_revenue
+ subq_10.ds__month
+ , subq_10.txn_revenue
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.revenue_instance__ds__day
- , subq_0.revenue_instance__ds__week
- , subq_0.revenue_instance__ds__month
- , subq_0.revenue_instance__ds__quarter
- , subq_0.revenue_instance__ds__year
- , subq_0.revenue_instance__ds__extract_year
- , subq_0.revenue_instance__ds__extract_quarter
- , subq_0.revenue_instance__ds__extract_month
- , subq_0.revenue_instance__ds__extract_day
- , subq_0.revenue_instance__ds__extract_dow
- , subq_0.revenue_instance__ds__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.user
- , subq_0.revenue_instance__user
- , subq_0.txn_revenue
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.revenue_instance__ds__day
+ , subq_9.revenue_instance__ds__week
+ , subq_9.revenue_instance__ds__month
+ , subq_9.revenue_instance__ds__quarter
+ , subq_9.revenue_instance__ds__year
+ , subq_9.revenue_instance__ds__extract_year
+ , subq_9.revenue_instance__ds__extract_quarter
+ , subq_9.revenue_instance__ds__extract_month
+ , subq_9.revenue_instance__ds__extract_day
+ , subq_9.revenue_instance__ds__extract_dow
+ , subq_9.revenue_instance__ds__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.user
+ , subq_9.revenue_instance__user
+ , subq_9.txn_revenue
FROM (
-- Read Elements From Semantic Model 'revenue'
SELECT
- revenue_src_28007.revenue AS txn_revenue
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM revenue_src_28007.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy
- , revenue_src_28007.user_id AS user
- , revenue_src_28007.user_id AS revenue_instance__user
- FROM ***************************.fct_revenue revenue_src_28007
- ) subq_0
- ) subq_1
- ) subq_2
+ revenue_src_28000.revenue AS txn_revenue
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM revenue_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS revenue_instance__ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS revenue_instance__ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS revenue_instance__ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS revenue_instance__ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , EXTRACT(day FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_doy
+ , revenue_src_28000.user_id AS user
+ , revenue_src_28000.user_id AS revenue_instance__user
+ FROM ***************************.fct_revenue revenue_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
GROUP BY
- subq_2.ds__month
-) subq_3
+ subq_11.ds__month
+) subq_12
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_no_window__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_no_window__plan0_optimized.sql
index a7ca78d4e5..05e48cdae3 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_no_window__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_no_window__plan0_optimized.sql
@@ -6,6 +6,6 @@
SELECT
DATE_TRUNC('month', created_at) AS ds__month
, SUM(revenue) AS revenue_all_time
-FROM ***************************.fct_revenue revenue_src_28007
+FROM ***************************.fct_revenue revenue_src_28000
GROUP BY
DATE_TRUNC('month', created_at)
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_no_window_with_time_constraint__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_no_window_with_time_constraint__plan0.sql
index 3b1941bbb6..1f21fb1984 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_no_window_with_time_constraint__plan0.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_no_window_with_time_constraint__plan0.sql
@@ -1,187 +1,187 @@
-- Compute Metrics via Expressions
SELECT
- subq_8.metric_time__month
- , subq_8.txn_revenue AS revenue_all_time
+ subq_19.metric_time__month
+ , subq_19.txn_revenue AS revenue_all_time
FROM (
-- Aggregate Measures
SELECT
- subq_7.metric_time__month
- , SUM(subq_7.txn_revenue) AS txn_revenue
+ subq_18.metric_time__month
+ , SUM(subq_18.txn_revenue) AS txn_revenue
FROM (
-- Constrain Time Range to [2020-01-01T00:00:00, 2020-01-01T00:00:00]
SELECT
- subq_6.metric_time__month
- , subq_6.txn_revenue
+ subq_17.metric_time__month
+ , subq_17.txn_revenue
FROM (
-- Pass Only Elements: ['txn_revenue', 'metric_time__month']
SELECT
- subq_5.metric_time__month
- , subq_5.txn_revenue
+ subq_16.metric_time__month
+ , subq_16.txn_revenue
FROM (
-- Join Self Over Time Range
SELECT
- subq_3.metric_time__month AS metric_time__month
- , subq_2.ds__day AS ds__day
- , subq_2.ds__week AS ds__week
- , subq_2.ds__month AS ds__month
- , subq_2.ds__quarter AS ds__quarter
- , subq_2.ds__year AS ds__year
- , subq_2.ds__extract_year AS ds__extract_year
- , subq_2.ds__extract_quarter AS ds__extract_quarter
- , subq_2.ds__extract_month AS ds__extract_month
- , subq_2.ds__extract_day AS ds__extract_day
- , subq_2.ds__extract_dow AS ds__extract_dow
- , subq_2.ds__extract_doy AS ds__extract_doy
- , subq_2.revenue_instance__ds__day AS revenue_instance__ds__day
- , subq_2.revenue_instance__ds__week AS revenue_instance__ds__week
- , subq_2.revenue_instance__ds__month AS revenue_instance__ds__month
- , subq_2.revenue_instance__ds__quarter AS revenue_instance__ds__quarter
- , subq_2.revenue_instance__ds__year AS revenue_instance__ds__year
- , subq_2.revenue_instance__ds__extract_year AS revenue_instance__ds__extract_year
- , subq_2.revenue_instance__ds__extract_quarter AS revenue_instance__ds__extract_quarter
- , subq_2.revenue_instance__ds__extract_month AS revenue_instance__ds__extract_month
- , subq_2.revenue_instance__ds__extract_day AS revenue_instance__ds__extract_day
- , subq_2.revenue_instance__ds__extract_dow AS revenue_instance__ds__extract_dow
- , subq_2.revenue_instance__ds__extract_doy AS revenue_instance__ds__extract_doy
- , subq_2.metric_time__day AS metric_time__day
- , subq_2.metric_time__week AS metric_time__week
- , subq_2.metric_time__quarter AS metric_time__quarter
- , subq_2.metric_time__year AS metric_time__year
- , subq_2.metric_time__extract_year AS metric_time__extract_year
- , subq_2.metric_time__extract_quarter AS metric_time__extract_quarter
- , subq_2.metric_time__extract_month AS metric_time__extract_month
- , subq_2.metric_time__extract_day AS metric_time__extract_day
- , subq_2.metric_time__extract_dow AS metric_time__extract_dow
- , subq_2.metric_time__extract_doy AS metric_time__extract_doy
- , subq_2.user AS user
- , subq_2.revenue_instance__user AS revenue_instance__user
- , subq_2.txn_revenue AS txn_revenue
+ subq_14.metric_time__month AS metric_time__month
+ , subq_13.ds__day AS ds__day
+ , subq_13.ds__week AS ds__week
+ , subq_13.ds__month AS ds__month
+ , subq_13.ds__quarter AS ds__quarter
+ , subq_13.ds__year AS ds__year
+ , subq_13.ds__extract_year AS ds__extract_year
+ , subq_13.ds__extract_quarter AS ds__extract_quarter
+ , subq_13.ds__extract_month AS ds__extract_month
+ , subq_13.ds__extract_day AS ds__extract_day
+ , subq_13.ds__extract_dow AS ds__extract_dow
+ , subq_13.ds__extract_doy AS ds__extract_doy
+ , subq_13.revenue_instance__ds__day AS revenue_instance__ds__day
+ , subq_13.revenue_instance__ds__week AS revenue_instance__ds__week
+ , subq_13.revenue_instance__ds__month AS revenue_instance__ds__month
+ , subq_13.revenue_instance__ds__quarter AS revenue_instance__ds__quarter
+ , subq_13.revenue_instance__ds__year AS revenue_instance__ds__year
+ , subq_13.revenue_instance__ds__extract_year AS revenue_instance__ds__extract_year
+ , subq_13.revenue_instance__ds__extract_quarter AS revenue_instance__ds__extract_quarter
+ , subq_13.revenue_instance__ds__extract_month AS revenue_instance__ds__extract_month
+ , subq_13.revenue_instance__ds__extract_day AS revenue_instance__ds__extract_day
+ , subq_13.revenue_instance__ds__extract_dow AS revenue_instance__ds__extract_dow
+ , subq_13.revenue_instance__ds__extract_doy AS revenue_instance__ds__extract_doy
+ , subq_13.metric_time__day AS metric_time__day
+ , subq_13.metric_time__week AS metric_time__week
+ , subq_13.metric_time__quarter AS metric_time__quarter
+ , subq_13.metric_time__year AS metric_time__year
+ , subq_13.metric_time__extract_year AS metric_time__extract_year
+ , subq_13.metric_time__extract_quarter AS metric_time__extract_quarter
+ , subq_13.metric_time__extract_month AS metric_time__extract_month
+ , subq_13.metric_time__extract_day AS metric_time__extract_day
+ , subq_13.metric_time__extract_dow AS metric_time__extract_dow
+ , subq_13.metric_time__extract_doy AS metric_time__extract_doy
+ , subq_13.user AS user
+ , subq_13.revenue_instance__user AS revenue_instance__user
+ , subq_13.txn_revenue AS txn_revenue
FROM (
-- Time Spine
SELECT
- DATE_TRUNC('month', subq_4.ds) AS metric_time__month
- FROM ***************************.mf_time_spine subq_4
- WHERE subq_4.ds BETWEEN '2020-01-01' AND '2020-01-01'
+ DATE_TRUNC('month', subq_15.ds) AS metric_time__month
+ FROM ***************************.mf_time_spine subq_15
+ WHERE subq_15.ds BETWEEN '2020-01-01' AND '2020-01-01'
GROUP BY
- DATE_TRUNC('month', subq_4.ds)
- ) subq_3
+ DATE_TRUNC('month', subq_15.ds)
+ ) subq_14
INNER JOIN (
-- Constrain Time Range to [2000-01-01T00:00:00, 2020-01-01T00:00:00]
SELECT
- subq_1.ds__day
- , subq_1.ds__week
- , subq_1.ds__month
- , subq_1.ds__quarter
- , subq_1.ds__year
- , subq_1.ds__extract_year
- , subq_1.ds__extract_quarter
- , subq_1.ds__extract_month
- , subq_1.ds__extract_day
- , subq_1.ds__extract_dow
- , subq_1.ds__extract_doy
- , subq_1.revenue_instance__ds__day
- , subq_1.revenue_instance__ds__week
- , subq_1.revenue_instance__ds__month
- , subq_1.revenue_instance__ds__quarter
- , subq_1.revenue_instance__ds__year
- , subq_1.revenue_instance__ds__extract_year
- , subq_1.revenue_instance__ds__extract_quarter
- , subq_1.revenue_instance__ds__extract_month
- , subq_1.revenue_instance__ds__extract_day
- , subq_1.revenue_instance__ds__extract_dow
- , subq_1.revenue_instance__ds__extract_doy
- , subq_1.metric_time__day
- , subq_1.metric_time__week
- , subq_1.metric_time__month
- , subq_1.metric_time__quarter
- , subq_1.metric_time__year
- , subq_1.metric_time__extract_year
- , subq_1.metric_time__extract_quarter
- , subq_1.metric_time__extract_month
- , subq_1.metric_time__extract_day
- , subq_1.metric_time__extract_dow
- , subq_1.metric_time__extract_doy
- , subq_1.user
- , subq_1.revenue_instance__user
- , subq_1.txn_revenue
+ subq_12.ds__day
+ , subq_12.ds__week
+ , subq_12.ds__month
+ , subq_12.ds__quarter
+ , subq_12.ds__year
+ , subq_12.ds__extract_year
+ , subq_12.ds__extract_quarter
+ , subq_12.ds__extract_month
+ , subq_12.ds__extract_day
+ , subq_12.ds__extract_dow
+ , subq_12.ds__extract_doy
+ , subq_12.revenue_instance__ds__day
+ , subq_12.revenue_instance__ds__week
+ , subq_12.revenue_instance__ds__month
+ , subq_12.revenue_instance__ds__quarter
+ , subq_12.revenue_instance__ds__year
+ , subq_12.revenue_instance__ds__extract_year
+ , subq_12.revenue_instance__ds__extract_quarter
+ , subq_12.revenue_instance__ds__extract_month
+ , subq_12.revenue_instance__ds__extract_day
+ , subq_12.revenue_instance__ds__extract_dow
+ , subq_12.revenue_instance__ds__extract_doy
+ , subq_12.metric_time__day
+ , subq_12.metric_time__week
+ , subq_12.metric_time__month
+ , subq_12.metric_time__quarter
+ , subq_12.metric_time__year
+ , subq_12.metric_time__extract_year
+ , subq_12.metric_time__extract_quarter
+ , subq_12.metric_time__extract_month
+ , subq_12.metric_time__extract_day
+ , subq_12.metric_time__extract_dow
+ , subq_12.metric_time__extract_doy
+ , subq_12.user
+ , subq_12.revenue_instance__user
+ , subq_12.txn_revenue
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.revenue_instance__ds__day
- , subq_0.revenue_instance__ds__week
- , subq_0.revenue_instance__ds__month
- , subq_0.revenue_instance__ds__quarter
- , subq_0.revenue_instance__ds__year
- , subq_0.revenue_instance__ds__extract_year
- , subq_0.revenue_instance__ds__extract_quarter
- , subq_0.revenue_instance__ds__extract_month
- , subq_0.revenue_instance__ds__extract_day
- , subq_0.revenue_instance__ds__extract_dow
- , subq_0.revenue_instance__ds__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.user
- , subq_0.revenue_instance__user
- , subq_0.txn_revenue
+ subq_11.ds__day
+ , subq_11.ds__week
+ , subq_11.ds__month
+ , subq_11.ds__quarter
+ , subq_11.ds__year
+ , subq_11.ds__extract_year
+ , subq_11.ds__extract_quarter
+ , subq_11.ds__extract_month
+ , subq_11.ds__extract_day
+ , subq_11.ds__extract_dow
+ , subq_11.ds__extract_doy
+ , subq_11.revenue_instance__ds__day
+ , subq_11.revenue_instance__ds__week
+ , subq_11.revenue_instance__ds__month
+ , subq_11.revenue_instance__ds__quarter
+ , subq_11.revenue_instance__ds__year
+ , subq_11.revenue_instance__ds__extract_year
+ , subq_11.revenue_instance__ds__extract_quarter
+ , subq_11.revenue_instance__ds__extract_month
+ , subq_11.revenue_instance__ds__extract_day
+ , subq_11.revenue_instance__ds__extract_dow
+ , subq_11.revenue_instance__ds__extract_doy
+ , subq_11.ds__day AS metric_time__day
+ , subq_11.ds__week AS metric_time__week
+ , subq_11.ds__month AS metric_time__month
+ , subq_11.ds__quarter AS metric_time__quarter
+ , subq_11.ds__year AS metric_time__year
+ , subq_11.ds__extract_year AS metric_time__extract_year
+ , subq_11.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_11.ds__extract_month AS metric_time__extract_month
+ , subq_11.ds__extract_day AS metric_time__extract_day
+ , subq_11.ds__extract_dow AS metric_time__extract_dow
+ , subq_11.ds__extract_doy AS metric_time__extract_doy
+ , subq_11.user
+ , subq_11.revenue_instance__user
+ , subq_11.txn_revenue
FROM (
-- Read Elements From Semantic Model 'revenue'
SELECT
- revenue_src_28007.revenue AS txn_revenue
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM revenue_src_28007.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy
- , revenue_src_28007.user_id AS user
- , revenue_src_28007.user_id AS revenue_instance__user
- FROM ***************************.fct_revenue revenue_src_28007
- ) subq_0
- ) subq_1
- WHERE subq_1.metric_time__day BETWEEN '2000-01-01' AND '2020-01-01'
- ) subq_2
+ revenue_src_28000.revenue AS txn_revenue
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM revenue_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS revenue_instance__ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS revenue_instance__ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS revenue_instance__ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS revenue_instance__ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , EXTRACT(day FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_doy
+ , revenue_src_28000.user_id AS user
+ , revenue_src_28000.user_id AS revenue_instance__user
+ FROM ***************************.fct_revenue revenue_src_28000
+ ) subq_11
+ ) subq_12
+ WHERE subq_12.metric_time__day BETWEEN '2000-01-01' AND '2020-01-01'
+ ) subq_13
ON
- (subq_2.metric_time__month <= subq_3.metric_time__month)
- ) subq_5
- ) subq_6
- WHERE subq_6.metric_time__month BETWEEN '2020-01-01' AND '2020-01-01'
- ) subq_7
+ (subq_13.metric_time__month <= subq_14.metric_time__month)
+ ) subq_16
+ ) subq_17
+ WHERE subq_17.metric_time__month BETWEEN '2020-01-01' AND '2020-01-01'
+ ) subq_18
GROUP BY
- subq_7.metric_time__month
-) subq_8
+ subq_18.metric_time__month
+) subq_19
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_no_window_with_time_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_no_window_with_time_constraint__plan0_optimized.sql
index a4e5bf994b..0267f01b4a 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_no_window_with_time_constraint__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_no_window_with_time_constraint__plan0_optimized.sql
@@ -4,17 +4,17 @@
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_12.metric_time__month AS metric_time__month
- , SUM(subq_11.txn_revenue) AS revenue_all_time
+ subq_23.metric_time__month AS metric_time__month
+ , SUM(subq_22.txn_revenue) AS revenue_all_time
FROM (
-- Time Spine
SELECT
DATE_TRUNC('month', ds) AS metric_time__month
- FROM ***************************.mf_time_spine subq_13
+ FROM ***************************.mf_time_spine subq_24
WHERE ds BETWEEN '2020-01-01' AND '2020-01-01'
GROUP BY
DATE_TRUNC('month', ds)
-) subq_12
+) subq_23
INNER JOIN (
-- Read Elements From Semantic Model 'revenue'
-- Metric Time Dimension 'ds'
@@ -22,11 +22,11 @@ INNER JOIN (
SELECT
DATE_TRUNC('month', created_at) AS metric_time__month
, revenue AS txn_revenue
- FROM ***************************.fct_revenue revenue_src_28007
+ FROM ***************************.fct_revenue revenue_src_28000
WHERE DATE_TRUNC('day', created_at) BETWEEN '2000-01-01' AND '2020-01-01'
-) subq_11
+) subq_22
ON
- (subq_11.metric_time__month <= subq_12.metric_time__month)
-WHERE subq_12.metric_time__month BETWEEN '2020-01-01' AND '2020-01-01'
+ (subq_22.metric_time__month <= subq_23.metric_time__month)
+WHERE subq_23.metric_time__month BETWEEN '2020-01-01' AND '2020-01-01'
GROUP BY
- subq_12.metric_time__month
+ subq_23.metric_time__month
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_with_agg_time_dimension__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_with_agg_time_dimension__plan0.sql
index de0af3a855..cf0aaa51ea 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_with_agg_time_dimension__plan0.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_with_agg_time_dimension__plan0.sql
@@ -1,140 +1,140 @@
-- Compute Metrics via Expressions
SELECT
- subq_6.revenue_instance__ds__day
- , subq_6.txn_revenue AS trailing_2_months_revenue
+ subq_15.revenue_instance__ds__day
+ , subq_15.txn_revenue AS trailing_2_months_revenue
FROM (
-- Aggregate Measures
SELECT
- subq_5.revenue_instance__ds__day
- , SUM(subq_5.txn_revenue) AS txn_revenue
+ subq_14.revenue_instance__ds__day
+ , SUM(subq_14.txn_revenue) AS txn_revenue
FROM (
-- Pass Only Elements: ['txn_revenue', 'revenue_instance__ds__day']
SELECT
- subq_4.revenue_instance__ds__day
- , subq_4.txn_revenue
+ subq_13.revenue_instance__ds__day
+ , subq_13.txn_revenue
FROM (
-- Join Self Over Time Range
SELECT
- subq_2.revenue_instance__ds__day AS revenue_instance__ds__day
- , subq_1.ds__day AS ds__day
- , subq_1.ds__week AS ds__week
- , subq_1.ds__month AS ds__month
- , subq_1.ds__quarter AS ds__quarter
- , subq_1.ds__year AS ds__year
- , subq_1.ds__extract_year AS ds__extract_year
- , subq_1.ds__extract_quarter AS ds__extract_quarter
- , subq_1.ds__extract_month AS ds__extract_month
- , subq_1.ds__extract_day AS ds__extract_day
- , subq_1.ds__extract_dow AS ds__extract_dow
- , subq_1.ds__extract_doy AS ds__extract_doy
- , subq_1.revenue_instance__ds__week AS revenue_instance__ds__week
- , subq_1.revenue_instance__ds__month AS revenue_instance__ds__month
- , subq_1.revenue_instance__ds__quarter AS revenue_instance__ds__quarter
- , subq_1.revenue_instance__ds__year AS revenue_instance__ds__year
- , subq_1.revenue_instance__ds__extract_year AS revenue_instance__ds__extract_year
- , subq_1.revenue_instance__ds__extract_quarter AS revenue_instance__ds__extract_quarter
- , subq_1.revenue_instance__ds__extract_month AS revenue_instance__ds__extract_month
- , subq_1.revenue_instance__ds__extract_day AS revenue_instance__ds__extract_day
- , subq_1.revenue_instance__ds__extract_dow AS revenue_instance__ds__extract_dow
- , subq_1.revenue_instance__ds__extract_doy AS revenue_instance__ds__extract_doy
- , subq_1.metric_time__day AS metric_time__day
- , subq_1.metric_time__week AS metric_time__week
- , subq_1.metric_time__month AS metric_time__month
- , subq_1.metric_time__quarter AS metric_time__quarter
- , subq_1.metric_time__year AS metric_time__year
- , subq_1.metric_time__extract_year AS metric_time__extract_year
- , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter
- , subq_1.metric_time__extract_month AS metric_time__extract_month
- , subq_1.metric_time__extract_day AS metric_time__extract_day
- , subq_1.metric_time__extract_dow AS metric_time__extract_dow
- , subq_1.metric_time__extract_doy AS metric_time__extract_doy
- , subq_1.user AS user
- , subq_1.revenue_instance__user AS revenue_instance__user
- , subq_1.txn_revenue AS txn_revenue
+ subq_11.revenue_instance__ds__day AS revenue_instance__ds__day
+ , subq_10.ds__day AS ds__day
+ , subq_10.ds__week AS ds__week
+ , subq_10.ds__month AS ds__month
+ , subq_10.ds__quarter AS ds__quarter
+ , subq_10.ds__year AS ds__year
+ , subq_10.ds__extract_year AS ds__extract_year
+ , subq_10.ds__extract_quarter AS ds__extract_quarter
+ , subq_10.ds__extract_month AS ds__extract_month
+ , subq_10.ds__extract_day AS ds__extract_day
+ , subq_10.ds__extract_dow AS ds__extract_dow
+ , subq_10.ds__extract_doy AS ds__extract_doy
+ , subq_10.revenue_instance__ds__week AS revenue_instance__ds__week
+ , subq_10.revenue_instance__ds__month AS revenue_instance__ds__month
+ , subq_10.revenue_instance__ds__quarter AS revenue_instance__ds__quarter
+ , subq_10.revenue_instance__ds__year AS revenue_instance__ds__year
+ , subq_10.revenue_instance__ds__extract_year AS revenue_instance__ds__extract_year
+ , subq_10.revenue_instance__ds__extract_quarter AS revenue_instance__ds__extract_quarter
+ , subq_10.revenue_instance__ds__extract_month AS revenue_instance__ds__extract_month
+ , subq_10.revenue_instance__ds__extract_day AS revenue_instance__ds__extract_day
+ , subq_10.revenue_instance__ds__extract_dow AS revenue_instance__ds__extract_dow
+ , subq_10.revenue_instance__ds__extract_doy AS revenue_instance__ds__extract_doy
+ , subq_10.metric_time__day AS metric_time__day
+ , subq_10.metric_time__week AS metric_time__week
+ , subq_10.metric_time__month AS metric_time__month
+ , subq_10.metric_time__quarter AS metric_time__quarter
+ , subq_10.metric_time__year AS metric_time__year
+ , subq_10.metric_time__extract_year AS metric_time__extract_year
+ , subq_10.metric_time__extract_quarter AS metric_time__extract_quarter
+ , subq_10.metric_time__extract_month AS metric_time__extract_month
+ , subq_10.metric_time__extract_day AS metric_time__extract_day
+ , subq_10.metric_time__extract_dow AS metric_time__extract_dow
+ , subq_10.metric_time__extract_doy AS metric_time__extract_doy
+ , subq_10.user AS user
+ , subq_10.revenue_instance__user AS revenue_instance__user
+ , subq_10.txn_revenue AS txn_revenue
FROM (
-- Time Spine
SELECT
- subq_3.ds AS revenue_instance__ds__day
- FROM ***************************.mf_time_spine subq_3
- ) subq_2
+ subq_12.ds AS revenue_instance__ds__day
+ FROM ***************************.mf_time_spine subq_12
+ ) subq_11
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.revenue_instance__ds__day
- , subq_0.revenue_instance__ds__week
- , subq_0.revenue_instance__ds__month
- , subq_0.revenue_instance__ds__quarter
- , subq_0.revenue_instance__ds__year
- , subq_0.revenue_instance__ds__extract_year
- , subq_0.revenue_instance__ds__extract_quarter
- , subq_0.revenue_instance__ds__extract_month
- , subq_0.revenue_instance__ds__extract_day
- , subq_0.revenue_instance__ds__extract_dow
- , subq_0.revenue_instance__ds__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.user
- , subq_0.revenue_instance__user
- , subq_0.txn_revenue
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.revenue_instance__ds__day
+ , subq_9.revenue_instance__ds__week
+ , subq_9.revenue_instance__ds__month
+ , subq_9.revenue_instance__ds__quarter
+ , subq_9.revenue_instance__ds__year
+ , subq_9.revenue_instance__ds__extract_year
+ , subq_9.revenue_instance__ds__extract_quarter
+ , subq_9.revenue_instance__ds__extract_month
+ , subq_9.revenue_instance__ds__extract_day
+ , subq_9.revenue_instance__ds__extract_dow
+ , subq_9.revenue_instance__ds__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.user
+ , subq_9.revenue_instance__user
+ , subq_9.txn_revenue
FROM (
-- Read Elements From Semantic Model 'revenue'
SELECT
- revenue_src_28007.revenue AS txn_revenue
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM revenue_src_28007.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy
- , revenue_src_28007.user_id AS user
- , revenue_src_28007.user_id AS revenue_instance__user
- FROM ***************************.fct_revenue revenue_src_28007
- ) subq_0
- ) subq_1
+ revenue_src_28000.revenue AS txn_revenue
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM revenue_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS revenue_instance__ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS revenue_instance__ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS revenue_instance__ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS revenue_instance__ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , EXTRACT(day FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_doy
+ , revenue_src_28000.user_id AS user
+ , revenue_src_28000.user_id AS revenue_instance__user
+ FROM ***************************.fct_revenue revenue_src_28000
+ ) subq_9
+ ) subq_10
ON
(
- subq_1.revenue_instance__ds__day <= subq_2.revenue_instance__ds__day
+ subq_10.revenue_instance__ds__day <= subq_11.revenue_instance__ds__day
) AND (
- subq_1.revenue_instance__ds__day > DATEADD(month, -2, subq_2.revenue_instance__ds__day)
+ subq_10.revenue_instance__ds__day > DATEADD(month, -2, subq_11.revenue_instance__ds__day)
)
- ) subq_4
- ) subq_5
+ ) subq_13
+ ) subq_14
GROUP BY
- subq_5.revenue_instance__ds__day
-) subq_6
+ subq_14.revenue_instance__ds__day
+) subq_15
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_with_agg_time_dimension__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_with_agg_time_dimension__plan0_optimized.sql
index 501e54f5dd..9769ddd7de 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_with_agg_time_dimension__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_with_agg_time_dimension__plan0_optimized.sql
@@ -3,16 +3,16 @@
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_10.ds AS revenue_instance__ds__day
- , SUM(revenue_src_28007.revenue) AS trailing_2_months_revenue
-FROM ***************************.mf_time_spine subq_10
+ subq_19.ds AS revenue_instance__ds__day
+ , SUM(revenue_src_28000.revenue) AS trailing_2_months_revenue
+FROM ***************************.mf_time_spine subq_19
INNER JOIN
- ***************************.fct_revenue revenue_src_28007
+ ***************************.fct_revenue revenue_src_28000
ON
(
- DATE_TRUNC('day', revenue_src_28007.created_at) <= subq_10.ds
+ DATE_TRUNC('day', revenue_src_28000.created_at) <= subq_19.ds
) AND (
- DATE_TRUNC('day', revenue_src_28007.created_at) > DATEADD(month, -2, subq_10.ds)
+ DATE_TRUNC('day', revenue_src_28000.created_at) > DATEADD(month, -2, subq_19.ds)
)
GROUP BY
- subq_10.ds
+ subq_19.ds
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_with_non_adjustable_time_filter__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_with_non_adjustable_time_filter__plan0.sql
index 49fd732c02..b97b754096 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_with_non_adjustable_time_filter__plan0.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_with_non_adjustable_time_filter__plan0.sql
@@ -1,334 +1,334 @@
-- Compute Metrics via Expressions
SELECT
- subq_7.metric_time__day
- , subq_7.bookers AS every_two_days_bookers
+ subq_16.metric_time__day
+ , subq_16.bookers AS every_two_days_bookers
FROM (
-- Aggregate Measures
SELECT
- subq_6.metric_time__day
- , COUNT(DISTINCT subq_6.bookers) AS bookers
+ subq_15.metric_time__day
+ , COUNT(DISTINCT subq_15.bookers) AS bookers
FROM (
-- Constrain Output with WHERE
SELECT
- subq_5.metric_time__day
- , subq_5.bookers
+ subq_14.metric_time__day
+ , subq_14.bookers
FROM (
-- Pass Only Elements: ['bookers', 'metric_time__day']
SELECT
- subq_4.metric_time__day
- , subq_4.bookers
+ subq_13.metric_time__day
+ , subq_13.bookers
FROM (
-- Join Self Over Time Range
SELECT
- subq_2.metric_time__day AS metric_time__day
- , subq_1.ds__day AS ds__day
- , subq_1.ds__week AS ds__week
- , subq_1.ds__month AS ds__month
- , subq_1.ds__quarter AS ds__quarter
- , subq_1.ds__year AS ds__year
- , subq_1.ds__extract_year AS ds__extract_year
- , subq_1.ds__extract_quarter AS ds__extract_quarter
- , subq_1.ds__extract_month AS ds__extract_month
- , subq_1.ds__extract_day AS ds__extract_day
- , subq_1.ds__extract_dow AS ds__extract_dow
- , subq_1.ds__extract_doy AS ds__extract_doy
- , subq_1.ds_partitioned__day AS ds_partitioned__day
- , subq_1.ds_partitioned__week AS ds_partitioned__week
- , subq_1.ds_partitioned__month AS ds_partitioned__month
- , subq_1.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_1.ds_partitioned__year AS ds_partitioned__year
- , subq_1.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_1.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_1.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_1.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_1.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_1.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_1.paid_at__day AS paid_at__day
- , subq_1.paid_at__week AS paid_at__week
- , subq_1.paid_at__month AS paid_at__month
- , subq_1.paid_at__quarter AS paid_at__quarter
- , subq_1.paid_at__year AS paid_at__year
- , subq_1.paid_at__extract_year AS paid_at__extract_year
- , subq_1.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_1.paid_at__extract_month AS paid_at__extract_month
- , subq_1.paid_at__extract_day AS paid_at__extract_day
- , subq_1.paid_at__extract_dow AS paid_at__extract_dow
- , subq_1.paid_at__extract_doy AS paid_at__extract_doy
- , subq_1.booking__ds__day AS booking__ds__day
- , subq_1.booking__ds__week AS booking__ds__week
- , subq_1.booking__ds__month AS booking__ds__month
- , subq_1.booking__ds__quarter AS booking__ds__quarter
- , subq_1.booking__ds__year AS booking__ds__year
- , subq_1.booking__ds__extract_year AS booking__ds__extract_year
- , subq_1.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_1.booking__ds__extract_month AS booking__ds__extract_month
- , subq_1.booking__ds__extract_day AS booking__ds__extract_day
- , subq_1.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_1.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_1.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_1.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_1.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_1.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_1.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_1.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_1.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_1.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_1.booking__paid_at__day AS booking__paid_at__day
- , subq_1.booking__paid_at__week AS booking__paid_at__week
- , subq_1.booking__paid_at__month AS booking__paid_at__month
- , subq_1.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_1.booking__paid_at__year AS booking__paid_at__year
- , subq_1.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_1.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_1.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_1.metric_time__week AS metric_time__week
- , subq_1.metric_time__month AS metric_time__month
- , subq_1.metric_time__quarter AS metric_time__quarter
- , subq_1.metric_time__year AS metric_time__year
- , subq_1.metric_time__extract_year AS metric_time__extract_year
- , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter
- , subq_1.metric_time__extract_month AS metric_time__extract_month
- , subq_1.metric_time__extract_day AS metric_time__extract_day
- , subq_1.metric_time__extract_dow AS metric_time__extract_dow
- , subq_1.metric_time__extract_doy AS metric_time__extract_doy
- , subq_1.listing AS listing
- , subq_1.guest AS guest
- , subq_1.host AS host
- , subq_1.booking__listing AS booking__listing
- , subq_1.booking__guest AS booking__guest
- , subq_1.booking__host AS booking__host
- , subq_1.is_instant AS is_instant
- , subq_1.booking__is_instant AS booking__is_instant
- , subq_1.bookings AS bookings
- , subq_1.instant_bookings AS instant_bookings
- , subq_1.booking_value AS booking_value
- , subq_1.max_booking_value AS max_booking_value
- , subq_1.min_booking_value AS min_booking_value
- , subq_1.bookers AS bookers
- , subq_1.average_booking_value AS average_booking_value
- , subq_1.referred_bookings AS referred_bookings
- , subq_1.median_booking_value AS median_booking_value
- , subq_1.booking_value_p99 AS booking_value_p99
- , subq_1.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_1.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_1.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ subq_11.metric_time__day AS metric_time__day
+ , subq_10.ds__day AS ds__day
+ , subq_10.ds__week AS ds__week
+ , subq_10.ds__month AS ds__month
+ , subq_10.ds__quarter AS ds__quarter
+ , subq_10.ds__year AS ds__year
+ , subq_10.ds__extract_year AS ds__extract_year
+ , subq_10.ds__extract_quarter AS ds__extract_quarter
+ , subq_10.ds__extract_month AS ds__extract_month
+ , subq_10.ds__extract_day AS ds__extract_day
+ , subq_10.ds__extract_dow AS ds__extract_dow
+ , subq_10.ds__extract_doy AS ds__extract_doy
+ , subq_10.ds_partitioned__day AS ds_partitioned__day
+ , subq_10.ds_partitioned__week AS ds_partitioned__week
+ , subq_10.ds_partitioned__month AS ds_partitioned__month
+ , subq_10.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_10.ds_partitioned__year AS ds_partitioned__year
+ , subq_10.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_10.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_10.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_10.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_10.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_10.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_10.paid_at__day AS paid_at__day
+ , subq_10.paid_at__week AS paid_at__week
+ , subq_10.paid_at__month AS paid_at__month
+ , subq_10.paid_at__quarter AS paid_at__quarter
+ , subq_10.paid_at__year AS paid_at__year
+ , subq_10.paid_at__extract_year AS paid_at__extract_year
+ , subq_10.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_10.paid_at__extract_month AS paid_at__extract_month
+ , subq_10.paid_at__extract_day AS paid_at__extract_day
+ , subq_10.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_10.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_10.booking__ds__day AS booking__ds__day
+ , subq_10.booking__ds__week AS booking__ds__week
+ , subq_10.booking__ds__month AS booking__ds__month
+ , subq_10.booking__ds__quarter AS booking__ds__quarter
+ , subq_10.booking__ds__year AS booking__ds__year
+ , subq_10.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_10.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_10.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_10.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_10.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_10.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_10.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_10.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_10.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_10.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_10.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_10.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_10.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_10.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_10.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_10.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_10.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_10.booking__paid_at__day AS booking__paid_at__day
+ , subq_10.booking__paid_at__week AS booking__paid_at__week
+ , subq_10.booking__paid_at__month AS booking__paid_at__month
+ , subq_10.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_10.booking__paid_at__year AS booking__paid_at__year
+ , subq_10.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_10.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_10.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_10.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_10.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_10.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_10.metric_time__week AS metric_time__week
+ , subq_10.metric_time__month AS metric_time__month
+ , subq_10.metric_time__quarter AS metric_time__quarter
+ , subq_10.metric_time__year AS metric_time__year
+ , subq_10.metric_time__extract_year AS metric_time__extract_year
+ , subq_10.metric_time__extract_quarter AS metric_time__extract_quarter
+ , subq_10.metric_time__extract_month AS metric_time__extract_month
+ , subq_10.metric_time__extract_day AS metric_time__extract_day
+ , subq_10.metric_time__extract_dow AS metric_time__extract_dow
+ , subq_10.metric_time__extract_doy AS metric_time__extract_doy
+ , subq_10.listing AS listing
+ , subq_10.guest AS guest
+ , subq_10.host AS host
+ , subq_10.booking__listing AS booking__listing
+ , subq_10.booking__guest AS booking__guest
+ , subq_10.booking__host AS booking__host
+ , subq_10.is_instant AS is_instant
+ , subq_10.booking__is_instant AS booking__is_instant
+ , subq_10.bookings AS bookings
+ , subq_10.instant_bookings AS instant_bookings
+ , subq_10.booking_value AS booking_value
+ , subq_10.max_booking_value AS max_booking_value
+ , subq_10.min_booking_value AS min_booking_value
+ , subq_10.bookers AS bookers
+ , subq_10.average_booking_value AS average_booking_value
+ , subq_10.referred_bookings AS referred_bookings
+ , subq_10.median_booking_value AS median_booking_value
+ , subq_10.booking_value_p99 AS booking_value_p99
+ , subq_10.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_10.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_10.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_3.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_3
- ) subq_2
+ subq_12.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_12
+ ) subq_11
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
ON
(
- subq_1.metric_time__day <= subq_2.metric_time__day
+ subq_10.metric_time__day <= subq_11.metric_time__day
) AND (
- subq_1.metric_time__day > DATEADD(day, -2, subq_2.metric_time__day)
+ subq_10.metric_time__day > DATEADD(day, -2, subq_11.metric_time__day)
)
- ) subq_4
- ) subq_5
+ ) subq_13
+ ) subq_14
WHERE metric_time__day = '2020-01-03' or metric_time__day = '2020-01-07'
- ) subq_6
+ ) subq_15
GROUP BY
- subq_6.metric_time__day
-) subq_7
+ subq_15.metric_time__day
+) subq_16
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_with_non_adjustable_time_filter__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_with_non_adjustable_time_filter__plan0_optimized.sql
index aa43d7d7d6..ab8b4812ed 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_with_non_adjustable_time_filter__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_with_non_adjustable_time_filter__plan0_optimized.sql
@@ -8,18 +8,18 @@ FROM (
-- Join Self Over Time Range
-- Pass Only Elements: ['bookers', 'metric_time__day']
SELECT
- subq_11.ds AS metric_time__day
- , bookings_source_src_28001.guest_id AS bookers
- FROM ***************************.mf_time_spine subq_11
+ subq_20.ds AS metric_time__day
+ , bookings_source_src_28000.guest_id AS bookers
+ FROM ***************************.mf_time_spine subq_20
INNER JOIN
- ***************************.fct_bookings bookings_source_src_28001
+ ***************************.fct_bookings bookings_source_src_28000
ON
(
- DATE_TRUNC('day', bookings_source_src_28001.ds) <= subq_11.ds
+ DATE_TRUNC('day', bookings_source_src_28000.ds) <= subq_20.ds
) AND (
- DATE_TRUNC('day', bookings_source_src_28001.ds) > DATEADD(day, -2, subq_11.ds)
+ DATE_TRUNC('day', bookings_source_src_28000.ds) > DATEADD(day, -2, subq_20.ds)
)
-) subq_13
+) subq_22
WHERE metric_time__day = '2020-01-03' or metric_time__day = '2020-01-07'
GROUP BY
metric_time__day
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_with_time_constraint__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_with_time_constraint__plan0.sql
index f3b2cee287..3cf90d835b 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_with_time_constraint__plan0.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_with_time_constraint__plan0.sql
@@ -1,189 +1,189 @@
-- Compute Metrics via Expressions
SELECT
- subq_8.metric_time__day
- , subq_8.txn_revenue AS trailing_2_months_revenue
+ subq_19.metric_time__day
+ , subq_19.txn_revenue AS trailing_2_months_revenue
FROM (
-- Aggregate Measures
SELECT
- subq_7.metric_time__day
- , SUM(subq_7.txn_revenue) AS txn_revenue
+ subq_18.metric_time__day
+ , SUM(subq_18.txn_revenue) AS txn_revenue
FROM (
-- Constrain Time Range to [2020-01-01T00:00:00, 2020-01-01T00:00:00]
SELECT
- subq_6.metric_time__day
- , subq_6.txn_revenue
+ subq_17.metric_time__day
+ , subq_17.txn_revenue
FROM (
-- Pass Only Elements: ['txn_revenue', 'metric_time__day']
SELECT
- subq_5.metric_time__day
- , subq_5.txn_revenue
+ subq_16.metric_time__day
+ , subq_16.txn_revenue
FROM (
-- Join Self Over Time Range
SELECT
- subq_3.metric_time__day AS metric_time__day
- , subq_2.ds__day AS ds__day
- , subq_2.ds__week AS ds__week
- , subq_2.ds__month AS ds__month
- , subq_2.ds__quarter AS ds__quarter
- , subq_2.ds__year AS ds__year
- , subq_2.ds__extract_year AS ds__extract_year
- , subq_2.ds__extract_quarter AS ds__extract_quarter
- , subq_2.ds__extract_month AS ds__extract_month
- , subq_2.ds__extract_day AS ds__extract_day
- , subq_2.ds__extract_dow AS ds__extract_dow
- , subq_2.ds__extract_doy AS ds__extract_doy
- , subq_2.revenue_instance__ds__day AS revenue_instance__ds__day
- , subq_2.revenue_instance__ds__week AS revenue_instance__ds__week
- , subq_2.revenue_instance__ds__month AS revenue_instance__ds__month
- , subq_2.revenue_instance__ds__quarter AS revenue_instance__ds__quarter
- , subq_2.revenue_instance__ds__year AS revenue_instance__ds__year
- , subq_2.revenue_instance__ds__extract_year AS revenue_instance__ds__extract_year
- , subq_2.revenue_instance__ds__extract_quarter AS revenue_instance__ds__extract_quarter
- , subq_2.revenue_instance__ds__extract_month AS revenue_instance__ds__extract_month
- , subq_2.revenue_instance__ds__extract_day AS revenue_instance__ds__extract_day
- , subq_2.revenue_instance__ds__extract_dow AS revenue_instance__ds__extract_dow
- , subq_2.revenue_instance__ds__extract_doy AS revenue_instance__ds__extract_doy
- , subq_2.metric_time__week AS metric_time__week
- , subq_2.metric_time__month AS metric_time__month
- , subq_2.metric_time__quarter AS metric_time__quarter
- , subq_2.metric_time__year AS metric_time__year
- , subq_2.metric_time__extract_year AS metric_time__extract_year
- , subq_2.metric_time__extract_quarter AS metric_time__extract_quarter
- , subq_2.metric_time__extract_month AS metric_time__extract_month
- , subq_2.metric_time__extract_day AS metric_time__extract_day
- , subq_2.metric_time__extract_dow AS metric_time__extract_dow
- , subq_2.metric_time__extract_doy AS metric_time__extract_doy
- , subq_2.user AS user
- , subq_2.revenue_instance__user AS revenue_instance__user
- , subq_2.txn_revenue AS txn_revenue
+ subq_14.metric_time__day AS metric_time__day
+ , subq_13.ds__day AS ds__day
+ , subq_13.ds__week AS ds__week
+ , subq_13.ds__month AS ds__month
+ , subq_13.ds__quarter AS ds__quarter
+ , subq_13.ds__year AS ds__year
+ , subq_13.ds__extract_year AS ds__extract_year
+ , subq_13.ds__extract_quarter AS ds__extract_quarter
+ , subq_13.ds__extract_month AS ds__extract_month
+ , subq_13.ds__extract_day AS ds__extract_day
+ , subq_13.ds__extract_dow AS ds__extract_dow
+ , subq_13.ds__extract_doy AS ds__extract_doy
+ , subq_13.revenue_instance__ds__day AS revenue_instance__ds__day
+ , subq_13.revenue_instance__ds__week AS revenue_instance__ds__week
+ , subq_13.revenue_instance__ds__month AS revenue_instance__ds__month
+ , subq_13.revenue_instance__ds__quarter AS revenue_instance__ds__quarter
+ , subq_13.revenue_instance__ds__year AS revenue_instance__ds__year
+ , subq_13.revenue_instance__ds__extract_year AS revenue_instance__ds__extract_year
+ , subq_13.revenue_instance__ds__extract_quarter AS revenue_instance__ds__extract_quarter
+ , subq_13.revenue_instance__ds__extract_month AS revenue_instance__ds__extract_month
+ , subq_13.revenue_instance__ds__extract_day AS revenue_instance__ds__extract_day
+ , subq_13.revenue_instance__ds__extract_dow AS revenue_instance__ds__extract_dow
+ , subq_13.revenue_instance__ds__extract_doy AS revenue_instance__ds__extract_doy
+ , subq_13.metric_time__week AS metric_time__week
+ , subq_13.metric_time__month AS metric_time__month
+ , subq_13.metric_time__quarter AS metric_time__quarter
+ , subq_13.metric_time__year AS metric_time__year
+ , subq_13.metric_time__extract_year AS metric_time__extract_year
+ , subq_13.metric_time__extract_quarter AS metric_time__extract_quarter
+ , subq_13.metric_time__extract_month AS metric_time__extract_month
+ , subq_13.metric_time__extract_day AS metric_time__extract_day
+ , subq_13.metric_time__extract_dow AS metric_time__extract_dow
+ , subq_13.metric_time__extract_doy AS metric_time__extract_doy
+ , subq_13.user AS user
+ , subq_13.revenue_instance__user AS revenue_instance__user
+ , subq_13.txn_revenue AS txn_revenue
FROM (
-- Time Spine
SELECT
- subq_4.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_4
- WHERE subq_4.ds BETWEEN '2020-01-01' AND '2020-01-01'
- ) subq_3
+ subq_15.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_15
+ WHERE subq_15.ds BETWEEN '2020-01-01' AND '2020-01-01'
+ ) subq_14
INNER JOIN (
-- Constrain Time Range to [2019-11-01T00:00:00, 2020-01-01T00:00:00]
SELECT
- subq_1.ds__day
- , subq_1.ds__week
- , subq_1.ds__month
- , subq_1.ds__quarter
- , subq_1.ds__year
- , subq_1.ds__extract_year
- , subq_1.ds__extract_quarter
- , subq_1.ds__extract_month
- , subq_1.ds__extract_day
- , subq_1.ds__extract_dow
- , subq_1.ds__extract_doy
- , subq_1.revenue_instance__ds__day
- , subq_1.revenue_instance__ds__week
- , subq_1.revenue_instance__ds__month
- , subq_1.revenue_instance__ds__quarter
- , subq_1.revenue_instance__ds__year
- , subq_1.revenue_instance__ds__extract_year
- , subq_1.revenue_instance__ds__extract_quarter
- , subq_1.revenue_instance__ds__extract_month
- , subq_1.revenue_instance__ds__extract_day
- , subq_1.revenue_instance__ds__extract_dow
- , subq_1.revenue_instance__ds__extract_doy
- , subq_1.metric_time__day
- , subq_1.metric_time__week
- , subq_1.metric_time__month
- , subq_1.metric_time__quarter
- , subq_1.metric_time__year
- , subq_1.metric_time__extract_year
- , subq_1.metric_time__extract_quarter
- , subq_1.metric_time__extract_month
- , subq_1.metric_time__extract_day
- , subq_1.metric_time__extract_dow
- , subq_1.metric_time__extract_doy
- , subq_1.user
- , subq_1.revenue_instance__user
- , subq_1.txn_revenue
+ subq_12.ds__day
+ , subq_12.ds__week
+ , subq_12.ds__month
+ , subq_12.ds__quarter
+ , subq_12.ds__year
+ , subq_12.ds__extract_year
+ , subq_12.ds__extract_quarter
+ , subq_12.ds__extract_month
+ , subq_12.ds__extract_day
+ , subq_12.ds__extract_dow
+ , subq_12.ds__extract_doy
+ , subq_12.revenue_instance__ds__day
+ , subq_12.revenue_instance__ds__week
+ , subq_12.revenue_instance__ds__month
+ , subq_12.revenue_instance__ds__quarter
+ , subq_12.revenue_instance__ds__year
+ , subq_12.revenue_instance__ds__extract_year
+ , subq_12.revenue_instance__ds__extract_quarter
+ , subq_12.revenue_instance__ds__extract_month
+ , subq_12.revenue_instance__ds__extract_day
+ , subq_12.revenue_instance__ds__extract_dow
+ , subq_12.revenue_instance__ds__extract_doy
+ , subq_12.metric_time__day
+ , subq_12.metric_time__week
+ , subq_12.metric_time__month
+ , subq_12.metric_time__quarter
+ , subq_12.metric_time__year
+ , subq_12.metric_time__extract_year
+ , subq_12.metric_time__extract_quarter
+ , subq_12.metric_time__extract_month
+ , subq_12.metric_time__extract_day
+ , subq_12.metric_time__extract_dow
+ , subq_12.metric_time__extract_doy
+ , subq_12.user
+ , subq_12.revenue_instance__user
+ , subq_12.txn_revenue
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.revenue_instance__ds__day
- , subq_0.revenue_instance__ds__week
- , subq_0.revenue_instance__ds__month
- , subq_0.revenue_instance__ds__quarter
- , subq_0.revenue_instance__ds__year
- , subq_0.revenue_instance__ds__extract_year
- , subq_0.revenue_instance__ds__extract_quarter
- , subq_0.revenue_instance__ds__extract_month
- , subq_0.revenue_instance__ds__extract_day
- , subq_0.revenue_instance__ds__extract_dow
- , subq_0.revenue_instance__ds__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.user
- , subq_0.revenue_instance__user
- , subq_0.txn_revenue
+ subq_11.ds__day
+ , subq_11.ds__week
+ , subq_11.ds__month
+ , subq_11.ds__quarter
+ , subq_11.ds__year
+ , subq_11.ds__extract_year
+ , subq_11.ds__extract_quarter
+ , subq_11.ds__extract_month
+ , subq_11.ds__extract_day
+ , subq_11.ds__extract_dow
+ , subq_11.ds__extract_doy
+ , subq_11.revenue_instance__ds__day
+ , subq_11.revenue_instance__ds__week
+ , subq_11.revenue_instance__ds__month
+ , subq_11.revenue_instance__ds__quarter
+ , subq_11.revenue_instance__ds__year
+ , subq_11.revenue_instance__ds__extract_year
+ , subq_11.revenue_instance__ds__extract_quarter
+ , subq_11.revenue_instance__ds__extract_month
+ , subq_11.revenue_instance__ds__extract_day
+ , subq_11.revenue_instance__ds__extract_dow
+ , subq_11.revenue_instance__ds__extract_doy
+ , subq_11.ds__day AS metric_time__day
+ , subq_11.ds__week AS metric_time__week
+ , subq_11.ds__month AS metric_time__month
+ , subq_11.ds__quarter AS metric_time__quarter
+ , subq_11.ds__year AS metric_time__year
+ , subq_11.ds__extract_year AS metric_time__extract_year
+ , subq_11.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_11.ds__extract_month AS metric_time__extract_month
+ , subq_11.ds__extract_day AS metric_time__extract_day
+ , subq_11.ds__extract_dow AS metric_time__extract_dow
+ , subq_11.ds__extract_doy AS metric_time__extract_doy
+ , subq_11.user
+ , subq_11.revenue_instance__user
+ , subq_11.txn_revenue
FROM (
-- Read Elements From Semantic Model 'revenue'
SELECT
- revenue_src_28007.revenue AS txn_revenue
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM revenue_src_28007.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy
- , revenue_src_28007.user_id AS user
- , revenue_src_28007.user_id AS revenue_instance__user
- FROM ***************************.fct_revenue revenue_src_28007
- ) subq_0
- ) subq_1
- WHERE subq_1.metric_time__day BETWEEN '2019-11-01' AND '2020-01-01'
- ) subq_2
+ revenue_src_28000.revenue AS txn_revenue
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM revenue_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS revenue_instance__ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS revenue_instance__ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS revenue_instance__ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS revenue_instance__ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , EXTRACT(day FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_doy
+ , revenue_src_28000.user_id AS user
+ , revenue_src_28000.user_id AS revenue_instance__user
+ FROM ***************************.fct_revenue revenue_src_28000
+ ) subq_11
+ ) subq_12
+ WHERE subq_12.metric_time__day BETWEEN '2019-11-01' AND '2020-01-01'
+ ) subq_13
ON
(
- subq_2.metric_time__day <= subq_3.metric_time__day
+ subq_13.metric_time__day <= subq_14.metric_time__day
) AND (
- subq_2.metric_time__day > DATEADD(month, -2, subq_3.metric_time__day)
+ subq_13.metric_time__day > DATEADD(month, -2, subq_14.metric_time__day)
)
- ) subq_5
- ) subq_6
- WHERE subq_6.metric_time__day BETWEEN '2020-01-01' AND '2020-01-01'
- ) subq_7
+ ) subq_16
+ ) subq_17
+ WHERE subq_17.metric_time__day BETWEEN '2020-01-01' AND '2020-01-01'
+ ) subq_18
GROUP BY
- subq_7.metric_time__day
-) subq_8
+ subq_18.metric_time__day
+) subq_19
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_with_time_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_with_time_constraint__plan0_optimized.sql
index 06ea3f5a91..bb3417f1ce 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_with_time_constraint__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_metric_with_time_constraint__plan0_optimized.sql
@@ -4,15 +4,15 @@
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_12.metric_time__day AS metric_time__day
- , SUM(subq_11.txn_revenue) AS trailing_2_months_revenue
+ subq_23.metric_time__day AS metric_time__day
+ , SUM(subq_22.txn_revenue) AS trailing_2_months_revenue
FROM (
-- Time Spine
SELECT
ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_13
+ FROM ***************************.mf_time_spine subq_24
WHERE ds BETWEEN '2020-01-01' AND '2020-01-01'
-) subq_12
+) subq_23
INNER JOIN (
-- Read Elements From Semantic Model 'revenue'
-- Metric Time Dimension 'ds'
@@ -20,15 +20,15 @@ INNER JOIN (
SELECT
DATE_TRUNC('day', created_at) AS metric_time__day
, revenue AS txn_revenue
- FROM ***************************.fct_revenue revenue_src_28007
+ FROM ***************************.fct_revenue revenue_src_28000
WHERE DATE_TRUNC('day', created_at) BETWEEN '2019-11-01' AND '2020-01-01'
-) subq_11
+) subq_22
ON
(
- subq_11.metric_time__day <= subq_12.metric_time__day
+ subq_22.metric_time__day <= subq_23.metric_time__day
) AND (
- subq_11.metric_time__day > DATEADD(month, -2, subq_12.metric_time__day)
+ subq_22.metric_time__day > DATEADD(month, -2, subq_23.metric_time__day)
)
-WHERE subq_12.metric_time__day BETWEEN '2020-01-01' AND '2020-01-01'
+WHERE subq_23.metric_time__day BETWEEN '2020-01-01' AND '2020-01-01'
GROUP BY
- subq_12.metric_time__day
+ subq_23.metric_time__day
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric__plan0.sql
index a19c35420a..7b75ca51c5 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric__plan0.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric__plan0.sql
@@ -1,88 +1,88 @@
-- Compute Metrics via Expressions
SELECT
- subq_3.ds__day
- , subq_3.txn_revenue AS trailing_2_months_revenue
+ subq_12.ds__day
+ , subq_12.txn_revenue AS trailing_2_months_revenue
FROM (
-- Aggregate Measures
SELECT
- subq_2.ds__day
- , SUM(subq_2.txn_revenue) AS txn_revenue
+ subq_11.ds__day
+ , SUM(subq_11.txn_revenue) AS txn_revenue
FROM (
-- Pass Only Elements: ['txn_revenue', 'ds__day']
SELECT
- subq_1.ds__day
- , subq_1.txn_revenue
+ subq_10.ds__day
+ , subq_10.txn_revenue
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.revenue_instance__ds__day
- , subq_0.revenue_instance__ds__week
- , subq_0.revenue_instance__ds__month
- , subq_0.revenue_instance__ds__quarter
- , subq_0.revenue_instance__ds__year
- , subq_0.revenue_instance__ds__extract_year
- , subq_0.revenue_instance__ds__extract_quarter
- , subq_0.revenue_instance__ds__extract_month
- , subq_0.revenue_instance__ds__extract_day
- , subq_0.revenue_instance__ds__extract_dow
- , subq_0.revenue_instance__ds__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.user
- , subq_0.revenue_instance__user
- , subq_0.txn_revenue
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.revenue_instance__ds__day
+ , subq_9.revenue_instance__ds__week
+ , subq_9.revenue_instance__ds__month
+ , subq_9.revenue_instance__ds__quarter
+ , subq_9.revenue_instance__ds__year
+ , subq_9.revenue_instance__ds__extract_year
+ , subq_9.revenue_instance__ds__extract_quarter
+ , subq_9.revenue_instance__ds__extract_month
+ , subq_9.revenue_instance__ds__extract_day
+ , subq_9.revenue_instance__ds__extract_dow
+ , subq_9.revenue_instance__ds__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.user
+ , subq_9.revenue_instance__user
+ , subq_9.txn_revenue
FROM (
-- Read Elements From Semantic Model 'revenue'
SELECT
- revenue_src_28007.revenue AS txn_revenue
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day
- , EXTRACT(isodow FROM revenue_src_28007.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day
- , EXTRACT(isodow FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy
- , revenue_src_28007.user_id AS user
- , revenue_src_28007.user_id AS revenue_instance__user
- FROM ***************************.fct_revenue revenue_src_28007
- ) subq_0
- ) subq_1
- ) subq_2
+ revenue_src_28000.revenue AS txn_revenue
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , EXTRACT(isodow FROM revenue_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS revenue_instance__ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS revenue_instance__ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS revenue_instance__ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS revenue_instance__ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , EXTRACT(day FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_day
+ , EXTRACT(isodow FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_doy
+ , revenue_src_28000.user_id AS user
+ , revenue_src_28000.user_id AS revenue_instance__user
+ FROM ***************************.fct_revenue revenue_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
GROUP BY
- subq_2.ds__day
-) subq_3
+ subq_11.ds__day
+) subq_12
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric__plan0_optimized.sql
index 749250c230..76e8f3252a 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric__plan0_optimized.sql
@@ -6,6 +6,6 @@
SELECT
DATE_TRUNC('day', created_at) AS ds__day
, SUM(revenue) AS trailing_2_months_revenue
-FROM ***************************.fct_revenue revenue_src_28007
+FROM ***************************.fct_revenue revenue_src_28000
GROUP BY
DATE_TRUNC('day', created_at)
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_grain_to_date__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_grain_to_date__plan0.sql
index af8623a007..a3900c0466 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_grain_to_date__plan0.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_grain_to_date__plan0.sql
@@ -1,88 +1,88 @@
-- Compute Metrics via Expressions
SELECT
- subq_3.ds__month
- , subq_3.txn_revenue AS revenue_mtd
+ subq_12.ds__month
+ , subq_12.txn_revenue AS revenue_mtd
FROM (
-- Aggregate Measures
SELECT
- subq_2.ds__month
- , SUM(subq_2.txn_revenue) AS txn_revenue
+ subq_11.ds__month
+ , SUM(subq_11.txn_revenue) AS txn_revenue
FROM (
-- Pass Only Elements: ['txn_revenue', 'ds__month']
SELECT
- subq_1.ds__month
- , subq_1.txn_revenue
+ subq_10.ds__month
+ , subq_10.txn_revenue
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.revenue_instance__ds__day
- , subq_0.revenue_instance__ds__week
- , subq_0.revenue_instance__ds__month
- , subq_0.revenue_instance__ds__quarter
- , subq_0.revenue_instance__ds__year
- , subq_0.revenue_instance__ds__extract_year
- , subq_0.revenue_instance__ds__extract_quarter
- , subq_0.revenue_instance__ds__extract_month
- , subq_0.revenue_instance__ds__extract_day
- , subq_0.revenue_instance__ds__extract_dow
- , subq_0.revenue_instance__ds__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.user
- , subq_0.revenue_instance__user
- , subq_0.txn_revenue
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.revenue_instance__ds__day
+ , subq_9.revenue_instance__ds__week
+ , subq_9.revenue_instance__ds__month
+ , subq_9.revenue_instance__ds__quarter
+ , subq_9.revenue_instance__ds__year
+ , subq_9.revenue_instance__ds__extract_year
+ , subq_9.revenue_instance__ds__extract_quarter
+ , subq_9.revenue_instance__ds__extract_month
+ , subq_9.revenue_instance__ds__extract_day
+ , subq_9.revenue_instance__ds__extract_dow
+ , subq_9.revenue_instance__ds__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.user
+ , subq_9.revenue_instance__user
+ , subq_9.txn_revenue
FROM (
-- Read Elements From Semantic Model 'revenue'
SELECT
- revenue_src_28007.revenue AS txn_revenue
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day
- , EXTRACT(isodow FROM revenue_src_28007.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day
- , EXTRACT(isodow FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy
- , revenue_src_28007.user_id AS user
- , revenue_src_28007.user_id AS revenue_instance__user
- FROM ***************************.fct_revenue revenue_src_28007
- ) subq_0
- ) subq_1
- ) subq_2
+ revenue_src_28000.revenue AS txn_revenue
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , EXTRACT(isodow FROM revenue_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS revenue_instance__ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS revenue_instance__ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS revenue_instance__ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS revenue_instance__ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , EXTRACT(day FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_day
+ , EXTRACT(isodow FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_doy
+ , revenue_src_28000.user_id AS user
+ , revenue_src_28000.user_id AS revenue_instance__user
+ FROM ***************************.fct_revenue revenue_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
GROUP BY
- subq_2.ds__month
-) subq_3
+ subq_11.ds__month
+) subq_12
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_grain_to_date__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_grain_to_date__plan0_optimized.sql
index 6a6dbce8b9..e057084866 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_grain_to_date__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_grain_to_date__plan0_optimized.sql
@@ -6,6 +6,6 @@
SELECT
DATE_TRUNC('month', created_at) AS ds__month
, SUM(revenue) AS revenue_mtd
-FROM ***************************.fct_revenue revenue_src_28007
+FROM ***************************.fct_revenue revenue_src_28000
GROUP BY
DATE_TRUNC('month', created_at)
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_month__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_month__plan0.sql
index 238774265f..0e91f53041 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_month__plan0.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_month__plan0.sql
@@ -1,103 +1,103 @@
-- Compute Metrics via Expressions
SELECT
- subq_8.metric_time__month
- , subq_8.bookings_monthly AS trailing_3_months_bookings
+ subq_12.metric_time__month
+ , subq_12.bookings_monthly AS trailing_3_months_bookings
FROM (
-- Aggregate Measures
SELECT
- subq_7.metric_time__month
- , SUM(subq_7.bookings_monthly) AS bookings_monthly
+ subq_11.metric_time__month
+ , SUM(subq_11.bookings_monthly) AS bookings_monthly
FROM (
-- Constrain Time Range to [2020-03-05T00:00:00, 2021-01-04T00:00:00]
SELECT
- subq_6.metric_time__month
- , subq_6.bookings_monthly
+ subq_10.metric_time__month
+ , subq_10.bookings_monthly
FROM (
-- Pass Only Elements: ['bookings_monthly', 'metric_time__month']
SELECT
- subq_5.metric_time__month
- , subq_5.bookings_monthly
+ subq_9.metric_time__month
+ , subq_9.bookings_monthly
FROM (
-- Join Self Over Time Range
SELECT
- subq_3.metric_time__month AS metric_time__month
- , subq_2.monthly_ds__month AS monthly_ds__month
- , subq_2.monthly_ds__quarter AS monthly_ds__quarter
- , subq_2.monthly_ds__year AS monthly_ds__year
- , subq_2.monthly_ds__extract_year AS monthly_ds__extract_year
- , subq_2.monthly_ds__extract_quarter AS monthly_ds__extract_quarter
- , subq_2.monthly_ds__extract_month AS monthly_ds__extract_month
- , subq_2.booking__monthly_ds__month AS booking__monthly_ds__month
- , subq_2.booking__monthly_ds__quarter AS booking__monthly_ds__quarter
- , subq_2.booking__monthly_ds__year AS booking__monthly_ds__year
- , subq_2.booking__monthly_ds__extract_year AS booking__monthly_ds__extract_year
- , subq_2.booking__monthly_ds__extract_quarter AS booking__monthly_ds__extract_quarter
- , subq_2.booking__monthly_ds__extract_month AS booking__monthly_ds__extract_month
- , subq_2.metric_time__quarter AS metric_time__quarter
- , subq_2.metric_time__year AS metric_time__year
- , subq_2.metric_time__extract_year AS metric_time__extract_year
- , subq_2.metric_time__extract_quarter AS metric_time__extract_quarter
- , subq_2.metric_time__extract_month AS metric_time__extract_month
- , subq_2.listing AS listing
- , subq_2.booking__listing AS booking__listing
- , subq_2.bookings_monthly AS bookings_monthly
+ subq_7.metric_time__month AS metric_time__month
+ , subq_6.monthly_ds__month AS monthly_ds__month
+ , subq_6.monthly_ds__quarter AS monthly_ds__quarter
+ , subq_6.monthly_ds__year AS monthly_ds__year
+ , subq_6.monthly_ds__extract_year AS monthly_ds__extract_year
+ , subq_6.monthly_ds__extract_quarter AS monthly_ds__extract_quarter
+ , subq_6.monthly_ds__extract_month AS monthly_ds__extract_month
+ , subq_6.booking__monthly_ds__month AS booking__monthly_ds__month
+ , subq_6.booking__monthly_ds__quarter AS booking__monthly_ds__quarter
+ , subq_6.booking__monthly_ds__year AS booking__monthly_ds__year
+ , subq_6.booking__monthly_ds__extract_year AS booking__monthly_ds__extract_year
+ , subq_6.booking__monthly_ds__extract_quarter AS booking__monthly_ds__extract_quarter
+ , subq_6.booking__monthly_ds__extract_month AS booking__monthly_ds__extract_month
+ , subq_6.metric_time__quarter AS metric_time__quarter
+ , subq_6.metric_time__year AS metric_time__year
+ , subq_6.metric_time__extract_year AS metric_time__extract_year
+ , subq_6.metric_time__extract_quarter AS metric_time__extract_quarter
+ , subq_6.metric_time__extract_month AS metric_time__extract_month
+ , subq_6.listing AS listing
+ , subq_6.booking__listing AS booking__listing
+ , subq_6.bookings_monthly AS bookings_monthly
FROM (
-- Time Spine
SELECT
- DATE_TRUNC('month', subq_4.ds) AS metric_time__month
- FROM ***************************.mf_time_spine subq_4
- WHERE subq_4.ds BETWEEN '2020-03-05' AND '2021-01-04'
+ DATE_TRUNC('month', subq_8.ds) AS metric_time__month
+ FROM ***************************.mf_time_spine subq_8
+ WHERE subq_8.ds BETWEEN '2020-03-05' AND '2021-01-04'
GROUP BY
- DATE_TRUNC('month', subq_4.ds)
- ) subq_3
+ DATE_TRUNC('month', subq_8.ds)
+ ) subq_7
INNER JOIN (
-- Constrain Time Range to [2019-12-05T00:00:00, 2021-01-04T00:00:00]
SELECT
- subq_1.monthly_ds__month
- , subq_1.monthly_ds__quarter
- , subq_1.monthly_ds__year
- , subq_1.monthly_ds__extract_year
- , subq_1.monthly_ds__extract_quarter
- , subq_1.monthly_ds__extract_month
- , subq_1.booking__monthly_ds__month
- , subq_1.booking__monthly_ds__quarter
- , subq_1.booking__monthly_ds__year
- , subq_1.booking__monthly_ds__extract_year
- , subq_1.booking__monthly_ds__extract_quarter
- , subq_1.booking__monthly_ds__extract_month
- , subq_1.metric_time__month
- , subq_1.metric_time__quarter
- , subq_1.metric_time__year
- , subq_1.metric_time__extract_year
- , subq_1.metric_time__extract_quarter
- , subq_1.metric_time__extract_month
- , subq_1.listing
- , subq_1.booking__listing
- , subq_1.bookings_monthly
+ subq_5.monthly_ds__month
+ , subq_5.monthly_ds__quarter
+ , subq_5.monthly_ds__year
+ , subq_5.monthly_ds__extract_year
+ , subq_5.monthly_ds__extract_quarter
+ , subq_5.monthly_ds__extract_month
+ , subq_5.booking__monthly_ds__month
+ , subq_5.booking__monthly_ds__quarter
+ , subq_5.booking__monthly_ds__year
+ , subq_5.booking__monthly_ds__extract_year
+ , subq_5.booking__monthly_ds__extract_quarter
+ , subq_5.booking__monthly_ds__extract_month
+ , subq_5.metric_time__month
+ , subq_5.metric_time__quarter
+ , subq_5.metric_time__year
+ , subq_5.metric_time__extract_year
+ , subq_5.metric_time__extract_quarter
+ , subq_5.metric_time__extract_month
+ , subq_5.listing
+ , subq_5.booking__listing
+ , subq_5.bookings_monthly
FROM (
-- Metric Time Dimension 'monthly_ds'
SELECT
- subq_0.monthly_ds__month
- , subq_0.monthly_ds__quarter
- , subq_0.monthly_ds__year
- , subq_0.monthly_ds__extract_year
- , subq_0.monthly_ds__extract_quarter
- , subq_0.monthly_ds__extract_month
- , subq_0.booking__monthly_ds__month
- , subq_0.booking__monthly_ds__quarter
- , subq_0.booking__monthly_ds__year
- , subq_0.booking__monthly_ds__extract_year
- , subq_0.booking__monthly_ds__extract_quarter
- , subq_0.booking__monthly_ds__extract_month
- , subq_0.monthly_ds__month AS metric_time__month
- , subq_0.monthly_ds__quarter AS metric_time__quarter
- , subq_0.monthly_ds__year AS metric_time__year
- , subq_0.monthly_ds__extract_year AS metric_time__extract_year
- , subq_0.monthly_ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.monthly_ds__extract_month AS metric_time__extract_month
- , subq_0.listing
- , subq_0.booking__listing
- , subq_0.bookings_monthly
+ subq_4.monthly_ds__month
+ , subq_4.monthly_ds__quarter
+ , subq_4.monthly_ds__year
+ , subq_4.monthly_ds__extract_year
+ , subq_4.monthly_ds__extract_quarter
+ , subq_4.monthly_ds__extract_month
+ , subq_4.booking__monthly_ds__month
+ , subq_4.booking__monthly_ds__quarter
+ , subq_4.booking__monthly_ds__year
+ , subq_4.booking__monthly_ds__extract_year
+ , subq_4.booking__monthly_ds__extract_quarter
+ , subq_4.booking__monthly_ds__extract_month
+ , subq_4.monthly_ds__month AS metric_time__month
+ , subq_4.monthly_ds__quarter AS metric_time__quarter
+ , subq_4.monthly_ds__year AS metric_time__year
+ , subq_4.monthly_ds__extract_year AS metric_time__extract_year
+ , subq_4.monthly_ds__extract_quarter AS metric_time__extract_quarter
+ , subq_4.monthly_ds__extract_month AS metric_time__extract_month
+ , subq_4.listing
+ , subq_4.booking__listing
+ , subq_4.bookings_monthly
FROM (
-- Read Elements From Semantic Model 'bookings_monthly_source'
SELECT
@@ -117,20 +117,20 @@ FROM (
, bookings_monthly_source_src_16000.listing_id AS listing
, bookings_monthly_source_src_16000.listing_id AS booking__listing
FROM ***************************.fct_bookings_extended_monthly bookings_monthly_source_src_16000
- ) subq_0
- ) subq_1
- WHERE subq_1.metric_time__month BETWEEN '2019-12-05' AND '2021-01-04'
- ) subq_2
+ ) subq_4
+ ) subq_5
+ WHERE subq_5.metric_time__month BETWEEN '2019-12-05' AND '2021-01-04'
+ ) subq_6
ON
(
- subq_2.metric_time__month <= subq_3.metric_time__month
+ subq_6.metric_time__month <= subq_7.metric_time__month
) AND (
- subq_2.metric_time__month > subq_3.metric_time__month - INTERVAL 3 month
+ subq_6.metric_time__month > subq_7.metric_time__month - INTERVAL 3 month
)
- ) subq_5
- ) subq_6
- WHERE subq_6.metric_time__month BETWEEN '2020-03-05' AND '2021-01-04'
- ) subq_7
+ ) subq_9
+ ) subq_10
+ WHERE subq_10.metric_time__month BETWEEN '2020-03-05' AND '2021-01-04'
+ ) subq_11
GROUP BY
- subq_7.metric_time__month
-) subq_8
+ subq_11.metric_time__month
+) subq_12
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_month__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_month__plan0_optimized.sql
index df00087c33..6a57a72ab0 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_month__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_month__plan0_optimized.sql
@@ -4,17 +4,17 @@
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_12.metric_time__month AS metric_time__month
- , SUM(subq_11.bookings_monthly) AS trailing_3_months_bookings
+ subq_16.metric_time__month AS metric_time__month
+ , SUM(subq_15.bookings_monthly) AS trailing_3_months_bookings
FROM (
-- Time Spine
SELECT
DATE_TRUNC('month', ds) AS metric_time__month
- FROM ***************************.mf_time_spine subq_13
+ FROM ***************************.mf_time_spine subq_17
WHERE ds BETWEEN '2020-03-05' AND '2021-01-04'
GROUP BY
DATE_TRUNC('month', ds)
-) subq_12
+) subq_16
INNER JOIN (
-- Read Elements From Semantic Model 'bookings_monthly_source'
-- Metric Time Dimension 'monthly_ds'
@@ -24,13 +24,13 @@ INNER JOIN (
, bookings_monthly
FROM ***************************.fct_bookings_extended_monthly bookings_monthly_source_src_16000
WHERE DATE_TRUNC('month', ds) BETWEEN '2019-12-05' AND '2021-01-04'
-) subq_11
+) subq_15
ON
(
- subq_11.metric_time__month <= subq_12.metric_time__month
+ subq_15.metric_time__month <= subq_16.metric_time__month
) AND (
- subq_11.metric_time__month > subq_12.metric_time__month - INTERVAL 3 month
+ subq_15.metric_time__month > subq_16.metric_time__month - INTERVAL 3 month
)
-WHERE subq_12.metric_time__month BETWEEN '2020-03-05' AND '2021-01-04'
+WHERE subq_16.metric_time__month BETWEEN '2020-03-05' AND '2021-01-04'
GROUP BY
- subq_12.metric_time__month
+ subq_16.metric_time__month
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_no_ds__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_no_ds__plan0.sql
index 740a8baf27..089925950f 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_no_ds__plan0.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_no_ds__plan0.sql
@@ -1,83 +1,83 @@
-- Compute Metrics via Expressions
SELECT
- subq_3.txn_revenue AS trailing_2_months_revenue
+ subq_12.txn_revenue AS trailing_2_months_revenue
FROM (
-- Aggregate Measures
SELECT
- SUM(subq_2.txn_revenue) AS txn_revenue
+ SUM(subq_11.txn_revenue) AS txn_revenue
FROM (
-- Pass Only Elements: ['txn_revenue',]
SELECT
- subq_1.txn_revenue
+ subq_10.txn_revenue
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.revenue_instance__ds__day
- , subq_0.revenue_instance__ds__week
- , subq_0.revenue_instance__ds__month
- , subq_0.revenue_instance__ds__quarter
- , subq_0.revenue_instance__ds__year
- , subq_0.revenue_instance__ds__extract_year
- , subq_0.revenue_instance__ds__extract_quarter
- , subq_0.revenue_instance__ds__extract_month
- , subq_0.revenue_instance__ds__extract_day
- , subq_0.revenue_instance__ds__extract_dow
- , subq_0.revenue_instance__ds__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.user
- , subq_0.revenue_instance__user
- , subq_0.txn_revenue
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.revenue_instance__ds__day
+ , subq_9.revenue_instance__ds__week
+ , subq_9.revenue_instance__ds__month
+ , subq_9.revenue_instance__ds__quarter
+ , subq_9.revenue_instance__ds__year
+ , subq_9.revenue_instance__ds__extract_year
+ , subq_9.revenue_instance__ds__extract_quarter
+ , subq_9.revenue_instance__ds__extract_month
+ , subq_9.revenue_instance__ds__extract_day
+ , subq_9.revenue_instance__ds__extract_dow
+ , subq_9.revenue_instance__ds__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.user
+ , subq_9.revenue_instance__user
+ , subq_9.txn_revenue
FROM (
-- Read Elements From Semantic Model 'revenue'
SELECT
- revenue_src_28007.revenue AS txn_revenue
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day
- , EXTRACT(isodow FROM revenue_src_28007.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day
- , EXTRACT(isodow FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy
- , revenue_src_28007.user_id AS user
- , revenue_src_28007.user_id AS revenue_instance__user
- FROM ***************************.fct_revenue revenue_src_28007
- ) subq_0
- ) subq_1
- ) subq_2
-) subq_3
+ revenue_src_28000.revenue AS txn_revenue
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , EXTRACT(isodow FROM revenue_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS revenue_instance__ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS revenue_instance__ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS revenue_instance__ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS revenue_instance__ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , EXTRACT(day FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_day
+ , EXTRACT(isodow FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_doy
+ , revenue_src_28000.user_id AS user
+ , revenue_src_28000.user_id AS revenue_instance__user
+ FROM ***************************.fct_revenue revenue_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
+) subq_12
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_no_ds__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_no_ds__plan0_optimized.sql
index e26a1bdb3d..4a0d5baff3 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_no_ds__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_no_ds__plan0_optimized.sql
@@ -5,4 +5,4 @@
-- Compute Metrics via Expressions
SELECT
SUM(revenue) AS trailing_2_months_revenue
-FROM ***************************.fct_revenue revenue_src_28007
+FROM ***************************.fct_revenue revenue_src_28000
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_no_window__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_no_window__plan0.sql
index c134310b8b..8aaa691cd5 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_no_window__plan0.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_no_window__plan0.sql
@@ -1,88 +1,88 @@
-- Compute Metrics via Expressions
SELECT
- subq_3.ds__month
- , subq_3.txn_revenue AS revenue_all_time
+ subq_12.ds__month
+ , subq_12.txn_revenue AS revenue_all_time
FROM (
-- Aggregate Measures
SELECT
- subq_2.ds__month
- , SUM(subq_2.txn_revenue) AS txn_revenue
+ subq_11.ds__month
+ , SUM(subq_11.txn_revenue) AS txn_revenue
FROM (
-- Pass Only Elements: ['txn_revenue', 'ds__month']
SELECT
- subq_1.ds__month
- , subq_1.txn_revenue
+ subq_10.ds__month
+ , subq_10.txn_revenue
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.revenue_instance__ds__day
- , subq_0.revenue_instance__ds__week
- , subq_0.revenue_instance__ds__month
- , subq_0.revenue_instance__ds__quarter
- , subq_0.revenue_instance__ds__year
- , subq_0.revenue_instance__ds__extract_year
- , subq_0.revenue_instance__ds__extract_quarter
- , subq_0.revenue_instance__ds__extract_month
- , subq_0.revenue_instance__ds__extract_day
- , subq_0.revenue_instance__ds__extract_dow
- , subq_0.revenue_instance__ds__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.user
- , subq_0.revenue_instance__user
- , subq_0.txn_revenue
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.revenue_instance__ds__day
+ , subq_9.revenue_instance__ds__week
+ , subq_9.revenue_instance__ds__month
+ , subq_9.revenue_instance__ds__quarter
+ , subq_9.revenue_instance__ds__year
+ , subq_9.revenue_instance__ds__extract_year
+ , subq_9.revenue_instance__ds__extract_quarter
+ , subq_9.revenue_instance__ds__extract_month
+ , subq_9.revenue_instance__ds__extract_day
+ , subq_9.revenue_instance__ds__extract_dow
+ , subq_9.revenue_instance__ds__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.user
+ , subq_9.revenue_instance__user
+ , subq_9.txn_revenue
FROM (
-- Read Elements From Semantic Model 'revenue'
SELECT
- revenue_src_28007.revenue AS txn_revenue
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day
- , EXTRACT(isodow FROM revenue_src_28007.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day
- , EXTRACT(isodow FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy
- , revenue_src_28007.user_id AS user
- , revenue_src_28007.user_id AS revenue_instance__user
- FROM ***************************.fct_revenue revenue_src_28007
- ) subq_0
- ) subq_1
- ) subq_2
+ revenue_src_28000.revenue AS txn_revenue
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , EXTRACT(isodow FROM revenue_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS revenue_instance__ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS revenue_instance__ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS revenue_instance__ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS revenue_instance__ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , EXTRACT(day FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_day
+ , EXTRACT(isodow FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_doy
+ , revenue_src_28000.user_id AS user
+ , revenue_src_28000.user_id AS revenue_instance__user
+ FROM ***************************.fct_revenue revenue_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
GROUP BY
- subq_2.ds__month
-) subq_3
+ subq_11.ds__month
+) subq_12
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_no_window__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_no_window__plan0_optimized.sql
index a7ca78d4e5..05e48cdae3 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_no_window__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_no_window__plan0_optimized.sql
@@ -6,6 +6,6 @@
SELECT
DATE_TRUNC('month', created_at) AS ds__month
, SUM(revenue) AS revenue_all_time
-FROM ***************************.fct_revenue revenue_src_28007
+FROM ***************************.fct_revenue revenue_src_28000
GROUP BY
DATE_TRUNC('month', created_at)
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_no_window_with_time_constraint__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_no_window_with_time_constraint__plan0.sql
index 61b9bcc9ac..f781a5a6f4 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_no_window_with_time_constraint__plan0.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_no_window_with_time_constraint__plan0.sql
@@ -1,187 +1,187 @@
-- Compute Metrics via Expressions
SELECT
- subq_8.metric_time__month
- , subq_8.txn_revenue AS revenue_all_time
+ subq_19.metric_time__month
+ , subq_19.txn_revenue AS revenue_all_time
FROM (
-- Aggregate Measures
SELECT
- subq_7.metric_time__month
- , SUM(subq_7.txn_revenue) AS txn_revenue
+ subq_18.metric_time__month
+ , SUM(subq_18.txn_revenue) AS txn_revenue
FROM (
-- Constrain Time Range to [2020-01-01T00:00:00, 2020-01-01T00:00:00]
SELECT
- subq_6.metric_time__month
- , subq_6.txn_revenue
+ subq_17.metric_time__month
+ , subq_17.txn_revenue
FROM (
-- Pass Only Elements: ['txn_revenue', 'metric_time__month']
SELECT
- subq_5.metric_time__month
- , subq_5.txn_revenue
+ subq_16.metric_time__month
+ , subq_16.txn_revenue
FROM (
-- Join Self Over Time Range
SELECT
- subq_3.metric_time__month AS metric_time__month
- , subq_2.ds__day AS ds__day
- , subq_2.ds__week AS ds__week
- , subq_2.ds__month AS ds__month
- , subq_2.ds__quarter AS ds__quarter
- , subq_2.ds__year AS ds__year
- , subq_2.ds__extract_year AS ds__extract_year
- , subq_2.ds__extract_quarter AS ds__extract_quarter
- , subq_2.ds__extract_month AS ds__extract_month
- , subq_2.ds__extract_day AS ds__extract_day
- , subq_2.ds__extract_dow AS ds__extract_dow
- , subq_2.ds__extract_doy AS ds__extract_doy
- , subq_2.revenue_instance__ds__day AS revenue_instance__ds__day
- , subq_2.revenue_instance__ds__week AS revenue_instance__ds__week
- , subq_2.revenue_instance__ds__month AS revenue_instance__ds__month
- , subq_2.revenue_instance__ds__quarter AS revenue_instance__ds__quarter
- , subq_2.revenue_instance__ds__year AS revenue_instance__ds__year
- , subq_2.revenue_instance__ds__extract_year AS revenue_instance__ds__extract_year
- , subq_2.revenue_instance__ds__extract_quarter AS revenue_instance__ds__extract_quarter
- , subq_2.revenue_instance__ds__extract_month AS revenue_instance__ds__extract_month
- , subq_2.revenue_instance__ds__extract_day AS revenue_instance__ds__extract_day
- , subq_2.revenue_instance__ds__extract_dow AS revenue_instance__ds__extract_dow
- , subq_2.revenue_instance__ds__extract_doy AS revenue_instance__ds__extract_doy
- , subq_2.metric_time__day AS metric_time__day
- , subq_2.metric_time__week AS metric_time__week
- , subq_2.metric_time__quarter AS metric_time__quarter
- , subq_2.metric_time__year AS metric_time__year
- , subq_2.metric_time__extract_year AS metric_time__extract_year
- , subq_2.metric_time__extract_quarter AS metric_time__extract_quarter
- , subq_2.metric_time__extract_month AS metric_time__extract_month
- , subq_2.metric_time__extract_day AS metric_time__extract_day
- , subq_2.metric_time__extract_dow AS metric_time__extract_dow
- , subq_2.metric_time__extract_doy AS metric_time__extract_doy
- , subq_2.user AS user
- , subq_2.revenue_instance__user AS revenue_instance__user
- , subq_2.txn_revenue AS txn_revenue
+ subq_14.metric_time__month AS metric_time__month
+ , subq_13.ds__day AS ds__day
+ , subq_13.ds__week AS ds__week
+ , subq_13.ds__month AS ds__month
+ , subq_13.ds__quarter AS ds__quarter
+ , subq_13.ds__year AS ds__year
+ , subq_13.ds__extract_year AS ds__extract_year
+ , subq_13.ds__extract_quarter AS ds__extract_quarter
+ , subq_13.ds__extract_month AS ds__extract_month
+ , subq_13.ds__extract_day AS ds__extract_day
+ , subq_13.ds__extract_dow AS ds__extract_dow
+ , subq_13.ds__extract_doy AS ds__extract_doy
+ , subq_13.revenue_instance__ds__day AS revenue_instance__ds__day
+ , subq_13.revenue_instance__ds__week AS revenue_instance__ds__week
+ , subq_13.revenue_instance__ds__month AS revenue_instance__ds__month
+ , subq_13.revenue_instance__ds__quarter AS revenue_instance__ds__quarter
+ , subq_13.revenue_instance__ds__year AS revenue_instance__ds__year
+ , subq_13.revenue_instance__ds__extract_year AS revenue_instance__ds__extract_year
+ , subq_13.revenue_instance__ds__extract_quarter AS revenue_instance__ds__extract_quarter
+ , subq_13.revenue_instance__ds__extract_month AS revenue_instance__ds__extract_month
+ , subq_13.revenue_instance__ds__extract_day AS revenue_instance__ds__extract_day
+ , subq_13.revenue_instance__ds__extract_dow AS revenue_instance__ds__extract_dow
+ , subq_13.revenue_instance__ds__extract_doy AS revenue_instance__ds__extract_doy
+ , subq_13.metric_time__day AS metric_time__day
+ , subq_13.metric_time__week AS metric_time__week
+ , subq_13.metric_time__quarter AS metric_time__quarter
+ , subq_13.metric_time__year AS metric_time__year
+ , subq_13.metric_time__extract_year AS metric_time__extract_year
+ , subq_13.metric_time__extract_quarter AS metric_time__extract_quarter
+ , subq_13.metric_time__extract_month AS metric_time__extract_month
+ , subq_13.metric_time__extract_day AS metric_time__extract_day
+ , subq_13.metric_time__extract_dow AS metric_time__extract_dow
+ , subq_13.metric_time__extract_doy AS metric_time__extract_doy
+ , subq_13.user AS user
+ , subq_13.revenue_instance__user AS revenue_instance__user
+ , subq_13.txn_revenue AS txn_revenue
FROM (
-- Time Spine
SELECT
- DATE_TRUNC('month', subq_4.ds) AS metric_time__month
- FROM ***************************.mf_time_spine subq_4
- WHERE subq_4.ds BETWEEN '2020-01-01' AND '2020-01-01'
+ DATE_TRUNC('month', subq_15.ds) AS metric_time__month
+ FROM ***************************.mf_time_spine subq_15
+ WHERE subq_15.ds BETWEEN '2020-01-01' AND '2020-01-01'
GROUP BY
- DATE_TRUNC('month', subq_4.ds)
- ) subq_3
+ DATE_TRUNC('month', subq_15.ds)
+ ) subq_14
INNER JOIN (
-- Constrain Time Range to [2000-01-01T00:00:00, 2020-01-01T00:00:00]
SELECT
- subq_1.ds__day
- , subq_1.ds__week
- , subq_1.ds__month
- , subq_1.ds__quarter
- , subq_1.ds__year
- , subq_1.ds__extract_year
- , subq_1.ds__extract_quarter
- , subq_1.ds__extract_month
- , subq_1.ds__extract_day
- , subq_1.ds__extract_dow
- , subq_1.ds__extract_doy
- , subq_1.revenue_instance__ds__day
- , subq_1.revenue_instance__ds__week
- , subq_1.revenue_instance__ds__month
- , subq_1.revenue_instance__ds__quarter
- , subq_1.revenue_instance__ds__year
- , subq_1.revenue_instance__ds__extract_year
- , subq_1.revenue_instance__ds__extract_quarter
- , subq_1.revenue_instance__ds__extract_month
- , subq_1.revenue_instance__ds__extract_day
- , subq_1.revenue_instance__ds__extract_dow
- , subq_1.revenue_instance__ds__extract_doy
- , subq_1.metric_time__day
- , subq_1.metric_time__week
- , subq_1.metric_time__month
- , subq_1.metric_time__quarter
- , subq_1.metric_time__year
- , subq_1.metric_time__extract_year
- , subq_1.metric_time__extract_quarter
- , subq_1.metric_time__extract_month
- , subq_1.metric_time__extract_day
- , subq_1.metric_time__extract_dow
- , subq_1.metric_time__extract_doy
- , subq_1.user
- , subq_1.revenue_instance__user
- , subq_1.txn_revenue
+ subq_12.ds__day
+ , subq_12.ds__week
+ , subq_12.ds__month
+ , subq_12.ds__quarter
+ , subq_12.ds__year
+ , subq_12.ds__extract_year
+ , subq_12.ds__extract_quarter
+ , subq_12.ds__extract_month
+ , subq_12.ds__extract_day
+ , subq_12.ds__extract_dow
+ , subq_12.ds__extract_doy
+ , subq_12.revenue_instance__ds__day
+ , subq_12.revenue_instance__ds__week
+ , subq_12.revenue_instance__ds__month
+ , subq_12.revenue_instance__ds__quarter
+ , subq_12.revenue_instance__ds__year
+ , subq_12.revenue_instance__ds__extract_year
+ , subq_12.revenue_instance__ds__extract_quarter
+ , subq_12.revenue_instance__ds__extract_month
+ , subq_12.revenue_instance__ds__extract_day
+ , subq_12.revenue_instance__ds__extract_dow
+ , subq_12.revenue_instance__ds__extract_doy
+ , subq_12.metric_time__day
+ , subq_12.metric_time__week
+ , subq_12.metric_time__month
+ , subq_12.metric_time__quarter
+ , subq_12.metric_time__year
+ , subq_12.metric_time__extract_year
+ , subq_12.metric_time__extract_quarter
+ , subq_12.metric_time__extract_month
+ , subq_12.metric_time__extract_day
+ , subq_12.metric_time__extract_dow
+ , subq_12.metric_time__extract_doy
+ , subq_12.user
+ , subq_12.revenue_instance__user
+ , subq_12.txn_revenue
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.revenue_instance__ds__day
- , subq_0.revenue_instance__ds__week
- , subq_0.revenue_instance__ds__month
- , subq_0.revenue_instance__ds__quarter
- , subq_0.revenue_instance__ds__year
- , subq_0.revenue_instance__ds__extract_year
- , subq_0.revenue_instance__ds__extract_quarter
- , subq_0.revenue_instance__ds__extract_month
- , subq_0.revenue_instance__ds__extract_day
- , subq_0.revenue_instance__ds__extract_dow
- , subq_0.revenue_instance__ds__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.user
- , subq_0.revenue_instance__user
- , subq_0.txn_revenue
+ subq_11.ds__day
+ , subq_11.ds__week
+ , subq_11.ds__month
+ , subq_11.ds__quarter
+ , subq_11.ds__year
+ , subq_11.ds__extract_year
+ , subq_11.ds__extract_quarter
+ , subq_11.ds__extract_month
+ , subq_11.ds__extract_day
+ , subq_11.ds__extract_dow
+ , subq_11.ds__extract_doy
+ , subq_11.revenue_instance__ds__day
+ , subq_11.revenue_instance__ds__week
+ , subq_11.revenue_instance__ds__month
+ , subq_11.revenue_instance__ds__quarter
+ , subq_11.revenue_instance__ds__year
+ , subq_11.revenue_instance__ds__extract_year
+ , subq_11.revenue_instance__ds__extract_quarter
+ , subq_11.revenue_instance__ds__extract_month
+ , subq_11.revenue_instance__ds__extract_day
+ , subq_11.revenue_instance__ds__extract_dow
+ , subq_11.revenue_instance__ds__extract_doy
+ , subq_11.ds__day AS metric_time__day
+ , subq_11.ds__week AS metric_time__week
+ , subq_11.ds__month AS metric_time__month
+ , subq_11.ds__quarter AS metric_time__quarter
+ , subq_11.ds__year AS metric_time__year
+ , subq_11.ds__extract_year AS metric_time__extract_year
+ , subq_11.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_11.ds__extract_month AS metric_time__extract_month
+ , subq_11.ds__extract_day AS metric_time__extract_day
+ , subq_11.ds__extract_dow AS metric_time__extract_dow
+ , subq_11.ds__extract_doy AS metric_time__extract_doy
+ , subq_11.user
+ , subq_11.revenue_instance__user
+ , subq_11.txn_revenue
FROM (
-- Read Elements From Semantic Model 'revenue'
SELECT
- revenue_src_28007.revenue AS txn_revenue
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day
- , EXTRACT(isodow FROM revenue_src_28007.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day
- , EXTRACT(isodow FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy
- , revenue_src_28007.user_id AS user
- , revenue_src_28007.user_id AS revenue_instance__user
- FROM ***************************.fct_revenue revenue_src_28007
- ) subq_0
- ) subq_1
- WHERE subq_1.metric_time__day BETWEEN '2000-01-01' AND '2020-01-01'
- ) subq_2
+ revenue_src_28000.revenue AS txn_revenue
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , EXTRACT(isodow FROM revenue_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS revenue_instance__ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS revenue_instance__ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS revenue_instance__ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS revenue_instance__ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , EXTRACT(day FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_day
+ , EXTRACT(isodow FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_doy
+ , revenue_src_28000.user_id AS user
+ , revenue_src_28000.user_id AS revenue_instance__user
+ FROM ***************************.fct_revenue revenue_src_28000
+ ) subq_11
+ ) subq_12
+ WHERE subq_12.metric_time__day BETWEEN '2000-01-01' AND '2020-01-01'
+ ) subq_13
ON
- (subq_2.metric_time__month <= subq_3.metric_time__month)
- ) subq_5
- ) subq_6
- WHERE subq_6.metric_time__month BETWEEN '2020-01-01' AND '2020-01-01'
- ) subq_7
+ (subq_13.metric_time__month <= subq_14.metric_time__month)
+ ) subq_16
+ ) subq_17
+ WHERE subq_17.metric_time__month BETWEEN '2020-01-01' AND '2020-01-01'
+ ) subq_18
GROUP BY
- subq_7.metric_time__month
-) subq_8
+ subq_18.metric_time__month
+) subq_19
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_no_window_with_time_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_no_window_with_time_constraint__plan0_optimized.sql
index a4e5bf994b..0267f01b4a 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_no_window_with_time_constraint__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_no_window_with_time_constraint__plan0_optimized.sql
@@ -4,17 +4,17 @@
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_12.metric_time__month AS metric_time__month
- , SUM(subq_11.txn_revenue) AS revenue_all_time
+ subq_23.metric_time__month AS metric_time__month
+ , SUM(subq_22.txn_revenue) AS revenue_all_time
FROM (
-- Time Spine
SELECT
DATE_TRUNC('month', ds) AS metric_time__month
- FROM ***************************.mf_time_spine subq_13
+ FROM ***************************.mf_time_spine subq_24
WHERE ds BETWEEN '2020-01-01' AND '2020-01-01'
GROUP BY
DATE_TRUNC('month', ds)
-) subq_12
+) subq_23
INNER JOIN (
-- Read Elements From Semantic Model 'revenue'
-- Metric Time Dimension 'ds'
@@ -22,11 +22,11 @@ INNER JOIN (
SELECT
DATE_TRUNC('month', created_at) AS metric_time__month
, revenue AS txn_revenue
- FROM ***************************.fct_revenue revenue_src_28007
+ FROM ***************************.fct_revenue revenue_src_28000
WHERE DATE_TRUNC('day', created_at) BETWEEN '2000-01-01' AND '2020-01-01'
-) subq_11
+) subq_22
ON
- (subq_11.metric_time__month <= subq_12.metric_time__month)
-WHERE subq_12.metric_time__month BETWEEN '2020-01-01' AND '2020-01-01'
+ (subq_22.metric_time__month <= subq_23.metric_time__month)
+WHERE subq_23.metric_time__month BETWEEN '2020-01-01' AND '2020-01-01'
GROUP BY
- subq_12.metric_time__month
+ subq_23.metric_time__month
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_with_agg_time_dimension__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_with_agg_time_dimension__plan0.sql
index 68477c9e75..f5c3b5d57c 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_with_agg_time_dimension__plan0.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_with_agg_time_dimension__plan0.sql
@@ -1,140 +1,140 @@
-- Compute Metrics via Expressions
SELECT
- subq_6.revenue_instance__ds__day
- , subq_6.txn_revenue AS trailing_2_months_revenue
+ subq_15.revenue_instance__ds__day
+ , subq_15.txn_revenue AS trailing_2_months_revenue
FROM (
-- Aggregate Measures
SELECT
- subq_5.revenue_instance__ds__day
- , SUM(subq_5.txn_revenue) AS txn_revenue
+ subq_14.revenue_instance__ds__day
+ , SUM(subq_14.txn_revenue) AS txn_revenue
FROM (
-- Pass Only Elements: ['txn_revenue', 'revenue_instance__ds__day']
SELECT
- subq_4.revenue_instance__ds__day
- , subq_4.txn_revenue
+ subq_13.revenue_instance__ds__day
+ , subq_13.txn_revenue
FROM (
-- Join Self Over Time Range
SELECT
- subq_2.revenue_instance__ds__day AS revenue_instance__ds__day
- , subq_1.ds__day AS ds__day
- , subq_1.ds__week AS ds__week
- , subq_1.ds__month AS ds__month
- , subq_1.ds__quarter AS ds__quarter
- , subq_1.ds__year AS ds__year
- , subq_1.ds__extract_year AS ds__extract_year
- , subq_1.ds__extract_quarter AS ds__extract_quarter
- , subq_1.ds__extract_month AS ds__extract_month
- , subq_1.ds__extract_day AS ds__extract_day
- , subq_1.ds__extract_dow AS ds__extract_dow
- , subq_1.ds__extract_doy AS ds__extract_doy
- , subq_1.revenue_instance__ds__week AS revenue_instance__ds__week
- , subq_1.revenue_instance__ds__month AS revenue_instance__ds__month
- , subq_1.revenue_instance__ds__quarter AS revenue_instance__ds__quarter
- , subq_1.revenue_instance__ds__year AS revenue_instance__ds__year
- , subq_1.revenue_instance__ds__extract_year AS revenue_instance__ds__extract_year
- , subq_1.revenue_instance__ds__extract_quarter AS revenue_instance__ds__extract_quarter
- , subq_1.revenue_instance__ds__extract_month AS revenue_instance__ds__extract_month
- , subq_1.revenue_instance__ds__extract_day AS revenue_instance__ds__extract_day
- , subq_1.revenue_instance__ds__extract_dow AS revenue_instance__ds__extract_dow
- , subq_1.revenue_instance__ds__extract_doy AS revenue_instance__ds__extract_doy
- , subq_1.metric_time__day AS metric_time__day
- , subq_1.metric_time__week AS metric_time__week
- , subq_1.metric_time__month AS metric_time__month
- , subq_1.metric_time__quarter AS metric_time__quarter
- , subq_1.metric_time__year AS metric_time__year
- , subq_1.metric_time__extract_year AS metric_time__extract_year
- , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter
- , subq_1.metric_time__extract_month AS metric_time__extract_month
- , subq_1.metric_time__extract_day AS metric_time__extract_day
- , subq_1.metric_time__extract_dow AS metric_time__extract_dow
- , subq_1.metric_time__extract_doy AS metric_time__extract_doy
- , subq_1.user AS user
- , subq_1.revenue_instance__user AS revenue_instance__user
- , subq_1.txn_revenue AS txn_revenue
+ subq_11.revenue_instance__ds__day AS revenue_instance__ds__day
+ , subq_10.ds__day AS ds__day
+ , subq_10.ds__week AS ds__week
+ , subq_10.ds__month AS ds__month
+ , subq_10.ds__quarter AS ds__quarter
+ , subq_10.ds__year AS ds__year
+ , subq_10.ds__extract_year AS ds__extract_year
+ , subq_10.ds__extract_quarter AS ds__extract_quarter
+ , subq_10.ds__extract_month AS ds__extract_month
+ , subq_10.ds__extract_day AS ds__extract_day
+ , subq_10.ds__extract_dow AS ds__extract_dow
+ , subq_10.ds__extract_doy AS ds__extract_doy
+ , subq_10.revenue_instance__ds__week AS revenue_instance__ds__week
+ , subq_10.revenue_instance__ds__month AS revenue_instance__ds__month
+ , subq_10.revenue_instance__ds__quarter AS revenue_instance__ds__quarter
+ , subq_10.revenue_instance__ds__year AS revenue_instance__ds__year
+ , subq_10.revenue_instance__ds__extract_year AS revenue_instance__ds__extract_year
+ , subq_10.revenue_instance__ds__extract_quarter AS revenue_instance__ds__extract_quarter
+ , subq_10.revenue_instance__ds__extract_month AS revenue_instance__ds__extract_month
+ , subq_10.revenue_instance__ds__extract_day AS revenue_instance__ds__extract_day
+ , subq_10.revenue_instance__ds__extract_dow AS revenue_instance__ds__extract_dow
+ , subq_10.revenue_instance__ds__extract_doy AS revenue_instance__ds__extract_doy
+ , subq_10.metric_time__day AS metric_time__day
+ , subq_10.metric_time__week AS metric_time__week
+ , subq_10.metric_time__month AS metric_time__month
+ , subq_10.metric_time__quarter AS metric_time__quarter
+ , subq_10.metric_time__year AS metric_time__year
+ , subq_10.metric_time__extract_year AS metric_time__extract_year
+ , subq_10.metric_time__extract_quarter AS metric_time__extract_quarter
+ , subq_10.metric_time__extract_month AS metric_time__extract_month
+ , subq_10.metric_time__extract_day AS metric_time__extract_day
+ , subq_10.metric_time__extract_dow AS metric_time__extract_dow
+ , subq_10.metric_time__extract_doy AS metric_time__extract_doy
+ , subq_10.user AS user
+ , subq_10.revenue_instance__user AS revenue_instance__user
+ , subq_10.txn_revenue AS txn_revenue
FROM (
-- Time Spine
SELECT
- subq_3.ds AS revenue_instance__ds__day
- FROM ***************************.mf_time_spine subq_3
- ) subq_2
+ subq_12.ds AS revenue_instance__ds__day
+ FROM ***************************.mf_time_spine subq_12
+ ) subq_11
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.revenue_instance__ds__day
- , subq_0.revenue_instance__ds__week
- , subq_0.revenue_instance__ds__month
- , subq_0.revenue_instance__ds__quarter
- , subq_0.revenue_instance__ds__year
- , subq_0.revenue_instance__ds__extract_year
- , subq_0.revenue_instance__ds__extract_quarter
- , subq_0.revenue_instance__ds__extract_month
- , subq_0.revenue_instance__ds__extract_day
- , subq_0.revenue_instance__ds__extract_dow
- , subq_0.revenue_instance__ds__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.user
- , subq_0.revenue_instance__user
- , subq_0.txn_revenue
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.revenue_instance__ds__day
+ , subq_9.revenue_instance__ds__week
+ , subq_9.revenue_instance__ds__month
+ , subq_9.revenue_instance__ds__quarter
+ , subq_9.revenue_instance__ds__year
+ , subq_9.revenue_instance__ds__extract_year
+ , subq_9.revenue_instance__ds__extract_quarter
+ , subq_9.revenue_instance__ds__extract_month
+ , subq_9.revenue_instance__ds__extract_day
+ , subq_9.revenue_instance__ds__extract_dow
+ , subq_9.revenue_instance__ds__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.user
+ , subq_9.revenue_instance__user
+ , subq_9.txn_revenue
FROM (
-- Read Elements From Semantic Model 'revenue'
SELECT
- revenue_src_28007.revenue AS txn_revenue
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day
- , EXTRACT(isodow FROM revenue_src_28007.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day
- , EXTRACT(isodow FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy
- , revenue_src_28007.user_id AS user
- , revenue_src_28007.user_id AS revenue_instance__user
- FROM ***************************.fct_revenue revenue_src_28007
- ) subq_0
- ) subq_1
+ revenue_src_28000.revenue AS txn_revenue
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , EXTRACT(isodow FROM revenue_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS revenue_instance__ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS revenue_instance__ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS revenue_instance__ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS revenue_instance__ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , EXTRACT(day FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_day
+ , EXTRACT(isodow FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_doy
+ , revenue_src_28000.user_id AS user
+ , revenue_src_28000.user_id AS revenue_instance__user
+ FROM ***************************.fct_revenue revenue_src_28000
+ ) subq_9
+ ) subq_10
ON
(
- subq_1.revenue_instance__ds__day <= subq_2.revenue_instance__ds__day
+ subq_10.revenue_instance__ds__day <= subq_11.revenue_instance__ds__day
) AND (
- subq_1.revenue_instance__ds__day > subq_2.revenue_instance__ds__day - INTERVAL 2 month
+ subq_10.revenue_instance__ds__day > subq_11.revenue_instance__ds__day - INTERVAL 2 month
)
- ) subq_4
- ) subq_5
+ ) subq_13
+ ) subq_14
GROUP BY
- subq_5.revenue_instance__ds__day
-) subq_6
+ subq_14.revenue_instance__ds__day
+) subq_15
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_with_agg_time_dimension__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_with_agg_time_dimension__plan0_optimized.sql
index 2cfdd396a1..4bca1960c0 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_with_agg_time_dimension__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_with_agg_time_dimension__plan0_optimized.sql
@@ -3,16 +3,16 @@
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_10.ds AS revenue_instance__ds__day
- , SUM(revenue_src_28007.revenue) AS trailing_2_months_revenue
-FROM ***************************.mf_time_spine subq_10
+ subq_19.ds AS revenue_instance__ds__day
+ , SUM(revenue_src_28000.revenue) AS trailing_2_months_revenue
+FROM ***************************.mf_time_spine subq_19
INNER JOIN
- ***************************.fct_revenue revenue_src_28007
+ ***************************.fct_revenue revenue_src_28000
ON
(
- DATE_TRUNC('day', revenue_src_28007.created_at) <= subq_10.ds
+ DATE_TRUNC('day', revenue_src_28000.created_at) <= subq_19.ds
) AND (
- DATE_TRUNC('day', revenue_src_28007.created_at) > subq_10.ds - INTERVAL 2 month
+ DATE_TRUNC('day', revenue_src_28000.created_at) > subq_19.ds - INTERVAL 2 month
)
GROUP BY
- subq_10.ds
+ subq_19.ds
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_with_non_adjustable_time_filter__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_with_non_adjustable_time_filter__plan0.sql
index 632c06ae57..04c746e295 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_with_non_adjustable_time_filter__plan0.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_with_non_adjustable_time_filter__plan0.sql
@@ -1,334 +1,334 @@
-- Compute Metrics via Expressions
SELECT
- subq_7.metric_time__day
- , subq_7.bookers AS every_two_days_bookers
+ subq_16.metric_time__day
+ , subq_16.bookers AS every_two_days_bookers
FROM (
-- Aggregate Measures
SELECT
- subq_6.metric_time__day
- , COUNT(DISTINCT subq_6.bookers) AS bookers
+ subq_15.metric_time__day
+ , COUNT(DISTINCT subq_15.bookers) AS bookers
FROM (
-- Constrain Output with WHERE
SELECT
- subq_5.metric_time__day
- , subq_5.bookers
+ subq_14.metric_time__day
+ , subq_14.bookers
FROM (
-- Pass Only Elements: ['bookers', 'metric_time__day']
SELECT
- subq_4.metric_time__day
- , subq_4.bookers
+ subq_13.metric_time__day
+ , subq_13.bookers
FROM (
-- Join Self Over Time Range
SELECT
- subq_2.metric_time__day AS metric_time__day
- , subq_1.ds__day AS ds__day
- , subq_1.ds__week AS ds__week
- , subq_1.ds__month AS ds__month
- , subq_1.ds__quarter AS ds__quarter
- , subq_1.ds__year AS ds__year
- , subq_1.ds__extract_year AS ds__extract_year
- , subq_1.ds__extract_quarter AS ds__extract_quarter
- , subq_1.ds__extract_month AS ds__extract_month
- , subq_1.ds__extract_day AS ds__extract_day
- , subq_1.ds__extract_dow AS ds__extract_dow
- , subq_1.ds__extract_doy AS ds__extract_doy
- , subq_1.ds_partitioned__day AS ds_partitioned__day
- , subq_1.ds_partitioned__week AS ds_partitioned__week
- , subq_1.ds_partitioned__month AS ds_partitioned__month
- , subq_1.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_1.ds_partitioned__year AS ds_partitioned__year
- , subq_1.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_1.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_1.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_1.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_1.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_1.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_1.paid_at__day AS paid_at__day
- , subq_1.paid_at__week AS paid_at__week
- , subq_1.paid_at__month AS paid_at__month
- , subq_1.paid_at__quarter AS paid_at__quarter
- , subq_1.paid_at__year AS paid_at__year
- , subq_1.paid_at__extract_year AS paid_at__extract_year
- , subq_1.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_1.paid_at__extract_month AS paid_at__extract_month
- , subq_1.paid_at__extract_day AS paid_at__extract_day
- , subq_1.paid_at__extract_dow AS paid_at__extract_dow
- , subq_1.paid_at__extract_doy AS paid_at__extract_doy
- , subq_1.booking__ds__day AS booking__ds__day
- , subq_1.booking__ds__week AS booking__ds__week
- , subq_1.booking__ds__month AS booking__ds__month
- , subq_1.booking__ds__quarter AS booking__ds__quarter
- , subq_1.booking__ds__year AS booking__ds__year
- , subq_1.booking__ds__extract_year AS booking__ds__extract_year
- , subq_1.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_1.booking__ds__extract_month AS booking__ds__extract_month
- , subq_1.booking__ds__extract_day AS booking__ds__extract_day
- , subq_1.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_1.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_1.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_1.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_1.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_1.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_1.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_1.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_1.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_1.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_1.booking__paid_at__day AS booking__paid_at__day
- , subq_1.booking__paid_at__week AS booking__paid_at__week
- , subq_1.booking__paid_at__month AS booking__paid_at__month
- , subq_1.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_1.booking__paid_at__year AS booking__paid_at__year
- , subq_1.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_1.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_1.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_1.metric_time__week AS metric_time__week
- , subq_1.metric_time__month AS metric_time__month
- , subq_1.metric_time__quarter AS metric_time__quarter
- , subq_1.metric_time__year AS metric_time__year
- , subq_1.metric_time__extract_year AS metric_time__extract_year
- , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter
- , subq_1.metric_time__extract_month AS metric_time__extract_month
- , subq_1.metric_time__extract_day AS metric_time__extract_day
- , subq_1.metric_time__extract_dow AS metric_time__extract_dow
- , subq_1.metric_time__extract_doy AS metric_time__extract_doy
- , subq_1.listing AS listing
- , subq_1.guest AS guest
- , subq_1.host AS host
- , subq_1.booking__listing AS booking__listing
- , subq_1.booking__guest AS booking__guest
- , subq_1.booking__host AS booking__host
- , subq_1.is_instant AS is_instant
- , subq_1.booking__is_instant AS booking__is_instant
- , subq_1.bookings AS bookings
- , subq_1.instant_bookings AS instant_bookings
- , subq_1.booking_value AS booking_value
- , subq_1.max_booking_value AS max_booking_value
- , subq_1.min_booking_value AS min_booking_value
- , subq_1.bookers AS bookers
- , subq_1.average_booking_value AS average_booking_value
- , subq_1.referred_bookings AS referred_bookings
- , subq_1.median_booking_value AS median_booking_value
- , subq_1.booking_value_p99 AS booking_value_p99
- , subq_1.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_1.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_1.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ subq_11.metric_time__day AS metric_time__day
+ , subq_10.ds__day AS ds__day
+ , subq_10.ds__week AS ds__week
+ , subq_10.ds__month AS ds__month
+ , subq_10.ds__quarter AS ds__quarter
+ , subq_10.ds__year AS ds__year
+ , subq_10.ds__extract_year AS ds__extract_year
+ , subq_10.ds__extract_quarter AS ds__extract_quarter
+ , subq_10.ds__extract_month AS ds__extract_month
+ , subq_10.ds__extract_day AS ds__extract_day
+ , subq_10.ds__extract_dow AS ds__extract_dow
+ , subq_10.ds__extract_doy AS ds__extract_doy
+ , subq_10.ds_partitioned__day AS ds_partitioned__day
+ , subq_10.ds_partitioned__week AS ds_partitioned__week
+ , subq_10.ds_partitioned__month AS ds_partitioned__month
+ , subq_10.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_10.ds_partitioned__year AS ds_partitioned__year
+ , subq_10.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_10.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_10.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_10.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_10.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_10.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_10.paid_at__day AS paid_at__day
+ , subq_10.paid_at__week AS paid_at__week
+ , subq_10.paid_at__month AS paid_at__month
+ , subq_10.paid_at__quarter AS paid_at__quarter
+ , subq_10.paid_at__year AS paid_at__year
+ , subq_10.paid_at__extract_year AS paid_at__extract_year
+ , subq_10.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_10.paid_at__extract_month AS paid_at__extract_month
+ , subq_10.paid_at__extract_day AS paid_at__extract_day
+ , subq_10.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_10.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_10.booking__ds__day AS booking__ds__day
+ , subq_10.booking__ds__week AS booking__ds__week
+ , subq_10.booking__ds__month AS booking__ds__month
+ , subq_10.booking__ds__quarter AS booking__ds__quarter
+ , subq_10.booking__ds__year AS booking__ds__year
+ , subq_10.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_10.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_10.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_10.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_10.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_10.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_10.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_10.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_10.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_10.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_10.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_10.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_10.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_10.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_10.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_10.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_10.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_10.booking__paid_at__day AS booking__paid_at__day
+ , subq_10.booking__paid_at__week AS booking__paid_at__week
+ , subq_10.booking__paid_at__month AS booking__paid_at__month
+ , subq_10.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_10.booking__paid_at__year AS booking__paid_at__year
+ , subq_10.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_10.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_10.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_10.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_10.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_10.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_10.metric_time__week AS metric_time__week
+ , subq_10.metric_time__month AS metric_time__month
+ , subq_10.metric_time__quarter AS metric_time__quarter
+ , subq_10.metric_time__year AS metric_time__year
+ , subq_10.metric_time__extract_year AS metric_time__extract_year
+ , subq_10.metric_time__extract_quarter AS metric_time__extract_quarter
+ , subq_10.metric_time__extract_month AS metric_time__extract_month
+ , subq_10.metric_time__extract_day AS metric_time__extract_day
+ , subq_10.metric_time__extract_dow AS metric_time__extract_dow
+ , subq_10.metric_time__extract_doy AS metric_time__extract_doy
+ , subq_10.listing AS listing
+ , subq_10.guest AS guest
+ , subq_10.host AS host
+ , subq_10.booking__listing AS booking__listing
+ , subq_10.booking__guest AS booking__guest
+ , subq_10.booking__host AS booking__host
+ , subq_10.is_instant AS is_instant
+ , subq_10.booking__is_instant AS booking__is_instant
+ , subq_10.bookings AS bookings
+ , subq_10.instant_bookings AS instant_bookings
+ , subq_10.booking_value AS booking_value
+ , subq_10.max_booking_value AS max_booking_value
+ , subq_10.min_booking_value AS min_booking_value
+ , subq_10.bookers AS bookers
+ , subq_10.average_booking_value AS average_booking_value
+ , subq_10.referred_bookings AS referred_bookings
+ , subq_10.median_booking_value AS median_booking_value
+ , subq_10.booking_value_p99 AS booking_value_p99
+ , subq_10.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_10.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_10.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_3.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_3
- ) subq_2
+ subq_12.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_12
+ ) subq_11
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
ON
(
- subq_1.metric_time__day <= subq_2.metric_time__day
+ subq_10.metric_time__day <= subq_11.metric_time__day
) AND (
- subq_1.metric_time__day > subq_2.metric_time__day - INTERVAL 2 day
+ subq_10.metric_time__day > subq_11.metric_time__day - INTERVAL 2 day
)
- ) subq_4
- ) subq_5
+ ) subq_13
+ ) subq_14
WHERE metric_time__day = '2020-01-03' or metric_time__day = '2020-01-07'
- ) subq_6
+ ) subq_15
GROUP BY
- subq_6.metric_time__day
-) subq_7
+ subq_15.metric_time__day
+) subq_16
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_with_non_adjustable_time_filter__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_with_non_adjustable_time_filter__plan0_optimized.sql
index 3f6c0bd9d5..100da0421a 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_with_non_adjustable_time_filter__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_with_non_adjustable_time_filter__plan0_optimized.sql
@@ -8,18 +8,18 @@ FROM (
-- Join Self Over Time Range
-- Pass Only Elements: ['bookers', 'metric_time__day']
SELECT
- subq_11.ds AS metric_time__day
- , bookings_source_src_28001.guest_id AS bookers
- FROM ***************************.mf_time_spine subq_11
+ subq_20.ds AS metric_time__day
+ , bookings_source_src_28000.guest_id AS bookers
+ FROM ***************************.mf_time_spine subq_20
INNER JOIN
- ***************************.fct_bookings bookings_source_src_28001
+ ***************************.fct_bookings bookings_source_src_28000
ON
(
- DATE_TRUNC('day', bookings_source_src_28001.ds) <= subq_11.ds
+ DATE_TRUNC('day', bookings_source_src_28000.ds) <= subq_20.ds
) AND (
- DATE_TRUNC('day', bookings_source_src_28001.ds) > subq_11.ds - INTERVAL 2 day
+ DATE_TRUNC('day', bookings_source_src_28000.ds) > subq_20.ds - INTERVAL 2 day
)
-) subq_13
+) subq_22
WHERE metric_time__day = '2020-01-03' or metric_time__day = '2020-01-07'
GROUP BY
metric_time__day
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_with_time_constraint__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_with_time_constraint__plan0.sql
index 34b9e71355..f48ab7491e 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_with_time_constraint__plan0.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_with_time_constraint__plan0.sql
@@ -1,189 +1,189 @@
-- Compute Metrics via Expressions
SELECT
- subq_8.metric_time__day
- , subq_8.txn_revenue AS trailing_2_months_revenue
+ subq_19.metric_time__day
+ , subq_19.txn_revenue AS trailing_2_months_revenue
FROM (
-- Aggregate Measures
SELECT
- subq_7.metric_time__day
- , SUM(subq_7.txn_revenue) AS txn_revenue
+ subq_18.metric_time__day
+ , SUM(subq_18.txn_revenue) AS txn_revenue
FROM (
-- Constrain Time Range to [2020-01-01T00:00:00, 2020-01-01T00:00:00]
SELECT
- subq_6.metric_time__day
- , subq_6.txn_revenue
+ subq_17.metric_time__day
+ , subq_17.txn_revenue
FROM (
-- Pass Only Elements: ['txn_revenue', 'metric_time__day']
SELECT
- subq_5.metric_time__day
- , subq_5.txn_revenue
+ subq_16.metric_time__day
+ , subq_16.txn_revenue
FROM (
-- Join Self Over Time Range
SELECT
- subq_3.metric_time__day AS metric_time__day
- , subq_2.ds__day AS ds__day
- , subq_2.ds__week AS ds__week
- , subq_2.ds__month AS ds__month
- , subq_2.ds__quarter AS ds__quarter
- , subq_2.ds__year AS ds__year
- , subq_2.ds__extract_year AS ds__extract_year
- , subq_2.ds__extract_quarter AS ds__extract_quarter
- , subq_2.ds__extract_month AS ds__extract_month
- , subq_2.ds__extract_day AS ds__extract_day
- , subq_2.ds__extract_dow AS ds__extract_dow
- , subq_2.ds__extract_doy AS ds__extract_doy
- , subq_2.revenue_instance__ds__day AS revenue_instance__ds__day
- , subq_2.revenue_instance__ds__week AS revenue_instance__ds__week
- , subq_2.revenue_instance__ds__month AS revenue_instance__ds__month
- , subq_2.revenue_instance__ds__quarter AS revenue_instance__ds__quarter
- , subq_2.revenue_instance__ds__year AS revenue_instance__ds__year
- , subq_2.revenue_instance__ds__extract_year AS revenue_instance__ds__extract_year
- , subq_2.revenue_instance__ds__extract_quarter AS revenue_instance__ds__extract_quarter
- , subq_2.revenue_instance__ds__extract_month AS revenue_instance__ds__extract_month
- , subq_2.revenue_instance__ds__extract_day AS revenue_instance__ds__extract_day
- , subq_2.revenue_instance__ds__extract_dow AS revenue_instance__ds__extract_dow
- , subq_2.revenue_instance__ds__extract_doy AS revenue_instance__ds__extract_doy
- , subq_2.metric_time__week AS metric_time__week
- , subq_2.metric_time__month AS metric_time__month
- , subq_2.metric_time__quarter AS metric_time__quarter
- , subq_2.metric_time__year AS metric_time__year
- , subq_2.metric_time__extract_year AS metric_time__extract_year
- , subq_2.metric_time__extract_quarter AS metric_time__extract_quarter
- , subq_2.metric_time__extract_month AS metric_time__extract_month
- , subq_2.metric_time__extract_day AS metric_time__extract_day
- , subq_2.metric_time__extract_dow AS metric_time__extract_dow
- , subq_2.metric_time__extract_doy AS metric_time__extract_doy
- , subq_2.user AS user
- , subq_2.revenue_instance__user AS revenue_instance__user
- , subq_2.txn_revenue AS txn_revenue
+ subq_14.metric_time__day AS metric_time__day
+ , subq_13.ds__day AS ds__day
+ , subq_13.ds__week AS ds__week
+ , subq_13.ds__month AS ds__month
+ , subq_13.ds__quarter AS ds__quarter
+ , subq_13.ds__year AS ds__year
+ , subq_13.ds__extract_year AS ds__extract_year
+ , subq_13.ds__extract_quarter AS ds__extract_quarter
+ , subq_13.ds__extract_month AS ds__extract_month
+ , subq_13.ds__extract_day AS ds__extract_day
+ , subq_13.ds__extract_dow AS ds__extract_dow
+ , subq_13.ds__extract_doy AS ds__extract_doy
+ , subq_13.revenue_instance__ds__day AS revenue_instance__ds__day
+ , subq_13.revenue_instance__ds__week AS revenue_instance__ds__week
+ , subq_13.revenue_instance__ds__month AS revenue_instance__ds__month
+ , subq_13.revenue_instance__ds__quarter AS revenue_instance__ds__quarter
+ , subq_13.revenue_instance__ds__year AS revenue_instance__ds__year
+ , subq_13.revenue_instance__ds__extract_year AS revenue_instance__ds__extract_year
+ , subq_13.revenue_instance__ds__extract_quarter AS revenue_instance__ds__extract_quarter
+ , subq_13.revenue_instance__ds__extract_month AS revenue_instance__ds__extract_month
+ , subq_13.revenue_instance__ds__extract_day AS revenue_instance__ds__extract_day
+ , subq_13.revenue_instance__ds__extract_dow AS revenue_instance__ds__extract_dow
+ , subq_13.revenue_instance__ds__extract_doy AS revenue_instance__ds__extract_doy
+ , subq_13.metric_time__week AS metric_time__week
+ , subq_13.metric_time__month AS metric_time__month
+ , subq_13.metric_time__quarter AS metric_time__quarter
+ , subq_13.metric_time__year AS metric_time__year
+ , subq_13.metric_time__extract_year AS metric_time__extract_year
+ , subq_13.metric_time__extract_quarter AS metric_time__extract_quarter
+ , subq_13.metric_time__extract_month AS metric_time__extract_month
+ , subq_13.metric_time__extract_day AS metric_time__extract_day
+ , subq_13.metric_time__extract_dow AS metric_time__extract_dow
+ , subq_13.metric_time__extract_doy AS metric_time__extract_doy
+ , subq_13.user AS user
+ , subq_13.revenue_instance__user AS revenue_instance__user
+ , subq_13.txn_revenue AS txn_revenue
FROM (
-- Time Spine
SELECT
- subq_4.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_4
- WHERE subq_4.ds BETWEEN '2020-01-01' AND '2020-01-01'
- ) subq_3
+ subq_15.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_15
+ WHERE subq_15.ds BETWEEN '2020-01-01' AND '2020-01-01'
+ ) subq_14
INNER JOIN (
-- Constrain Time Range to [2019-11-01T00:00:00, 2020-01-01T00:00:00]
SELECT
- subq_1.ds__day
- , subq_1.ds__week
- , subq_1.ds__month
- , subq_1.ds__quarter
- , subq_1.ds__year
- , subq_1.ds__extract_year
- , subq_1.ds__extract_quarter
- , subq_1.ds__extract_month
- , subq_1.ds__extract_day
- , subq_1.ds__extract_dow
- , subq_1.ds__extract_doy
- , subq_1.revenue_instance__ds__day
- , subq_1.revenue_instance__ds__week
- , subq_1.revenue_instance__ds__month
- , subq_1.revenue_instance__ds__quarter
- , subq_1.revenue_instance__ds__year
- , subq_1.revenue_instance__ds__extract_year
- , subq_1.revenue_instance__ds__extract_quarter
- , subq_1.revenue_instance__ds__extract_month
- , subq_1.revenue_instance__ds__extract_day
- , subq_1.revenue_instance__ds__extract_dow
- , subq_1.revenue_instance__ds__extract_doy
- , subq_1.metric_time__day
- , subq_1.metric_time__week
- , subq_1.metric_time__month
- , subq_1.metric_time__quarter
- , subq_1.metric_time__year
- , subq_1.metric_time__extract_year
- , subq_1.metric_time__extract_quarter
- , subq_1.metric_time__extract_month
- , subq_1.metric_time__extract_day
- , subq_1.metric_time__extract_dow
- , subq_1.metric_time__extract_doy
- , subq_1.user
- , subq_1.revenue_instance__user
- , subq_1.txn_revenue
+ subq_12.ds__day
+ , subq_12.ds__week
+ , subq_12.ds__month
+ , subq_12.ds__quarter
+ , subq_12.ds__year
+ , subq_12.ds__extract_year
+ , subq_12.ds__extract_quarter
+ , subq_12.ds__extract_month
+ , subq_12.ds__extract_day
+ , subq_12.ds__extract_dow
+ , subq_12.ds__extract_doy
+ , subq_12.revenue_instance__ds__day
+ , subq_12.revenue_instance__ds__week
+ , subq_12.revenue_instance__ds__month
+ , subq_12.revenue_instance__ds__quarter
+ , subq_12.revenue_instance__ds__year
+ , subq_12.revenue_instance__ds__extract_year
+ , subq_12.revenue_instance__ds__extract_quarter
+ , subq_12.revenue_instance__ds__extract_month
+ , subq_12.revenue_instance__ds__extract_day
+ , subq_12.revenue_instance__ds__extract_dow
+ , subq_12.revenue_instance__ds__extract_doy
+ , subq_12.metric_time__day
+ , subq_12.metric_time__week
+ , subq_12.metric_time__month
+ , subq_12.metric_time__quarter
+ , subq_12.metric_time__year
+ , subq_12.metric_time__extract_year
+ , subq_12.metric_time__extract_quarter
+ , subq_12.metric_time__extract_month
+ , subq_12.metric_time__extract_day
+ , subq_12.metric_time__extract_dow
+ , subq_12.metric_time__extract_doy
+ , subq_12.user
+ , subq_12.revenue_instance__user
+ , subq_12.txn_revenue
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.revenue_instance__ds__day
- , subq_0.revenue_instance__ds__week
- , subq_0.revenue_instance__ds__month
- , subq_0.revenue_instance__ds__quarter
- , subq_0.revenue_instance__ds__year
- , subq_0.revenue_instance__ds__extract_year
- , subq_0.revenue_instance__ds__extract_quarter
- , subq_0.revenue_instance__ds__extract_month
- , subq_0.revenue_instance__ds__extract_day
- , subq_0.revenue_instance__ds__extract_dow
- , subq_0.revenue_instance__ds__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.user
- , subq_0.revenue_instance__user
- , subq_0.txn_revenue
+ subq_11.ds__day
+ , subq_11.ds__week
+ , subq_11.ds__month
+ , subq_11.ds__quarter
+ , subq_11.ds__year
+ , subq_11.ds__extract_year
+ , subq_11.ds__extract_quarter
+ , subq_11.ds__extract_month
+ , subq_11.ds__extract_day
+ , subq_11.ds__extract_dow
+ , subq_11.ds__extract_doy
+ , subq_11.revenue_instance__ds__day
+ , subq_11.revenue_instance__ds__week
+ , subq_11.revenue_instance__ds__month
+ , subq_11.revenue_instance__ds__quarter
+ , subq_11.revenue_instance__ds__year
+ , subq_11.revenue_instance__ds__extract_year
+ , subq_11.revenue_instance__ds__extract_quarter
+ , subq_11.revenue_instance__ds__extract_month
+ , subq_11.revenue_instance__ds__extract_day
+ , subq_11.revenue_instance__ds__extract_dow
+ , subq_11.revenue_instance__ds__extract_doy
+ , subq_11.ds__day AS metric_time__day
+ , subq_11.ds__week AS metric_time__week
+ , subq_11.ds__month AS metric_time__month
+ , subq_11.ds__quarter AS metric_time__quarter
+ , subq_11.ds__year AS metric_time__year
+ , subq_11.ds__extract_year AS metric_time__extract_year
+ , subq_11.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_11.ds__extract_month AS metric_time__extract_month
+ , subq_11.ds__extract_day AS metric_time__extract_day
+ , subq_11.ds__extract_dow AS metric_time__extract_dow
+ , subq_11.ds__extract_doy AS metric_time__extract_doy
+ , subq_11.user
+ , subq_11.revenue_instance__user
+ , subq_11.txn_revenue
FROM (
-- Read Elements From Semantic Model 'revenue'
SELECT
- revenue_src_28007.revenue AS txn_revenue
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day
- , EXTRACT(isodow FROM revenue_src_28007.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day
- , EXTRACT(isodow FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy
- , revenue_src_28007.user_id AS user
- , revenue_src_28007.user_id AS revenue_instance__user
- FROM ***************************.fct_revenue revenue_src_28007
- ) subq_0
- ) subq_1
- WHERE subq_1.metric_time__day BETWEEN '2019-11-01' AND '2020-01-01'
- ) subq_2
+ revenue_src_28000.revenue AS txn_revenue
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , EXTRACT(isodow FROM revenue_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS revenue_instance__ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS revenue_instance__ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS revenue_instance__ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS revenue_instance__ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , EXTRACT(day FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_day
+ , EXTRACT(isodow FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_doy
+ , revenue_src_28000.user_id AS user
+ , revenue_src_28000.user_id AS revenue_instance__user
+ FROM ***************************.fct_revenue revenue_src_28000
+ ) subq_11
+ ) subq_12
+ WHERE subq_12.metric_time__day BETWEEN '2019-11-01' AND '2020-01-01'
+ ) subq_13
ON
(
- subq_2.metric_time__day <= subq_3.metric_time__day
+ subq_13.metric_time__day <= subq_14.metric_time__day
) AND (
- subq_2.metric_time__day > subq_3.metric_time__day - INTERVAL 2 month
+ subq_13.metric_time__day > subq_14.metric_time__day - INTERVAL 2 month
)
- ) subq_5
- ) subq_6
- WHERE subq_6.metric_time__day BETWEEN '2020-01-01' AND '2020-01-01'
- ) subq_7
+ ) subq_16
+ ) subq_17
+ WHERE subq_17.metric_time__day BETWEEN '2020-01-01' AND '2020-01-01'
+ ) subq_18
GROUP BY
- subq_7.metric_time__day
-) subq_8
+ subq_18.metric_time__day
+) subq_19
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_with_time_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_with_time_constraint__plan0_optimized.sql
index 1063445e46..745a4be4aa 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_with_time_constraint__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_metric_with_time_constraint__plan0_optimized.sql
@@ -4,15 +4,15 @@
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_12.metric_time__day AS metric_time__day
- , SUM(subq_11.txn_revenue) AS trailing_2_months_revenue
+ subq_23.metric_time__day AS metric_time__day
+ , SUM(subq_22.txn_revenue) AS trailing_2_months_revenue
FROM (
-- Time Spine
SELECT
ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_13
+ FROM ***************************.mf_time_spine subq_24
WHERE ds BETWEEN '2020-01-01' AND '2020-01-01'
-) subq_12
+) subq_23
INNER JOIN (
-- Read Elements From Semantic Model 'revenue'
-- Metric Time Dimension 'ds'
@@ -20,15 +20,15 @@ INNER JOIN (
SELECT
DATE_TRUNC('day', created_at) AS metric_time__day
, revenue AS txn_revenue
- FROM ***************************.fct_revenue revenue_src_28007
+ FROM ***************************.fct_revenue revenue_src_28000
WHERE DATE_TRUNC('day', created_at) BETWEEN '2019-11-01' AND '2020-01-01'
-) subq_11
+) subq_22
ON
(
- subq_11.metric_time__day <= subq_12.metric_time__day
+ subq_22.metric_time__day <= subq_23.metric_time__day
) AND (
- subq_11.metric_time__day > subq_12.metric_time__day - INTERVAL 2 month
+ subq_22.metric_time__day > subq_23.metric_time__day - INTERVAL 2 month
)
-WHERE subq_12.metric_time__day BETWEEN '2020-01-01' AND '2020-01-01'
+WHERE subq_23.metric_time__day BETWEEN '2020-01-01' AND '2020-01-01'
GROUP BY
- subq_12.metric_time__day
+ subq_23.metric_time__day
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric__plan0.sql
index a19c35420a..7b75ca51c5 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric__plan0.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric__plan0.sql
@@ -1,88 +1,88 @@
-- Compute Metrics via Expressions
SELECT
- subq_3.ds__day
- , subq_3.txn_revenue AS trailing_2_months_revenue
+ subq_12.ds__day
+ , subq_12.txn_revenue AS trailing_2_months_revenue
FROM (
-- Aggregate Measures
SELECT
- subq_2.ds__day
- , SUM(subq_2.txn_revenue) AS txn_revenue
+ subq_11.ds__day
+ , SUM(subq_11.txn_revenue) AS txn_revenue
FROM (
-- Pass Only Elements: ['txn_revenue', 'ds__day']
SELECT
- subq_1.ds__day
- , subq_1.txn_revenue
+ subq_10.ds__day
+ , subq_10.txn_revenue
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.revenue_instance__ds__day
- , subq_0.revenue_instance__ds__week
- , subq_0.revenue_instance__ds__month
- , subq_0.revenue_instance__ds__quarter
- , subq_0.revenue_instance__ds__year
- , subq_0.revenue_instance__ds__extract_year
- , subq_0.revenue_instance__ds__extract_quarter
- , subq_0.revenue_instance__ds__extract_month
- , subq_0.revenue_instance__ds__extract_day
- , subq_0.revenue_instance__ds__extract_dow
- , subq_0.revenue_instance__ds__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.user
- , subq_0.revenue_instance__user
- , subq_0.txn_revenue
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.revenue_instance__ds__day
+ , subq_9.revenue_instance__ds__week
+ , subq_9.revenue_instance__ds__month
+ , subq_9.revenue_instance__ds__quarter
+ , subq_9.revenue_instance__ds__year
+ , subq_9.revenue_instance__ds__extract_year
+ , subq_9.revenue_instance__ds__extract_quarter
+ , subq_9.revenue_instance__ds__extract_month
+ , subq_9.revenue_instance__ds__extract_day
+ , subq_9.revenue_instance__ds__extract_dow
+ , subq_9.revenue_instance__ds__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.user
+ , subq_9.revenue_instance__user
+ , subq_9.txn_revenue
FROM (
-- Read Elements From Semantic Model 'revenue'
SELECT
- revenue_src_28007.revenue AS txn_revenue
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day
- , EXTRACT(isodow FROM revenue_src_28007.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day
- , EXTRACT(isodow FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy
- , revenue_src_28007.user_id AS user
- , revenue_src_28007.user_id AS revenue_instance__user
- FROM ***************************.fct_revenue revenue_src_28007
- ) subq_0
- ) subq_1
- ) subq_2
+ revenue_src_28000.revenue AS txn_revenue
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , EXTRACT(isodow FROM revenue_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS revenue_instance__ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS revenue_instance__ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS revenue_instance__ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS revenue_instance__ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , EXTRACT(day FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_day
+ , EXTRACT(isodow FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_doy
+ , revenue_src_28000.user_id AS user
+ , revenue_src_28000.user_id AS revenue_instance__user
+ FROM ***************************.fct_revenue revenue_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
GROUP BY
- subq_2.ds__day
-) subq_3
+ subq_11.ds__day
+) subq_12
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric__plan0_optimized.sql
index 749250c230..76e8f3252a 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric__plan0_optimized.sql
@@ -6,6 +6,6 @@
SELECT
DATE_TRUNC('day', created_at) AS ds__day
, SUM(revenue) AS trailing_2_months_revenue
-FROM ***************************.fct_revenue revenue_src_28007
+FROM ***************************.fct_revenue revenue_src_28000
GROUP BY
DATE_TRUNC('day', created_at)
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_grain_to_date__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_grain_to_date__plan0.sql
index af8623a007..a3900c0466 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_grain_to_date__plan0.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_grain_to_date__plan0.sql
@@ -1,88 +1,88 @@
-- Compute Metrics via Expressions
SELECT
- subq_3.ds__month
- , subq_3.txn_revenue AS revenue_mtd
+ subq_12.ds__month
+ , subq_12.txn_revenue AS revenue_mtd
FROM (
-- Aggregate Measures
SELECT
- subq_2.ds__month
- , SUM(subq_2.txn_revenue) AS txn_revenue
+ subq_11.ds__month
+ , SUM(subq_11.txn_revenue) AS txn_revenue
FROM (
-- Pass Only Elements: ['txn_revenue', 'ds__month']
SELECT
- subq_1.ds__month
- , subq_1.txn_revenue
+ subq_10.ds__month
+ , subq_10.txn_revenue
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.revenue_instance__ds__day
- , subq_0.revenue_instance__ds__week
- , subq_0.revenue_instance__ds__month
- , subq_0.revenue_instance__ds__quarter
- , subq_0.revenue_instance__ds__year
- , subq_0.revenue_instance__ds__extract_year
- , subq_0.revenue_instance__ds__extract_quarter
- , subq_0.revenue_instance__ds__extract_month
- , subq_0.revenue_instance__ds__extract_day
- , subq_0.revenue_instance__ds__extract_dow
- , subq_0.revenue_instance__ds__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.user
- , subq_0.revenue_instance__user
- , subq_0.txn_revenue
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.revenue_instance__ds__day
+ , subq_9.revenue_instance__ds__week
+ , subq_9.revenue_instance__ds__month
+ , subq_9.revenue_instance__ds__quarter
+ , subq_9.revenue_instance__ds__year
+ , subq_9.revenue_instance__ds__extract_year
+ , subq_9.revenue_instance__ds__extract_quarter
+ , subq_9.revenue_instance__ds__extract_month
+ , subq_9.revenue_instance__ds__extract_day
+ , subq_9.revenue_instance__ds__extract_dow
+ , subq_9.revenue_instance__ds__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.user
+ , subq_9.revenue_instance__user
+ , subq_9.txn_revenue
FROM (
-- Read Elements From Semantic Model 'revenue'
SELECT
- revenue_src_28007.revenue AS txn_revenue
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day
- , EXTRACT(isodow FROM revenue_src_28007.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day
- , EXTRACT(isodow FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy
- , revenue_src_28007.user_id AS user
- , revenue_src_28007.user_id AS revenue_instance__user
- FROM ***************************.fct_revenue revenue_src_28007
- ) subq_0
- ) subq_1
- ) subq_2
+ revenue_src_28000.revenue AS txn_revenue
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , EXTRACT(isodow FROM revenue_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS revenue_instance__ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS revenue_instance__ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS revenue_instance__ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS revenue_instance__ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , EXTRACT(day FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_day
+ , EXTRACT(isodow FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_doy
+ , revenue_src_28000.user_id AS user
+ , revenue_src_28000.user_id AS revenue_instance__user
+ FROM ***************************.fct_revenue revenue_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
GROUP BY
- subq_2.ds__month
-) subq_3
+ subq_11.ds__month
+) subq_12
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_grain_to_date__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_grain_to_date__plan0_optimized.sql
index 6a6dbce8b9..e057084866 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_grain_to_date__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_grain_to_date__plan0_optimized.sql
@@ -6,6 +6,6 @@
SELECT
DATE_TRUNC('month', created_at) AS ds__month
, SUM(revenue) AS revenue_mtd
-FROM ***************************.fct_revenue revenue_src_28007
+FROM ***************************.fct_revenue revenue_src_28000
GROUP BY
DATE_TRUNC('month', created_at)
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_month__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_month__plan0.sql
index 8c30047781..e3f5faf43c 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_month__plan0.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_month__plan0.sql
@@ -1,103 +1,103 @@
-- Compute Metrics via Expressions
SELECT
- subq_8.metric_time__month
- , subq_8.bookings_monthly AS trailing_3_months_bookings
+ subq_12.metric_time__month
+ , subq_12.bookings_monthly AS trailing_3_months_bookings
FROM (
-- Aggregate Measures
SELECT
- subq_7.metric_time__month
- , SUM(subq_7.bookings_monthly) AS bookings_monthly
+ subq_11.metric_time__month
+ , SUM(subq_11.bookings_monthly) AS bookings_monthly
FROM (
-- Constrain Time Range to [2020-03-05T00:00:00, 2021-01-04T00:00:00]
SELECT
- subq_6.metric_time__month
- , subq_6.bookings_monthly
+ subq_10.metric_time__month
+ , subq_10.bookings_monthly
FROM (
-- Pass Only Elements: ['bookings_monthly', 'metric_time__month']
SELECT
- subq_5.metric_time__month
- , subq_5.bookings_monthly
+ subq_9.metric_time__month
+ , subq_9.bookings_monthly
FROM (
-- Join Self Over Time Range
SELECT
- subq_3.metric_time__month AS metric_time__month
- , subq_2.monthly_ds__month AS monthly_ds__month
- , subq_2.monthly_ds__quarter AS monthly_ds__quarter
- , subq_2.monthly_ds__year AS monthly_ds__year
- , subq_2.monthly_ds__extract_year AS monthly_ds__extract_year
- , subq_2.monthly_ds__extract_quarter AS monthly_ds__extract_quarter
- , subq_2.monthly_ds__extract_month AS monthly_ds__extract_month
- , subq_2.booking__monthly_ds__month AS booking__monthly_ds__month
- , subq_2.booking__monthly_ds__quarter AS booking__monthly_ds__quarter
- , subq_2.booking__monthly_ds__year AS booking__monthly_ds__year
- , subq_2.booking__monthly_ds__extract_year AS booking__monthly_ds__extract_year
- , subq_2.booking__monthly_ds__extract_quarter AS booking__monthly_ds__extract_quarter
- , subq_2.booking__monthly_ds__extract_month AS booking__monthly_ds__extract_month
- , subq_2.metric_time__quarter AS metric_time__quarter
- , subq_2.metric_time__year AS metric_time__year
- , subq_2.metric_time__extract_year AS metric_time__extract_year
- , subq_2.metric_time__extract_quarter AS metric_time__extract_quarter
- , subq_2.metric_time__extract_month AS metric_time__extract_month
- , subq_2.listing AS listing
- , subq_2.booking__listing AS booking__listing
- , subq_2.bookings_monthly AS bookings_monthly
+ subq_7.metric_time__month AS metric_time__month
+ , subq_6.monthly_ds__month AS monthly_ds__month
+ , subq_6.monthly_ds__quarter AS monthly_ds__quarter
+ , subq_6.monthly_ds__year AS monthly_ds__year
+ , subq_6.monthly_ds__extract_year AS monthly_ds__extract_year
+ , subq_6.monthly_ds__extract_quarter AS monthly_ds__extract_quarter
+ , subq_6.monthly_ds__extract_month AS monthly_ds__extract_month
+ , subq_6.booking__monthly_ds__month AS booking__monthly_ds__month
+ , subq_6.booking__monthly_ds__quarter AS booking__monthly_ds__quarter
+ , subq_6.booking__monthly_ds__year AS booking__monthly_ds__year
+ , subq_6.booking__monthly_ds__extract_year AS booking__monthly_ds__extract_year
+ , subq_6.booking__monthly_ds__extract_quarter AS booking__monthly_ds__extract_quarter
+ , subq_6.booking__monthly_ds__extract_month AS booking__monthly_ds__extract_month
+ , subq_6.metric_time__quarter AS metric_time__quarter
+ , subq_6.metric_time__year AS metric_time__year
+ , subq_6.metric_time__extract_year AS metric_time__extract_year
+ , subq_6.metric_time__extract_quarter AS metric_time__extract_quarter
+ , subq_6.metric_time__extract_month AS metric_time__extract_month
+ , subq_6.listing AS listing
+ , subq_6.booking__listing AS booking__listing
+ , subq_6.bookings_monthly AS bookings_monthly
FROM (
-- Time Spine
SELECT
- DATE_TRUNC('month', subq_4.ds) AS metric_time__month
- FROM ***************************.mf_time_spine subq_4
- WHERE subq_4.ds BETWEEN '2020-03-05' AND '2021-01-04'
+ DATE_TRUNC('month', subq_8.ds) AS metric_time__month
+ FROM ***************************.mf_time_spine subq_8
+ WHERE subq_8.ds BETWEEN '2020-03-05' AND '2021-01-04'
GROUP BY
- DATE_TRUNC('month', subq_4.ds)
- ) subq_3
+ DATE_TRUNC('month', subq_8.ds)
+ ) subq_7
INNER JOIN (
-- Constrain Time Range to [2019-12-05T00:00:00, 2021-01-04T00:00:00]
SELECT
- subq_1.monthly_ds__month
- , subq_1.monthly_ds__quarter
- , subq_1.monthly_ds__year
- , subq_1.monthly_ds__extract_year
- , subq_1.monthly_ds__extract_quarter
- , subq_1.monthly_ds__extract_month
- , subq_1.booking__monthly_ds__month
- , subq_1.booking__monthly_ds__quarter
- , subq_1.booking__monthly_ds__year
- , subq_1.booking__monthly_ds__extract_year
- , subq_1.booking__monthly_ds__extract_quarter
- , subq_1.booking__monthly_ds__extract_month
- , subq_1.metric_time__month
- , subq_1.metric_time__quarter
- , subq_1.metric_time__year
- , subq_1.metric_time__extract_year
- , subq_1.metric_time__extract_quarter
- , subq_1.metric_time__extract_month
- , subq_1.listing
- , subq_1.booking__listing
- , subq_1.bookings_monthly
+ subq_5.monthly_ds__month
+ , subq_5.monthly_ds__quarter
+ , subq_5.monthly_ds__year
+ , subq_5.monthly_ds__extract_year
+ , subq_5.monthly_ds__extract_quarter
+ , subq_5.monthly_ds__extract_month
+ , subq_5.booking__monthly_ds__month
+ , subq_5.booking__monthly_ds__quarter
+ , subq_5.booking__monthly_ds__year
+ , subq_5.booking__monthly_ds__extract_year
+ , subq_5.booking__monthly_ds__extract_quarter
+ , subq_5.booking__monthly_ds__extract_month
+ , subq_5.metric_time__month
+ , subq_5.metric_time__quarter
+ , subq_5.metric_time__year
+ , subq_5.metric_time__extract_year
+ , subq_5.metric_time__extract_quarter
+ , subq_5.metric_time__extract_month
+ , subq_5.listing
+ , subq_5.booking__listing
+ , subq_5.bookings_monthly
FROM (
-- Metric Time Dimension 'monthly_ds'
SELECT
- subq_0.monthly_ds__month
- , subq_0.monthly_ds__quarter
- , subq_0.monthly_ds__year
- , subq_0.monthly_ds__extract_year
- , subq_0.monthly_ds__extract_quarter
- , subq_0.monthly_ds__extract_month
- , subq_0.booking__monthly_ds__month
- , subq_0.booking__monthly_ds__quarter
- , subq_0.booking__monthly_ds__year
- , subq_0.booking__monthly_ds__extract_year
- , subq_0.booking__monthly_ds__extract_quarter
- , subq_0.booking__monthly_ds__extract_month
- , subq_0.monthly_ds__month AS metric_time__month
- , subq_0.monthly_ds__quarter AS metric_time__quarter
- , subq_0.monthly_ds__year AS metric_time__year
- , subq_0.monthly_ds__extract_year AS metric_time__extract_year
- , subq_0.monthly_ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.monthly_ds__extract_month AS metric_time__extract_month
- , subq_0.listing
- , subq_0.booking__listing
- , subq_0.bookings_monthly
+ subq_4.monthly_ds__month
+ , subq_4.monthly_ds__quarter
+ , subq_4.monthly_ds__year
+ , subq_4.monthly_ds__extract_year
+ , subq_4.monthly_ds__extract_quarter
+ , subq_4.monthly_ds__extract_month
+ , subq_4.booking__monthly_ds__month
+ , subq_4.booking__monthly_ds__quarter
+ , subq_4.booking__monthly_ds__year
+ , subq_4.booking__monthly_ds__extract_year
+ , subq_4.booking__monthly_ds__extract_quarter
+ , subq_4.booking__monthly_ds__extract_month
+ , subq_4.monthly_ds__month AS metric_time__month
+ , subq_4.monthly_ds__quarter AS metric_time__quarter
+ , subq_4.monthly_ds__year AS metric_time__year
+ , subq_4.monthly_ds__extract_year AS metric_time__extract_year
+ , subq_4.monthly_ds__extract_quarter AS metric_time__extract_quarter
+ , subq_4.monthly_ds__extract_month AS metric_time__extract_month
+ , subq_4.listing
+ , subq_4.booking__listing
+ , subq_4.bookings_monthly
FROM (
-- Read Elements From Semantic Model 'bookings_monthly_source'
SELECT
@@ -117,20 +117,20 @@ FROM (
, bookings_monthly_source_src_16000.listing_id AS listing
, bookings_monthly_source_src_16000.listing_id AS booking__listing
FROM ***************************.fct_bookings_extended_monthly bookings_monthly_source_src_16000
- ) subq_0
- ) subq_1
- WHERE subq_1.metric_time__month BETWEEN '2019-12-05' AND '2021-01-04'
- ) subq_2
+ ) subq_4
+ ) subq_5
+ WHERE subq_5.metric_time__month BETWEEN '2019-12-05' AND '2021-01-04'
+ ) subq_6
ON
(
- subq_2.metric_time__month <= subq_3.metric_time__month
+ subq_6.metric_time__month <= subq_7.metric_time__month
) AND (
- subq_2.metric_time__month > subq_3.metric_time__month - MAKE_INTERVAL(months => 3)
+ subq_6.metric_time__month > subq_7.metric_time__month - MAKE_INTERVAL(months => 3)
)
- ) subq_5
- ) subq_6
- WHERE subq_6.metric_time__month BETWEEN '2020-03-05' AND '2021-01-04'
- ) subq_7
+ ) subq_9
+ ) subq_10
+ WHERE subq_10.metric_time__month BETWEEN '2020-03-05' AND '2021-01-04'
+ ) subq_11
GROUP BY
- subq_7.metric_time__month
-) subq_8
+ subq_11.metric_time__month
+) subq_12
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_month__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_month__plan0_optimized.sql
index 96c1cc7f0b..59109e02ce 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_month__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_month__plan0_optimized.sql
@@ -4,17 +4,17 @@
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_12.metric_time__month AS metric_time__month
- , SUM(subq_11.bookings_monthly) AS trailing_3_months_bookings
+ subq_16.metric_time__month AS metric_time__month
+ , SUM(subq_15.bookings_monthly) AS trailing_3_months_bookings
FROM (
-- Time Spine
SELECT
DATE_TRUNC('month', ds) AS metric_time__month
- FROM ***************************.mf_time_spine subq_13
+ FROM ***************************.mf_time_spine subq_17
WHERE ds BETWEEN '2020-03-05' AND '2021-01-04'
GROUP BY
DATE_TRUNC('month', ds)
-) subq_12
+) subq_16
INNER JOIN (
-- Read Elements From Semantic Model 'bookings_monthly_source'
-- Metric Time Dimension 'monthly_ds'
@@ -24,13 +24,13 @@ INNER JOIN (
, bookings_monthly
FROM ***************************.fct_bookings_extended_monthly bookings_monthly_source_src_16000
WHERE DATE_TRUNC('month', ds) BETWEEN '2019-12-05' AND '2021-01-04'
-) subq_11
+) subq_15
ON
(
- subq_11.metric_time__month <= subq_12.metric_time__month
+ subq_15.metric_time__month <= subq_16.metric_time__month
) AND (
- subq_11.metric_time__month > subq_12.metric_time__month - MAKE_INTERVAL(months => 3)
+ subq_15.metric_time__month > subq_16.metric_time__month - MAKE_INTERVAL(months => 3)
)
-WHERE subq_12.metric_time__month BETWEEN '2020-03-05' AND '2021-01-04'
+WHERE subq_16.metric_time__month BETWEEN '2020-03-05' AND '2021-01-04'
GROUP BY
- subq_12.metric_time__month
+ subq_16.metric_time__month
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_no_ds__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_no_ds__plan0.sql
index 740a8baf27..089925950f 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_no_ds__plan0.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_no_ds__plan0.sql
@@ -1,83 +1,83 @@
-- Compute Metrics via Expressions
SELECT
- subq_3.txn_revenue AS trailing_2_months_revenue
+ subq_12.txn_revenue AS trailing_2_months_revenue
FROM (
-- Aggregate Measures
SELECT
- SUM(subq_2.txn_revenue) AS txn_revenue
+ SUM(subq_11.txn_revenue) AS txn_revenue
FROM (
-- Pass Only Elements: ['txn_revenue',]
SELECT
- subq_1.txn_revenue
+ subq_10.txn_revenue
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.revenue_instance__ds__day
- , subq_0.revenue_instance__ds__week
- , subq_0.revenue_instance__ds__month
- , subq_0.revenue_instance__ds__quarter
- , subq_0.revenue_instance__ds__year
- , subq_0.revenue_instance__ds__extract_year
- , subq_0.revenue_instance__ds__extract_quarter
- , subq_0.revenue_instance__ds__extract_month
- , subq_0.revenue_instance__ds__extract_day
- , subq_0.revenue_instance__ds__extract_dow
- , subq_0.revenue_instance__ds__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.user
- , subq_0.revenue_instance__user
- , subq_0.txn_revenue
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.revenue_instance__ds__day
+ , subq_9.revenue_instance__ds__week
+ , subq_9.revenue_instance__ds__month
+ , subq_9.revenue_instance__ds__quarter
+ , subq_9.revenue_instance__ds__year
+ , subq_9.revenue_instance__ds__extract_year
+ , subq_9.revenue_instance__ds__extract_quarter
+ , subq_9.revenue_instance__ds__extract_month
+ , subq_9.revenue_instance__ds__extract_day
+ , subq_9.revenue_instance__ds__extract_dow
+ , subq_9.revenue_instance__ds__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.user
+ , subq_9.revenue_instance__user
+ , subq_9.txn_revenue
FROM (
-- Read Elements From Semantic Model 'revenue'
SELECT
- revenue_src_28007.revenue AS txn_revenue
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day
- , EXTRACT(isodow FROM revenue_src_28007.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day
- , EXTRACT(isodow FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy
- , revenue_src_28007.user_id AS user
- , revenue_src_28007.user_id AS revenue_instance__user
- FROM ***************************.fct_revenue revenue_src_28007
- ) subq_0
- ) subq_1
- ) subq_2
-) subq_3
+ revenue_src_28000.revenue AS txn_revenue
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , EXTRACT(isodow FROM revenue_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS revenue_instance__ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS revenue_instance__ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS revenue_instance__ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS revenue_instance__ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , EXTRACT(day FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_day
+ , EXTRACT(isodow FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_doy
+ , revenue_src_28000.user_id AS user
+ , revenue_src_28000.user_id AS revenue_instance__user
+ FROM ***************************.fct_revenue revenue_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
+) subq_12
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_no_ds__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_no_ds__plan0_optimized.sql
index e26a1bdb3d..4a0d5baff3 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_no_ds__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_no_ds__plan0_optimized.sql
@@ -5,4 +5,4 @@
-- Compute Metrics via Expressions
SELECT
SUM(revenue) AS trailing_2_months_revenue
-FROM ***************************.fct_revenue revenue_src_28007
+FROM ***************************.fct_revenue revenue_src_28000
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_no_window__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_no_window__plan0.sql
index c134310b8b..8aaa691cd5 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_no_window__plan0.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_no_window__plan0.sql
@@ -1,88 +1,88 @@
-- Compute Metrics via Expressions
SELECT
- subq_3.ds__month
- , subq_3.txn_revenue AS revenue_all_time
+ subq_12.ds__month
+ , subq_12.txn_revenue AS revenue_all_time
FROM (
-- Aggregate Measures
SELECT
- subq_2.ds__month
- , SUM(subq_2.txn_revenue) AS txn_revenue
+ subq_11.ds__month
+ , SUM(subq_11.txn_revenue) AS txn_revenue
FROM (
-- Pass Only Elements: ['txn_revenue', 'ds__month']
SELECT
- subq_1.ds__month
- , subq_1.txn_revenue
+ subq_10.ds__month
+ , subq_10.txn_revenue
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.revenue_instance__ds__day
- , subq_0.revenue_instance__ds__week
- , subq_0.revenue_instance__ds__month
- , subq_0.revenue_instance__ds__quarter
- , subq_0.revenue_instance__ds__year
- , subq_0.revenue_instance__ds__extract_year
- , subq_0.revenue_instance__ds__extract_quarter
- , subq_0.revenue_instance__ds__extract_month
- , subq_0.revenue_instance__ds__extract_day
- , subq_0.revenue_instance__ds__extract_dow
- , subq_0.revenue_instance__ds__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.user
- , subq_0.revenue_instance__user
- , subq_0.txn_revenue
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.revenue_instance__ds__day
+ , subq_9.revenue_instance__ds__week
+ , subq_9.revenue_instance__ds__month
+ , subq_9.revenue_instance__ds__quarter
+ , subq_9.revenue_instance__ds__year
+ , subq_9.revenue_instance__ds__extract_year
+ , subq_9.revenue_instance__ds__extract_quarter
+ , subq_9.revenue_instance__ds__extract_month
+ , subq_9.revenue_instance__ds__extract_day
+ , subq_9.revenue_instance__ds__extract_dow
+ , subq_9.revenue_instance__ds__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.user
+ , subq_9.revenue_instance__user
+ , subq_9.txn_revenue
FROM (
-- Read Elements From Semantic Model 'revenue'
SELECT
- revenue_src_28007.revenue AS txn_revenue
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day
- , EXTRACT(isodow FROM revenue_src_28007.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day
- , EXTRACT(isodow FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy
- , revenue_src_28007.user_id AS user
- , revenue_src_28007.user_id AS revenue_instance__user
- FROM ***************************.fct_revenue revenue_src_28007
- ) subq_0
- ) subq_1
- ) subq_2
+ revenue_src_28000.revenue AS txn_revenue
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , EXTRACT(isodow FROM revenue_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS revenue_instance__ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS revenue_instance__ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS revenue_instance__ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS revenue_instance__ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , EXTRACT(day FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_day
+ , EXTRACT(isodow FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_doy
+ , revenue_src_28000.user_id AS user
+ , revenue_src_28000.user_id AS revenue_instance__user
+ FROM ***************************.fct_revenue revenue_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
GROUP BY
- subq_2.ds__month
-) subq_3
+ subq_11.ds__month
+) subq_12
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_no_window__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_no_window__plan0_optimized.sql
index a7ca78d4e5..05e48cdae3 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_no_window__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_no_window__plan0_optimized.sql
@@ -6,6 +6,6 @@
SELECT
DATE_TRUNC('month', created_at) AS ds__month
, SUM(revenue) AS revenue_all_time
-FROM ***************************.fct_revenue revenue_src_28007
+FROM ***************************.fct_revenue revenue_src_28000
GROUP BY
DATE_TRUNC('month', created_at)
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_no_window_with_time_constraint__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_no_window_with_time_constraint__plan0.sql
index 61b9bcc9ac..f781a5a6f4 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_no_window_with_time_constraint__plan0.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_no_window_with_time_constraint__plan0.sql
@@ -1,187 +1,187 @@
-- Compute Metrics via Expressions
SELECT
- subq_8.metric_time__month
- , subq_8.txn_revenue AS revenue_all_time
+ subq_19.metric_time__month
+ , subq_19.txn_revenue AS revenue_all_time
FROM (
-- Aggregate Measures
SELECT
- subq_7.metric_time__month
- , SUM(subq_7.txn_revenue) AS txn_revenue
+ subq_18.metric_time__month
+ , SUM(subq_18.txn_revenue) AS txn_revenue
FROM (
-- Constrain Time Range to [2020-01-01T00:00:00, 2020-01-01T00:00:00]
SELECT
- subq_6.metric_time__month
- , subq_6.txn_revenue
+ subq_17.metric_time__month
+ , subq_17.txn_revenue
FROM (
-- Pass Only Elements: ['txn_revenue', 'metric_time__month']
SELECT
- subq_5.metric_time__month
- , subq_5.txn_revenue
+ subq_16.metric_time__month
+ , subq_16.txn_revenue
FROM (
-- Join Self Over Time Range
SELECT
- subq_3.metric_time__month AS metric_time__month
- , subq_2.ds__day AS ds__day
- , subq_2.ds__week AS ds__week
- , subq_2.ds__month AS ds__month
- , subq_2.ds__quarter AS ds__quarter
- , subq_2.ds__year AS ds__year
- , subq_2.ds__extract_year AS ds__extract_year
- , subq_2.ds__extract_quarter AS ds__extract_quarter
- , subq_2.ds__extract_month AS ds__extract_month
- , subq_2.ds__extract_day AS ds__extract_day
- , subq_2.ds__extract_dow AS ds__extract_dow
- , subq_2.ds__extract_doy AS ds__extract_doy
- , subq_2.revenue_instance__ds__day AS revenue_instance__ds__day
- , subq_2.revenue_instance__ds__week AS revenue_instance__ds__week
- , subq_2.revenue_instance__ds__month AS revenue_instance__ds__month
- , subq_2.revenue_instance__ds__quarter AS revenue_instance__ds__quarter
- , subq_2.revenue_instance__ds__year AS revenue_instance__ds__year
- , subq_2.revenue_instance__ds__extract_year AS revenue_instance__ds__extract_year
- , subq_2.revenue_instance__ds__extract_quarter AS revenue_instance__ds__extract_quarter
- , subq_2.revenue_instance__ds__extract_month AS revenue_instance__ds__extract_month
- , subq_2.revenue_instance__ds__extract_day AS revenue_instance__ds__extract_day
- , subq_2.revenue_instance__ds__extract_dow AS revenue_instance__ds__extract_dow
- , subq_2.revenue_instance__ds__extract_doy AS revenue_instance__ds__extract_doy
- , subq_2.metric_time__day AS metric_time__day
- , subq_2.metric_time__week AS metric_time__week
- , subq_2.metric_time__quarter AS metric_time__quarter
- , subq_2.metric_time__year AS metric_time__year
- , subq_2.metric_time__extract_year AS metric_time__extract_year
- , subq_2.metric_time__extract_quarter AS metric_time__extract_quarter
- , subq_2.metric_time__extract_month AS metric_time__extract_month
- , subq_2.metric_time__extract_day AS metric_time__extract_day
- , subq_2.metric_time__extract_dow AS metric_time__extract_dow
- , subq_2.metric_time__extract_doy AS metric_time__extract_doy
- , subq_2.user AS user
- , subq_2.revenue_instance__user AS revenue_instance__user
- , subq_2.txn_revenue AS txn_revenue
+ subq_14.metric_time__month AS metric_time__month
+ , subq_13.ds__day AS ds__day
+ , subq_13.ds__week AS ds__week
+ , subq_13.ds__month AS ds__month
+ , subq_13.ds__quarter AS ds__quarter
+ , subq_13.ds__year AS ds__year
+ , subq_13.ds__extract_year AS ds__extract_year
+ , subq_13.ds__extract_quarter AS ds__extract_quarter
+ , subq_13.ds__extract_month AS ds__extract_month
+ , subq_13.ds__extract_day AS ds__extract_day
+ , subq_13.ds__extract_dow AS ds__extract_dow
+ , subq_13.ds__extract_doy AS ds__extract_doy
+ , subq_13.revenue_instance__ds__day AS revenue_instance__ds__day
+ , subq_13.revenue_instance__ds__week AS revenue_instance__ds__week
+ , subq_13.revenue_instance__ds__month AS revenue_instance__ds__month
+ , subq_13.revenue_instance__ds__quarter AS revenue_instance__ds__quarter
+ , subq_13.revenue_instance__ds__year AS revenue_instance__ds__year
+ , subq_13.revenue_instance__ds__extract_year AS revenue_instance__ds__extract_year
+ , subq_13.revenue_instance__ds__extract_quarter AS revenue_instance__ds__extract_quarter
+ , subq_13.revenue_instance__ds__extract_month AS revenue_instance__ds__extract_month
+ , subq_13.revenue_instance__ds__extract_day AS revenue_instance__ds__extract_day
+ , subq_13.revenue_instance__ds__extract_dow AS revenue_instance__ds__extract_dow
+ , subq_13.revenue_instance__ds__extract_doy AS revenue_instance__ds__extract_doy
+ , subq_13.metric_time__day AS metric_time__day
+ , subq_13.metric_time__week AS metric_time__week
+ , subq_13.metric_time__quarter AS metric_time__quarter
+ , subq_13.metric_time__year AS metric_time__year
+ , subq_13.metric_time__extract_year AS metric_time__extract_year
+ , subq_13.metric_time__extract_quarter AS metric_time__extract_quarter
+ , subq_13.metric_time__extract_month AS metric_time__extract_month
+ , subq_13.metric_time__extract_day AS metric_time__extract_day
+ , subq_13.metric_time__extract_dow AS metric_time__extract_dow
+ , subq_13.metric_time__extract_doy AS metric_time__extract_doy
+ , subq_13.user AS user
+ , subq_13.revenue_instance__user AS revenue_instance__user
+ , subq_13.txn_revenue AS txn_revenue
FROM (
-- Time Spine
SELECT
- DATE_TRUNC('month', subq_4.ds) AS metric_time__month
- FROM ***************************.mf_time_spine subq_4
- WHERE subq_4.ds BETWEEN '2020-01-01' AND '2020-01-01'
+ DATE_TRUNC('month', subq_15.ds) AS metric_time__month
+ FROM ***************************.mf_time_spine subq_15
+ WHERE subq_15.ds BETWEEN '2020-01-01' AND '2020-01-01'
GROUP BY
- DATE_TRUNC('month', subq_4.ds)
- ) subq_3
+ DATE_TRUNC('month', subq_15.ds)
+ ) subq_14
INNER JOIN (
-- Constrain Time Range to [2000-01-01T00:00:00, 2020-01-01T00:00:00]
SELECT
- subq_1.ds__day
- , subq_1.ds__week
- , subq_1.ds__month
- , subq_1.ds__quarter
- , subq_1.ds__year
- , subq_1.ds__extract_year
- , subq_1.ds__extract_quarter
- , subq_1.ds__extract_month
- , subq_1.ds__extract_day
- , subq_1.ds__extract_dow
- , subq_1.ds__extract_doy
- , subq_1.revenue_instance__ds__day
- , subq_1.revenue_instance__ds__week
- , subq_1.revenue_instance__ds__month
- , subq_1.revenue_instance__ds__quarter
- , subq_1.revenue_instance__ds__year
- , subq_1.revenue_instance__ds__extract_year
- , subq_1.revenue_instance__ds__extract_quarter
- , subq_1.revenue_instance__ds__extract_month
- , subq_1.revenue_instance__ds__extract_day
- , subq_1.revenue_instance__ds__extract_dow
- , subq_1.revenue_instance__ds__extract_doy
- , subq_1.metric_time__day
- , subq_1.metric_time__week
- , subq_1.metric_time__month
- , subq_1.metric_time__quarter
- , subq_1.metric_time__year
- , subq_1.metric_time__extract_year
- , subq_1.metric_time__extract_quarter
- , subq_1.metric_time__extract_month
- , subq_1.metric_time__extract_day
- , subq_1.metric_time__extract_dow
- , subq_1.metric_time__extract_doy
- , subq_1.user
- , subq_1.revenue_instance__user
- , subq_1.txn_revenue
+ subq_12.ds__day
+ , subq_12.ds__week
+ , subq_12.ds__month
+ , subq_12.ds__quarter
+ , subq_12.ds__year
+ , subq_12.ds__extract_year
+ , subq_12.ds__extract_quarter
+ , subq_12.ds__extract_month
+ , subq_12.ds__extract_day
+ , subq_12.ds__extract_dow
+ , subq_12.ds__extract_doy
+ , subq_12.revenue_instance__ds__day
+ , subq_12.revenue_instance__ds__week
+ , subq_12.revenue_instance__ds__month
+ , subq_12.revenue_instance__ds__quarter
+ , subq_12.revenue_instance__ds__year
+ , subq_12.revenue_instance__ds__extract_year
+ , subq_12.revenue_instance__ds__extract_quarter
+ , subq_12.revenue_instance__ds__extract_month
+ , subq_12.revenue_instance__ds__extract_day
+ , subq_12.revenue_instance__ds__extract_dow
+ , subq_12.revenue_instance__ds__extract_doy
+ , subq_12.metric_time__day
+ , subq_12.metric_time__week
+ , subq_12.metric_time__month
+ , subq_12.metric_time__quarter
+ , subq_12.metric_time__year
+ , subq_12.metric_time__extract_year
+ , subq_12.metric_time__extract_quarter
+ , subq_12.metric_time__extract_month
+ , subq_12.metric_time__extract_day
+ , subq_12.metric_time__extract_dow
+ , subq_12.metric_time__extract_doy
+ , subq_12.user
+ , subq_12.revenue_instance__user
+ , subq_12.txn_revenue
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.revenue_instance__ds__day
- , subq_0.revenue_instance__ds__week
- , subq_0.revenue_instance__ds__month
- , subq_0.revenue_instance__ds__quarter
- , subq_0.revenue_instance__ds__year
- , subq_0.revenue_instance__ds__extract_year
- , subq_0.revenue_instance__ds__extract_quarter
- , subq_0.revenue_instance__ds__extract_month
- , subq_0.revenue_instance__ds__extract_day
- , subq_0.revenue_instance__ds__extract_dow
- , subq_0.revenue_instance__ds__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.user
- , subq_0.revenue_instance__user
- , subq_0.txn_revenue
+ subq_11.ds__day
+ , subq_11.ds__week
+ , subq_11.ds__month
+ , subq_11.ds__quarter
+ , subq_11.ds__year
+ , subq_11.ds__extract_year
+ , subq_11.ds__extract_quarter
+ , subq_11.ds__extract_month
+ , subq_11.ds__extract_day
+ , subq_11.ds__extract_dow
+ , subq_11.ds__extract_doy
+ , subq_11.revenue_instance__ds__day
+ , subq_11.revenue_instance__ds__week
+ , subq_11.revenue_instance__ds__month
+ , subq_11.revenue_instance__ds__quarter
+ , subq_11.revenue_instance__ds__year
+ , subq_11.revenue_instance__ds__extract_year
+ , subq_11.revenue_instance__ds__extract_quarter
+ , subq_11.revenue_instance__ds__extract_month
+ , subq_11.revenue_instance__ds__extract_day
+ , subq_11.revenue_instance__ds__extract_dow
+ , subq_11.revenue_instance__ds__extract_doy
+ , subq_11.ds__day AS metric_time__day
+ , subq_11.ds__week AS metric_time__week
+ , subq_11.ds__month AS metric_time__month
+ , subq_11.ds__quarter AS metric_time__quarter
+ , subq_11.ds__year AS metric_time__year
+ , subq_11.ds__extract_year AS metric_time__extract_year
+ , subq_11.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_11.ds__extract_month AS metric_time__extract_month
+ , subq_11.ds__extract_day AS metric_time__extract_day
+ , subq_11.ds__extract_dow AS metric_time__extract_dow
+ , subq_11.ds__extract_doy AS metric_time__extract_doy
+ , subq_11.user
+ , subq_11.revenue_instance__user
+ , subq_11.txn_revenue
FROM (
-- Read Elements From Semantic Model 'revenue'
SELECT
- revenue_src_28007.revenue AS txn_revenue
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day
- , EXTRACT(isodow FROM revenue_src_28007.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day
- , EXTRACT(isodow FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy
- , revenue_src_28007.user_id AS user
- , revenue_src_28007.user_id AS revenue_instance__user
- FROM ***************************.fct_revenue revenue_src_28007
- ) subq_0
- ) subq_1
- WHERE subq_1.metric_time__day BETWEEN '2000-01-01' AND '2020-01-01'
- ) subq_2
+ revenue_src_28000.revenue AS txn_revenue
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , EXTRACT(isodow FROM revenue_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS revenue_instance__ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS revenue_instance__ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS revenue_instance__ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS revenue_instance__ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , EXTRACT(day FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_day
+ , EXTRACT(isodow FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_doy
+ , revenue_src_28000.user_id AS user
+ , revenue_src_28000.user_id AS revenue_instance__user
+ FROM ***************************.fct_revenue revenue_src_28000
+ ) subq_11
+ ) subq_12
+ WHERE subq_12.metric_time__day BETWEEN '2000-01-01' AND '2020-01-01'
+ ) subq_13
ON
- (subq_2.metric_time__month <= subq_3.metric_time__month)
- ) subq_5
- ) subq_6
- WHERE subq_6.metric_time__month BETWEEN '2020-01-01' AND '2020-01-01'
- ) subq_7
+ (subq_13.metric_time__month <= subq_14.metric_time__month)
+ ) subq_16
+ ) subq_17
+ WHERE subq_17.metric_time__month BETWEEN '2020-01-01' AND '2020-01-01'
+ ) subq_18
GROUP BY
- subq_7.metric_time__month
-) subq_8
+ subq_18.metric_time__month
+) subq_19
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_no_window_with_time_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_no_window_with_time_constraint__plan0_optimized.sql
index a4e5bf994b..0267f01b4a 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_no_window_with_time_constraint__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_no_window_with_time_constraint__plan0_optimized.sql
@@ -4,17 +4,17 @@
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_12.metric_time__month AS metric_time__month
- , SUM(subq_11.txn_revenue) AS revenue_all_time
+ subq_23.metric_time__month AS metric_time__month
+ , SUM(subq_22.txn_revenue) AS revenue_all_time
FROM (
-- Time Spine
SELECT
DATE_TRUNC('month', ds) AS metric_time__month
- FROM ***************************.mf_time_spine subq_13
+ FROM ***************************.mf_time_spine subq_24
WHERE ds BETWEEN '2020-01-01' AND '2020-01-01'
GROUP BY
DATE_TRUNC('month', ds)
-) subq_12
+) subq_23
INNER JOIN (
-- Read Elements From Semantic Model 'revenue'
-- Metric Time Dimension 'ds'
@@ -22,11 +22,11 @@ INNER JOIN (
SELECT
DATE_TRUNC('month', created_at) AS metric_time__month
, revenue AS txn_revenue
- FROM ***************************.fct_revenue revenue_src_28007
+ FROM ***************************.fct_revenue revenue_src_28000
WHERE DATE_TRUNC('day', created_at) BETWEEN '2000-01-01' AND '2020-01-01'
-) subq_11
+) subq_22
ON
- (subq_11.metric_time__month <= subq_12.metric_time__month)
-WHERE subq_12.metric_time__month BETWEEN '2020-01-01' AND '2020-01-01'
+ (subq_22.metric_time__month <= subq_23.metric_time__month)
+WHERE subq_23.metric_time__month BETWEEN '2020-01-01' AND '2020-01-01'
GROUP BY
- subq_12.metric_time__month
+ subq_23.metric_time__month
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_with_agg_time_dimension__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_with_agg_time_dimension__plan0.sql
index cbf535c48f..98f9b3cdce 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_with_agg_time_dimension__plan0.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_with_agg_time_dimension__plan0.sql
@@ -1,140 +1,140 @@
-- Compute Metrics via Expressions
SELECT
- subq_6.revenue_instance__ds__day
- , subq_6.txn_revenue AS trailing_2_months_revenue
+ subq_15.revenue_instance__ds__day
+ , subq_15.txn_revenue AS trailing_2_months_revenue
FROM (
-- Aggregate Measures
SELECT
- subq_5.revenue_instance__ds__day
- , SUM(subq_5.txn_revenue) AS txn_revenue
+ subq_14.revenue_instance__ds__day
+ , SUM(subq_14.txn_revenue) AS txn_revenue
FROM (
-- Pass Only Elements: ['txn_revenue', 'revenue_instance__ds__day']
SELECT
- subq_4.revenue_instance__ds__day
- , subq_4.txn_revenue
+ subq_13.revenue_instance__ds__day
+ , subq_13.txn_revenue
FROM (
-- Join Self Over Time Range
SELECT
- subq_2.revenue_instance__ds__day AS revenue_instance__ds__day
- , subq_1.ds__day AS ds__day
- , subq_1.ds__week AS ds__week
- , subq_1.ds__month AS ds__month
- , subq_1.ds__quarter AS ds__quarter
- , subq_1.ds__year AS ds__year
- , subq_1.ds__extract_year AS ds__extract_year
- , subq_1.ds__extract_quarter AS ds__extract_quarter
- , subq_1.ds__extract_month AS ds__extract_month
- , subq_1.ds__extract_day AS ds__extract_day
- , subq_1.ds__extract_dow AS ds__extract_dow
- , subq_1.ds__extract_doy AS ds__extract_doy
- , subq_1.revenue_instance__ds__week AS revenue_instance__ds__week
- , subq_1.revenue_instance__ds__month AS revenue_instance__ds__month
- , subq_1.revenue_instance__ds__quarter AS revenue_instance__ds__quarter
- , subq_1.revenue_instance__ds__year AS revenue_instance__ds__year
- , subq_1.revenue_instance__ds__extract_year AS revenue_instance__ds__extract_year
- , subq_1.revenue_instance__ds__extract_quarter AS revenue_instance__ds__extract_quarter
- , subq_1.revenue_instance__ds__extract_month AS revenue_instance__ds__extract_month
- , subq_1.revenue_instance__ds__extract_day AS revenue_instance__ds__extract_day
- , subq_1.revenue_instance__ds__extract_dow AS revenue_instance__ds__extract_dow
- , subq_1.revenue_instance__ds__extract_doy AS revenue_instance__ds__extract_doy
- , subq_1.metric_time__day AS metric_time__day
- , subq_1.metric_time__week AS metric_time__week
- , subq_1.metric_time__month AS metric_time__month
- , subq_1.metric_time__quarter AS metric_time__quarter
- , subq_1.metric_time__year AS metric_time__year
- , subq_1.metric_time__extract_year AS metric_time__extract_year
- , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter
- , subq_1.metric_time__extract_month AS metric_time__extract_month
- , subq_1.metric_time__extract_day AS metric_time__extract_day
- , subq_1.metric_time__extract_dow AS metric_time__extract_dow
- , subq_1.metric_time__extract_doy AS metric_time__extract_doy
- , subq_1.user AS user
- , subq_1.revenue_instance__user AS revenue_instance__user
- , subq_1.txn_revenue AS txn_revenue
+ subq_11.revenue_instance__ds__day AS revenue_instance__ds__day
+ , subq_10.ds__day AS ds__day
+ , subq_10.ds__week AS ds__week
+ , subq_10.ds__month AS ds__month
+ , subq_10.ds__quarter AS ds__quarter
+ , subq_10.ds__year AS ds__year
+ , subq_10.ds__extract_year AS ds__extract_year
+ , subq_10.ds__extract_quarter AS ds__extract_quarter
+ , subq_10.ds__extract_month AS ds__extract_month
+ , subq_10.ds__extract_day AS ds__extract_day
+ , subq_10.ds__extract_dow AS ds__extract_dow
+ , subq_10.ds__extract_doy AS ds__extract_doy
+ , subq_10.revenue_instance__ds__week AS revenue_instance__ds__week
+ , subq_10.revenue_instance__ds__month AS revenue_instance__ds__month
+ , subq_10.revenue_instance__ds__quarter AS revenue_instance__ds__quarter
+ , subq_10.revenue_instance__ds__year AS revenue_instance__ds__year
+ , subq_10.revenue_instance__ds__extract_year AS revenue_instance__ds__extract_year
+ , subq_10.revenue_instance__ds__extract_quarter AS revenue_instance__ds__extract_quarter
+ , subq_10.revenue_instance__ds__extract_month AS revenue_instance__ds__extract_month
+ , subq_10.revenue_instance__ds__extract_day AS revenue_instance__ds__extract_day
+ , subq_10.revenue_instance__ds__extract_dow AS revenue_instance__ds__extract_dow
+ , subq_10.revenue_instance__ds__extract_doy AS revenue_instance__ds__extract_doy
+ , subq_10.metric_time__day AS metric_time__day
+ , subq_10.metric_time__week AS metric_time__week
+ , subq_10.metric_time__month AS metric_time__month
+ , subq_10.metric_time__quarter AS metric_time__quarter
+ , subq_10.metric_time__year AS metric_time__year
+ , subq_10.metric_time__extract_year AS metric_time__extract_year
+ , subq_10.metric_time__extract_quarter AS metric_time__extract_quarter
+ , subq_10.metric_time__extract_month AS metric_time__extract_month
+ , subq_10.metric_time__extract_day AS metric_time__extract_day
+ , subq_10.metric_time__extract_dow AS metric_time__extract_dow
+ , subq_10.metric_time__extract_doy AS metric_time__extract_doy
+ , subq_10.user AS user
+ , subq_10.revenue_instance__user AS revenue_instance__user
+ , subq_10.txn_revenue AS txn_revenue
FROM (
-- Time Spine
SELECT
- subq_3.ds AS revenue_instance__ds__day
- FROM ***************************.mf_time_spine subq_3
- ) subq_2
+ subq_12.ds AS revenue_instance__ds__day
+ FROM ***************************.mf_time_spine subq_12
+ ) subq_11
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.revenue_instance__ds__day
- , subq_0.revenue_instance__ds__week
- , subq_0.revenue_instance__ds__month
- , subq_0.revenue_instance__ds__quarter
- , subq_0.revenue_instance__ds__year
- , subq_0.revenue_instance__ds__extract_year
- , subq_0.revenue_instance__ds__extract_quarter
- , subq_0.revenue_instance__ds__extract_month
- , subq_0.revenue_instance__ds__extract_day
- , subq_0.revenue_instance__ds__extract_dow
- , subq_0.revenue_instance__ds__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.user
- , subq_0.revenue_instance__user
- , subq_0.txn_revenue
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.revenue_instance__ds__day
+ , subq_9.revenue_instance__ds__week
+ , subq_9.revenue_instance__ds__month
+ , subq_9.revenue_instance__ds__quarter
+ , subq_9.revenue_instance__ds__year
+ , subq_9.revenue_instance__ds__extract_year
+ , subq_9.revenue_instance__ds__extract_quarter
+ , subq_9.revenue_instance__ds__extract_month
+ , subq_9.revenue_instance__ds__extract_day
+ , subq_9.revenue_instance__ds__extract_dow
+ , subq_9.revenue_instance__ds__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.user
+ , subq_9.revenue_instance__user
+ , subq_9.txn_revenue
FROM (
-- Read Elements From Semantic Model 'revenue'
SELECT
- revenue_src_28007.revenue AS txn_revenue
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day
- , EXTRACT(isodow FROM revenue_src_28007.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day
- , EXTRACT(isodow FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy
- , revenue_src_28007.user_id AS user
- , revenue_src_28007.user_id AS revenue_instance__user
- FROM ***************************.fct_revenue revenue_src_28007
- ) subq_0
- ) subq_1
+ revenue_src_28000.revenue AS txn_revenue
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , EXTRACT(isodow FROM revenue_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS revenue_instance__ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS revenue_instance__ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS revenue_instance__ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS revenue_instance__ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , EXTRACT(day FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_day
+ , EXTRACT(isodow FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_doy
+ , revenue_src_28000.user_id AS user
+ , revenue_src_28000.user_id AS revenue_instance__user
+ FROM ***************************.fct_revenue revenue_src_28000
+ ) subq_9
+ ) subq_10
ON
(
- subq_1.revenue_instance__ds__day <= subq_2.revenue_instance__ds__day
+ subq_10.revenue_instance__ds__day <= subq_11.revenue_instance__ds__day
) AND (
- subq_1.revenue_instance__ds__day > subq_2.revenue_instance__ds__day - MAKE_INTERVAL(months => 2)
+ subq_10.revenue_instance__ds__day > subq_11.revenue_instance__ds__day - MAKE_INTERVAL(months => 2)
)
- ) subq_4
- ) subq_5
+ ) subq_13
+ ) subq_14
GROUP BY
- subq_5.revenue_instance__ds__day
-) subq_6
+ subq_14.revenue_instance__ds__day
+) subq_15
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_with_agg_time_dimension__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_with_agg_time_dimension__plan0_optimized.sql
index 6a552ea045..36bf6ebf13 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_with_agg_time_dimension__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_with_agg_time_dimension__plan0_optimized.sql
@@ -3,16 +3,16 @@
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_10.ds AS revenue_instance__ds__day
- , SUM(revenue_src_28007.revenue) AS trailing_2_months_revenue
-FROM ***************************.mf_time_spine subq_10
+ subq_19.ds AS revenue_instance__ds__day
+ , SUM(revenue_src_28000.revenue) AS trailing_2_months_revenue
+FROM ***************************.mf_time_spine subq_19
INNER JOIN
- ***************************.fct_revenue revenue_src_28007
+ ***************************.fct_revenue revenue_src_28000
ON
(
- DATE_TRUNC('day', revenue_src_28007.created_at) <= subq_10.ds
+ DATE_TRUNC('day', revenue_src_28000.created_at) <= subq_19.ds
) AND (
- DATE_TRUNC('day', revenue_src_28007.created_at) > subq_10.ds - MAKE_INTERVAL(months => 2)
+ DATE_TRUNC('day', revenue_src_28000.created_at) > subq_19.ds - MAKE_INTERVAL(months => 2)
)
GROUP BY
- subq_10.ds
+ subq_19.ds
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_with_non_adjustable_time_filter__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_with_non_adjustable_time_filter__plan0.sql
index d7619f64dc..b858211503 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_with_non_adjustable_time_filter__plan0.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_with_non_adjustable_time_filter__plan0.sql
@@ -1,334 +1,334 @@
-- Compute Metrics via Expressions
SELECT
- subq_7.metric_time__day
- , subq_7.bookers AS every_two_days_bookers
+ subq_16.metric_time__day
+ , subq_16.bookers AS every_two_days_bookers
FROM (
-- Aggregate Measures
SELECT
- subq_6.metric_time__day
- , COUNT(DISTINCT subq_6.bookers) AS bookers
+ subq_15.metric_time__day
+ , COUNT(DISTINCT subq_15.bookers) AS bookers
FROM (
-- Constrain Output with WHERE
SELECT
- subq_5.metric_time__day
- , subq_5.bookers
+ subq_14.metric_time__day
+ , subq_14.bookers
FROM (
-- Pass Only Elements: ['bookers', 'metric_time__day']
SELECT
- subq_4.metric_time__day
- , subq_4.bookers
+ subq_13.metric_time__day
+ , subq_13.bookers
FROM (
-- Join Self Over Time Range
SELECT
- subq_2.metric_time__day AS metric_time__day
- , subq_1.ds__day AS ds__day
- , subq_1.ds__week AS ds__week
- , subq_1.ds__month AS ds__month
- , subq_1.ds__quarter AS ds__quarter
- , subq_1.ds__year AS ds__year
- , subq_1.ds__extract_year AS ds__extract_year
- , subq_1.ds__extract_quarter AS ds__extract_quarter
- , subq_1.ds__extract_month AS ds__extract_month
- , subq_1.ds__extract_day AS ds__extract_day
- , subq_1.ds__extract_dow AS ds__extract_dow
- , subq_1.ds__extract_doy AS ds__extract_doy
- , subq_1.ds_partitioned__day AS ds_partitioned__day
- , subq_1.ds_partitioned__week AS ds_partitioned__week
- , subq_1.ds_partitioned__month AS ds_partitioned__month
- , subq_1.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_1.ds_partitioned__year AS ds_partitioned__year
- , subq_1.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_1.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_1.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_1.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_1.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_1.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_1.paid_at__day AS paid_at__day
- , subq_1.paid_at__week AS paid_at__week
- , subq_1.paid_at__month AS paid_at__month
- , subq_1.paid_at__quarter AS paid_at__quarter
- , subq_1.paid_at__year AS paid_at__year
- , subq_1.paid_at__extract_year AS paid_at__extract_year
- , subq_1.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_1.paid_at__extract_month AS paid_at__extract_month
- , subq_1.paid_at__extract_day AS paid_at__extract_day
- , subq_1.paid_at__extract_dow AS paid_at__extract_dow
- , subq_1.paid_at__extract_doy AS paid_at__extract_doy
- , subq_1.booking__ds__day AS booking__ds__day
- , subq_1.booking__ds__week AS booking__ds__week
- , subq_1.booking__ds__month AS booking__ds__month
- , subq_1.booking__ds__quarter AS booking__ds__quarter
- , subq_1.booking__ds__year AS booking__ds__year
- , subq_1.booking__ds__extract_year AS booking__ds__extract_year
- , subq_1.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_1.booking__ds__extract_month AS booking__ds__extract_month
- , subq_1.booking__ds__extract_day AS booking__ds__extract_day
- , subq_1.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_1.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_1.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_1.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_1.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_1.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_1.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_1.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_1.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_1.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_1.booking__paid_at__day AS booking__paid_at__day
- , subq_1.booking__paid_at__week AS booking__paid_at__week
- , subq_1.booking__paid_at__month AS booking__paid_at__month
- , subq_1.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_1.booking__paid_at__year AS booking__paid_at__year
- , subq_1.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_1.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_1.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_1.metric_time__week AS metric_time__week
- , subq_1.metric_time__month AS metric_time__month
- , subq_1.metric_time__quarter AS metric_time__quarter
- , subq_1.metric_time__year AS metric_time__year
- , subq_1.metric_time__extract_year AS metric_time__extract_year
- , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter
- , subq_1.metric_time__extract_month AS metric_time__extract_month
- , subq_1.metric_time__extract_day AS metric_time__extract_day
- , subq_1.metric_time__extract_dow AS metric_time__extract_dow
- , subq_1.metric_time__extract_doy AS metric_time__extract_doy
- , subq_1.listing AS listing
- , subq_1.guest AS guest
- , subq_1.host AS host
- , subq_1.booking__listing AS booking__listing
- , subq_1.booking__guest AS booking__guest
- , subq_1.booking__host AS booking__host
- , subq_1.is_instant AS is_instant
- , subq_1.booking__is_instant AS booking__is_instant
- , subq_1.bookings AS bookings
- , subq_1.instant_bookings AS instant_bookings
- , subq_1.booking_value AS booking_value
- , subq_1.max_booking_value AS max_booking_value
- , subq_1.min_booking_value AS min_booking_value
- , subq_1.bookers AS bookers
- , subq_1.average_booking_value AS average_booking_value
- , subq_1.referred_bookings AS referred_bookings
- , subq_1.median_booking_value AS median_booking_value
- , subq_1.booking_value_p99 AS booking_value_p99
- , subq_1.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_1.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_1.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ subq_11.metric_time__day AS metric_time__day
+ , subq_10.ds__day AS ds__day
+ , subq_10.ds__week AS ds__week
+ , subq_10.ds__month AS ds__month
+ , subq_10.ds__quarter AS ds__quarter
+ , subq_10.ds__year AS ds__year
+ , subq_10.ds__extract_year AS ds__extract_year
+ , subq_10.ds__extract_quarter AS ds__extract_quarter
+ , subq_10.ds__extract_month AS ds__extract_month
+ , subq_10.ds__extract_day AS ds__extract_day
+ , subq_10.ds__extract_dow AS ds__extract_dow
+ , subq_10.ds__extract_doy AS ds__extract_doy
+ , subq_10.ds_partitioned__day AS ds_partitioned__day
+ , subq_10.ds_partitioned__week AS ds_partitioned__week
+ , subq_10.ds_partitioned__month AS ds_partitioned__month
+ , subq_10.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_10.ds_partitioned__year AS ds_partitioned__year
+ , subq_10.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_10.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_10.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_10.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_10.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_10.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_10.paid_at__day AS paid_at__day
+ , subq_10.paid_at__week AS paid_at__week
+ , subq_10.paid_at__month AS paid_at__month
+ , subq_10.paid_at__quarter AS paid_at__quarter
+ , subq_10.paid_at__year AS paid_at__year
+ , subq_10.paid_at__extract_year AS paid_at__extract_year
+ , subq_10.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_10.paid_at__extract_month AS paid_at__extract_month
+ , subq_10.paid_at__extract_day AS paid_at__extract_day
+ , subq_10.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_10.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_10.booking__ds__day AS booking__ds__day
+ , subq_10.booking__ds__week AS booking__ds__week
+ , subq_10.booking__ds__month AS booking__ds__month
+ , subq_10.booking__ds__quarter AS booking__ds__quarter
+ , subq_10.booking__ds__year AS booking__ds__year
+ , subq_10.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_10.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_10.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_10.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_10.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_10.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_10.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_10.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_10.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_10.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_10.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_10.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_10.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_10.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_10.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_10.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_10.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_10.booking__paid_at__day AS booking__paid_at__day
+ , subq_10.booking__paid_at__week AS booking__paid_at__week
+ , subq_10.booking__paid_at__month AS booking__paid_at__month
+ , subq_10.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_10.booking__paid_at__year AS booking__paid_at__year
+ , subq_10.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_10.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_10.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_10.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_10.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_10.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_10.metric_time__week AS metric_time__week
+ , subq_10.metric_time__month AS metric_time__month
+ , subq_10.metric_time__quarter AS metric_time__quarter
+ , subq_10.metric_time__year AS metric_time__year
+ , subq_10.metric_time__extract_year AS metric_time__extract_year
+ , subq_10.metric_time__extract_quarter AS metric_time__extract_quarter
+ , subq_10.metric_time__extract_month AS metric_time__extract_month
+ , subq_10.metric_time__extract_day AS metric_time__extract_day
+ , subq_10.metric_time__extract_dow AS metric_time__extract_dow
+ , subq_10.metric_time__extract_doy AS metric_time__extract_doy
+ , subq_10.listing AS listing
+ , subq_10.guest AS guest
+ , subq_10.host AS host
+ , subq_10.booking__listing AS booking__listing
+ , subq_10.booking__guest AS booking__guest
+ , subq_10.booking__host AS booking__host
+ , subq_10.is_instant AS is_instant
+ , subq_10.booking__is_instant AS booking__is_instant
+ , subq_10.bookings AS bookings
+ , subq_10.instant_bookings AS instant_bookings
+ , subq_10.booking_value AS booking_value
+ , subq_10.max_booking_value AS max_booking_value
+ , subq_10.min_booking_value AS min_booking_value
+ , subq_10.bookers AS bookers
+ , subq_10.average_booking_value AS average_booking_value
+ , subq_10.referred_bookings AS referred_bookings
+ , subq_10.median_booking_value AS median_booking_value
+ , subq_10.booking_value_p99 AS booking_value_p99
+ , subq_10.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_10.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_10.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_3.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_3
- ) subq_2
+ subq_12.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_12
+ ) subq_11
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
ON
(
- subq_1.metric_time__day <= subq_2.metric_time__day
+ subq_10.metric_time__day <= subq_11.metric_time__day
) AND (
- subq_1.metric_time__day > subq_2.metric_time__day - MAKE_INTERVAL(days => 2)
+ subq_10.metric_time__day > subq_11.metric_time__day - MAKE_INTERVAL(days => 2)
)
- ) subq_4
- ) subq_5
+ ) subq_13
+ ) subq_14
WHERE metric_time__day = '2020-01-03' or metric_time__day = '2020-01-07'
- ) subq_6
+ ) subq_15
GROUP BY
- subq_6.metric_time__day
-) subq_7
+ subq_15.metric_time__day
+) subq_16
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_with_non_adjustable_time_filter__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_with_non_adjustable_time_filter__plan0_optimized.sql
index e5c6c927b9..ae89676933 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_with_non_adjustable_time_filter__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_with_non_adjustable_time_filter__plan0_optimized.sql
@@ -8,18 +8,18 @@ FROM (
-- Join Self Over Time Range
-- Pass Only Elements: ['bookers', 'metric_time__day']
SELECT
- subq_11.ds AS metric_time__day
- , bookings_source_src_28001.guest_id AS bookers
- FROM ***************************.mf_time_spine subq_11
+ subq_20.ds AS metric_time__day
+ , bookings_source_src_28000.guest_id AS bookers
+ FROM ***************************.mf_time_spine subq_20
INNER JOIN
- ***************************.fct_bookings bookings_source_src_28001
+ ***************************.fct_bookings bookings_source_src_28000
ON
(
- DATE_TRUNC('day', bookings_source_src_28001.ds) <= subq_11.ds
+ DATE_TRUNC('day', bookings_source_src_28000.ds) <= subq_20.ds
) AND (
- DATE_TRUNC('day', bookings_source_src_28001.ds) > subq_11.ds - MAKE_INTERVAL(days => 2)
+ DATE_TRUNC('day', bookings_source_src_28000.ds) > subq_20.ds - MAKE_INTERVAL(days => 2)
)
-) subq_13
+) subq_22
WHERE metric_time__day = '2020-01-03' or metric_time__day = '2020-01-07'
GROUP BY
metric_time__day
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_with_time_constraint__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_with_time_constraint__plan0.sql
index 034096cfd6..6e3c3caeff 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_with_time_constraint__plan0.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_with_time_constraint__plan0.sql
@@ -1,189 +1,189 @@
-- Compute Metrics via Expressions
SELECT
- subq_8.metric_time__day
- , subq_8.txn_revenue AS trailing_2_months_revenue
+ subq_19.metric_time__day
+ , subq_19.txn_revenue AS trailing_2_months_revenue
FROM (
-- Aggregate Measures
SELECT
- subq_7.metric_time__day
- , SUM(subq_7.txn_revenue) AS txn_revenue
+ subq_18.metric_time__day
+ , SUM(subq_18.txn_revenue) AS txn_revenue
FROM (
-- Constrain Time Range to [2020-01-01T00:00:00, 2020-01-01T00:00:00]
SELECT
- subq_6.metric_time__day
- , subq_6.txn_revenue
+ subq_17.metric_time__day
+ , subq_17.txn_revenue
FROM (
-- Pass Only Elements: ['txn_revenue', 'metric_time__day']
SELECT
- subq_5.metric_time__day
- , subq_5.txn_revenue
+ subq_16.metric_time__day
+ , subq_16.txn_revenue
FROM (
-- Join Self Over Time Range
SELECT
- subq_3.metric_time__day AS metric_time__day
- , subq_2.ds__day AS ds__day
- , subq_2.ds__week AS ds__week
- , subq_2.ds__month AS ds__month
- , subq_2.ds__quarter AS ds__quarter
- , subq_2.ds__year AS ds__year
- , subq_2.ds__extract_year AS ds__extract_year
- , subq_2.ds__extract_quarter AS ds__extract_quarter
- , subq_2.ds__extract_month AS ds__extract_month
- , subq_2.ds__extract_day AS ds__extract_day
- , subq_2.ds__extract_dow AS ds__extract_dow
- , subq_2.ds__extract_doy AS ds__extract_doy
- , subq_2.revenue_instance__ds__day AS revenue_instance__ds__day
- , subq_2.revenue_instance__ds__week AS revenue_instance__ds__week
- , subq_2.revenue_instance__ds__month AS revenue_instance__ds__month
- , subq_2.revenue_instance__ds__quarter AS revenue_instance__ds__quarter
- , subq_2.revenue_instance__ds__year AS revenue_instance__ds__year
- , subq_2.revenue_instance__ds__extract_year AS revenue_instance__ds__extract_year
- , subq_2.revenue_instance__ds__extract_quarter AS revenue_instance__ds__extract_quarter
- , subq_2.revenue_instance__ds__extract_month AS revenue_instance__ds__extract_month
- , subq_2.revenue_instance__ds__extract_day AS revenue_instance__ds__extract_day
- , subq_2.revenue_instance__ds__extract_dow AS revenue_instance__ds__extract_dow
- , subq_2.revenue_instance__ds__extract_doy AS revenue_instance__ds__extract_doy
- , subq_2.metric_time__week AS metric_time__week
- , subq_2.metric_time__month AS metric_time__month
- , subq_2.metric_time__quarter AS metric_time__quarter
- , subq_2.metric_time__year AS metric_time__year
- , subq_2.metric_time__extract_year AS metric_time__extract_year
- , subq_2.metric_time__extract_quarter AS metric_time__extract_quarter
- , subq_2.metric_time__extract_month AS metric_time__extract_month
- , subq_2.metric_time__extract_day AS metric_time__extract_day
- , subq_2.metric_time__extract_dow AS metric_time__extract_dow
- , subq_2.metric_time__extract_doy AS metric_time__extract_doy
- , subq_2.user AS user
- , subq_2.revenue_instance__user AS revenue_instance__user
- , subq_2.txn_revenue AS txn_revenue
+ subq_14.metric_time__day AS metric_time__day
+ , subq_13.ds__day AS ds__day
+ , subq_13.ds__week AS ds__week
+ , subq_13.ds__month AS ds__month
+ , subq_13.ds__quarter AS ds__quarter
+ , subq_13.ds__year AS ds__year
+ , subq_13.ds__extract_year AS ds__extract_year
+ , subq_13.ds__extract_quarter AS ds__extract_quarter
+ , subq_13.ds__extract_month AS ds__extract_month
+ , subq_13.ds__extract_day AS ds__extract_day
+ , subq_13.ds__extract_dow AS ds__extract_dow
+ , subq_13.ds__extract_doy AS ds__extract_doy
+ , subq_13.revenue_instance__ds__day AS revenue_instance__ds__day
+ , subq_13.revenue_instance__ds__week AS revenue_instance__ds__week
+ , subq_13.revenue_instance__ds__month AS revenue_instance__ds__month
+ , subq_13.revenue_instance__ds__quarter AS revenue_instance__ds__quarter
+ , subq_13.revenue_instance__ds__year AS revenue_instance__ds__year
+ , subq_13.revenue_instance__ds__extract_year AS revenue_instance__ds__extract_year
+ , subq_13.revenue_instance__ds__extract_quarter AS revenue_instance__ds__extract_quarter
+ , subq_13.revenue_instance__ds__extract_month AS revenue_instance__ds__extract_month
+ , subq_13.revenue_instance__ds__extract_day AS revenue_instance__ds__extract_day
+ , subq_13.revenue_instance__ds__extract_dow AS revenue_instance__ds__extract_dow
+ , subq_13.revenue_instance__ds__extract_doy AS revenue_instance__ds__extract_doy
+ , subq_13.metric_time__week AS metric_time__week
+ , subq_13.metric_time__month AS metric_time__month
+ , subq_13.metric_time__quarter AS metric_time__quarter
+ , subq_13.metric_time__year AS metric_time__year
+ , subq_13.metric_time__extract_year AS metric_time__extract_year
+ , subq_13.metric_time__extract_quarter AS metric_time__extract_quarter
+ , subq_13.metric_time__extract_month AS metric_time__extract_month
+ , subq_13.metric_time__extract_day AS metric_time__extract_day
+ , subq_13.metric_time__extract_dow AS metric_time__extract_dow
+ , subq_13.metric_time__extract_doy AS metric_time__extract_doy
+ , subq_13.user AS user
+ , subq_13.revenue_instance__user AS revenue_instance__user
+ , subq_13.txn_revenue AS txn_revenue
FROM (
-- Time Spine
SELECT
- subq_4.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_4
- WHERE subq_4.ds BETWEEN '2020-01-01' AND '2020-01-01'
- ) subq_3
+ subq_15.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_15
+ WHERE subq_15.ds BETWEEN '2020-01-01' AND '2020-01-01'
+ ) subq_14
INNER JOIN (
-- Constrain Time Range to [2019-11-01T00:00:00, 2020-01-01T00:00:00]
SELECT
- subq_1.ds__day
- , subq_1.ds__week
- , subq_1.ds__month
- , subq_1.ds__quarter
- , subq_1.ds__year
- , subq_1.ds__extract_year
- , subq_1.ds__extract_quarter
- , subq_1.ds__extract_month
- , subq_1.ds__extract_day
- , subq_1.ds__extract_dow
- , subq_1.ds__extract_doy
- , subq_1.revenue_instance__ds__day
- , subq_1.revenue_instance__ds__week
- , subq_1.revenue_instance__ds__month
- , subq_1.revenue_instance__ds__quarter
- , subq_1.revenue_instance__ds__year
- , subq_1.revenue_instance__ds__extract_year
- , subq_1.revenue_instance__ds__extract_quarter
- , subq_1.revenue_instance__ds__extract_month
- , subq_1.revenue_instance__ds__extract_day
- , subq_1.revenue_instance__ds__extract_dow
- , subq_1.revenue_instance__ds__extract_doy
- , subq_1.metric_time__day
- , subq_1.metric_time__week
- , subq_1.metric_time__month
- , subq_1.metric_time__quarter
- , subq_1.metric_time__year
- , subq_1.metric_time__extract_year
- , subq_1.metric_time__extract_quarter
- , subq_1.metric_time__extract_month
- , subq_1.metric_time__extract_day
- , subq_1.metric_time__extract_dow
- , subq_1.metric_time__extract_doy
- , subq_1.user
- , subq_1.revenue_instance__user
- , subq_1.txn_revenue
+ subq_12.ds__day
+ , subq_12.ds__week
+ , subq_12.ds__month
+ , subq_12.ds__quarter
+ , subq_12.ds__year
+ , subq_12.ds__extract_year
+ , subq_12.ds__extract_quarter
+ , subq_12.ds__extract_month
+ , subq_12.ds__extract_day
+ , subq_12.ds__extract_dow
+ , subq_12.ds__extract_doy
+ , subq_12.revenue_instance__ds__day
+ , subq_12.revenue_instance__ds__week
+ , subq_12.revenue_instance__ds__month
+ , subq_12.revenue_instance__ds__quarter
+ , subq_12.revenue_instance__ds__year
+ , subq_12.revenue_instance__ds__extract_year
+ , subq_12.revenue_instance__ds__extract_quarter
+ , subq_12.revenue_instance__ds__extract_month
+ , subq_12.revenue_instance__ds__extract_day
+ , subq_12.revenue_instance__ds__extract_dow
+ , subq_12.revenue_instance__ds__extract_doy
+ , subq_12.metric_time__day
+ , subq_12.metric_time__week
+ , subq_12.metric_time__month
+ , subq_12.metric_time__quarter
+ , subq_12.metric_time__year
+ , subq_12.metric_time__extract_year
+ , subq_12.metric_time__extract_quarter
+ , subq_12.metric_time__extract_month
+ , subq_12.metric_time__extract_day
+ , subq_12.metric_time__extract_dow
+ , subq_12.metric_time__extract_doy
+ , subq_12.user
+ , subq_12.revenue_instance__user
+ , subq_12.txn_revenue
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.revenue_instance__ds__day
- , subq_0.revenue_instance__ds__week
- , subq_0.revenue_instance__ds__month
- , subq_0.revenue_instance__ds__quarter
- , subq_0.revenue_instance__ds__year
- , subq_0.revenue_instance__ds__extract_year
- , subq_0.revenue_instance__ds__extract_quarter
- , subq_0.revenue_instance__ds__extract_month
- , subq_0.revenue_instance__ds__extract_day
- , subq_0.revenue_instance__ds__extract_dow
- , subq_0.revenue_instance__ds__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.user
- , subq_0.revenue_instance__user
- , subq_0.txn_revenue
+ subq_11.ds__day
+ , subq_11.ds__week
+ , subq_11.ds__month
+ , subq_11.ds__quarter
+ , subq_11.ds__year
+ , subq_11.ds__extract_year
+ , subq_11.ds__extract_quarter
+ , subq_11.ds__extract_month
+ , subq_11.ds__extract_day
+ , subq_11.ds__extract_dow
+ , subq_11.ds__extract_doy
+ , subq_11.revenue_instance__ds__day
+ , subq_11.revenue_instance__ds__week
+ , subq_11.revenue_instance__ds__month
+ , subq_11.revenue_instance__ds__quarter
+ , subq_11.revenue_instance__ds__year
+ , subq_11.revenue_instance__ds__extract_year
+ , subq_11.revenue_instance__ds__extract_quarter
+ , subq_11.revenue_instance__ds__extract_month
+ , subq_11.revenue_instance__ds__extract_day
+ , subq_11.revenue_instance__ds__extract_dow
+ , subq_11.revenue_instance__ds__extract_doy
+ , subq_11.ds__day AS metric_time__day
+ , subq_11.ds__week AS metric_time__week
+ , subq_11.ds__month AS metric_time__month
+ , subq_11.ds__quarter AS metric_time__quarter
+ , subq_11.ds__year AS metric_time__year
+ , subq_11.ds__extract_year AS metric_time__extract_year
+ , subq_11.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_11.ds__extract_month AS metric_time__extract_month
+ , subq_11.ds__extract_day AS metric_time__extract_day
+ , subq_11.ds__extract_dow AS metric_time__extract_dow
+ , subq_11.ds__extract_doy AS metric_time__extract_doy
+ , subq_11.user
+ , subq_11.revenue_instance__user
+ , subq_11.txn_revenue
FROM (
-- Read Elements From Semantic Model 'revenue'
SELECT
- revenue_src_28007.revenue AS txn_revenue
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day
- , EXTRACT(isodow FROM revenue_src_28007.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day
- , EXTRACT(isodow FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy
- , revenue_src_28007.user_id AS user
- , revenue_src_28007.user_id AS revenue_instance__user
- FROM ***************************.fct_revenue revenue_src_28007
- ) subq_0
- ) subq_1
- WHERE subq_1.metric_time__day BETWEEN '2019-11-01' AND '2020-01-01'
- ) subq_2
+ revenue_src_28000.revenue AS txn_revenue
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , EXTRACT(isodow FROM revenue_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS revenue_instance__ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS revenue_instance__ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS revenue_instance__ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS revenue_instance__ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , EXTRACT(day FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_day
+ , EXTRACT(isodow FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_doy
+ , revenue_src_28000.user_id AS user
+ , revenue_src_28000.user_id AS revenue_instance__user
+ FROM ***************************.fct_revenue revenue_src_28000
+ ) subq_11
+ ) subq_12
+ WHERE subq_12.metric_time__day BETWEEN '2019-11-01' AND '2020-01-01'
+ ) subq_13
ON
(
- subq_2.metric_time__day <= subq_3.metric_time__day
+ subq_13.metric_time__day <= subq_14.metric_time__day
) AND (
- subq_2.metric_time__day > subq_3.metric_time__day - MAKE_INTERVAL(months => 2)
+ subq_13.metric_time__day > subq_14.metric_time__day - MAKE_INTERVAL(months => 2)
)
- ) subq_5
- ) subq_6
- WHERE subq_6.metric_time__day BETWEEN '2020-01-01' AND '2020-01-01'
- ) subq_7
+ ) subq_16
+ ) subq_17
+ WHERE subq_17.metric_time__day BETWEEN '2020-01-01' AND '2020-01-01'
+ ) subq_18
GROUP BY
- subq_7.metric_time__day
-) subq_8
+ subq_18.metric_time__day
+) subq_19
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_with_time_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_with_time_constraint__plan0_optimized.sql
index 0e6a83d34d..87365ba91b 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_with_time_constraint__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_metric_with_time_constraint__plan0_optimized.sql
@@ -4,15 +4,15 @@
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_12.metric_time__day AS metric_time__day
- , SUM(subq_11.txn_revenue) AS trailing_2_months_revenue
+ subq_23.metric_time__day AS metric_time__day
+ , SUM(subq_22.txn_revenue) AS trailing_2_months_revenue
FROM (
-- Time Spine
SELECT
ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_13
+ FROM ***************************.mf_time_spine subq_24
WHERE ds BETWEEN '2020-01-01' AND '2020-01-01'
-) subq_12
+) subq_23
INNER JOIN (
-- Read Elements From Semantic Model 'revenue'
-- Metric Time Dimension 'ds'
@@ -20,15 +20,15 @@ INNER JOIN (
SELECT
DATE_TRUNC('day', created_at) AS metric_time__day
, revenue AS txn_revenue
- FROM ***************************.fct_revenue revenue_src_28007
+ FROM ***************************.fct_revenue revenue_src_28000
WHERE DATE_TRUNC('day', created_at) BETWEEN '2019-11-01' AND '2020-01-01'
-) subq_11
+) subq_22
ON
(
- subq_11.metric_time__day <= subq_12.metric_time__day
+ subq_22.metric_time__day <= subq_23.metric_time__day
) AND (
- subq_11.metric_time__day > subq_12.metric_time__day - MAKE_INTERVAL(months => 2)
+ subq_22.metric_time__day > subq_23.metric_time__day - MAKE_INTERVAL(months => 2)
)
-WHERE subq_12.metric_time__day BETWEEN '2020-01-01' AND '2020-01-01'
+WHERE subq_23.metric_time__day BETWEEN '2020-01-01' AND '2020-01-01'
GROUP BY
- subq_12.metric_time__day
+ subq_23.metric_time__day
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric__plan0.sql
index 628e764a09..8924d445aa 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric__plan0.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric__plan0.sql
@@ -1,88 +1,88 @@
-- Compute Metrics via Expressions
SELECT
- subq_3.ds__day
- , subq_3.txn_revenue AS trailing_2_months_revenue
+ subq_12.ds__day
+ , subq_12.txn_revenue AS trailing_2_months_revenue
FROM (
-- Aggregate Measures
SELECT
- subq_2.ds__day
- , SUM(subq_2.txn_revenue) AS txn_revenue
+ subq_11.ds__day
+ , SUM(subq_11.txn_revenue) AS txn_revenue
FROM (
-- Pass Only Elements: ['txn_revenue', 'ds__day']
SELECT
- subq_1.ds__day
- , subq_1.txn_revenue
+ subq_10.ds__day
+ , subq_10.txn_revenue
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.revenue_instance__ds__day
- , subq_0.revenue_instance__ds__week
- , subq_0.revenue_instance__ds__month
- , subq_0.revenue_instance__ds__quarter
- , subq_0.revenue_instance__ds__year
- , subq_0.revenue_instance__ds__extract_year
- , subq_0.revenue_instance__ds__extract_quarter
- , subq_0.revenue_instance__ds__extract_month
- , subq_0.revenue_instance__ds__extract_day
- , subq_0.revenue_instance__ds__extract_dow
- , subq_0.revenue_instance__ds__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.user
- , subq_0.revenue_instance__user
- , subq_0.txn_revenue
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.revenue_instance__ds__day
+ , subq_9.revenue_instance__ds__week
+ , subq_9.revenue_instance__ds__month
+ , subq_9.revenue_instance__ds__quarter
+ , subq_9.revenue_instance__ds__year
+ , subq_9.revenue_instance__ds__extract_year
+ , subq_9.revenue_instance__ds__extract_quarter
+ , subq_9.revenue_instance__ds__extract_month
+ , subq_9.revenue_instance__ds__extract_day
+ , subq_9.revenue_instance__ds__extract_dow
+ , subq_9.revenue_instance__ds__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.user
+ , subq_9.revenue_instance__user
+ , subq_9.txn_revenue
FROM (
-- Read Elements From Semantic Model 'revenue'
SELECT
- revenue_src_28007.revenue AS txn_revenue
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day
- , CASE WHEN EXTRACT(dow FROM revenue_src_28007.created_at) = 0 THEN EXTRACT(dow FROM revenue_src_28007.created_at) + 7 ELSE EXTRACT(dow FROM revenue_src_28007.created_at) END AS ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day
- , CASE WHEN EXTRACT(dow FROM revenue_src_28007.created_at) = 0 THEN EXTRACT(dow FROM revenue_src_28007.created_at) + 7 ELSE EXTRACT(dow FROM revenue_src_28007.created_at) END AS revenue_instance__ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy
- , revenue_src_28007.user_id AS user
- , revenue_src_28007.user_id AS revenue_instance__user
- FROM ***************************.fct_revenue revenue_src_28007
- ) subq_0
- ) subq_1
- ) subq_2
+ revenue_src_28000.revenue AS txn_revenue
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , CASE WHEN EXTRACT(dow FROM revenue_src_28000.created_at) = 0 THEN EXTRACT(dow FROM revenue_src_28000.created_at) + 7 ELSE EXTRACT(dow FROM revenue_src_28000.created_at) END AS ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS revenue_instance__ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS revenue_instance__ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS revenue_instance__ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS revenue_instance__ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , EXTRACT(day FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_day
+ , CASE WHEN EXTRACT(dow FROM revenue_src_28000.created_at) = 0 THEN EXTRACT(dow FROM revenue_src_28000.created_at) + 7 ELSE EXTRACT(dow FROM revenue_src_28000.created_at) END AS revenue_instance__ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_doy
+ , revenue_src_28000.user_id AS user
+ , revenue_src_28000.user_id AS revenue_instance__user
+ FROM ***************************.fct_revenue revenue_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
GROUP BY
- subq_2.ds__day
-) subq_3
+ subq_11.ds__day
+) subq_12
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric__plan0_optimized.sql
index 749250c230..76e8f3252a 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric__plan0_optimized.sql
@@ -6,6 +6,6 @@
SELECT
DATE_TRUNC('day', created_at) AS ds__day
, SUM(revenue) AS trailing_2_months_revenue
-FROM ***************************.fct_revenue revenue_src_28007
+FROM ***************************.fct_revenue revenue_src_28000
GROUP BY
DATE_TRUNC('day', created_at)
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_grain_to_date__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_grain_to_date__plan0.sql
index 5449f0fd88..0593cab40e 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_grain_to_date__plan0.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_grain_to_date__plan0.sql
@@ -1,88 +1,88 @@
-- Compute Metrics via Expressions
SELECT
- subq_3.ds__month
- , subq_3.txn_revenue AS revenue_mtd
+ subq_12.ds__month
+ , subq_12.txn_revenue AS revenue_mtd
FROM (
-- Aggregate Measures
SELECT
- subq_2.ds__month
- , SUM(subq_2.txn_revenue) AS txn_revenue
+ subq_11.ds__month
+ , SUM(subq_11.txn_revenue) AS txn_revenue
FROM (
-- Pass Only Elements: ['txn_revenue', 'ds__month']
SELECT
- subq_1.ds__month
- , subq_1.txn_revenue
+ subq_10.ds__month
+ , subq_10.txn_revenue
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.revenue_instance__ds__day
- , subq_0.revenue_instance__ds__week
- , subq_0.revenue_instance__ds__month
- , subq_0.revenue_instance__ds__quarter
- , subq_0.revenue_instance__ds__year
- , subq_0.revenue_instance__ds__extract_year
- , subq_0.revenue_instance__ds__extract_quarter
- , subq_0.revenue_instance__ds__extract_month
- , subq_0.revenue_instance__ds__extract_day
- , subq_0.revenue_instance__ds__extract_dow
- , subq_0.revenue_instance__ds__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.user
- , subq_0.revenue_instance__user
- , subq_0.txn_revenue
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.revenue_instance__ds__day
+ , subq_9.revenue_instance__ds__week
+ , subq_9.revenue_instance__ds__month
+ , subq_9.revenue_instance__ds__quarter
+ , subq_9.revenue_instance__ds__year
+ , subq_9.revenue_instance__ds__extract_year
+ , subq_9.revenue_instance__ds__extract_quarter
+ , subq_9.revenue_instance__ds__extract_month
+ , subq_9.revenue_instance__ds__extract_day
+ , subq_9.revenue_instance__ds__extract_dow
+ , subq_9.revenue_instance__ds__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.user
+ , subq_9.revenue_instance__user
+ , subq_9.txn_revenue
FROM (
-- Read Elements From Semantic Model 'revenue'
SELECT
- revenue_src_28007.revenue AS txn_revenue
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day
- , CASE WHEN EXTRACT(dow FROM revenue_src_28007.created_at) = 0 THEN EXTRACT(dow FROM revenue_src_28007.created_at) + 7 ELSE EXTRACT(dow FROM revenue_src_28007.created_at) END AS ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day
- , CASE WHEN EXTRACT(dow FROM revenue_src_28007.created_at) = 0 THEN EXTRACT(dow FROM revenue_src_28007.created_at) + 7 ELSE EXTRACT(dow FROM revenue_src_28007.created_at) END AS revenue_instance__ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy
- , revenue_src_28007.user_id AS user
- , revenue_src_28007.user_id AS revenue_instance__user
- FROM ***************************.fct_revenue revenue_src_28007
- ) subq_0
- ) subq_1
- ) subq_2
+ revenue_src_28000.revenue AS txn_revenue
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , CASE WHEN EXTRACT(dow FROM revenue_src_28000.created_at) = 0 THEN EXTRACT(dow FROM revenue_src_28000.created_at) + 7 ELSE EXTRACT(dow FROM revenue_src_28000.created_at) END AS ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS revenue_instance__ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS revenue_instance__ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS revenue_instance__ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS revenue_instance__ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , EXTRACT(day FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_day
+ , CASE WHEN EXTRACT(dow FROM revenue_src_28000.created_at) = 0 THEN EXTRACT(dow FROM revenue_src_28000.created_at) + 7 ELSE EXTRACT(dow FROM revenue_src_28000.created_at) END AS revenue_instance__ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_doy
+ , revenue_src_28000.user_id AS user
+ , revenue_src_28000.user_id AS revenue_instance__user
+ FROM ***************************.fct_revenue revenue_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
GROUP BY
- subq_2.ds__month
-) subq_3
+ subq_11.ds__month
+) subq_12
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_grain_to_date__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_grain_to_date__plan0_optimized.sql
index 6a6dbce8b9..e057084866 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_grain_to_date__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_grain_to_date__plan0_optimized.sql
@@ -6,6 +6,6 @@
SELECT
DATE_TRUNC('month', created_at) AS ds__month
, SUM(revenue) AS revenue_mtd
-FROM ***************************.fct_revenue revenue_src_28007
+FROM ***************************.fct_revenue revenue_src_28000
GROUP BY
DATE_TRUNC('month', created_at)
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_month__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_month__plan0.sql
index 5bc9116fc1..cc865b5b84 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_month__plan0.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_month__plan0.sql
@@ -1,103 +1,103 @@
-- Compute Metrics via Expressions
SELECT
- subq_8.metric_time__month
- , subq_8.bookings_monthly AS trailing_3_months_bookings
+ subq_12.metric_time__month
+ , subq_12.bookings_monthly AS trailing_3_months_bookings
FROM (
-- Aggregate Measures
SELECT
- subq_7.metric_time__month
- , SUM(subq_7.bookings_monthly) AS bookings_monthly
+ subq_11.metric_time__month
+ , SUM(subq_11.bookings_monthly) AS bookings_monthly
FROM (
-- Constrain Time Range to [2020-03-05T00:00:00, 2021-01-04T00:00:00]
SELECT
- subq_6.metric_time__month
- , subq_6.bookings_monthly
+ subq_10.metric_time__month
+ , subq_10.bookings_monthly
FROM (
-- Pass Only Elements: ['bookings_monthly', 'metric_time__month']
SELECT
- subq_5.metric_time__month
- , subq_5.bookings_monthly
+ subq_9.metric_time__month
+ , subq_9.bookings_monthly
FROM (
-- Join Self Over Time Range
SELECT
- subq_3.metric_time__month AS metric_time__month
- , subq_2.monthly_ds__month AS monthly_ds__month
- , subq_2.monthly_ds__quarter AS monthly_ds__quarter
- , subq_2.monthly_ds__year AS monthly_ds__year
- , subq_2.monthly_ds__extract_year AS monthly_ds__extract_year
- , subq_2.monthly_ds__extract_quarter AS monthly_ds__extract_quarter
- , subq_2.monthly_ds__extract_month AS monthly_ds__extract_month
- , subq_2.booking__monthly_ds__month AS booking__monthly_ds__month
- , subq_2.booking__monthly_ds__quarter AS booking__monthly_ds__quarter
- , subq_2.booking__monthly_ds__year AS booking__monthly_ds__year
- , subq_2.booking__monthly_ds__extract_year AS booking__monthly_ds__extract_year
- , subq_2.booking__monthly_ds__extract_quarter AS booking__monthly_ds__extract_quarter
- , subq_2.booking__monthly_ds__extract_month AS booking__monthly_ds__extract_month
- , subq_2.metric_time__quarter AS metric_time__quarter
- , subq_2.metric_time__year AS metric_time__year
- , subq_2.metric_time__extract_year AS metric_time__extract_year
- , subq_2.metric_time__extract_quarter AS metric_time__extract_quarter
- , subq_2.metric_time__extract_month AS metric_time__extract_month
- , subq_2.listing AS listing
- , subq_2.booking__listing AS booking__listing
- , subq_2.bookings_monthly AS bookings_monthly
+ subq_7.metric_time__month AS metric_time__month
+ , subq_6.monthly_ds__month AS monthly_ds__month
+ , subq_6.monthly_ds__quarter AS monthly_ds__quarter
+ , subq_6.monthly_ds__year AS monthly_ds__year
+ , subq_6.monthly_ds__extract_year AS monthly_ds__extract_year
+ , subq_6.monthly_ds__extract_quarter AS monthly_ds__extract_quarter
+ , subq_6.monthly_ds__extract_month AS monthly_ds__extract_month
+ , subq_6.booking__monthly_ds__month AS booking__monthly_ds__month
+ , subq_6.booking__monthly_ds__quarter AS booking__monthly_ds__quarter
+ , subq_6.booking__monthly_ds__year AS booking__monthly_ds__year
+ , subq_6.booking__monthly_ds__extract_year AS booking__monthly_ds__extract_year
+ , subq_6.booking__monthly_ds__extract_quarter AS booking__monthly_ds__extract_quarter
+ , subq_6.booking__monthly_ds__extract_month AS booking__monthly_ds__extract_month
+ , subq_6.metric_time__quarter AS metric_time__quarter
+ , subq_6.metric_time__year AS metric_time__year
+ , subq_6.metric_time__extract_year AS metric_time__extract_year
+ , subq_6.metric_time__extract_quarter AS metric_time__extract_quarter
+ , subq_6.metric_time__extract_month AS metric_time__extract_month
+ , subq_6.listing AS listing
+ , subq_6.booking__listing AS booking__listing
+ , subq_6.bookings_monthly AS bookings_monthly
FROM (
-- Time Spine
SELECT
- DATE_TRUNC('month', subq_4.ds) AS metric_time__month
- FROM ***************************.mf_time_spine subq_4
- WHERE subq_4.ds BETWEEN '2020-03-05' AND '2021-01-04'
+ DATE_TRUNC('month', subq_8.ds) AS metric_time__month
+ FROM ***************************.mf_time_spine subq_8
+ WHERE subq_8.ds BETWEEN '2020-03-05' AND '2021-01-04'
GROUP BY
- DATE_TRUNC('month', subq_4.ds)
- ) subq_3
+ DATE_TRUNC('month', subq_8.ds)
+ ) subq_7
INNER JOIN (
-- Constrain Time Range to [2019-12-05T00:00:00, 2021-01-04T00:00:00]
SELECT
- subq_1.monthly_ds__month
- , subq_1.monthly_ds__quarter
- , subq_1.monthly_ds__year
- , subq_1.monthly_ds__extract_year
- , subq_1.monthly_ds__extract_quarter
- , subq_1.monthly_ds__extract_month
- , subq_1.booking__monthly_ds__month
- , subq_1.booking__monthly_ds__quarter
- , subq_1.booking__monthly_ds__year
- , subq_1.booking__monthly_ds__extract_year
- , subq_1.booking__monthly_ds__extract_quarter
- , subq_1.booking__monthly_ds__extract_month
- , subq_1.metric_time__month
- , subq_1.metric_time__quarter
- , subq_1.metric_time__year
- , subq_1.metric_time__extract_year
- , subq_1.metric_time__extract_quarter
- , subq_1.metric_time__extract_month
- , subq_1.listing
- , subq_1.booking__listing
- , subq_1.bookings_monthly
+ subq_5.monthly_ds__month
+ , subq_5.monthly_ds__quarter
+ , subq_5.monthly_ds__year
+ , subq_5.monthly_ds__extract_year
+ , subq_5.monthly_ds__extract_quarter
+ , subq_5.monthly_ds__extract_month
+ , subq_5.booking__monthly_ds__month
+ , subq_5.booking__monthly_ds__quarter
+ , subq_5.booking__monthly_ds__year
+ , subq_5.booking__monthly_ds__extract_year
+ , subq_5.booking__monthly_ds__extract_quarter
+ , subq_5.booking__monthly_ds__extract_month
+ , subq_5.metric_time__month
+ , subq_5.metric_time__quarter
+ , subq_5.metric_time__year
+ , subq_5.metric_time__extract_year
+ , subq_5.metric_time__extract_quarter
+ , subq_5.metric_time__extract_month
+ , subq_5.listing
+ , subq_5.booking__listing
+ , subq_5.bookings_monthly
FROM (
-- Metric Time Dimension 'monthly_ds'
SELECT
- subq_0.monthly_ds__month
- , subq_0.monthly_ds__quarter
- , subq_0.monthly_ds__year
- , subq_0.monthly_ds__extract_year
- , subq_0.monthly_ds__extract_quarter
- , subq_0.monthly_ds__extract_month
- , subq_0.booking__monthly_ds__month
- , subq_0.booking__monthly_ds__quarter
- , subq_0.booking__monthly_ds__year
- , subq_0.booking__monthly_ds__extract_year
- , subq_0.booking__monthly_ds__extract_quarter
- , subq_0.booking__monthly_ds__extract_month
- , subq_0.monthly_ds__month AS metric_time__month
- , subq_0.monthly_ds__quarter AS metric_time__quarter
- , subq_0.monthly_ds__year AS metric_time__year
- , subq_0.monthly_ds__extract_year AS metric_time__extract_year
- , subq_0.monthly_ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.monthly_ds__extract_month AS metric_time__extract_month
- , subq_0.listing
- , subq_0.booking__listing
- , subq_0.bookings_monthly
+ subq_4.monthly_ds__month
+ , subq_4.monthly_ds__quarter
+ , subq_4.monthly_ds__year
+ , subq_4.monthly_ds__extract_year
+ , subq_4.monthly_ds__extract_quarter
+ , subq_4.monthly_ds__extract_month
+ , subq_4.booking__monthly_ds__month
+ , subq_4.booking__monthly_ds__quarter
+ , subq_4.booking__monthly_ds__year
+ , subq_4.booking__monthly_ds__extract_year
+ , subq_4.booking__monthly_ds__extract_quarter
+ , subq_4.booking__monthly_ds__extract_month
+ , subq_4.monthly_ds__month AS metric_time__month
+ , subq_4.monthly_ds__quarter AS metric_time__quarter
+ , subq_4.monthly_ds__year AS metric_time__year
+ , subq_4.monthly_ds__extract_year AS metric_time__extract_year
+ , subq_4.monthly_ds__extract_quarter AS metric_time__extract_quarter
+ , subq_4.monthly_ds__extract_month AS metric_time__extract_month
+ , subq_4.listing
+ , subq_4.booking__listing
+ , subq_4.bookings_monthly
FROM (
-- Read Elements From Semantic Model 'bookings_monthly_source'
SELECT
@@ -117,20 +117,20 @@ FROM (
, bookings_monthly_source_src_16000.listing_id AS listing
, bookings_monthly_source_src_16000.listing_id AS booking__listing
FROM ***************************.fct_bookings_extended_monthly bookings_monthly_source_src_16000
- ) subq_0
- ) subq_1
- WHERE subq_1.metric_time__month BETWEEN '2019-12-05' AND '2021-01-04'
- ) subq_2
+ ) subq_4
+ ) subq_5
+ WHERE subq_5.metric_time__month BETWEEN '2019-12-05' AND '2021-01-04'
+ ) subq_6
ON
(
- subq_2.metric_time__month <= subq_3.metric_time__month
+ subq_6.metric_time__month <= subq_7.metric_time__month
) AND (
- subq_2.metric_time__month > DATEADD(month, -3, subq_3.metric_time__month)
+ subq_6.metric_time__month > DATEADD(month, -3, subq_7.metric_time__month)
)
- ) subq_5
- ) subq_6
- WHERE subq_6.metric_time__month BETWEEN '2020-03-05' AND '2021-01-04'
- ) subq_7
+ ) subq_9
+ ) subq_10
+ WHERE subq_10.metric_time__month BETWEEN '2020-03-05' AND '2021-01-04'
+ ) subq_11
GROUP BY
- subq_7.metric_time__month
-) subq_8
+ subq_11.metric_time__month
+) subq_12
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_month__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_month__plan0_optimized.sql
index 4611f8316c..c9b1da3166 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_month__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_month__plan0_optimized.sql
@@ -4,17 +4,17 @@
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_12.metric_time__month AS metric_time__month
- , SUM(subq_11.bookings_monthly) AS trailing_3_months_bookings
+ subq_16.metric_time__month AS metric_time__month
+ , SUM(subq_15.bookings_monthly) AS trailing_3_months_bookings
FROM (
-- Time Spine
SELECT
DATE_TRUNC('month', ds) AS metric_time__month
- FROM ***************************.mf_time_spine subq_13
+ FROM ***************************.mf_time_spine subq_17
WHERE ds BETWEEN '2020-03-05' AND '2021-01-04'
GROUP BY
DATE_TRUNC('month', ds)
-) subq_12
+) subq_16
INNER JOIN (
-- Read Elements From Semantic Model 'bookings_monthly_source'
-- Metric Time Dimension 'monthly_ds'
@@ -24,13 +24,13 @@ INNER JOIN (
, bookings_monthly
FROM ***************************.fct_bookings_extended_monthly bookings_monthly_source_src_16000
WHERE DATE_TRUNC('month', ds) BETWEEN '2019-12-05' AND '2021-01-04'
-) subq_11
+) subq_15
ON
(
- subq_11.metric_time__month <= subq_12.metric_time__month
+ subq_15.metric_time__month <= subq_16.metric_time__month
) AND (
- subq_11.metric_time__month > DATEADD(month, -3, subq_12.metric_time__month)
+ subq_15.metric_time__month > DATEADD(month, -3, subq_16.metric_time__month)
)
-WHERE subq_12.metric_time__month BETWEEN '2020-03-05' AND '2021-01-04'
+WHERE subq_16.metric_time__month BETWEEN '2020-03-05' AND '2021-01-04'
GROUP BY
- subq_12.metric_time__month
+ subq_16.metric_time__month
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_no_ds__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_no_ds__plan0.sql
index adbc914a7a..a1310c81ac 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_no_ds__plan0.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_no_ds__plan0.sql
@@ -1,83 +1,83 @@
-- Compute Metrics via Expressions
SELECT
- subq_3.txn_revenue AS trailing_2_months_revenue
+ subq_12.txn_revenue AS trailing_2_months_revenue
FROM (
-- Aggregate Measures
SELECT
- SUM(subq_2.txn_revenue) AS txn_revenue
+ SUM(subq_11.txn_revenue) AS txn_revenue
FROM (
-- Pass Only Elements: ['txn_revenue',]
SELECT
- subq_1.txn_revenue
+ subq_10.txn_revenue
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.revenue_instance__ds__day
- , subq_0.revenue_instance__ds__week
- , subq_0.revenue_instance__ds__month
- , subq_0.revenue_instance__ds__quarter
- , subq_0.revenue_instance__ds__year
- , subq_0.revenue_instance__ds__extract_year
- , subq_0.revenue_instance__ds__extract_quarter
- , subq_0.revenue_instance__ds__extract_month
- , subq_0.revenue_instance__ds__extract_day
- , subq_0.revenue_instance__ds__extract_dow
- , subq_0.revenue_instance__ds__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.user
- , subq_0.revenue_instance__user
- , subq_0.txn_revenue
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.revenue_instance__ds__day
+ , subq_9.revenue_instance__ds__week
+ , subq_9.revenue_instance__ds__month
+ , subq_9.revenue_instance__ds__quarter
+ , subq_9.revenue_instance__ds__year
+ , subq_9.revenue_instance__ds__extract_year
+ , subq_9.revenue_instance__ds__extract_quarter
+ , subq_9.revenue_instance__ds__extract_month
+ , subq_9.revenue_instance__ds__extract_day
+ , subq_9.revenue_instance__ds__extract_dow
+ , subq_9.revenue_instance__ds__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.user
+ , subq_9.revenue_instance__user
+ , subq_9.txn_revenue
FROM (
-- Read Elements From Semantic Model 'revenue'
SELECT
- revenue_src_28007.revenue AS txn_revenue
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day
- , CASE WHEN EXTRACT(dow FROM revenue_src_28007.created_at) = 0 THEN EXTRACT(dow FROM revenue_src_28007.created_at) + 7 ELSE EXTRACT(dow FROM revenue_src_28007.created_at) END AS ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day
- , CASE WHEN EXTRACT(dow FROM revenue_src_28007.created_at) = 0 THEN EXTRACT(dow FROM revenue_src_28007.created_at) + 7 ELSE EXTRACT(dow FROM revenue_src_28007.created_at) END AS revenue_instance__ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy
- , revenue_src_28007.user_id AS user
- , revenue_src_28007.user_id AS revenue_instance__user
- FROM ***************************.fct_revenue revenue_src_28007
- ) subq_0
- ) subq_1
- ) subq_2
-) subq_3
+ revenue_src_28000.revenue AS txn_revenue
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , CASE WHEN EXTRACT(dow FROM revenue_src_28000.created_at) = 0 THEN EXTRACT(dow FROM revenue_src_28000.created_at) + 7 ELSE EXTRACT(dow FROM revenue_src_28000.created_at) END AS ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS revenue_instance__ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS revenue_instance__ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS revenue_instance__ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS revenue_instance__ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , EXTRACT(day FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_day
+ , CASE WHEN EXTRACT(dow FROM revenue_src_28000.created_at) = 0 THEN EXTRACT(dow FROM revenue_src_28000.created_at) + 7 ELSE EXTRACT(dow FROM revenue_src_28000.created_at) END AS revenue_instance__ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_doy
+ , revenue_src_28000.user_id AS user
+ , revenue_src_28000.user_id AS revenue_instance__user
+ FROM ***************************.fct_revenue revenue_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
+) subq_12
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_no_ds__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_no_ds__plan0_optimized.sql
index e26a1bdb3d..4a0d5baff3 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_no_ds__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_no_ds__plan0_optimized.sql
@@ -5,4 +5,4 @@
-- Compute Metrics via Expressions
SELECT
SUM(revenue) AS trailing_2_months_revenue
-FROM ***************************.fct_revenue revenue_src_28007
+FROM ***************************.fct_revenue revenue_src_28000
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_no_window__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_no_window__plan0.sql
index af069affcc..c97e68cff4 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_no_window__plan0.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_no_window__plan0.sql
@@ -1,88 +1,88 @@
-- Compute Metrics via Expressions
SELECT
- subq_3.ds__month
- , subq_3.txn_revenue AS revenue_all_time
+ subq_12.ds__month
+ , subq_12.txn_revenue AS revenue_all_time
FROM (
-- Aggregate Measures
SELECT
- subq_2.ds__month
- , SUM(subq_2.txn_revenue) AS txn_revenue
+ subq_11.ds__month
+ , SUM(subq_11.txn_revenue) AS txn_revenue
FROM (
-- Pass Only Elements: ['txn_revenue', 'ds__month']
SELECT
- subq_1.ds__month
- , subq_1.txn_revenue
+ subq_10.ds__month
+ , subq_10.txn_revenue
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.revenue_instance__ds__day
- , subq_0.revenue_instance__ds__week
- , subq_0.revenue_instance__ds__month
- , subq_0.revenue_instance__ds__quarter
- , subq_0.revenue_instance__ds__year
- , subq_0.revenue_instance__ds__extract_year
- , subq_0.revenue_instance__ds__extract_quarter
- , subq_0.revenue_instance__ds__extract_month
- , subq_0.revenue_instance__ds__extract_day
- , subq_0.revenue_instance__ds__extract_dow
- , subq_0.revenue_instance__ds__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.user
- , subq_0.revenue_instance__user
- , subq_0.txn_revenue
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.revenue_instance__ds__day
+ , subq_9.revenue_instance__ds__week
+ , subq_9.revenue_instance__ds__month
+ , subq_9.revenue_instance__ds__quarter
+ , subq_9.revenue_instance__ds__year
+ , subq_9.revenue_instance__ds__extract_year
+ , subq_9.revenue_instance__ds__extract_quarter
+ , subq_9.revenue_instance__ds__extract_month
+ , subq_9.revenue_instance__ds__extract_day
+ , subq_9.revenue_instance__ds__extract_dow
+ , subq_9.revenue_instance__ds__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.user
+ , subq_9.revenue_instance__user
+ , subq_9.txn_revenue
FROM (
-- Read Elements From Semantic Model 'revenue'
SELECT
- revenue_src_28007.revenue AS txn_revenue
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day
- , CASE WHEN EXTRACT(dow FROM revenue_src_28007.created_at) = 0 THEN EXTRACT(dow FROM revenue_src_28007.created_at) + 7 ELSE EXTRACT(dow FROM revenue_src_28007.created_at) END AS ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day
- , CASE WHEN EXTRACT(dow FROM revenue_src_28007.created_at) = 0 THEN EXTRACT(dow FROM revenue_src_28007.created_at) + 7 ELSE EXTRACT(dow FROM revenue_src_28007.created_at) END AS revenue_instance__ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy
- , revenue_src_28007.user_id AS user
- , revenue_src_28007.user_id AS revenue_instance__user
- FROM ***************************.fct_revenue revenue_src_28007
- ) subq_0
- ) subq_1
- ) subq_2
+ revenue_src_28000.revenue AS txn_revenue
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , CASE WHEN EXTRACT(dow FROM revenue_src_28000.created_at) = 0 THEN EXTRACT(dow FROM revenue_src_28000.created_at) + 7 ELSE EXTRACT(dow FROM revenue_src_28000.created_at) END AS ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS revenue_instance__ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS revenue_instance__ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS revenue_instance__ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS revenue_instance__ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , EXTRACT(day FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_day
+ , CASE WHEN EXTRACT(dow FROM revenue_src_28000.created_at) = 0 THEN EXTRACT(dow FROM revenue_src_28000.created_at) + 7 ELSE EXTRACT(dow FROM revenue_src_28000.created_at) END AS revenue_instance__ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_doy
+ , revenue_src_28000.user_id AS user
+ , revenue_src_28000.user_id AS revenue_instance__user
+ FROM ***************************.fct_revenue revenue_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
GROUP BY
- subq_2.ds__month
-) subq_3
+ subq_11.ds__month
+) subq_12
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_no_window__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_no_window__plan0_optimized.sql
index a7ca78d4e5..05e48cdae3 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_no_window__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_no_window__plan0_optimized.sql
@@ -6,6 +6,6 @@
SELECT
DATE_TRUNC('month', created_at) AS ds__month
, SUM(revenue) AS revenue_all_time
-FROM ***************************.fct_revenue revenue_src_28007
+FROM ***************************.fct_revenue revenue_src_28000
GROUP BY
DATE_TRUNC('month', created_at)
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_no_window_with_time_constraint__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_no_window_with_time_constraint__plan0.sql
index e9b856ce1a..2d00f83f68 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_no_window_with_time_constraint__plan0.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_no_window_with_time_constraint__plan0.sql
@@ -1,187 +1,187 @@
-- Compute Metrics via Expressions
SELECT
- subq_8.metric_time__month
- , subq_8.txn_revenue AS revenue_all_time
+ subq_19.metric_time__month
+ , subq_19.txn_revenue AS revenue_all_time
FROM (
-- Aggregate Measures
SELECT
- subq_7.metric_time__month
- , SUM(subq_7.txn_revenue) AS txn_revenue
+ subq_18.metric_time__month
+ , SUM(subq_18.txn_revenue) AS txn_revenue
FROM (
-- Constrain Time Range to [2020-01-01T00:00:00, 2020-01-01T00:00:00]
SELECT
- subq_6.metric_time__month
- , subq_6.txn_revenue
+ subq_17.metric_time__month
+ , subq_17.txn_revenue
FROM (
-- Pass Only Elements: ['txn_revenue', 'metric_time__month']
SELECT
- subq_5.metric_time__month
- , subq_5.txn_revenue
+ subq_16.metric_time__month
+ , subq_16.txn_revenue
FROM (
-- Join Self Over Time Range
SELECT
- subq_3.metric_time__month AS metric_time__month
- , subq_2.ds__day AS ds__day
- , subq_2.ds__week AS ds__week
- , subq_2.ds__month AS ds__month
- , subq_2.ds__quarter AS ds__quarter
- , subq_2.ds__year AS ds__year
- , subq_2.ds__extract_year AS ds__extract_year
- , subq_2.ds__extract_quarter AS ds__extract_quarter
- , subq_2.ds__extract_month AS ds__extract_month
- , subq_2.ds__extract_day AS ds__extract_day
- , subq_2.ds__extract_dow AS ds__extract_dow
- , subq_2.ds__extract_doy AS ds__extract_doy
- , subq_2.revenue_instance__ds__day AS revenue_instance__ds__day
- , subq_2.revenue_instance__ds__week AS revenue_instance__ds__week
- , subq_2.revenue_instance__ds__month AS revenue_instance__ds__month
- , subq_2.revenue_instance__ds__quarter AS revenue_instance__ds__quarter
- , subq_2.revenue_instance__ds__year AS revenue_instance__ds__year
- , subq_2.revenue_instance__ds__extract_year AS revenue_instance__ds__extract_year
- , subq_2.revenue_instance__ds__extract_quarter AS revenue_instance__ds__extract_quarter
- , subq_2.revenue_instance__ds__extract_month AS revenue_instance__ds__extract_month
- , subq_2.revenue_instance__ds__extract_day AS revenue_instance__ds__extract_day
- , subq_2.revenue_instance__ds__extract_dow AS revenue_instance__ds__extract_dow
- , subq_2.revenue_instance__ds__extract_doy AS revenue_instance__ds__extract_doy
- , subq_2.metric_time__day AS metric_time__day
- , subq_2.metric_time__week AS metric_time__week
- , subq_2.metric_time__quarter AS metric_time__quarter
- , subq_2.metric_time__year AS metric_time__year
- , subq_2.metric_time__extract_year AS metric_time__extract_year
- , subq_2.metric_time__extract_quarter AS metric_time__extract_quarter
- , subq_2.metric_time__extract_month AS metric_time__extract_month
- , subq_2.metric_time__extract_day AS metric_time__extract_day
- , subq_2.metric_time__extract_dow AS metric_time__extract_dow
- , subq_2.metric_time__extract_doy AS metric_time__extract_doy
- , subq_2.user AS user
- , subq_2.revenue_instance__user AS revenue_instance__user
- , subq_2.txn_revenue AS txn_revenue
+ subq_14.metric_time__month AS metric_time__month
+ , subq_13.ds__day AS ds__day
+ , subq_13.ds__week AS ds__week
+ , subq_13.ds__month AS ds__month
+ , subq_13.ds__quarter AS ds__quarter
+ , subq_13.ds__year AS ds__year
+ , subq_13.ds__extract_year AS ds__extract_year
+ , subq_13.ds__extract_quarter AS ds__extract_quarter
+ , subq_13.ds__extract_month AS ds__extract_month
+ , subq_13.ds__extract_day AS ds__extract_day
+ , subq_13.ds__extract_dow AS ds__extract_dow
+ , subq_13.ds__extract_doy AS ds__extract_doy
+ , subq_13.revenue_instance__ds__day AS revenue_instance__ds__day
+ , subq_13.revenue_instance__ds__week AS revenue_instance__ds__week
+ , subq_13.revenue_instance__ds__month AS revenue_instance__ds__month
+ , subq_13.revenue_instance__ds__quarter AS revenue_instance__ds__quarter
+ , subq_13.revenue_instance__ds__year AS revenue_instance__ds__year
+ , subq_13.revenue_instance__ds__extract_year AS revenue_instance__ds__extract_year
+ , subq_13.revenue_instance__ds__extract_quarter AS revenue_instance__ds__extract_quarter
+ , subq_13.revenue_instance__ds__extract_month AS revenue_instance__ds__extract_month
+ , subq_13.revenue_instance__ds__extract_day AS revenue_instance__ds__extract_day
+ , subq_13.revenue_instance__ds__extract_dow AS revenue_instance__ds__extract_dow
+ , subq_13.revenue_instance__ds__extract_doy AS revenue_instance__ds__extract_doy
+ , subq_13.metric_time__day AS metric_time__day
+ , subq_13.metric_time__week AS metric_time__week
+ , subq_13.metric_time__quarter AS metric_time__quarter
+ , subq_13.metric_time__year AS metric_time__year
+ , subq_13.metric_time__extract_year AS metric_time__extract_year
+ , subq_13.metric_time__extract_quarter AS metric_time__extract_quarter
+ , subq_13.metric_time__extract_month AS metric_time__extract_month
+ , subq_13.metric_time__extract_day AS metric_time__extract_day
+ , subq_13.metric_time__extract_dow AS metric_time__extract_dow
+ , subq_13.metric_time__extract_doy AS metric_time__extract_doy
+ , subq_13.user AS user
+ , subq_13.revenue_instance__user AS revenue_instance__user
+ , subq_13.txn_revenue AS txn_revenue
FROM (
-- Time Spine
SELECT
- DATE_TRUNC('month', subq_4.ds) AS metric_time__month
- FROM ***************************.mf_time_spine subq_4
- WHERE subq_4.ds BETWEEN '2020-01-01' AND '2020-01-01'
+ DATE_TRUNC('month', subq_15.ds) AS metric_time__month
+ FROM ***************************.mf_time_spine subq_15
+ WHERE subq_15.ds BETWEEN '2020-01-01' AND '2020-01-01'
GROUP BY
- DATE_TRUNC('month', subq_4.ds)
- ) subq_3
+ DATE_TRUNC('month', subq_15.ds)
+ ) subq_14
INNER JOIN (
-- Constrain Time Range to [2000-01-01T00:00:00, 2020-01-01T00:00:00]
SELECT
- subq_1.ds__day
- , subq_1.ds__week
- , subq_1.ds__month
- , subq_1.ds__quarter
- , subq_1.ds__year
- , subq_1.ds__extract_year
- , subq_1.ds__extract_quarter
- , subq_1.ds__extract_month
- , subq_1.ds__extract_day
- , subq_1.ds__extract_dow
- , subq_1.ds__extract_doy
- , subq_1.revenue_instance__ds__day
- , subq_1.revenue_instance__ds__week
- , subq_1.revenue_instance__ds__month
- , subq_1.revenue_instance__ds__quarter
- , subq_1.revenue_instance__ds__year
- , subq_1.revenue_instance__ds__extract_year
- , subq_1.revenue_instance__ds__extract_quarter
- , subq_1.revenue_instance__ds__extract_month
- , subq_1.revenue_instance__ds__extract_day
- , subq_1.revenue_instance__ds__extract_dow
- , subq_1.revenue_instance__ds__extract_doy
- , subq_1.metric_time__day
- , subq_1.metric_time__week
- , subq_1.metric_time__month
- , subq_1.metric_time__quarter
- , subq_1.metric_time__year
- , subq_1.metric_time__extract_year
- , subq_1.metric_time__extract_quarter
- , subq_1.metric_time__extract_month
- , subq_1.metric_time__extract_day
- , subq_1.metric_time__extract_dow
- , subq_1.metric_time__extract_doy
- , subq_1.user
- , subq_1.revenue_instance__user
- , subq_1.txn_revenue
+ subq_12.ds__day
+ , subq_12.ds__week
+ , subq_12.ds__month
+ , subq_12.ds__quarter
+ , subq_12.ds__year
+ , subq_12.ds__extract_year
+ , subq_12.ds__extract_quarter
+ , subq_12.ds__extract_month
+ , subq_12.ds__extract_day
+ , subq_12.ds__extract_dow
+ , subq_12.ds__extract_doy
+ , subq_12.revenue_instance__ds__day
+ , subq_12.revenue_instance__ds__week
+ , subq_12.revenue_instance__ds__month
+ , subq_12.revenue_instance__ds__quarter
+ , subq_12.revenue_instance__ds__year
+ , subq_12.revenue_instance__ds__extract_year
+ , subq_12.revenue_instance__ds__extract_quarter
+ , subq_12.revenue_instance__ds__extract_month
+ , subq_12.revenue_instance__ds__extract_day
+ , subq_12.revenue_instance__ds__extract_dow
+ , subq_12.revenue_instance__ds__extract_doy
+ , subq_12.metric_time__day
+ , subq_12.metric_time__week
+ , subq_12.metric_time__month
+ , subq_12.metric_time__quarter
+ , subq_12.metric_time__year
+ , subq_12.metric_time__extract_year
+ , subq_12.metric_time__extract_quarter
+ , subq_12.metric_time__extract_month
+ , subq_12.metric_time__extract_day
+ , subq_12.metric_time__extract_dow
+ , subq_12.metric_time__extract_doy
+ , subq_12.user
+ , subq_12.revenue_instance__user
+ , subq_12.txn_revenue
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.revenue_instance__ds__day
- , subq_0.revenue_instance__ds__week
- , subq_0.revenue_instance__ds__month
- , subq_0.revenue_instance__ds__quarter
- , subq_0.revenue_instance__ds__year
- , subq_0.revenue_instance__ds__extract_year
- , subq_0.revenue_instance__ds__extract_quarter
- , subq_0.revenue_instance__ds__extract_month
- , subq_0.revenue_instance__ds__extract_day
- , subq_0.revenue_instance__ds__extract_dow
- , subq_0.revenue_instance__ds__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.user
- , subq_0.revenue_instance__user
- , subq_0.txn_revenue
+ subq_11.ds__day
+ , subq_11.ds__week
+ , subq_11.ds__month
+ , subq_11.ds__quarter
+ , subq_11.ds__year
+ , subq_11.ds__extract_year
+ , subq_11.ds__extract_quarter
+ , subq_11.ds__extract_month
+ , subq_11.ds__extract_day
+ , subq_11.ds__extract_dow
+ , subq_11.ds__extract_doy
+ , subq_11.revenue_instance__ds__day
+ , subq_11.revenue_instance__ds__week
+ , subq_11.revenue_instance__ds__month
+ , subq_11.revenue_instance__ds__quarter
+ , subq_11.revenue_instance__ds__year
+ , subq_11.revenue_instance__ds__extract_year
+ , subq_11.revenue_instance__ds__extract_quarter
+ , subq_11.revenue_instance__ds__extract_month
+ , subq_11.revenue_instance__ds__extract_day
+ , subq_11.revenue_instance__ds__extract_dow
+ , subq_11.revenue_instance__ds__extract_doy
+ , subq_11.ds__day AS metric_time__day
+ , subq_11.ds__week AS metric_time__week
+ , subq_11.ds__month AS metric_time__month
+ , subq_11.ds__quarter AS metric_time__quarter
+ , subq_11.ds__year AS metric_time__year
+ , subq_11.ds__extract_year AS metric_time__extract_year
+ , subq_11.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_11.ds__extract_month AS metric_time__extract_month
+ , subq_11.ds__extract_day AS metric_time__extract_day
+ , subq_11.ds__extract_dow AS metric_time__extract_dow
+ , subq_11.ds__extract_doy AS metric_time__extract_doy
+ , subq_11.user
+ , subq_11.revenue_instance__user
+ , subq_11.txn_revenue
FROM (
-- Read Elements From Semantic Model 'revenue'
SELECT
- revenue_src_28007.revenue AS txn_revenue
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day
- , CASE WHEN EXTRACT(dow FROM revenue_src_28007.created_at) = 0 THEN EXTRACT(dow FROM revenue_src_28007.created_at) + 7 ELSE EXTRACT(dow FROM revenue_src_28007.created_at) END AS ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day
- , CASE WHEN EXTRACT(dow FROM revenue_src_28007.created_at) = 0 THEN EXTRACT(dow FROM revenue_src_28007.created_at) + 7 ELSE EXTRACT(dow FROM revenue_src_28007.created_at) END AS revenue_instance__ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy
- , revenue_src_28007.user_id AS user
- , revenue_src_28007.user_id AS revenue_instance__user
- FROM ***************************.fct_revenue revenue_src_28007
- ) subq_0
- ) subq_1
- WHERE subq_1.metric_time__day BETWEEN '2000-01-01' AND '2020-01-01'
- ) subq_2
+ revenue_src_28000.revenue AS txn_revenue
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , CASE WHEN EXTRACT(dow FROM revenue_src_28000.created_at) = 0 THEN EXTRACT(dow FROM revenue_src_28000.created_at) + 7 ELSE EXTRACT(dow FROM revenue_src_28000.created_at) END AS ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS revenue_instance__ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS revenue_instance__ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS revenue_instance__ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS revenue_instance__ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , EXTRACT(day FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_day
+ , CASE WHEN EXTRACT(dow FROM revenue_src_28000.created_at) = 0 THEN EXTRACT(dow FROM revenue_src_28000.created_at) + 7 ELSE EXTRACT(dow FROM revenue_src_28000.created_at) END AS revenue_instance__ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_doy
+ , revenue_src_28000.user_id AS user
+ , revenue_src_28000.user_id AS revenue_instance__user
+ FROM ***************************.fct_revenue revenue_src_28000
+ ) subq_11
+ ) subq_12
+ WHERE subq_12.metric_time__day BETWEEN '2000-01-01' AND '2020-01-01'
+ ) subq_13
ON
- (subq_2.metric_time__month <= subq_3.metric_time__month)
- ) subq_5
- ) subq_6
- WHERE subq_6.metric_time__month BETWEEN '2020-01-01' AND '2020-01-01'
- ) subq_7
+ (subq_13.metric_time__month <= subq_14.metric_time__month)
+ ) subq_16
+ ) subq_17
+ WHERE subq_17.metric_time__month BETWEEN '2020-01-01' AND '2020-01-01'
+ ) subq_18
GROUP BY
- subq_7.metric_time__month
-) subq_8
+ subq_18.metric_time__month
+) subq_19
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_no_window_with_time_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_no_window_with_time_constraint__plan0_optimized.sql
index a4e5bf994b..0267f01b4a 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_no_window_with_time_constraint__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_no_window_with_time_constraint__plan0_optimized.sql
@@ -4,17 +4,17 @@
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_12.metric_time__month AS metric_time__month
- , SUM(subq_11.txn_revenue) AS revenue_all_time
+ subq_23.metric_time__month AS metric_time__month
+ , SUM(subq_22.txn_revenue) AS revenue_all_time
FROM (
-- Time Spine
SELECT
DATE_TRUNC('month', ds) AS metric_time__month
- FROM ***************************.mf_time_spine subq_13
+ FROM ***************************.mf_time_spine subq_24
WHERE ds BETWEEN '2020-01-01' AND '2020-01-01'
GROUP BY
DATE_TRUNC('month', ds)
-) subq_12
+) subq_23
INNER JOIN (
-- Read Elements From Semantic Model 'revenue'
-- Metric Time Dimension 'ds'
@@ -22,11 +22,11 @@ INNER JOIN (
SELECT
DATE_TRUNC('month', created_at) AS metric_time__month
, revenue AS txn_revenue
- FROM ***************************.fct_revenue revenue_src_28007
+ FROM ***************************.fct_revenue revenue_src_28000
WHERE DATE_TRUNC('day', created_at) BETWEEN '2000-01-01' AND '2020-01-01'
-) subq_11
+) subq_22
ON
- (subq_11.metric_time__month <= subq_12.metric_time__month)
-WHERE subq_12.metric_time__month BETWEEN '2020-01-01' AND '2020-01-01'
+ (subq_22.metric_time__month <= subq_23.metric_time__month)
+WHERE subq_23.metric_time__month BETWEEN '2020-01-01' AND '2020-01-01'
GROUP BY
- subq_12.metric_time__month
+ subq_23.metric_time__month
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_with_agg_time_dimension__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_with_agg_time_dimension__plan0.sql
index 6063a555c2..0d517bc3a0 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_with_agg_time_dimension__plan0.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_with_agg_time_dimension__plan0.sql
@@ -1,140 +1,140 @@
-- Compute Metrics via Expressions
SELECT
- subq_6.revenue_instance__ds__day
- , subq_6.txn_revenue AS trailing_2_months_revenue
+ subq_15.revenue_instance__ds__day
+ , subq_15.txn_revenue AS trailing_2_months_revenue
FROM (
-- Aggregate Measures
SELECT
- subq_5.revenue_instance__ds__day
- , SUM(subq_5.txn_revenue) AS txn_revenue
+ subq_14.revenue_instance__ds__day
+ , SUM(subq_14.txn_revenue) AS txn_revenue
FROM (
-- Pass Only Elements: ['txn_revenue', 'revenue_instance__ds__day']
SELECT
- subq_4.revenue_instance__ds__day
- , subq_4.txn_revenue
+ subq_13.revenue_instance__ds__day
+ , subq_13.txn_revenue
FROM (
-- Join Self Over Time Range
SELECT
- subq_2.revenue_instance__ds__day AS revenue_instance__ds__day
- , subq_1.ds__day AS ds__day
- , subq_1.ds__week AS ds__week
- , subq_1.ds__month AS ds__month
- , subq_1.ds__quarter AS ds__quarter
- , subq_1.ds__year AS ds__year
- , subq_1.ds__extract_year AS ds__extract_year
- , subq_1.ds__extract_quarter AS ds__extract_quarter
- , subq_1.ds__extract_month AS ds__extract_month
- , subq_1.ds__extract_day AS ds__extract_day
- , subq_1.ds__extract_dow AS ds__extract_dow
- , subq_1.ds__extract_doy AS ds__extract_doy
- , subq_1.revenue_instance__ds__week AS revenue_instance__ds__week
- , subq_1.revenue_instance__ds__month AS revenue_instance__ds__month
- , subq_1.revenue_instance__ds__quarter AS revenue_instance__ds__quarter
- , subq_1.revenue_instance__ds__year AS revenue_instance__ds__year
- , subq_1.revenue_instance__ds__extract_year AS revenue_instance__ds__extract_year
- , subq_1.revenue_instance__ds__extract_quarter AS revenue_instance__ds__extract_quarter
- , subq_1.revenue_instance__ds__extract_month AS revenue_instance__ds__extract_month
- , subq_1.revenue_instance__ds__extract_day AS revenue_instance__ds__extract_day
- , subq_1.revenue_instance__ds__extract_dow AS revenue_instance__ds__extract_dow
- , subq_1.revenue_instance__ds__extract_doy AS revenue_instance__ds__extract_doy
- , subq_1.metric_time__day AS metric_time__day
- , subq_1.metric_time__week AS metric_time__week
- , subq_1.metric_time__month AS metric_time__month
- , subq_1.metric_time__quarter AS metric_time__quarter
- , subq_1.metric_time__year AS metric_time__year
- , subq_1.metric_time__extract_year AS metric_time__extract_year
- , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter
- , subq_1.metric_time__extract_month AS metric_time__extract_month
- , subq_1.metric_time__extract_day AS metric_time__extract_day
- , subq_1.metric_time__extract_dow AS metric_time__extract_dow
- , subq_1.metric_time__extract_doy AS metric_time__extract_doy
- , subq_1.user AS user
- , subq_1.revenue_instance__user AS revenue_instance__user
- , subq_1.txn_revenue AS txn_revenue
+ subq_11.revenue_instance__ds__day AS revenue_instance__ds__day
+ , subq_10.ds__day AS ds__day
+ , subq_10.ds__week AS ds__week
+ , subq_10.ds__month AS ds__month
+ , subq_10.ds__quarter AS ds__quarter
+ , subq_10.ds__year AS ds__year
+ , subq_10.ds__extract_year AS ds__extract_year
+ , subq_10.ds__extract_quarter AS ds__extract_quarter
+ , subq_10.ds__extract_month AS ds__extract_month
+ , subq_10.ds__extract_day AS ds__extract_day
+ , subq_10.ds__extract_dow AS ds__extract_dow
+ , subq_10.ds__extract_doy AS ds__extract_doy
+ , subq_10.revenue_instance__ds__week AS revenue_instance__ds__week
+ , subq_10.revenue_instance__ds__month AS revenue_instance__ds__month
+ , subq_10.revenue_instance__ds__quarter AS revenue_instance__ds__quarter
+ , subq_10.revenue_instance__ds__year AS revenue_instance__ds__year
+ , subq_10.revenue_instance__ds__extract_year AS revenue_instance__ds__extract_year
+ , subq_10.revenue_instance__ds__extract_quarter AS revenue_instance__ds__extract_quarter
+ , subq_10.revenue_instance__ds__extract_month AS revenue_instance__ds__extract_month
+ , subq_10.revenue_instance__ds__extract_day AS revenue_instance__ds__extract_day
+ , subq_10.revenue_instance__ds__extract_dow AS revenue_instance__ds__extract_dow
+ , subq_10.revenue_instance__ds__extract_doy AS revenue_instance__ds__extract_doy
+ , subq_10.metric_time__day AS metric_time__day
+ , subq_10.metric_time__week AS metric_time__week
+ , subq_10.metric_time__month AS metric_time__month
+ , subq_10.metric_time__quarter AS metric_time__quarter
+ , subq_10.metric_time__year AS metric_time__year
+ , subq_10.metric_time__extract_year AS metric_time__extract_year
+ , subq_10.metric_time__extract_quarter AS metric_time__extract_quarter
+ , subq_10.metric_time__extract_month AS metric_time__extract_month
+ , subq_10.metric_time__extract_day AS metric_time__extract_day
+ , subq_10.metric_time__extract_dow AS metric_time__extract_dow
+ , subq_10.metric_time__extract_doy AS metric_time__extract_doy
+ , subq_10.user AS user
+ , subq_10.revenue_instance__user AS revenue_instance__user
+ , subq_10.txn_revenue AS txn_revenue
FROM (
-- Time Spine
SELECT
- subq_3.ds AS revenue_instance__ds__day
- FROM ***************************.mf_time_spine subq_3
- ) subq_2
+ subq_12.ds AS revenue_instance__ds__day
+ FROM ***************************.mf_time_spine subq_12
+ ) subq_11
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.revenue_instance__ds__day
- , subq_0.revenue_instance__ds__week
- , subq_0.revenue_instance__ds__month
- , subq_0.revenue_instance__ds__quarter
- , subq_0.revenue_instance__ds__year
- , subq_0.revenue_instance__ds__extract_year
- , subq_0.revenue_instance__ds__extract_quarter
- , subq_0.revenue_instance__ds__extract_month
- , subq_0.revenue_instance__ds__extract_day
- , subq_0.revenue_instance__ds__extract_dow
- , subq_0.revenue_instance__ds__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.user
- , subq_0.revenue_instance__user
- , subq_0.txn_revenue
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.revenue_instance__ds__day
+ , subq_9.revenue_instance__ds__week
+ , subq_9.revenue_instance__ds__month
+ , subq_9.revenue_instance__ds__quarter
+ , subq_9.revenue_instance__ds__year
+ , subq_9.revenue_instance__ds__extract_year
+ , subq_9.revenue_instance__ds__extract_quarter
+ , subq_9.revenue_instance__ds__extract_month
+ , subq_9.revenue_instance__ds__extract_day
+ , subq_9.revenue_instance__ds__extract_dow
+ , subq_9.revenue_instance__ds__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.user
+ , subq_9.revenue_instance__user
+ , subq_9.txn_revenue
FROM (
-- Read Elements From Semantic Model 'revenue'
SELECT
- revenue_src_28007.revenue AS txn_revenue
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day
- , CASE WHEN EXTRACT(dow FROM revenue_src_28007.created_at) = 0 THEN EXTRACT(dow FROM revenue_src_28007.created_at) + 7 ELSE EXTRACT(dow FROM revenue_src_28007.created_at) END AS ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day
- , CASE WHEN EXTRACT(dow FROM revenue_src_28007.created_at) = 0 THEN EXTRACT(dow FROM revenue_src_28007.created_at) + 7 ELSE EXTRACT(dow FROM revenue_src_28007.created_at) END AS revenue_instance__ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy
- , revenue_src_28007.user_id AS user
- , revenue_src_28007.user_id AS revenue_instance__user
- FROM ***************************.fct_revenue revenue_src_28007
- ) subq_0
- ) subq_1
+ revenue_src_28000.revenue AS txn_revenue
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , CASE WHEN EXTRACT(dow FROM revenue_src_28000.created_at) = 0 THEN EXTRACT(dow FROM revenue_src_28000.created_at) + 7 ELSE EXTRACT(dow FROM revenue_src_28000.created_at) END AS ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS revenue_instance__ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS revenue_instance__ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS revenue_instance__ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS revenue_instance__ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , EXTRACT(day FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_day
+ , CASE WHEN EXTRACT(dow FROM revenue_src_28000.created_at) = 0 THEN EXTRACT(dow FROM revenue_src_28000.created_at) + 7 ELSE EXTRACT(dow FROM revenue_src_28000.created_at) END AS revenue_instance__ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_doy
+ , revenue_src_28000.user_id AS user
+ , revenue_src_28000.user_id AS revenue_instance__user
+ FROM ***************************.fct_revenue revenue_src_28000
+ ) subq_9
+ ) subq_10
ON
(
- subq_1.revenue_instance__ds__day <= subq_2.revenue_instance__ds__day
+ subq_10.revenue_instance__ds__day <= subq_11.revenue_instance__ds__day
) AND (
- subq_1.revenue_instance__ds__day > DATEADD(month, -2, subq_2.revenue_instance__ds__day)
+ subq_10.revenue_instance__ds__day > DATEADD(month, -2, subq_11.revenue_instance__ds__day)
)
- ) subq_4
- ) subq_5
+ ) subq_13
+ ) subq_14
GROUP BY
- subq_5.revenue_instance__ds__day
-) subq_6
+ subq_14.revenue_instance__ds__day
+) subq_15
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_with_agg_time_dimension__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_with_agg_time_dimension__plan0_optimized.sql
index 501e54f5dd..9769ddd7de 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_with_agg_time_dimension__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_with_agg_time_dimension__plan0_optimized.sql
@@ -3,16 +3,16 @@
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_10.ds AS revenue_instance__ds__day
- , SUM(revenue_src_28007.revenue) AS trailing_2_months_revenue
-FROM ***************************.mf_time_spine subq_10
+ subq_19.ds AS revenue_instance__ds__day
+ , SUM(revenue_src_28000.revenue) AS trailing_2_months_revenue
+FROM ***************************.mf_time_spine subq_19
INNER JOIN
- ***************************.fct_revenue revenue_src_28007
+ ***************************.fct_revenue revenue_src_28000
ON
(
- DATE_TRUNC('day', revenue_src_28007.created_at) <= subq_10.ds
+ DATE_TRUNC('day', revenue_src_28000.created_at) <= subq_19.ds
) AND (
- DATE_TRUNC('day', revenue_src_28007.created_at) > DATEADD(month, -2, subq_10.ds)
+ DATE_TRUNC('day', revenue_src_28000.created_at) > DATEADD(month, -2, subq_19.ds)
)
GROUP BY
- subq_10.ds
+ subq_19.ds
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_with_non_adjustable_time_filter__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_with_non_adjustable_time_filter__plan0.sql
index 59ea896bbc..6ea7a1a66e 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_with_non_adjustable_time_filter__plan0.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_with_non_adjustable_time_filter__plan0.sql
@@ -1,334 +1,334 @@
-- Compute Metrics via Expressions
SELECT
- subq_7.metric_time__day
- , subq_7.bookers AS every_two_days_bookers
+ subq_16.metric_time__day
+ , subq_16.bookers AS every_two_days_bookers
FROM (
-- Aggregate Measures
SELECT
- subq_6.metric_time__day
- , COUNT(DISTINCT subq_6.bookers) AS bookers
+ subq_15.metric_time__day
+ , COUNT(DISTINCT subq_15.bookers) AS bookers
FROM (
-- Constrain Output with WHERE
SELECT
- subq_5.metric_time__day
- , subq_5.bookers
+ subq_14.metric_time__day
+ , subq_14.bookers
FROM (
-- Pass Only Elements: ['bookers', 'metric_time__day']
SELECT
- subq_4.metric_time__day
- , subq_4.bookers
+ subq_13.metric_time__day
+ , subq_13.bookers
FROM (
-- Join Self Over Time Range
SELECT
- subq_2.metric_time__day AS metric_time__day
- , subq_1.ds__day AS ds__day
- , subq_1.ds__week AS ds__week
- , subq_1.ds__month AS ds__month
- , subq_1.ds__quarter AS ds__quarter
- , subq_1.ds__year AS ds__year
- , subq_1.ds__extract_year AS ds__extract_year
- , subq_1.ds__extract_quarter AS ds__extract_quarter
- , subq_1.ds__extract_month AS ds__extract_month
- , subq_1.ds__extract_day AS ds__extract_day
- , subq_1.ds__extract_dow AS ds__extract_dow
- , subq_1.ds__extract_doy AS ds__extract_doy
- , subq_1.ds_partitioned__day AS ds_partitioned__day
- , subq_1.ds_partitioned__week AS ds_partitioned__week
- , subq_1.ds_partitioned__month AS ds_partitioned__month
- , subq_1.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_1.ds_partitioned__year AS ds_partitioned__year
- , subq_1.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_1.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_1.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_1.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_1.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_1.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_1.paid_at__day AS paid_at__day
- , subq_1.paid_at__week AS paid_at__week
- , subq_1.paid_at__month AS paid_at__month
- , subq_1.paid_at__quarter AS paid_at__quarter
- , subq_1.paid_at__year AS paid_at__year
- , subq_1.paid_at__extract_year AS paid_at__extract_year
- , subq_1.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_1.paid_at__extract_month AS paid_at__extract_month
- , subq_1.paid_at__extract_day AS paid_at__extract_day
- , subq_1.paid_at__extract_dow AS paid_at__extract_dow
- , subq_1.paid_at__extract_doy AS paid_at__extract_doy
- , subq_1.booking__ds__day AS booking__ds__day
- , subq_1.booking__ds__week AS booking__ds__week
- , subq_1.booking__ds__month AS booking__ds__month
- , subq_1.booking__ds__quarter AS booking__ds__quarter
- , subq_1.booking__ds__year AS booking__ds__year
- , subq_1.booking__ds__extract_year AS booking__ds__extract_year
- , subq_1.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_1.booking__ds__extract_month AS booking__ds__extract_month
- , subq_1.booking__ds__extract_day AS booking__ds__extract_day
- , subq_1.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_1.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_1.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_1.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_1.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_1.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_1.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_1.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_1.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_1.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_1.booking__paid_at__day AS booking__paid_at__day
- , subq_1.booking__paid_at__week AS booking__paid_at__week
- , subq_1.booking__paid_at__month AS booking__paid_at__month
- , subq_1.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_1.booking__paid_at__year AS booking__paid_at__year
- , subq_1.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_1.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_1.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_1.metric_time__week AS metric_time__week
- , subq_1.metric_time__month AS metric_time__month
- , subq_1.metric_time__quarter AS metric_time__quarter
- , subq_1.metric_time__year AS metric_time__year
- , subq_1.metric_time__extract_year AS metric_time__extract_year
- , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter
- , subq_1.metric_time__extract_month AS metric_time__extract_month
- , subq_1.metric_time__extract_day AS metric_time__extract_day
- , subq_1.metric_time__extract_dow AS metric_time__extract_dow
- , subq_1.metric_time__extract_doy AS metric_time__extract_doy
- , subq_1.listing AS listing
- , subq_1.guest AS guest
- , subq_1.host AS host
- , subq_1.booking__listing AS booking__listing
- , subq_1.booking__guest AS booking__guest
- , subq_1.booking__host AS booking__host
- , subq_1.is_instant AS is_instant
- , subq_1.booking__is_instant AS booking__is_instant
- , subq_1.bookings AS bookings
- , subq_1.instant_bookings AS instant_bookings
- , subq_1.booking_value AS booking_value
- , subq_1.max_booking_value AS max_booking_value
- , subq_1.min_booking_value AS min_booking_value
- , subq_1.bookers AS bookers
- , subq_1.average_booking_value AS average_booking_value
- , subq_1.referred_bookings AS referred_bookings
- , subq_1.median_booking_value AS median_booking_value
- , subq_1.booking_value_p99 AS booking_value_p99
- , subq_1.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_1.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_1.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ subq_11.metric_time__day AS metric_time__day
+ , subq_10.ds__day AS ds__day
+ , subq_10.ds__week AS ds__week
+ , subq_10.ds__month AS ds__month
+ , subq_10.ds__quarter AS ds__quarter
+ , subq_10.ds__year AS ds__year
+ , subq_10.ds__extract_year AS ds__extract_year
+ , subq_10.ds__extract_quarter AS ds__extract_quarter
+ , subq_10.ds__extract_month AS ds__extract_month
+ , subq_10.ds__extract_day AS ds__extract_day
+ , subq_10.ds__extract_dow AS ds__extract_dow
+ , subq_10.ds__extract_doy AS ds__extract_doy
+ , subq_10.ds_partitioned__day AS ds_partitioned__day
+ , subq_10.ds_partitioned__week AS ds_partitioned__week
+ , subq_10.ds_partitioned__month AS ds_partitioned__month
+ , subq_10.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_10.ds_partitioned__year AS ds_partitioned__year
+ , subq_10.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_10.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_10.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_10.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_10.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_10.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_10.paid_at__day AS paid_at__day
+ , subq_10.paid_at__week AS paid_at__week
+ , subq_10.paid_at__month AS paid_at__month
+ , subq_10.paid_at__quarter AS paid_at__quarter
+ , subq_10.paid_at__year AS paid_at__year
+ , subq_10.paid_at__extract_year AS paid_at__extract_year
+ , subq_10.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_10.paid_at__extract_month AS paid_at__extract_month
+ , subq_10.paid_at__extract_day AS paid_at__extract_day
+ , subq_10.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_10.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_10.booking__ds__day AS booking__ds__day
+ , subq_10.booking__ds__week AS booking__ds__week
+ , subq_10.booking__ds__month AS booking__ds__month
+ , subq_10.booking__ds__quarter AS booking__ds__quarter
+ , subq_10.booking__ds__year AS booking__ds__year
+ , subq_10.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_10.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_10.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_10.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_10.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_10.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_10.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_10.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_10.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_10.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_10.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_10.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_10.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_10.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_10.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_10.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_10.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_10.booking__paid_at__day AS booking__paid_at__day
+ , subq_10.booking__paid_at__week AS booking__paid_at__week
+ , subq_10.booking__paid_at__month AS booking__paid_at__month
+ , subq_10.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_10.booking__paid_at__year AS booking__paid_at__year
+ , subq_10.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_10.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_10.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_10.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_10.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_10.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_10.metric_time__week AS metric_time__week
+ , subq_10.metric_time__month AS metric_time__month
+ , subq_10.metric_time__quarter AS metric_time__quarter
+ , subq_10.metric_time__year AS metric_time__year
+ , subq_10.metric_time__extract_year AS metric_time__extract_year
+ , subq_10.metric_time__extract_quarter AS metric_time__extract_quarter
+ , subq_10.metric_time__extract_month AS metric_time__extract_month
+ , subq_10.metric_time__extract_day AS metric_time__extract_day
+ , subq_10.metric_time__extract_dow AS metric_time__extract_dow
+ , subq_10.metric_time__extract_doy AS metric_time__extract_doy
+ , subq_10.listing AS listing
+ , subq_10.guest AS guest
+ , subq_10.host AS host
+ , subq_10.booking__listing AS booking__listing
+ , subq_10.booking__guest AS booking__guest
+ , subq_10.booking__host AS booking__host
+ , subq_10.is_instant AS is_instant
+ , subq_10.booking__is_instant AS booking__is_instant
+ , subq_10.bookings AS bookings
+ , subq_10.instant_bookings AS instant_bookings
+ , subq_10.booking_value AS booking_value
+ , subq_10.max_booking_value AS max_booking_value
+ , subq_10.min_booking_value AS min_booking_value
+ , subq_10.bookers AS bookers
+ , subq_10.average_booking_value AS average_booking_value
+ , subq_10.referred_bookings AS referred_bookings
+ , subq_10.median_booking_value AS median_booking_value
+ , subq_10.booking_value_p99 AS booking_value_p99
+ , subq_10.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_10.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_10.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_3.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_3
- ) subq_2
+ subq_12.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_12
+ ) subq_11
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds) END AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) END AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.paid_at) END AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds) END AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) END AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.paid_at) END AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
ON
(
- subq_1.metric_time__day <= subq_2.metric_time__day
+ subq_10.metric_time__day <= subq_11.metric_time__day
) AND (
- subq_1.metric_time__day > DATEADD(day, -2, subq_2.metric_time__day)
+ subq_10.metric_time__day > DATEADD(day, -2, subq_11.metric_time__day)
)
- ) subq_4
- ) subq_5
+ ) subq_13
+ ) subq_14
WHERE metric_time__day = '2020-01-03' or metric_time__day = '2020-01-07'
- ) subq_6
+ ) subq_15
GROUP BY
- subq_6.metric_time__day
-) subq_7
+ subq_15.metric_time__day
+) subq_16
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_with_non_adjustable_time_filter__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_with_non_adjustable_time_filter__plan0_optimized.sql
index aa43d7d7d6..ab8b4812ed 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_with_non_adjustable_time_filter__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_with_non_adjustable_time_filter__plan0_optimized.sql
@@ -8,18 +8,18 @@ FROM (
-- Join Self Over Time Range
-- Pass Only Elements: ['bookers', 'metric_time__day']
SELECT
- subq_11.ds AS metric_time__day
- , bookings_source_src_28001.guest_id AS bookers
- FROM ***************************.mf_time_spine subq_11
+ subq_20.ds AS metric_time__day
+ , bookings_source_src_28000.guest_id AS bookers
+ FROM ***************************.mf_time_spine subq_20
INNER JOIN
- ***************************.fct_bookings bookings_source_src_28001
+ ***************************.fct_bookings bookings_source_src_28000
ON
(
- DATE_TRUNC('day', bookings_source_src_28001.ds) <= subq_11.ds
+ DATE_TRUNC('day', bookings_source_src_28000.ds) <= subq_20.ds
) AND (
- DATE_TRUNC('day', bookings_source_src_28001.ds) > DATEADD(day, -2, subq_11.ds)
+ DATE_TRUNC('day', bookings_source_src_28000.ds) > DATEADD(day, -2, subq_20.ds)
)
-) subq_13
+) subq_22
WHERE metric_time__day = '2020-01-03' or metric_time__day = '2020-01-07'
GROUP BY
metric_time__day
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_with_time_constraint__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_with_time_constraint__plan0.sql
index 0b2cf487c5..cd5b13ebad 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_with_time_constraint__plan0.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_with_time_constraint__plan0.sql
@@ -1,189 +1,189 @@
-- Compute Metrics via Expressions
SELECT
- subq_8.metric_time__day
- , subq_8.txn_revenue AS trailing_2_months_revenue
+ subq_19.metric_time__day
+ , subq_19.txn_revenue AS trailing_2_months_revenue
FROM (
-- Aggregate Measures
SELECT
- subq_7.metric_time__day
- , SUM(subq_7.txn_revenue) AS txn_revenue
+ subq_18.metric_time__day
+ , SUM(subq_18.txn_revenue) AS txn_revenue
FROM (
-- Constrain Time Range to [2020-01-01T00:00:00, 2020-01-01T00:00:00]
SELECT
- subq_6.metric_time__day
- , subq_6.txn_revenue
+ subq_17.metric_time__day
+ , subq_17.txn_revenue
FROM (
-- Pass Only Elements: ['txn_revenue', 'metric_time__day']
SELECT
- subq_5.metric_time__day
- , subq_5.txn_revenue
+ subq_16.metric_time__day
+ , subq_16.txn_revenue
FROM (
-- Join Self Over Time Range
SELECT
- subq_3.metric_time__day AS metric_time__day
- , subq_2.ds__day AS ds__day
- , subq_2.ds__week AS ds__week
- , subq_2.ds__month AS ds__month
- , subq_2.ds__quarter AS ds__quarter
- , subq_2.ds__year AS ds__year
- , subq_2.ds__extract_year AS ds__extract_year
- , subq_2.ds__extract_quarter AS ds__extract_quarter
- , subq_2.ds__extract_month AS ds__extract_month
- , subq_2.ds__extract_day AS ds__extract_day
- , subq_2.ds__extract_dow AS ds__extract_dow
- , subq_2.ds__extract_doy AS ds__extract_doy
- , subq_2.revenue_instance__ds__day AS revenue_instance__ds__day
- , subq_2.revenue_instance__ds__week AS revenue_instance__ds__week
- , subq_2.revenue_instance__ds__month AS revenue_instance__ds__month
- , subq_2.revenue_instance__ds__quarter AS revenue_instance__ds__quarter
- , subq_2.revenue_instance__ds__year AS revenue_instance__ds__year
- , subq_2.revenue_instance__ds__extract_year AS revenue_instance__ds__extract_year
- , subq_2.revenue_instance__ds__extract_quarter AS revenue_instance__ds__extract_quarter
- , subq_2.revenue_instance__ds__extract_month AS revenue_instance__ds__extract_month
- , subq_2.revenue_instance__ds__extract_day AS revenue_instance__ds__extract_day
- , subq_2.revenue_instance__ds__extract_dow AS revenue_instance__ds__extract_dow
- , subq_2.revenue_instance__ds__extract_doy AS revenue_instance__ds__extract_doy
- , subq_2.metric_time__week AS metric_time__week
- , subq_2.metric_time__month AS metric_time__month
- , subq_2.metric_time__quarter AS metric_time__quarter
- , subq_2.metric_time__year AS metric_time__year
- , subq_2.metric_time__extract_year AS metric_time__extract_year
- , subq_2.metric_time__extract_quarter AS metric_time__extract_quarter
- , subq_2.metric_time__extract_month AS metric_time__extract_month
- , subq_2.metric_time__extract_day AS metric_time__extract_day
- , subq_2.metric_time__extract_dow AS metric_time__extract_dow
- , subq_2.metric_time__extract_doy AS metric_time__extract_doy
- , subq_2.user AS user
- , subq_2.revenue_instance__user AS revenue_instance__user
- , subq_2.txn_revenue AS txn_revenue
+ subq_14.metric_time__day AS metric_time__day
+ , subq_13.ds__day AS ds__day
+ , subq_13.ds__week AS ds__week
+ , subq_13.ds__month AS ds__month
+ , subq_13.ds__quarter AS ds__quarter
+ , subq_13.ds__year AS ds__year
+ , subq_13.ds__extract_year AS ds__extract_year
+ , subq_13.ds__extract_quarter AS ds__extract_quarter
+ , subq_13.ds__extract_month AS ds__extract_month
+ , subq_13.ds__extract_day AS ds__extract_day
+ , subq_13.ds__extract_dow AS ds__extract_dow
+ , subq_13.ds__extract_doy AS ds__extract_doy
+ , subq_13.revenue_instance__ds__day AS revenue_instance__ds__day
+ , subq_13.revenue_instance__ds__week AS revenue_instance__ds__week
+ , subq_13.revenue_instance__ds__month AS revenue_instance__ds__month
+ , subq_13.revenue_instance__ds__quarter AS revenue_instance__ds__quarter
+ , subq_13.revenue_instance__ds__year AS revenue_instance__ds__year
+ , subq_13.revenue_instance__ds__extract_year AS revenue_instance__ds__extract_year
+ , subq_13.revenue_instance__ds__extract_quarter AS revenue_instance__ds__extract_quarter
+ , subq_13.revenue_instance__ds__extract_month AS revenue_instance__ds__extract_month
+ , subq_13.revenue_instance__ds__extract_day AS revenue_instance__ds__extract_day
+ , subq_13.revenue_instance__ds__extract_dow AS revenue_instance__ds__extract_dow
+ , subq_13.revenue_instance__ds__extract_doy AS revenue_instance__ds__extract_doy
+ , subq_13.metric_time__week AS metric_time__week
+ , subq_13.metric_time__month AS metric_time__month
+ , subq_13.metric_time__quarter AS metric_time__quarter
+ , subq_13.metric_time__year AS metric_time__year
+ , subq_13.metric_time__extract_year AS metric_time__extract_year
+ , subq_13.metric_time__extract_quarter AS metric_time__extract_quarter
+ , subq_13.metric_time__extract_month AS metric_time__extract_month
+ , subq_13.metric_time__extract_day AS metric_time__extract_day
+ , subq_13.metric_time__extract_dow AS metric_time__extract_dow
+ , subq_13.metric_time__extract_doy AS metric_time__extract_doy
+ , subq_13.user AS user
+ , subq_13.revenue_instance__user AS revenue_instance__user
+ , subq_13.txn_revenue AS txn_revenue
FROM (
-- Time Spine
SELECT
- subq_4.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_4
- WHERE subq_4.ds BETWEEN '2020-01-01' AND '2020-01-01'
- ) subq_3
+ subq_15.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_15
+ WHERE subq_15.ds BETWEEN '2020-01-01' AND '2020-01-01'
+ ) subq_14
INNER JOIN (
-- Constrain Time Range to [2019-11-01T00:00:00, 2020-01-01T00:00:00]
SELECT
- subq_1.ds__day
- , subq_1.ds__week
- , subq_1.ds__month
- , subq_1.ds__quarter
- , subq_1.ds__year
- , subq_1.ds__extract_year
- , subq_1.ds__extract_quarter
- , subq_1.ds__extract_month
- , subq_1.ds__extract_day
- , subq_1.ds__extract_dow
- , subq_1.ds__extract_doy
- , subq_1.revenue_instance__ds__day
- , subq_1.revenue_instance__ds__week
- , subq_1.revenue_instance__ds__month
- , subq_1.revenue_instance__ds__quarter
- , subq_1.revenue_instance__ds__year
- , subq_1.revenue_instance__ds__extract_year
- , subq_1.revenue_instance__ds__extract_quarter
- , subq_1.revenue_instance__ds__extract_month
- , subq_1.revenue_instance__ds__extract_day
- , subq_1.revenue_instance__ds__extract_dow
- , subq_1.revenue_instance__ds__extract_doy
- , subq_1.metric_time__day
- , subq_1.metric_time__week
- , subq_1.metric_time__month
- , subq_1.metric_time__quarter
- , subq_1.metric_time__year
- , subq_1.metric_time__extract_year
- , subq_1.metric_time__extract_quarter
- , subq_1.metric_time__extract_month
- , subq_1.metric_time__extract_day
- , subq_1.metric_time__extract_dow
- , subq_1.metric_time__extract_doy
- , subq_1.user
- , subq_1.revenue_instance__user
- , subq_1.txn_revenue
+ subq_12.ds__day
+ , subq_12.ds__week
+ , subq_12.ds__month
+ , subq_12.ds__quarter
+ , subq_12.ds__year
+ , subq_12.ds__extract_year
+ , subq_12.ds__extract_quarter
+ , subq_12.ds__extract_month
+ , subq_12.ds__extract_day
+ , subq_12.ds__extract_dow
+ , subq_12.ds__extract_doy
+ , subq_12.revenue_instance__ds__day
+ , subq_12.revenue_instance__ds__week
+ , subq_12.revenue_instance__ds__month
+ , subq_12.revenue_instance__ds__quarter
+ , subq_12.revenue_instance__ds__year
+ , subq_12.revenue_instance__ds__extract_year
+ , subq_12.revenue_instance__ds__extract_quarter
+ , subq_12.revenue_instance__ds__extract_month
+ , subq_12.revenue_instance__ds__extract_day
+ , subq_12.revenue_instance__ds__extract_dow
+ , subq_12.revenue_instance__ds__extract_doy
+ , subq_12.metric_time__day
+ , subq_12.metric_time__week
+ , subq_12.metric_time__month
+ , subq_12.metric_time__quarter
+ , subq_12.metric_time__year
+ , subq_12.metric_time__extract_year
+ , subq_12.metric_time__extract_quarter
+ , subq_12.metric_time__extract_month
+ , subq_12.metric_time__extract_day
+ , subq_12.metric_time__extract_dow
+ , subq_12.metric_time__extract_doy
+ , subq_12.user
+ , subq_12.revenue_instance__user
+ , subq_12.txn_revenue
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.revenue_instance__ds__day
- , subq_0.revenue_instance__ds__week
- , subq_0.revenue_instance__ds__month
- , subq_0.revenue_instance__ds__quarter
- , subq_0.revenue_instance__ds__year
- , subq_0.revenue_instance__ds__extract_year
- , subq_0.revenue_instance__ds__extract_quarter
- , subq_0.revenue_instance__ds__extract_month
- , subq_0.revenue_instance__ds__extract_day
- , subq_0.revenue_instance__ds__extract_dow
- , subq_0.revenue_instance__ds__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.user
- , subq_0.revenue_instance__user
- , subq_0.txn_revenue
+ subq_11.ds__day
+ , subq_11.ds__week
+ , subq_11.ds__month
+ , subq_11.ds__quarter
+ , subq_11.ds__year
+ , subq_11.ds__extract_year
+ , subq_11.ds__extract_quarter
+ , subq_11.ds__extract_month
+ , subq_11.ds__extract_day
+ , subq_11.ds__extract_dow
+ , subq_11.ds__extract_doy
+ , subq_11.revenue_instance__ds__day
+ , subq_11.revenue_instance__ds__week
+ , subq_11.revenue_instance__ds__month
+ , subq_11.revenue_instance__ds__quarter
+ , subq_11.revenue_instance__ds__year
+ , subq_11.revenue_instance__ds__extract_year
+ , subq_11.revenue_instance__ds__extract_quarter
+ , subq_11.revenue_instance__ds__extract_month
+ , subq_11.revenue_instance__ds__extract_day
+ , subq_11.revenue_instance__ds__extract_dow
+ , subq_11.revenue_instance__ds__extract_doy
+ , subq_11.ds__day AS metric_time__day
+ , subq_11.ds__week AS metric_time__week
+ , subq_11.ds__month AS metric_time__month
+ , subq_11.ds__quarter AS metric_time__quarter
+ , subq_11.ds__year AS metric_time__year
+ , subq_11.ds__extract_year AS metric_time__extract_year
+ , subq_11.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_11.ds__extract_month AS metric_time__extract_month
+ , subq_11.ds__extract_day AS metric_time__extract_day
+ , subq_11.ds__extract_dow AS metric_time__extract_dow
+ , subq_11.ds__extract_doy AS metric_time__extract_doy
+ , subq_11.user
+ , subq_11.revenue_instance__user
+ , subq_11.txn_revenue
FROM (
-- Read Elements From Semantic Model 'revenue'
SELECT
- revenue_src_28007.revenue AS txn_revenue
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day
- , CASE WHEN EXTRACT(dow FROM revenue_src_28007.created_at) = 0 THEN EXTRACT(dow FROM revenue_src_28007.created_at) + 7 ELSE EXTRACT(dow FROM revenue_src_28007.created_at) END AS ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day
- , CASE WHEN EXTRACT(dow FROM revenue_src_28007.created_at) = 0 THEN EXTRACT(dow FROM revenue_src_28007.created_at) + 7 ELSE EXTRACT(dow FROM revenue_src_28007.created_at) END AS revenue_instance__ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy
- , revenue_src_28007.user_id AS user
- , revenue_src_28007.user_id AS revenue_instance__user
- FROM ***************************.fct_revenue revenue_src_28007
- ) subq_0
- ) subq_1
- WHERE subq_1.metric_time__day BETWEEN '2019-11-01' AND '2020-01-01'
- ) subq_2
+ revenue_src_28000.revenue AS txn_revenue
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , CASE WHEN EXTRACT(dow FROM revenue_src_28000.created_at) = 0 THEN EXTRACT(dow FROM revenue_src_28000.created_at) + 7 ELSE EXTRACT(dow FROM revenue_src_28000.created_at) END AS ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS revenue_instance__ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS revenue_instance__ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS revenue_instance__ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS revenue_instance__ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , EXTRACT(day FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_day
+ , CASE WHEN EXTRACT(dow FROM revenue_src_28000.created_at) = 0 THEN EXTRACT(dow FROM revenue_src_28000.created_at) + 7 ELSE EXTRACT(dow FROM revenue_src_28000.created_at) END AS revenue_instance__ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_doy
+ , revenue_src_28000.user_id AS user
+ , revenue_src_28000.user_id AS revenue_instance__user
+ FROM ***************************.fct_revenue revenue_src_28000
+ ) subq_11
+ ) subq_12
+ WHERE subq_12.metric_time__day BETWEEN '2019-11-01' AND '2020-01-01'
+ ) subq_13
ON
(
- subq_2.metric_time__day <= subq_3.metric_time__day
+ subq_13.metric_time__day <= subq_14.metric_time__day
) AND (
- subq_2.metric_time__day > DATEADD(month, -2, subq_3.metric_time__day)
+ subq_13.metric_time__day > DATEADD(month, -2, subq_14.metric_time__day)
)
- ) subq_5
- ) subq_6
- WHERE subq_6.metric_time__day BETWEEN '2020-01-01' AND '2020-01-01'
- ) subq_7
+ ) subq_16
+ ) subq_17
+ WHERE subq_17.metric_time__day BETWEEN '2020-01-01' AND '2020-01-01'
+ ) subq_18
GROUP BY
- subq_7.metric_time__day
-) subq_8
+ subq_18.metric_time__day
+) subq_19
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_with_time_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_with_time_constraint__plan0_optimized.sql
index 06ea3f5a91..bb3417f1ce 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_with_time_constraint__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_metric_with_time_constraint__plan0_optimized.sql
@@ -4,15 +4,15 @@
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_12.metric_time__day AS metric_time__day
- , SUM(subq_11.txn_revenue) AS trailing_2_months_revenue
+ subq_23.metric_time__day AS metric_time__day
+ , SUM(subq_22.txn_revenue) AS trailing_2_months_revenue
FROM (
-- Time Spine
SELECT
ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_13
+ FROM ***************************.mf_time_spine subq_24
WHERE ds BETWEEN '2020-01-01' AND '2020-01-01'
-) subq_12
+) subq_23
INNER JOIN (
-- Read Elements From Semantic Model 'revenue'
-- Metric Time Dimension 'ds'
@@ -20,15 +20,15 @@ INNER JOIN (
SELECT
DATE_TRUNC('day', created_at) AS metric_time__day
, revenue AS txn_revenue
- FROM ***************************.fct_revenue revenue_src_28007
+ FROM ***************************.fct_revenue revenue_src_28000
WHERE DATE_TRUNC('day', created_at) BETWEEN '2019-11-01' AND '2020-01-01'
-) subq_11
+) subq_22
ON
(
- subq_11.metric_time__day <= subq_12.metric_time__day
+ subq_22.metric_time__day <= subq_23.metric_time__day
) AND (
- subq_11.metric_time__day > DATEADD(month, -2, subq_12.metric_time__day)
+ subq_22.metric_time__day > DATEADD(month, -2, subq_23.metric_time__day)
)
-WHERE subq_12.metric_time__day BETWEEN '2020-01-01' AND '2020-01-01'
+WHERE subq_23.metric_time__day BETWEEN '2020-01-01' AND '2020-01-01'
GROUP BY
- subq_12.metric_time__day
+ subq_23.metric_time__day
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric__plan0.sql
index 34a09f54e7..870bfdcfdc 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric__plan0.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric__plan0.sql
@@ -1,88 +1,88 @@
-- Compute Metrics via Expressions
SELECT
- subq_3.ds__day
- , subq_3.txn_revenue AS trailing_2_months_revenue
+ subq_12.ds__day
+ , subq_12.txn_revenue AS trailing_2_months_revenue
FROM (
-- Aggregate Measures
SELECT
- subq_2.ds__day
- , SUM(subq_2.txn_revenue) AS txn_revenue
+ subq_11.ds__day
+ , SUM(subq_11.txn_revenue) AS txn_revenue
FROM (
-- Pass Only Elements: ['txn_revenue', 'ds__day']
SELECT
- subq_1.ds__day
- , subq_1.txn_revenue
+ subq_10.ds__day
+ , subq_10.txn_revenue
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.revenue_instance__ds__day
- , subq_0.revenue_instance__ds__week
- , subq_0.revenue_instance__ds__month
- , subq_0.revenue_instance__ds__quarter
- , subq_0.revenue_instance__ds__year
- , subq_0.revenue_instance__ds__extract_year
- , subq_0.revenue_instance__ds__extract_quarter
- , subq_0.revenue_instance__ds__extract_month
- , subq_0.revenue_instance__ds__extract_day
- , subq_0.revenue_instance__ds__extract_dow
- , subq_0.revenue_instance__ds__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.user
- , subq_0.revenue_instance__user
- , subq_0.txn_revenue
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.revenue_instance__ds__day
+ , subq_9.revenue_instance__ds__week
+ , subq_9.revenue_instance__ds__month
+ , subq_9.revenue_instance__ds__quarter
+ , subq_9.revenue_instance__ds__year
+ , subq_9.revenue_instance__ds__extract_year
+ , subq_9.revenue_instance__ds__extract_quarter
+ , subq_9.revenue_instance__ds__extract_month
+ , subq_9.revenue_instance__ds__extract_day
+ , subq_9.revenue_instance__ds__extract_dow
+ , subq_9.revenue_instance__ds__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.user
+ , subq_9.revenue_instance__user
+ , subq_9.txn_revenue
FROM (
-- Read Elements From Semantic Model 'revenue'
SELECT
- revenue_src_28007.revenue AS txn_revenue
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day
- , EXTRACT(dayofweekiso FROM revenue_src_28007.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day
- , EXTRACT(dayofweekiso FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy
- , revenue_src_28007.user_id AS user
- , revenue_src_28007.user_id AS revenue_instance__user
- FROM ***************************.fct_revenue revenue_src_28007
- ) subq_0
- ) subq_1
- ) subq_2
+ revenue_src_28000.revenue AS txn_revenue
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , EXTRACT(dayofweekiso FROM revenue_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS revenue_instance__ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS revenue_instance__ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS revenue_instance__ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS revenue_instance__ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , EXTRACT(day FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_day
+ , EXTRACT(dayofweekiso FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_doy
+ , revenue_src_28000.user_id AS user
+ , revenue_src_28000.user_id AS revenue_instance__user
+ FROM ***************************.fct_revenue revenue_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
GROUP BY
- subq_2.ds__day
-) subq_3
+ subq_11.ds__day
+) subq_12
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric__plan0_optimized.sql
index 749250c230..76e8f3252a 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric__plan0_optimized.sql
@@ -6,6 +6,6 @@
SELECT
DATE_TRUNC('day', created_at) AS ds__day
, SUM(revenue) AS trailing_2_months_revenue
-FROM ***************************.fct_revenue revenue_src_28007
+FROM ***************************.fct_revenue revenue_src_28000
GROUP BY
DATE_TRUNC('day', created_at)
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_grain_to_date__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_grain_to_date__plan0.sql
index 55b47814b1..2db3813f0a 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_grain_to_date__plan0.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_grain_to_date__plan0.sql
@@ -1,88 +1,88 @@
-- Compute Metrics via Expressions
SELECT
- subq_3.ds__month
- , subq_3.txn_revenue AS revenue_mtd
+ subq_12.ds__month
+ , subq_12.txn_revenue AS revenue_mtd
FROM (
-- Aggregate Measures
SELECT
- subq_2.ds__month
- , SUM(subq_2.txn_revenue) AS txn_revenue
+ subq_11.ds__month
+ , SUM(subq_11.txn_revenue) AS txn_revenue
FROM (
-- Pass Only Elements: ['txn_revenue', 'ds__month']
SELECT
- subq_1.ds__month
- , subq_1.txn_revenue
+ subq_10.ds__month
+ , subq_10.txn_revenue
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.revenue_instance__ds__day
- , subq_0.revenue_instance__ds__week
- , subq_0.revenue_instance__ds__month
- , subq_0.revenue_instance__ds__quarter
- , subq_0.revenue_instance__ds__year
- , subq_0.revenue_instance__ds__extract_year
- , subq_0.revenue_instance__ds__extract_quarter
- , subq_0.revenue_instance__ds__extract_month
- , subq_0.revenue_instance__ds__extract_day
- , subq_0.revenue_instance__ds__extract_dow
- , subq_0.revenue_instance__ds__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.user
- , subq_0.revenue_instance__user
- , subq_0.txn_revenue
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.revenue_instance__ds__day
+ , subq_9.revenue_instance__ds__week
+ , subq_9.revenue_instance__ds__month
+ , subq_9.revenue_instance__ds__quarter
+ , subq_9.revenue_instance__ds__year
+ , subq_9.revenue_instance__ds__extract_year
+ , subq_9.revenue_instance__ds__extract_quarter
+ , subq_9.revenue_instance__ds__extract_month
+ , subq_9.revenue_instance__ds__extract_day
+ , subq_9.revenue_instance__ds__extract_dow
+ , subq_9.revenue_instance__ds__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.user
+ , subq_9.revenue_instance__user
+ , subq_9.txn_revenue
FROM (
-- Read Elements From Semantic Model 'revenue'
SELECT
- revenue_src_28007.revenue AS txn_revenue
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day
- , EXTRACT(dayofweekiso FROM revenue_src_28007.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day
- , EXTRACT(dayofweekiso FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy
- , revenue_src_28007.user_id AS user
- , revenue_src_28007.user_id AS revenue_instance__user
- FROM ***************************.fct_revenue revenue_src_28007
- ) subq_0
- ) subq_1
- ) subq_2
+ revenue_src_28000.revenue AS txn_revenue
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , EXTRACT(dayofweekiso FROM revenue_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS revenue_instance__ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS revenue_instance__ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS revenue_instance__ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS revenue_instance__ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , EXTRACT(day FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_day
+ , EXTRACT(dayofweekiso FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_doy
+ , revenue_src_28000.user_id AS user
+ , revenue_src_28000.user_id AS revenue_instance__user
+ FROM ***************************.fct_revenue revenue_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
GROUP BY
- subq_2.ds__month
-) subq_3
+ subq_11.ds__month
+) subq_12
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_grain_to_date__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_grain_to_date__plan0_optimized.sql
index 6a6dbce8b9..e057084866 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_grain_to_date__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_grain_to_date__plan0_optimized.sql
@@ -6,6 +6,6 @@
SELECT
DATE_TRUNC('month', created_at) AS ds__month
, SUM(revenue) AS revenue_mtd
-FROM ***************************.fct_revenue revenue_src_28007
+FROM ***************************.fct_revenue revenue_src_28000
GROUP BY
DATE_TRUNC('month', created_at)
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_month__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_month__plan0.sql
index 5bc9116fc1..cc865b5b84 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_month__plan0.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_month__plan0.sql
@@ -1,103 +1,103 @@
-- Compute Metrics via Expressions
SELECT
- subq_8.metric_time__month
- , subq_8.bookings_monthly AS trailing_3_months_bookings
+ subq_12.metric_time__month
+ , subq_12.bookings_monthly AS trailing_3_months_bookings
FROM (
-- Aggregate Measures
SELECT
- subq_7.metric_time__month
- , SUM(subq_7.bookings_monthly) AS bookings_monthly
+ subq_11.metric_time__month
+ , SUM(subq_11.bookings_monthly) AS bookings_monthly
FROM (
-- Constrain Time Range to [2020-03-05T00:00:00, 2021-01-04T00:00:00]
SELECT
- subq_6.metric_time__month
- , subq_6.bookings_monthly
+ subq_10.metric_time__month
+ , subq_10.bookings_monthly
FROM (
-- Pass Only Elements: ['bookings_monthly', 'metric_time__month']
SELECT
- subq_5.metric_time__month
- , subq_5.bookings_monthly
+ subq_9.metric_time__month
+ , subq_9.bookings_monthly
FROM (
-- Join Self Over Time Range
SELECT
- subq_3.metric_time__month AS metric_time__month
- , subq_2.monthly_ds__month AS monthly_ds__month
- , subq_2.monthly_ds__quarter AS monthly_ds__quarter
- , subq_2.monthly_ds__year AS monthly_ds__year
- , subq_2.monthly_ds__extract_year AS monthly_ds__extract_year
- , subq_2.monthly_ds__extract_quarter AS monthly_ds__extract_quarter
- , subq_2.monthly_ds__extract_month AS monthly_ds__extract_month
- , subq_2.booking__monthly_ds__month AS booking__monthly_ds__month
- , subq_2.booking__monthly_ds__quarter AS booking__monthly_ds__quarter
- , subq_2.booking__monthly_ds__year AS booking__monthly_ds__year
- , subq_2.booking__monthly_ds__extract_year AS booking__monthly_ds__extract_year
- , subq_2.booking__monthly_ds__extract_quarter AS booking__monthly_ds__extract_quarter
- , subq_2.booking__monthly_ds__extract_month AS booking__monthly_ds__extract_month
- , subq_2.metric_time__quarter AS metric_time__quarter
- , subq_2.metric_time__year AS metric_time__year
- , subq_2.metric_time__extract_year AS metric_time__extract_year
- , subq_2.metric_time__extract_quarter AS metric_time__extract_quarter
- , subq_2.metric_time__extract_month AS metric_time__extract_month
- , subq_2.listing AS listing
- , subq_2.booking__listing AS booking__listing
- , subq_2.bookings_monthly AS bookings_monthly
+ subq_7.metric_time__month AS metric_time__month
+ , subq_6.monthly_ds__month AS monthly_ds__month
+ , subq_6.monthly_ds__quarter AS monthly_ds__quarter
+ , subq_6.monthly_ds__year AS monthly_ds__year
+ , subq_6.monthly_ds__extract_year AS monthly_ds__extract_year
+ , subq_6.monthly_ds__extract_quarter AS monthly_ds__extract_quarter
+ , subq_6.monthly_ds__extract_month AS monthly_ds__extract_month
+ , subq_6.booking__monthly_ds__month AS booking__monthly_ds__month
+ , subq_6.booking__monthly_ds__quarter AS booking__monthly_ds__quarter
+ , subq_6.booking__monthly_ds__year AS booking__monthly_ds__year
+ , subq_6.booking__monthly_ds__extract_year AS booking__monthly_ds__extract_year
+ , subq_6.booking__monthly_ds__extract_quarter AS booking__monthly_ds__extract_quarter
+ , subq_6.booking__monthly_ds__extract_month AS booking__monthly_ds__extract_month
+ , subq_6.metric_time__quarter AS metric_time__quarter
+ , subq_6.metric_time__year AS metric_time__year
+ , subq_6.metric_time__extract_year AS metric_time__extract_year
+ , subq_6.metric_time__extract_quarter AS metric_time__extract_quarter
+ , subq_6.metric_time__extract_month AS metric_time__extract_month
+ , subq_6.listing AS listing
+ , subq_6.booking__listing AS booking__listing
+ , subq_6.bookings_monthly AS bookings_monthly
FROM (
-- Time Spine
SELECT
- DATE_TRUNC('month', subq_4.ds) AS metric_time__month
- FROM ***************************.mf_time_spine subq_4
- WHERE subq_4.ds BETWEEN '2020-03-05' AND '2021-01-04'
+ DATE_TRUNC('month', subq_8.ds) AS metric_time__month
+ FROM ***************************.mf_time_spine subq_8
+ WHERE subq_8.ds BETWEEN '2020-03-05' AND '2021-01-04'
GROUP BY
- DATE_TRUNC('month', subq_4.ds)
- ) subq_3
+ DATE_TRUNC('month', subq_8.ds)
+ ) subq_7
INNER JOIN (
-- Constrain Time Range to [2019-12-05T00:00:00, 2021-01-04T00:00:00]
SELECT
- subq_1.monthly_ds__month
- , subq_1.monthly_ds__quarter
- , subq_1.monthly_ds__year
- , subq_1.monthly_ds__extract_year
- , subq_1.monthly_ds__extract_quarter
- , subq_1.monthly_ds__extract_month
- , subq_1.booking__monthly_ds__month
- , subq_1.booking__monthly_ds__quarter
- , subq_1.booking__monthly_ds__year
- , subq_1.booking__monthly_ds__extract_year
- , subq_1.booking__monthly_ds__extract_quarter
- , subq_1.booking__monthly_ds__extract_month
- , subq_1.metric_time__month
- , subq_1.metric_time__quarter
- , subq_1.metric_time__year
- , subq_1.metric_time__extract_year
- , subq_1.metric_time__extract_quarter
- , subq_1.metric_time__extract_month
- , subq_1.listing
- , subq_1.booking__listing
- , subq_1.bookings_monthly
+ subq_5.monthly_ds__month
+ , subq_5.monthly_ds__quarter
+ , subq_5.monthly_ds__year
+ , subq_5.monthly_ds__extract_year
+ , subq_5.monthly_ds__extract_quarter
+ , subq_5.monthly_ds__extract_month
+ , subq_5.booking__monthly_ds__month
+ , subq_5.booking__monthly_ds__quarter
+ , subq_5.booking__monthly_ds__year
+ , subq_5.booking__monthly_ds__extract_year
+ , subq_5.booking__monthly_ds__extract_quarter
+ , subq_5.booking__monthly_ds__extract_month
+ , subq_5.metric_time__month
+ , subq_5.metric_time__quarter
+ , subq_5.metric_time__year
+ , subq_5.metric_time__extract_year
+ , subq_5.metric_time__extract_quarter
+ , subq_5.metric_time__extract_month
+ , subq_5.listing
+ , subq_5.booking__listing
+ , subq_5.bookings_monthly
FROM (
-- Metric Time Dimension 'monthly_ds'
SELECT
- subq_0.monthly_ds__month
- , subq_0.monthly_ds__quarter
- , subq_0.monthly_ds__year
- , subq_0.monthly_ds__extract_year
- , subq_0.monthly_ds__extract_quarter
- , subq_0.monthly_ds__extract_month
- , subq_0.booking__monthly_ds__month
- , subq_0.booking__monthly_ds__quarter
- , subq_0.booking__monthly_ds__year
- , subq_0.booking__monthly_ds__extract_year
- , subq_0.booking__monthly_ds__extract_quarter
- , subq_0.booking__monthly_ds__extract_month
- , subq_0.monthly_ds__month AS metric_time__month
- , subq_0.monthly_ds__quarter AS metric_time__quarter
- , subq_0.monthly_ds__year AS metric_time__year
- , subq_0.monthly_ds__extract_year AS metric_time__extract_year
- , subq_0.monthly_ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.monthly_ds__extract_month AS metric_time__extract_month
- , subq_0.listing
- , subq_0.booking__listing
- , subq_0.bookings_monthly
+ subq_4.monthly_ds__month
+ , subq_4.monthly_ds__quarter
+ , subq_4.monthly_ds__year
+ , subq_4.monthly_ds__extract_year
+ , subq_4.monthly_ds__extract_quarter
+ , subq_4.monthly_ds__extract_month
+ , subq_4.booking__monthly_ds__month
+ , subq_4.booking__monthly_ds__quarter
+ , subq_4.booking__monthly_ds__year
+ , subq_4.booking__monthly_ds__extract_year
+ , subq_4.booking__monthly_ds__extract_quarter
+ , subq_4.booking__monthly_ds__extract_month
+ , subq_4.monthly_ds__month AS metric_time__month
+ , subq_4.monthly_ds__quarter AS metric_time__quarter
+ , subq_4.monthly_ds__year AS metric_time__year
+ , subq_4.monthly_ds__extract_year AS metric_time__extract_year
+ , subq_4.monthly_ds__extract_quarter AS metric_time__extract_quarter
+ , subq_4.monthly_ds__extract_month AS metric_time__extract_month
+ , subq_4.listing
+ , subq_4.booking__listing
+ , subq_4.bookings_monthly
FROM (
-- Read Elements From Semantic Model 'bookings_monthly_source'
SELECT
@@ -117,20 +117,20 @@ FROM (
, bookings_monthly_source_src_16000.listing_id AS listing
, bookings_monthly_source_src_16000.listing_id AS booking__listing
FROM ***************************.fct_bookings_extended_monthly bookings_monthly_source_src_16000
- ) subq_0
- ) subq_1
- WHERE subq_1.metric_time__month BETWEEN '2019-12-05' AND '2021-01-04'
- ) subq_2
+ ) subq_4
+ ) subq_5
+ WHERE subq_5.metric_time__month BETWEEN '2019-12-05' AND '2021-01-04'
+ ) subq_6
ON
(
- subq_2.metric_time__month <= subq_3.metric_time__month
+ subq_6.metric_time__month <= subq_7.metric_time__month
) AND (
- subq_2.metric_time__month > DATEADD(month, -3, subq_3.metric_time__month)
+ subq_6.metric_time__month > DATEADD(month, -3, subq_7.metric_time__month)
)
- ) subq_5
- ) subq_6
- WHERE subq_6.metric_time__month BETWEEN '2020-03-05' AND '2021-01-04'
- ) subq_7
+ ) subq_9
+ ) subq_10
+ WHERE subq_10.metric_time__month BETWEEN '2020-03-05' AND '2021-01-04'
+ ) subq_11
GROUP BY
- subq_7.metric_time__month
-) subq_8
+ subq_11.metric_time__month
+) subq_12
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_month__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_month__plan0_optimized.sql
index 4611f8316c..c9b1da3166 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_month__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_month__plan0_optimized.sql
@@ -4,17 +4,17 @@
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_12.metric_time__month AS metric_time__month
- , SUM(subq_11.bookings_monthly) AS trailing_3_months_bookings
+ subq_16.metric_time__month AS metric_time__month
+ , SUM(subq_15.bookings_monthly) AS trailing_3_months_bookings
FROM (
-- Time Spine
SELECT
DATE_TRUNC('month', ds) AS metric_time__month
- FROM ***************************.mf_time_spine subq_13
+ FROM ***************************.mf_time_spine subq_17
WHERE ds BETWEEN '2020-03-05' AND '2021-01-04'
GROUP BY
DATE_TRUNC('month', ds)
-) subq_12
+) subq_16
INNER JOIN (
-- Read Elements From Semantic Model 'bookings_monthly_source'
-- Metric Time Dimension 'monthly_ds'
@@ -24,13 +24,13 @@ INNER JOIN (
, bookings_monthly
FROM ***************************.fct_bookings_extended_monthly bookings_monthly_source_src_16000
WHERE DATE_TRUNC('month', ds) BETWEEN '2019-12-05' AND '2021-01-04'
-) subq_11
+) subq_15
ON
(
- subq_11.metric_time__month <= subq_12.metric_time__month
+ subq_15.metric_time__month <= subq_16.metric_time__month
) AND (
- subq_11.metric_time__month > DATEADD(month, -3, subq_12.metric_time__month)
+ subq_15.metric_time__month > DATEADD(month, -3, subq_16.metric_time__month)
)
-WHERE subq_12.metric_time__month BETWEEN '2020-03-05' AND '2021-01-04'
+WHERE subq_16.metric_time__month BETWEEN '2020-03-05' AND '2021-01-04'
GROUP BY
- subq_12.metric_time__month
+ subq_16.metric_time__month
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_no_ds__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_no_ds__plan0.sql
index 8bc130fbf5..251bc5a79f 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_no_ds__plan0.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_no_ds__plan0.sql
@@ -1,83 +1,83 @@
-- Compute Metrics via Expressions
SELECT
- subq_3.txn_revenue AS trailing_2_months_revenue
+ subq_12.txn_revenue AS trailing_2_months_revenue
FROM (
-- Aggregate Measures
SELECT
- SUM(subq_2.txn_revenue) AS txn_revenue
+ SUM(subq_11.txn_revenue) AS txn_revenue
FROM (
-- Pass Only Elements: ['txn_revenue',]
SELECT
- subq_1.txn_revenue
+ subq_10.txn_revenue
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.revenue_instance__ds__day
- , subq_0.revenue_instance__ds__week
- , subq_0.revenue_instance__ds__month
- , subq_0.revenue_instance__ds__quarter
- , subq_0.revenue_instance__ds__year
- , subq_0.revenue_instance__ds__extract_year
- , subq_0.revenue_instance__ds__extract_quarter
- , subq_0.revenue_instance__ds__extract_month
- , subq_0.revenue_instance__ds__extract_day
- , subq_0.revenue_instance__ds__extract_dow
- , subq_0.revenue_instance__ds__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.user
- , subq_0.revenue_instance__user
- , subq_0.txn_revenue
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.revenue_instance__ds__day
+ , subq_9.revenue_instance__ds__week
+ , subq_9.revenue_instance__ds__month
+ , subq_9.revenue_instance__ds__quarter
+ , subq_9.revenue_instance__ds__year
+ , subq_9.revenue_instance__ds__extract_year
+ , subq_9.revenue_instance__ds__extract_quarter
+ , subq_9.revenue_instance__ds__extract_month
+ , subq_9.revenue_instance__ds__extract_day
+ , subq_9.revenue_instance__ds__extract_dow
+ , subq_9.revenue_instance__ds__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.user
+ , subq_9.revenue_instance__user
+ , subq_9.txn_revenue
FROM (
-- Read Elements From Semantic Model 'revenue'
SELECT
- revenue_src_28007.revenue AS txn_revenue
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day
- , EXTRACT(dayofweekiso FROM revenue_src_28007.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day
- , EXTRACT(dayofweekiso FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy
- , revenue_src_28007.user_id AS user
- , revenue_src_28007.user_id AS revenue_instance__user
- FROM ***************************.fct_revenue revenue_src_28007
- ) subq_0
- ) subq_1
- ) subq_2
-) subq_3
+ revenue_src_28000.revenue AS txn_revenue
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , EXTRACT(dayofweekiso FROM revenue_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS revenue_instance__ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS revenue_instance__ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS revenue_instance__ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS revenue_instance__ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , EXTRACT(day FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_day
+ , EXTRACT(dayofweekiso FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_doy
+ , revenue_src_28000.user_id AS user
+ , revenue_src_28000.user_id AS revenue_instance__user
+ FROM ***************************.fct_revenue revenue_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
+) subq_12
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_no_ds__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_no_ds__plan0_optimized.sql
index e26a1bdb3d..4a0d5baff3 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_no_ds__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_no_ds__plan0_optimized.sql
@@ -5,4 +5,4 @@
-- Compute Metrics via Expressions
SELECT
SUM(revenue) AS trailing_2_months_revenue
-FROM ***************************.fct_revenue revenue_src_28007
+FROM ***************************.fct_revenue revenue_src_28000
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_no_window__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_no_window__plan0.sql
index dfc1d734e7..55e6b58ce9 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_no_window__plan0.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_no_window__plan0.sql
@@ -1,88 +1,88 @@
-- Compute Metrics via Expressions
SELECT
- subq_3.ds__month
- , subq_3.txn_revenue AS revenue_all_time
+ subq_12.ds__month
+ , subq_12.txn_revenue AS revenue_all_time
FROM (
-- Aggregate Measures
SELECT
- subq_2.ds__month
- , SUM(subq_2.txn_revenue) AS txn_revenue
+ subq_11.ds__month
+ , SUM(subq_11.txn_revenue) AS txn_revenue
FROM (
-- Pass Only Elements: ['txn_revenue', 'ds__month']
SELECT
- subq_1.ds__month
- , subq_1.txn_revenue
+ subq_10.ds__month
+ , subq_10.txn_revenue
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.revenue_instance__ds__day
- , subq_0.revenue_instance__ds__week
- , subq_0.revenue_instance__ds__month
- , subq_0.revenue_instance__ds__quarter
- , subq_0.revenue_instance__ds__year
- , subq_0.revenue_instance__ds__extract_year
- , subq_0.revenue_instance__ds__extract_quarter
- , subq_0.revenue_instance__ds__extract_month
- , subq_0.revenue_instance__ds__extract_day
- , subq_0.revenue_instance__ds__extract_dow
- , subq_0.revenue_instance__ds__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.user
- , subq_0.revenue_instance__user
- , subq_0.txn_revenue
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.revenue_instance__ds__day
+ , subq_9.revenue_instance__ds__week
+ , subq_9.revenue_instance__ds__month
+ , subq_9.revenue_instance__ds__quarter
+ , subq_9.revenue_instance__ds__year
+ , subq_9.revenue_instance__ds__extract_year
+ , subq_9.revenue_instance__ds__extract_quarter
+ , subq_9.revenue_instance__ds__extract_month
+ , subq_9.revenue_instance__ds__extract_day
+ , subq_9.revenue_instance__ds__extract_dow
+ , subq_9.revenue_instance__ds__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.user
+ , subq_9.revenue_instance__user
+ , subq_9.txn_revenue
FROM (
-- Read Elements From Semantic Model 'revenue'
SELECT
- revenue_src_28007.revenue AS txn_revenue
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day
- , EXTRACT(dayofweekiso FROM revenue_src_28007.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day
- , EXTRACT(dayofweekiso FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy
- , revenue_src_28007.user_id AS user
- , revenue_src_28007.user_id AS revenue_instance__user
- FROM ***************************.fct_revenue revenue_src_28007
- ) subq_0
- ) subq_1
- ) subq_2
+ revenue_src_28000.revenue AS txn_revenue
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , EXTRACT(dayofweekiso FROM revenue_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS revenue_instance__ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS revenue_instance__ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS revenue_instance__ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS revenue_instance__ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , EXTRACT(day FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_day
+ , EXTRACT(dayofweekiso FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_doy
+ , revenue_src_28000.user_id AS user
+ , revenue_src_28000.user_id AS revenue_instance__user
+ FROM ***************************.fct_revenue revenue_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
GROUP BY
- subq_2.ds__month
-) subq_3
+ subq_11.ds__month
+) subq_12
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_no_window__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_no_window__plan0_optimized.sql
index a7ca78d4e5..05e48cdae3 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_no_window__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_no_window__plan0_optimized.sql
@@ -6,6 +6,6 @@
SELECT
DATE_TRUNC('month', created_at) AS ds__month
, SUM(revenue) AS revenue_all_time
-FROM ***************************.fct_revenue revenue_src_28007
+FROM ***************************.fct_revenue revenue_src_28000
GROUP BY
DATE_TRUNC('month', created_at)
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_no_window_with_time_constraint__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_no_window_with_time_constraint__plan0.sql
index 5e5336aedd..fed3314007 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_no_window_with_time_constraint__plan0.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_no_window_with_time_constraint__plan0.sql
@@ -1,187 +1,187 @@
-- Compute Metrics via Expressions
SELECT
- subq_8.metric_time__month
- , subq_8.txn_revenue AS revenue_all_time
+ subq_19.metric_time__month
+ , subq_19.txn_revenue AS revenue_all_time
FROM (
-- Aggregate Measures
SELECT
- subq_7.metric_time__month
- , SUM(subq_7.txn_revenue) AS txn_revenue
+ subq_18.metric_time__month
+ , SUM(subq_18.txn_revenue) AS txn_revenue
FROM (
-- Constrain Time Range to [2020-01-01T00:00:00, 2020-01-01T00:00:00]
SELECT
- subq_6.metric_time__month
- , subq_6.txn_revenue
+ subq_17.metric_time__month
+ , subq_17.txn_revenue
FROM (
-- Pass Only Elements: ['txn_revenue', 'metric_time__month']
SELECT
- subq_5.metric_time__month
- , subq_5.txn_revenue
+ subq_16.metric_time__month
+ , subq_16.txn_revenue
FROM (
-- Join Self Over Time Range
SELECT
- subq_3.metric_time__month AS metric_time__month
- , subq_2.ds__day AS ds__day
- , subq_2.ds__week AS ds__week
- , subq_2.ds__month AS ds__month
- , subq_2.ds__quarter AS ds__quarter
- , subq_2.ds__year AS ds__year
- , subq_2.ds__extract_year AS ds__extract_year
- , subq_2.ds__extract_quarter AS ds__extract_quarter
- , subq_2.ds__extract_month AS ds__extract_month
- , subq_2.ds__extract_day AS ds__extract_day
- , subq_2.ds__extract_dow AS ds__extract_dow
- , subq_2.ds__extract_doy AS ds__extract_doy
- , subq_2.revenue_instance__ds__day AS revenue_instance__ds__day
- , subq_2.revenue_instance__ds__week AS revenue_instance__ds__week
- , subq_2.revenue_instance__ds__month AS revenue_instance__ds__month
- , subq_2.revenue_instance__ds__quarter AS revenue_instance__ds__quarter
- , subq_2.revenue_instance__ds__year AS revenue_instance__ds__year
- , subq_2.revenue_instance__ds__extract_year AS revenue_instance__ds__extract_year
- , subq_2.revenue_instance__ds__extract_quarter AS revenue_instance__ds__extract_quarter
- , subq_2.revenue_instance__ds__extract_month AS revenue_instance__ds__extract_month
- , subq_2.revenue_instance__ds__extract_day AS revenue_instance__ds__extract_day
- , subq_2.revenue_instance__ds__extract_dow AS revenue_instance__ds__extract_dow
- , subq_2.revenue_instance__ds__extract_doy AS revenue_instance__ds__extract_doy
- , subq_2.metric_time__day AS metric_time__day
- , subq_2.metric_time__week AS metric_time__week
- , subq_2.metric_time__quarter AS metric_time__quarter
- , subq_2.metric_time__year AS metric_time__year
- , subq_2.metric_time__extract_year AS metric_time__extract_year
- , subq_2.metric_time__extract_quarter AS metric_time__extract_quarter
- , subq_2.metric_time__extract_month AS metric_time__extract_month
- , subq_2.metric_time__extract_day AS metric_time__extract_day
- , subq_2.metric_time__extract_dow AS metric_time__extract_dow
- , subq_2.metric_time__extract_doy AS metric_time__extract_doy
- , subq_2.user AS user
- , subq_2.revenue_instance__user AS revenue_instance__user
- , subq_2.txn_revenue AS txn_revenue
+ subq_14.metric_time__month AS metric_time__month
+ , subq_13.ds__day AS ds__day
+ , subq_13.ds__week AS ds__week
+ , subq_13.ds__month AS ds__month
+ , subq_13.ds__quarter AS ds__quarter
+ , subq_13.ds__year AS ds__year
+ , subq_13.ds__extract_year AS ds__extract_year
+ , subq_13.ds__extract_quarter AS ds__extract_quarter
+ , subq_13.ds__extract_month AS ds__extract_month
+ , subq_13.ds__extract_day AS ds__extract_day
+ , subq_13.ds__extract_dow AS ds__extract_dow
+ , subq_13.ds__extract_doy AS ds__extract_doy
+ , subq_13.revenue_instance__ds__day AS revenue_instance__ds__day
+ , subq_13.revenue_instance__ds__week AS revenue_instance__ds__week
+ , subq_13.revenue_instance__ds__month AS revenue_instance__ds__month
+ , subq_13.revenue_instance__ds__quarter AS revenue_instance__ds__quarter
+ , subq_13.revenue_instance__ds__year AS revenue_instance__ds__year
+ , subq_13.revenue_instance__ds__extract_year AS revenue_instance__ds__extract_year
+ , subq_13.revenue_instance__ds__extract_quarter AS revenue_instance__ds__extract_quarter
+ , subq_13.revenue_instance__ds__extract_month AS revenue_instance__ds__extract_month
+ , subq_13.revenue_instance__ds__extract_day AS revenue_instance__ds__extract_day
+ , subq_13.revenue_instance__ds__extract_dow AS revenue_instance__ds__extract_dow
+ , subq_13.revenue_instance__ds__extract_doy AS revenue_instance__ds__extract_doy
+ , subq_13.metric_time__day AS metric_time__day
+ , subq_13.metric_time__week AS metric_time__week
+ , subq_13.metric_time__quarter AS metric_time__quarter
+ , subq_13.metric_time__year AS metric_time__year
+ , subq_13.metric_time__extract_year AS metric_time__extract_year
+ , subq_13.metric_time__extract_quarter AS metric_time__extract_quarter
+ , subq_13.metric_time__extract_month AS metric_time__extract_month
+ , subq_13.metric_time__extract_day AS metric_time__extract_day
+ , subq_13.metric_time__extract_dow AS metric_time__extract_dow
+ , subq_13.metric_time__extract_doy AS metric_time__extract_doy
+ , subq_13.user AS user
+ , subq_13.revenue_instance__user AS revenue_instance__user
+ , subq_13.txn_revenue AS txn_revenue
FROM (
-- Time Spine
SELECT
- DATE_TRUNC('month', subq_4.ds) AS metric_time__month
- FROM ***************************.mf_time_spine subq_4
- WHERE subq_4.ds BETWEEN '2020-01-01' AND '2020-01-01'
+ DATE_TRUNC('month', subq_15.ds) AS metric_time__month
+ FROM ***************************.mf_time_spine subq_15
+ WHERE subq_15.ds BETWEEN '2020-01-01' AND '2020-01-01'
GROUP BY
- DATE_TRUNC('month', subq_4.ds)
- ) subq_3
+ DATE_TRUNC('month', subq_15.ds)
+ ) subq_14
INNER JOIN (
-- Constrain Time Range to [2000-01-01T00:00:00, 2020-01-01T00:00:00]
SELECT
- subq_1.ds__day
- , subq_1.ds__week
- , subq_1.ds__month
- , subq_1.ds__quarter
- , subq_1.ds__year
- , subq_1.ds__extract_year
- , subq_1.ds__extract_quarter
- , subq_1.ds__extract_month
- , subq_1.ds__extract_day
- , subq_1.ds__extract_dow
- , subq_1.ds__extract_doy
- , subq_1.revenue_instance__ds__day
- , subq_1.revenue_instance__ds__week
- , subq_1.revenue_instance__ds__month
- , subq_1.revenue_instance__ds__quarter
- , subq_1.revenue_instance__ds__year
- , subq_1.revenue_instance__ds__extract_year
- , subq_1.revenue_instance__ds__extract_quarter
- , subq_1.revenue_instance__ds__extract_month
- , subq_1.revenue_instance__ds__extract_day
- , subq_1.revenue_instance__ds__extract_dow
- , subq_1.revenue_instance__ds__extract_doy
- , subq_1.metric_time__day
- , subq_1.metric_time__week
- , subq_1.metric_time__month
- , subq_1.metric_time__quarter
- , subq_1.metric_time__year
- , subq_1.metric_time__extract_year
- , subq_1.metric_time__extract_quarter
- , subq_1.metric_time__extract_month
- , subq_1.metric_time__extract_day
- , subq_1.metric_time__extract_dow
- , subq_1.metric_time__extract_doy
- , subq_1.user
- , subq_1.revenue_instance__user
- , subq_1.txn_revenue
+ subq_12.ds__day
+ , subq_12.ds__week
+ , subq_12.ds__month
+ , subq_12.ds__quarter
+ , subq_12.ds__year
+ , subq_12.ds__extract_year
+ , subq_12.ds__extract_quarter
+ , subq_12.ds__extract_month
+ , subq_12.ds__extract_day
+ , subq_12.ds__extract_dow
+ , subq_12.ds__extract_doy
+ , subq_12.revenue_instance__ds__day
+ , subq_12.revenue_instance__ds__week
+ , subq_12.revenue_instance__ds__month
+ , subq_12.revenue_instance__ds__quarter
+ , subq_12.revenue_instance__ds__year
+ , subq_12.revenue_instance__ds__extract_year
+ , subq_12.revenue_instance__ds__extract_quarter
+ , subq_12.revenue_instance__ds__extract_month
+ , subq_12.revenue_instance__ds__extract_day
+ , subq_12.revenue_instance__ds__extract_dow
+ , subq_12.revenue_instance__ds__extract_doy
+ , subq_12.metric_time__day
+ , subq_12.metric_time__week
+ , subq_12.metric_time__month
+ , subq_12.metric_time__quarter
+ , subq_12.metric_time__year
+ , subq_12.metric_time__extract_year
+ , subq_12.metric_time__extract_quarter
+ , subq_12.metric_time__extract_month
+ , subq_12.metric_time__extract_day
+ , subq_12.metric_time__extract_dow
+ , subq_12.metric_time__extract_doy
+ , subq_12.user
+ , subq_12.revenue_instance__user
+ , subq_12.txn_revenue
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.revenue_instance__ds__day
- , subq_0.revenue_instance__ds__week
- , subq_0.revenue_instance__ds__month
- , subq_0.revenue_instance__ds__quarter
- , subq_0.revenue_instance__ds__year
- , subq_0.revenue_instance__ds__extract_year
- , subq_0.revenue_instance__ds__extract_quarter
- , subq_0.revenue_instance__ds__extract_month
- , subq_0.revenue_instance__ds__extract_day
- , subq_0.revenue_instance__ds__extract_dow
- , subq_0.revenue_instance__ds__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.user
- , subq_0.revenue_instance__user
- , subq_0.txn_revenue
+ subq_11.ds__day
+ , subq_11.ds__week
+ , subq_11.ds__month
+ , subq_11.ds__quarter
+ , subq_11.ds__year
+ , subq_11.ds__extract_year
+ , subq_11.ds__extract_quarter
+ , subq_11.ds__extract_month
+ , subq_11.ds__extract_day
+ , subq_11.ds__extract_dow
+ , subq_11.ds__extract_doy
+ , subq_11.revenue_instance__ds__day
+ , subq_11.revenue_instance__ds__week
+ , subq_11.revenue_instance__ds__month
+ , subq_11.revenue_instance__ds__quarter
+ , subq_11.revenue_instance__ds__year
+ , subq_11.revenue_instance__ds__extract_year
+ , subq_11.revenue_instance__ds__extract_quarter
+ , subq_11.revenue_instance__ds__extract_month
+ , subq_11.revenue_instance__ds__extract_day
+ , subq_11.revenue_instance__ds__extract_dow
+ , subq_11.revenue_instance__ds__extract_doy
+ , subq_11.ds__day AS metric_time__day
+ , subq_11.ds__week AS metric_time__week
+ , subq_11.ds__month AS metric_time__month
+ , subq_11.ds__quarter AS metric_time__quarter
+ , subq_11.ds__year AS metric_time__year
+ , subq_11.ds__extract_year AS metric_time__extract_year
+ , subq_11.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_11.ds__extract_month AS metric_time__extract_month
+ , subq_11.ds__extract_day AS metric_time__extract_day
+ , subq_11.ds__extract_dow AS metric_time__extract_dow
+ , subq_11.ds__extract_doy AS metric_time__extract_doy
+ , subq_11.user
+ , subq_11.revenue_instance__user
+ , subq_11.txn_revenue
FROM (
-- Read Elements From Semantic Model 'revenue'
SELECT
- revenue_src_28007.revenue AS txn_revenue
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day
- , EXTRACT(dayofweekiso FROM revenue_src_28007.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day
- , EXTRACT(dayofweekiso FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy
- , revenue_src_28007.user_id AS user
- , revenue_src_28007.user_id AS revenue_instance__user
- FROM ***************************.fct_revenue revenue_src_28007
- ) subq_0
- ) subq_1
- WHERE subq_1.metric_time__day BETWEEN '2000-01-01' AND '2020-01-01'
- ) subq_2
+ revenue_src_28000.revenue AS txn_revenue
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , EXTRACT(dayofweekiso FROM revenue_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS revenue_instance__ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS revenue_instance__ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS revenue_instance__ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS revenue_instance__ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , EXTRACT(day FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_day
+ , EXTRACT(dayofweekiso FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_doy
+ , revenue_src_28000.user_id AS user
+ , revenue_src_28000.user_id AS revenue_instance__user
+ FROM ***************************.fct_revenue revenue_src_28000
+ ) subq_11
+ ) subq_12
+ WHERE subq_12.metric_time__day BETWEEN '2000-01-01' AND '2020-01-01'
+ ) subq_13
ON
- (subq_2.metric_time__month <= subq_3.metric_time__month)
- ) subq_5
- ) subq_6
- WHERE subq_6.metric_time__month BETWEEN '2020-01-01' AND '2020-01-01'
- ) subq_7
+ (subq_13.metric_time__month <= subq_14.metric_time__month)
+ ) subq_16
+ ) subq_17
+ WHERE subq_17.metric_time__month BETWEEN '2020-01-01' AND '2020-01-01'
+ ) subq_18
GROUP BY
- subq_7.metric_time__month
-) subq_8
+ subq_18.metric_time__month
+) subq_19
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_no_window_with_time_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_no_window_with_time_constraint__plan0_optimized.sql
index a4e5bf994b..0267f01b4a 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_no_window_with_time_constraint__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_no_window_with_time_constraint__plan0_optimized.sql
@@ -4,17 +4,17 @@
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_12.metric_time__month AS metric_time__month
- , SUM(subq_11.txn_revenue) AS revenue_all_time
+ subq_23.metric_time__month AS metric_time__month
+ , SUM(subq_22.txn_revenue) AS revenue_all_time
FROM (
-- Time Spine
SELECT
DATE_TRUNC('month', ds) AS metric_time__month
- FROM ***************************.mf_time_spine subq_13
+ FROM ***************************.mf_time_spine subq_24
WHERE ds BETWEEN '2020-01-01' AND '2020-01-01'
GROUP BY
DATE_TRUNC('month', ds)
-) subq_12
+) subq_23
INNER JOIN (
-- Read Elements From Semantic Model 'revenue'
-- Metric Time Dimension 'ds'
@@ -22,11 +22,11 @@ INNER JOIN (
SELECT
DATE_TRUNC('month', created_at) AS metric_time__month
, revenue AS txn_revenue
- FROM ***************************.fct_revenue revenue_src_28007
+ FROM ***************************.fct_revenue revenue_src_28000
WHERE DATE_TRUNC('day', created_at) BETWEEN '2000-01-01' AND '2020-01-01'
-) subq_11
+) subq_22
ON
- (subq_11.metric_time__month <= subq_12.metric_time__month)
-WHERE subq_12.metric_time__month BETWEEN '2020-01-01' AND '2020-01-01'
+ (subq_22.metric_time__month <= subq_23.metric_time__month)
+WHERE subq_23.metric_time__month BETWEEN '2020-01-01' AND '2020-01-01'
GROUP BY
- subq_12.metric_time__month
+ subq_23.metric_time__month
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_with_agg_time_dimension__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_with_agg_time_dimension__plan0.sql
index 22100cdf6e..0d10f13418 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_with_agg_time_dimension__plan0.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_with_agg_time_dimension__plan0.sql
@@ -1,140 +1,140 @@
-- Compute Metrics via Expressions
SELECT
- subq_6.revenue_instance__ds__day
- , subq_6.txn_revenue AS trailing_2_months_revenue
+ subq_15.revenue_instance__ds__day
+ , subq_15.txn_revenue AS trailing_2_months_revenue
FROM (
-- Aggregate Measures
SELECT
- subq_5.revenue_instance__ds__day
- , SUM(subq_5.txn_revenue) AS txn_revenue
+ subq_14.revenue_instance__ds__day
+ , SUM(subq_14.txn_revenue) AS txn_revenue
FROM (
-- Pass Only Elements: ['txn_revenue', 'revenue_instance__ds__day']
SELECT
- subq_4.revenue_instance__ds__day
- , subq_4.txn_revenue
+ subq_13.revenue_instance__ds__day
+ , subq_13.txn_revenue
FROM (
-- Join Self Over Time Range
SELECT
- subq_2.revenue_instance__ds__day AS revenue_instance__ds__day
- , subq_1.ds__day AS ds__day
- , subq_1.ds__week AS ds__week
- , subq_1.ds__month AS ds__month
- , subq_1.ds__quarter AS ds__quarter
- , subq_1.ds__year AS ds__year
- , subq_1.ds__extract_year AS ds__extract_year
- , subq_1.ds__extract_quarter AS ds__extract_quarter
- , subq_1.ds__extract_month AS ds__extract_month
- , subq_1.ds__extract_day AS ds__extract_day
- , subq_1.ds__extract_dow AS ds__extract_dow
- , subq_1.ds__extract_doy AS ds__extract_doy
- , subq_1.revenue_instance__ds__week AS revenue_instance__ds__week
- , subq_1.revenue_instance__ds__month AS revenue_instance__ds__month
- , subq_1.revenue_instance__ds__quarter AS revenue_instance__ds__quarter
- , subq_1.revenue_instance__ds__year AS revenue_instance__ds__year
- , subq_1.revenue_instance__ds__extract_year AS revenue_instance__ds__extract_year
- , subq_1.revenue_instance__ds__extract_quarter AS revenue_instance__ds__extract_quarter
- , subq_1.revenue_instance__ds__extract_month AS revenue_instance__ds__extract_month
- , subq_1.revenue_instance__ds__extract_day AS revenue_instance__ds__extract_day
- , subq_1.revenue_instance__ds__extract_dow AS revenue_instance__ds__extract_dow
- , subq_1.revenue_instance__ds__extract_doy AS revenue_instance__ds__extract_doy
- , subq_1.metric_time__day AS metric_time__day
- , subq_1.metric_time__week AS metric_time__week
- , subq_1.metric_time__month AS metric_time__month
- , subq_1.metric_time__quarter AS metric_time__quarter
- , subq_1.metric_time__year AS metric_time__year
- , subq_1.metric_time__extract_year AS metric_time__extract_year
- , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter
- , subq_1.metric_time__extract_month AS metric_time__extract_month
- , subq_1.metric_time__extract_day AS metric_time__extract_day
- , subq_1.metric_time__extract_dow AS metric_time__extract_dow
- , subq_1.metric_time__extract_doy AS metric_time__extract_doy
- , subq_1.user AS user
- , subq_1.revenue_instance__user AS revenue_instance__user
- , subq_1.txn_revenue AS txn_revenue
+ subq_11.revenue_instance__ds__day AS revenue_instance__ds__day
+ , subq_10.ds__day AS ds__day
+ , subq_10.ds__week AS ds__week
+ , subq_10.ds__month AS ds__month
+ , subq_10.ds__quarter AS ds__quarter
+ , subq_10.ds__year AS ds__year
+ , subq_10.ds__extract_year AS ds__extract_year
+ , subq_10.ds__extract_quarter AS ds__extract_quarter
+ , subq_10.ds__extract_month AS ds__extract_month
+ , subq_10.ds__extract_day AS ds__extract_day
+ , subq_10.ds__extract_dow AS ds__extract_dow
+ , subq_10.ds__extract_doy AS ds__extract_doy
+ , subq_10.revenue_instance__ds__week AS revenue_instance__ds__week
+ , subq_10.revenue_instance__ds__month AS revenue_instance__ds__month
+ , subq_10.revenue_instance__ds__quarter AS revenue_instance__ds__quarter
+ , subq_10.revenue_instance__ds__year AS revenue_instance__ds__year
+ , subq_10.revenue_instance__ds__extract_year AS revenue_instance__ds__extract_year
+ , subq_10.revenue_instance__ds__extract_quarter AS revenue_instance__ds__extract_quarter
+ , subq_10.revenue_instance__ds__extract_month AS revenue_instance__ds__extract_month
+ , subq_10.revenue_instance__ds__extract_day AS revenue_instance__ds__extract_day
+ , subq_10.revenue_instance__ds__extract_dow AS revenue_instance__ds__extract_dow
+ , subq_10.revenue_instance__ds__extract_doy AS revenue_instance__ds__extract_doy
+ , subq_10.metric_time__day AS metric_time__day
+ , subq_10.metric_time__week AS metric_time__week
+ , subq_10.metric_time__month AS metric_time__month
+ , subq_10.metric_time__quarter AS metric_time__quarter
+ , subq_10.metric_time__year AS metric_time__year
+ , subq_10.metric_time__extract_year AS metric_time__extract_year
+ , subq_10.metric_time__extract_quarter AS metric_time__extract_quarter
+ , subq_10.metric_time__extract_month AS metric_time__extract_month
+ , subq_10.metric_time__extract_day AS metric_time__extract_day
+ , subq_10.metric_time__extract_dow AS metric_time__extract_dow
+ , subq_10.metric_time__extract_doy AS metric_time__extract_doy
+ , subq_10.user AS user
+ , subq_10.revenue_instance__user AS revenue_instance__user
+ , subq_10.txn_revenue AS txn_revenue
FROM (
-- Time Spine
SELECT
- subq_3.ds AS revenue_instance__ds__day
- FROM ***************************.mf_time_spine subq_3
- ) subq_2
+ subq_12.ds AS revenue_instance__ds__day
+ FROM ***************************.mf_time_spine subq_12
+ ) subq_11
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.revenue_instance__ds__day
- , subq_0.revenue_instance__ds__week
- , subq_0.revenue_instance__ds__month
- , subq_0.revenue_instance__ds__quarter
- , subq_0.revenue_instance__ds__year
- , subq_0.revenue_instance__ds__extract_year
- , subq_0.revenue_instance__ds__extract_quarter
- , subq_0.revenue_instance__ds__extract_month
- , subq_0.revenue_instance__ds__extract_day
- , subq_0.revenue_instance__ds__extract_dow
- , subq_0.revenue_instance__ds__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.user
- , subq_0.revenue_instance__user
- , subq_0.txn_revenue
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.revenue_instance__ds__day
+ , subq_9.revenue_instance__ds__week
+ , subq_9.revenue_instance__ds__month
+ , subq_9.revenue_instance__ds__quarter
+ , subq_9.revenue_instance__ds__year
+ , subq_9.revenue_instance__ds__extract_year
+ , subq_9.revenue_instance__ds__extract_quarter
+ , subq_9.revenue_instance__ds__extract_month
+ , subq_9.revenue_instance__ds__extract_day
+ , subq_9.revenue_instance__ds__extract_dow
+ , subq_9.revenue_instance__ds__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.user
+ , subq_9.revenue_instance__user
+ , subq_9.txn_revenue
FROM (
-- Read Elements From Semantic Model 'revenue'
SELECT
- revenue_src_28007.revenue AS txn_revenue
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day
- , EXTRACT(dayofweekiso FROM revenue_src_28007.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day
- , EXTRACT(dayofweekiso FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy
- , revenue_src_28007.user_id AS user
- , revenue_src_28007.user_id AS revenue_instance__user
- FROM ***************************.fct_revenue revenue_src_28007
- ) subq_0
- ) subq_1
+ revenue_src_28000.revenue AS txn_revenue
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , EXTRACT(dayofweekiso FROM revenue_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS revenue_instance__ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS revenue_instance__ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS revenue_instance__ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS revenue_instance__ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , EXTRACT(day FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_day
+ , EXTRACT(dayofweekiso FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_doy
+ , revenue_src_28000.user_id AS user
+ , revenue_src_28000.user_id AS revenue_instance__user
+ FROM ***************************.fct_revenue revenue_src_28000
+ ) subq_9
+ ) subq_10
ON
(
- subq_1.revenue_instance__ds__day <= subq_2.revenue_instance__ds__day
+ subq_10.revenue_instance__ds__day <= subq_11.revenue_instance__ds__day
) AND (
- subq_1.revenue_instance__ds__day > DATEADD(month, -2, subq_2.revenue_instance__ds__day)
+ subq_10.revenue_instance__ds__day > DATEADD(month, -2, subq_11.revenue_instance__ds__day)
)
- ) subq_4
- ) subq_5
+ ) subq_13
+ ) subq_14
GROUP BY
- subq_5.revenue_instance__ds__day
-) subq_6
+ subq_14.revenue_instance__ds__day
+) subq_15
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_with_agg_time_dimension__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_with_agg_time_dimension__plan0_optimized.sql
index 501e54f5dd..9769ddd7de 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_with_agg_time_dimension__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_with_agg_time_dimension__plan0_optimized.sql
@@ -3,16 +3,16 @@
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_10.ds AS revenue_instance__ds__day
- , SUM(revenue_src_28007.revenue) AS trailing_2_months_revenue
-FROM ***************************.mf_time_spine subq_10
+ subq_19.ds AS revenue_instance__ds__day
+ , SUM(revenue_src_28000.revenue) AS trailing_2_months_revenue
+FROM ***************************.mf_time_spine subq_19
INNER JOIN
- ***************************.fct_revenue revenue_src_28007
+ ***************************.fct_revenue revenue_src_28000
ON
(
- DATE_TRUNC('day', revenue_src_28007.created_at) <= subq_10.ds
+ DATE_TRUNC('day', revenue_src_28000.created_at) <= subq_19.ds
) AND (
- DATE_TRUNC('day', revenue_src_28007.created_at) > DATEADD(month, -2, subq_10.ds)
+ DATE_TRUNC('day', revenue_src_28000.created_at) > DATEADD(month, -2, subq_19.ds)
)
GROUP BY
- subq_10.ds
+ subq_19.ds
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_with_non_adjustable_time_filter__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_with_non_adjustable_time_filter__plan0.sql
index c888543562..e7c67ad1f2 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_with_non_adjustable_time_filter__plan0.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_with_non_adjustable_time_filter__plan0.sql
@@ -1,334 +1,334 @@
-- Compute Metrics via Expressions
SELECT
- subq_7.metric_time__day
- , subq_7.bookers AS every_two_days_bookers
+ subq_16.metric_time__day
+ , subq_16.bookers AS every_two_days_bookers
FROM (
-- Aggregate Measures
SELECT
- subq_6.metric_time__day
- , COUNT(DISTINCT subq_6.bookers) AS bookers
+ subq_15.metric_time__day
+ , COUNT(DISTINCT subq_15.bookers) AS bookers
FROM (
-- Constrain Output with WHERE
SELECT
- subq_5.metric_time__day
- , subq_5.bookers
+ subq_14.metric_time__day
+ , subq_14.bookers
FROM (
-- Pass Only Elements: ['bookers', 'metric_time__day']
SELECT
- subq_4.metric_time__day
- , subq_4.bookers
+ subq_13.metric_time__day
+ , subq_13.bookers
FROM (
-- Join Self Over Time Range
SELECT
- subq_2.metric_time__day AS metric_time__day
- , subq_1.ds__day AS ds__day
- , subq_1.ds__week AS ds__week
- , subq_1.ds__month AS ds__month
- , subq_1.ds__quarter AS ds__quarter
- , subq_1.ds__year AS ds__year
- , subq_1.ds__extract_year AS ds__extract_year
- , subq_1.ds__extract_quarter AS ds__extract_quarter
- , subq_1.ds__extract_month AS ds__extract_month
- , subq_1.ds__extract_day AS ds__extract_day
- , subq_1.ds__extract_dow AS ds__extract_dow
- , subq_1.ds__extract_doy AS ds__extract_doy
- , subq_1.ds_partitioned__day AS ds_partitioned__day
- , subq_1.ds_partitioned__week AS ds_partitioned__week
- , subq_1.ds_partitioned__month AS ds_partitioned__month
- , subq_1.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_1.ds_partitioned__year AS ds_partitioned__year
- , subq_1.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_1.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_1.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_1.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_1.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_1.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_1.paid_at__day AS paid_at__day
- , subq_1.paid_at__week AS paid_at__week
- , subq_1.paid_at__month AS paid_at__month
- , subq_1.paid_at__quarter AS paid_at__quarter
- , subq_1.paid_at__year AS paid_at__year
- , subq_1.paid_at__extract_year AS paid_at__extract_year
- , subq_1.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_1.paid_at__extract_month AS paid_at__extract_month
- , subq_1.paid_at__extract_day AS paid_at__extract_day
- , subq_1.paid_at__extract_dow AS paid_at__extract_dow
- , subq_1.paid_at__extract_doy AS paid_at__extract_doy
- , subq_1.booking__ds__day AS booking__ds__day
- , subq_1.booking__ds__week AS booking__ds__week
- , subq_1.booking__ds__month AS booking__ds__month
- , subq_1.booking__ds__quarter AS booking__ds__quarter
- , subq_1.booking__ds__year AS booking__ds__year
- , subq_1.booking__ds__extract_year AS booking__ds__extract_year
- , subq_1.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_1.booking__ds__extract_month AS booking__ds__extract_month
- , subq_1.booking__ds__extract_day AS booking__ds__extract_day
- , subq_1.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_1.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_1.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_1.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_1.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_1.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_1.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_1.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_1.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_1.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_1.booking__paid_at__day AS booking__paid_at__day
- , subq_1.booking__paid_at__week AS booking__paid_at__week
- , subq_1.booking__paid_at__month AS booking__paid_at__month
- , subq_1.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_1.booking__paid_at__year AS booking__paid_at__year
- , subq_1.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_1.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_1.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_1.metric_time__week AS metric_time__week
- , subq_1.metric_time__month AS metric_time__month
- , subq_1.metric_time__quarter AS metric_time__quarter
- , subq_1.metric_time__year AS metric_time__year
- , subq_1.metric_time__extract_year AS metric_time__extract_year
- , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter
- , subq_1.metric_time__extract_month AS metric_time__extract_month
- , subq_1.metric_time__extract_day AS metric_time__extract_day
- , subq_1.metric_time__extract_dow AS metric_time__extract_dow
- , subq_1.metric_time__extract_doy AS metric_time__extract_doy
- , subq_1.listing AS listing
- , subq_1.guest AS guest
- , subq_1.host AS host
- , subq_1.booking__listing AS booking__listing
- , subq_1.booking__guest AS booking__guest
- , subq_1.booking__host AS booking__host
- , subq_1.is_instant AS is_instant
- , subq_1.booking__is_instant AS booking__is_instant
- , subq_1.bookings AS bookings
- , subq_1.instant_bookings AS instant_bookings
- , subq_1.booking_value AS booking_value
- , subq_1.max_booking_value AS max_booking_value
- , subq_1.min_booking_value AS min_booking_value
- , subq_1.bookers AS bookers
- , subq_1.average_booking_value AS average_booking_value
- , subq_1.referred_bookings AS referred_bookings
- , subq_1.median_booking_value AS median_booking_value
- , subq_1.booking_value_p99 AS booking_value_p99
- , subq_1.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_1.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_1.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ subq_11.metric_time__day AS metric_time__day
+ , subq_10.ds__day AS ds__day
+ , subq_10.ds__week AS ds__week
+ , subq_10.ds__month AS ds__month
+ , subq_10.ds__quarter AS ds__quarter
+ , subq_10.ds__year AS ds__year
+ , subq_10.ds__extract_year AS ds__extract_year
+ , subq_10.ds__extract_quarter AS ds__extract_quarter
+ , subq_10.ds__extract_month AS ds__extract_month
+ , subq_10.ds__extract_day AS ds__extract_day
+ , subq_10.ds__extract_dow AS ds__extract_dow
+ , subq_10.ds__extract_doy AS ds__extract_doy
+ , subq_10.ds_partitioned__day AS ds_partitioned__day
+ , subq_10.ds_partitioned__week AS ds_partitioned__week
+ , subq_10.ds_partitioned__month AS ds_partitioned__month
+ , subq_10.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_10.ds_partitioned__year AS ds_partitioned__year
+ , subq_10.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_10.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_10.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_10.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_10.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_10.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_10.paid_at__day AS paid_at__day
+ , subq_10.paid_at__week AS paid_at__week
+ , subq_10.paid_at__month AS paid_at__month
+ , subq_10.paid_at__quarter AS paid_at__quarter
+ , subq_10.paid_at__year AS paid_at__year
+ , subq_10.paid_at__extract_year AS paid_at__extract_year
+ , subq_10.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_10.paid_at__extract_month AS paid_at__extract_month
+ , subq_10.paid_at__extract_day AS paid_at__extract_day
+ , subq_10.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_10.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_10.booking__ds__day AS booking__ds__day
+ , subq_10.booking__ds__week AS booking__ds__week
+ , subq_10.booking__ds__month AS booking__ds__month
+ , subq_10.booking__ds__quarter AS booking__ds__quarter
+ , subq_10.booking__ds__year AS booking__ds__year
+ , subq_10.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_10.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_10.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_10.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_10.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_10.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_10.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_10.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_10.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_10.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_10.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_10.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_10.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_10.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_10.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_10.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_10.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_10.booking__paid_at__day AS booking__paid_at__day
+ , subq_10.booking__paid_at__week AS booking__paid_at__week
+ , subq_10.booking__paid_at__month AS booking__paid_at__month
+ , subq_10.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_10.booking__paid_at__year AS booking__paid_at__year
+ , subq_10.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_10.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_10.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_10.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_10.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_10.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_10.metric_time__week AS metric_time__week
+ , subq_10.metric_time__month AS metric_time__month
+ , subq_10.metric_time__quarter AS metric_time__quarter
+ , subq_10.metric_time__year AS metric_time__year
+ , subq_10.metric_time__extract_year AS metric_time__extract_year
+ , subq_10.metric_time__extract_quarter AS metric_time__extract_quarter
+ , subq_10.metric_time__extract_month AS metric_time__extract_month
+ , subq_10.metric_time__extract_day AS metric_time__extract_day
+ , subq_10.metric_time__extract_dow AS metric_time__extract_dow
+ , subq_10.metric_time__extract_doy AS metric_time__extract_doy
+ , subq_10.listing AS listing
+ , subq_10.guest AS guest
+ , subq_10.host AS host
+ , subq_10.booking__listing AS booking__listing
+ , subq_10.booking__guest AS booking__guest
+ , subq_10.booking__host AS booking__host
+ , subq_10.is_instant AS is_instant
+ , subq_10.booking__is_instant AS booking__is_instant
+ , subq_10.bookings AS bookings
+ , subq_10.instant_bookings AS instant_bookings
+ , subq_10.booking_value AS booking_value
+ , subq_10.max_booking_value AS max_booking_value
+ , subq_10.min_booking_value AS min_booking_value
+ , subq_10.bookers AS bookers
+ , subq_10.average_booking_value AS average_booking_value
+ , subq_10.referred_bookings AS referred_bookings
+ , subq_10.median_booking_value AS median_booking_value
+ , subq_10.booking_value_p99 AS booking_value_p99
+ , subq_10.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_10.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_10.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_3.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_3
- ) subq_2
+ subq_12.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_12
+ ) subq_11
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
ON
(
- subq_1.metric_time__day <= subq_2.metric_time__day
+ subq_10.metric_time__day <= subq_11.metric_time__day
) AND (
- subq_1.metric_time__day > DATEADD(day, -2, subq_2.metric_time__day)
+ subq_10.metric_time__day > DATEADD(day, -2, subq_11.metric_time__day)
)
- ) subq_4
- ) subq_5
+ ) subq_13
+ ) subq_14
WHERE metric_time__day = '2020-01-03' or metric_time__day = '2020-01-07'
- ) subq_6
+ ) subq_15
GROUP BY
- subq_6.metric_time__day
-) subq_7
+ subq_15.metric_time__day
+) subq_16
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_with_non_adjustable_time_filter__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_with_non_adjustable_time_filter__plan0_optimized.sql
index aa43d7d7d6..ab8b4812ed 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_with_non_adjustable_time_filter__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_with_non_adjustable_time_filter__plan0_optimized.sql
@@ -8,18 +8,18 @@ FROM (
-- Join Self Over Time Range
-- Pass Only Elements: ['bookers', 'metric_time__day']
SELECT
- subq_11.ds AS metric_time__day
- , bookings_source_src_28001.guest_id AS bookers
- FROM ***************************.mf_time_spine subq_11
+ subq_20.ds AS metric_time__day
+ , bookings_source_src_28000.guest_id AS bookers
+ FROM ***************************.mf_time_spine subq_20
INNER JOIN
- ***************************.fct_bookings bookings_source_src_28001
+ ***************************.fct_bookings bookings_source_src_28000
ON
(
- DATE_TRUNC('day', bookings_source_src_28001.ds) <= subq_11.ds
+ DATE_TRUNC('day', bookings_source_src_28000.ds) <= subq_20.ds
) AND (
- DATE_TRUNC('day', bookings_source_src_28001.ds) > DATEADD(day, -2, subq_11.ds)
+ DATE_TRUNC('day', bookings_source_src_28000.ds) > DATEADD(day, -2, subq_20.ds)
)
-) subq_13
+) subq_22
WHERE metric_time__day = '2020-01-03' or metric_time__day = '2020-01-07'
GROUP BY
metric_time__day
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_with_time_constraint__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_with_time_constraint__plan0.sql
index 0720bd2b47..aa231c3d04 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_with_time_constraint__plan0.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_with_time_constraint__plan0.sql
@@ -1,189 +1,189 @@
-- Compute Metrics via Expressions
SELECT
- subq_8.metric_time__day
- , subq_8.txn_revenue AS trailing_2_months_revenue
+ subq_19.metric_time__day
+ , subq_19.txn_revenue AS trailing_2_months_revenue
FROM (
-- Aggregate Measures
SELECT
- subq_7.metric_time__day
- , SUM(subq_7.txn_revenue) AS txn_revenue
+ subq_18.metric_time__day
+ , SUM(subq_18.txn_revenue) AS txn_revenue
FROM (
-- Constrain Time Range to [2020-01-01T00:00:00, 2020-01-01T00:00:00]
SELECT
- subq_6.metric_time__day
- , subq_6.txn_revenue
+ subq_17.metric_time__day
+ , subq_17.txn_revenue
FROM (
-- Pass Only Elements: ['txn_revenue', 'metric_time__day']
SELECT
- subq_5.metric_time__day
- , subq_5.txn_revenue
+ subq_16.metric_time__day
+ , subq_16.txn_revenue
FROM (
-- Join Self Over Time Range
SELECT
- subq_3.metric_time__day AS metric_time__day
- , subq_2.ds__day AS ds__day
- , subq_2.ds__week AS ds__week
- , subq_2.ds__month AS ds__month
- , subq_2.ds__quarter AS ds__quarter
- , subq_2.ds__year AS ds__year
- , subq_2.ds__extract_year AS ds__extract_year
- , subq_2.ds__extract_quarter AS ds__extract_quarter
- , subq_2.ds__extract_month AS ds__extract_month
- , subq_2.ds__extract_day AS ds__extract_day
- , subq_2.ds__extract_dow AS ds__extract_dow
- , subq_2.ds__extract_doy AS ds__extract_doy
- , subq_2.revenue_instance__ds__day AS revenue_instance__ds__day
- , subq_2.revenue_instance__ds__week AS revenue_instance__ds__week
- , subq_2.revenue_instance__ds__month AS revenue_instance__ds__month
- , subq_2.revenue_instance__ds__quarter AS revenue_instance__ds__quarter
- , subq_2.revenue_instance__ds__year AS revenue_instance__ds__year
- , subq_2.revenue_instance__ds__extract_year AS revenue_instance__ds__extract_year
- , subq_2.revenue_instance__ds__extract_quarter AS revenue_instance__ds__extract_quarter
- , subq_2.revenue_instance__ds__extract_month AS revenue_instance__ds__extract_month
- , subq_2.revenue_instance__ds__extract_day AS revenue_instance__ds__extract_day
- , subq_2.revenue_instance__ds__extract_dow AS revenue_instance__ds__extract_dow
- , subq_2.revenue_instance__ds__extract_doy AS revenue_instance__ds__extract_doy
- , subq_2.metric_time__week AS metric_time__week
- , subq_2.metric_time__month AS metric_time__month
- , subq_2.metric_time__quarter AS metric_time__quarter
- , subq_2.metric_time__year AS metric_time__year
- , subq_2.metric_time__extract_year AS metric_time__extract_year
- , subq_2.metric_time__extract_quarter AS metric_time__extract_quarter
- , subq_2.metric_time__extract_month AS metric_time__extract_month
- , subq_2.metric_time__extract_day AS metric_time__extract_day
- , subq_2.metric_time__extract_dow AS metric_time__extract_dow
- , subq_2.metric_time__extract_doy AS metric_time__extract_doy
- , subq_2.user AS user
- , subq_2.revenue_instance__user AS revenue_instance__user
- , subq_2.txn_revenue AS txn_revenue
+ subq_14.metric_time__day AS metric_time__day
+ , subq_13.ds__day AS ds__day
+ , subq_13.ds__week AS ds__week
+ , subq_13.ds__month AS ds__month
+ , subq_13.ds__quarter AS ds__quarter
+ , subq_13.ds__year AS ds__year
+ , subq_13.ds__extract_year AS ds__extract_year
+ , subq_13.ds__extract_quarter AS ds__extract_quarter
+ , subq_13.ds__extract_month AS ds__extract_month
+ , subq_13.ds__extract_day AS ds__extract_day
+ , subq_13.ds__extract_dow AS ds__extract_dow
+ , subq_13.ds__extract_doy AS ds__extract_doy
+ , subq_13.revenue_instance__ds__day AS revenue_instance__ds__day
+ , subq_13.revenue_instance__ds__week AS revenue_instance__ds__week
+ , subq_13.revenue_instance__ds__month AS revenue_instance__ds__month
+ , subq_13.revenue_instance__ds__quarter AS revenue_instance__ds__quarter
+ , subq_13.revenue_instance__ds__year AS revenue_instance__ds__year
+ , subq_13.revenue_instance__ds__extract_year AS revenue_instance__ds__extract_year
+ , subq_13.revenue_instance__ds__extract_quarter AS revenue_instance__ds__extract_quarter
+ , subq_13.revenue_instance__ds__extract_month AS revenue_instance__ds__extract_month
+ , subq_13.revenue_instance__ds__extract_day AS revenue_instance__ds__extract_day
+ , subq_13.revenue_instance__ds__extract_dow AS revenue_instance__ds__extract_dow
+ , subq_13.revenue_instance__ds__extract_doy AS revenue_instance__ds__extract_doy
+ , subq_13.metric_time__week AS metric_time__week
+ , subq_13.metric_time__month AS metric_time__month
+ , subq_13.metric_time__quarter AS metric_time__quarter
+ , subq_13.metric_time__year AS metric_time__year
+ , subq_13.metric_time__extract_year AS metric_time__extract_year
+ , subq_13.metric_time__extract_quarter AS metric_time__extract_quarter
+ , subq_13.metric_time__extract_month AS metric_time__extract_month
+ , subq_13.metric_time__extract_day AS metric_time__extract_day
+ , subq_13.metric_time__extract_dow AS metric_time__extract_dow
+ , subq_13.metric_time__extract_doy AS metric_time__extract_doy
+ , subq_13.user AS user
+ , subq_13.revenue_instance__user AS revenue_instance__user
+ , subq_13.txn_revenue AS txn_revenue
FROM (
-- Time Spine
SELECT
- subq_4.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_4
- WHERE subq_4.ds BETWEEN '2020-01-01' AND '2020-01-01'
- ) subq_3
+ subq_15.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_15
+ WHERE subq_15.ds BETWEEN '2020-01-01' AND '2020-01-01'
+ ) subq_14
INNER JOIN (
-- Constrain Time Range to [2019-11-01T00:00:00, 2020-01-01T00:00:00]
SELECT
- subq_1.ds__day
- , subq_1.ds__week
- , subq_1.ds__month
- , subq_1.ds__quarter
- , subq_1.ds__year
- , subq_1.ds__extract_year
- , subq_1.ds__extract_quarter
- , subq_1.ds__extract_month
- , subq_1.ds__extract_day
- , subq_1.ds__extract_dow
- , subq_1.ds__extract_doy
- , subq_1.revenue_instance__ds__day
- , subq_1.revenue_instance__ds__week
- , subq_1.revenue_instance__ds__month
- , subq_1.revenue_instance__ds__quarter
- , subq_1.revenue_instance__ds__year
- , subq_1.revenue_instance__ds__extract_year
- , subq_1.revenue_instance__ds__extract_quarter
- , subq_1.revenue_instance__ds__extract_month
- , subq_1.revenue_instance__ds__extract_day
- , subq_1.revenue_instance__ds__extract_dow
- , subq_1.revenue_instance__ds__extract_doy
- , subq_1.metric_time__day
- , subq_1.metric_time__week
- , subq_1.metric_time__month
- , subq_1.metric_time__quarter
- , subq_1.metric_time__year
- , subq_1.metric_time__extract_year
- , subq_1.metric_time__extract_quarter
- , subq_1.metric_time__extract_month
- , subq_1.metric_time__extract_day
- , subq_1.metric_time__extract_dow
- , subq_1.metric_time__extract_doy
- , subq_1.user
- , subq_1.revenue_instance__user
- , subq_1.txn_revenue
+ subq_12.ds__day
+ , subq_12.ds__week
+ , subq_12.ds__month
+ , subq_12.ds__quarter
+ , subq_12.ds__year
+ , subq_12.ds__extract_year
+ , subq_12.ds__extract_quarter
+ , subq_12.ds__extract_month
+ , subq_12.ds__extract_day
+ , subq_12.ds__extract_dow
+ , subq_12.ds__extract_doy
+ , subq_12.revenue_instance__ds__day
+ , subq_12.revenue_instance__ds__week
+ , subq_12.revenue_instance__ds__month
+ , subq_12.revenue_instance__ds__quarter
+ , subq_12.revenue_instance__ds__year
+ , subq_12.revenue_instance__ds__extract_year
+ , subq_12.revenue_instance__ds__extract_quarter
+ , subq_12.revenue_instance__ds__extract_month
+ , subq_12.revenue_instance__ds__extract_day
+ , subq_12.revenue_instance__ds__extract_dow
+ , subq_12.revenue_instance__ds__extract_doy
+ , subq_12.metric_time__day
+ , subq_12.metric_time__week
+ , subq_12.metric_time__month
+ , subq_12.metric_time__quarter
+ , subq_12.metric_time__year
+ , subq_12.metric_time__extract_year
+ , subq_12.metric_time__extract_quarter
+ , subq_12.metric_time__extract_month
+ , subq_12.metric_time__extract_day
+ , subq_12.metric_time__extract_dow
+ , subq_12.metric_time__extract_doy
+ , subq_12.user
+ , subq_12.revenue_instance__user
+ , subq_12.txn_revenue
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.revenue_instance__ds__day
- , subq_0.revenue_instance__ds__week
- , subq_0.revenue_instance__ds__month
- , subq_0.revenue_instance__ds__quarter
- , subq_0.revenue_instance__ds__year
- , subq_0.revenue_instance__ds__extract_year
- , subq_0.revenue_instance__ds__extract_quarter
- , subq_0.revenue_instance__ds__extract_month
- , subq_0.revenue_instance__ds__extract_day
- , subq_0.revenue_instance__ds__extract_dow
- , subq_0.revenue_instance__ds__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.user
- , subq_0.revenue_instance__user
- , subq_0.txn_revenue
+ subq_11.ds__day
+ , subq_11.ds__week
+ , subq_11.ds__month
+ , subq_11.ds__quarter
+ , subq_11.ds__year
+ , subq_11.ds__extract_year
+ , subq_11.ds__extract_quarter
+ , subq_11.ds__extract_month
+ , subq_11.ds__extract_day
+ , subq_11.ds__extract_dow
+ , subq_11.ds__extract_doy
+ , subq_11.revenue_instance__ds__day
+ , subq_11.revenue_instance__ds__week
+ , subq_11.revenue_instance__ds__month
+ , subq_11.revenue_instance__ds__quarter
+ , subq_11.revenue_instance__ds__year
+ , subq_11.revenue_instance__ds__extract_year
+ , subq_11.revenue_instance__ds__extract_quarter
+ , subq_11.revenue_instance__ds__extract_month
+ , subq_11.revenue_instance__ds__extract_day
+ , subq_11.revenue_instance__ds__extract_dow
+ , subq_11.revenue_instance__ds__extract_doy
+ , subq_11.ds__day AS metric_time__day
+ , subq_11.ds__week AS metric_time__week
+ , subq_11.ds__month AS metric_time__month
+ , subq_11.ds__quarter AS metric_time__quarter
+ , subq_11.ds__year AS metric_time__year
+ , subq_11.ds__extract_year AS metric_time__extract_year
+ , subq_11.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_11.ds__extract_month AS metric_time__extract_month
+ , subq_11.ds__extract_day AS metric_time__extract_day
+ , subq_11.ds__extract_dow AS metric_time__extract_dow
+ , subq_11.ds__extract_doy AS metric_time__extract_doy
+ , subq_11.user
+ , subq_11.revenue_instance__user
+ , subq_11.txn_revenue
FROM (
-- Read Elements From Semantic Model 'revenue'
SELECT
- revenue_src_28007.revenue AS txn_revenue
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day
- , EXTRACT(dayofweekiso FROM revenue_src_28007.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day
- , EXTRACT(dayofweekiso FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy
- , revenue_src_28007.user_id AS user
- , revenue_src_28007.user_id AS revenue_instance__user
- FROM ***************************.fct_revenue revenue_src_28007
- ) subq_0
- ) subq_1
- WHERE subq_1.metric_time__day BETWEEN '2019-11-01' AND '2020-01-01'
- ) subq_2
+ revenue_src_28000.revenue AS txn_revenue
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , EXTRACT(dayofweekiso FROM revenue_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS revenue_instance__ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS revenue_instance__ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS revenue_instance__ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS revenue_instance__ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , EXTRACT(day FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_day
+ , EXTRACT(dayofweekiso FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_doy
+ , revenue_src_28000.user_id AS user
+ , revenue_src_28000.user_id AS revenue_instance__user
+ FROM ***************************.fct_revenue revenue_src_28000
+ ) subq_11
+ ) subq_12
+ WHERE subq_12.metric_time__day BETWEEN '2019-11-01' AND '2020-01-01'
+ ) subq_13
ON
(
- subq_2.metric_time__day <= subq_3.metric_time__day
+ subq_13.metric_time__day <= subq_14.metric_time__day
) AND (
- subq_2.metric_time__day > DATEADD(month, -2, subq_3.metric_time__day)
+ subq_13.metric_time__day > DATEADD(month, -2, subq_14.metric_time__day)
)
- ) subq_5
- ) subq_6
- WHERE subq_6.metric_time__day BETWEEN '2020-01-01' AND '2020-01-01'
- ) subq_7
+ ) subq_16
+ ) subq_17
+ WHERE subq_17.metric_time__day BETWEEN '2020-01-01' AND '2020-01-01'
+ ) subq_18
GROUP BY
- subq_7.metric_time__day
-) subq_8
+ subq_18.metric_time__day
+) subq_19
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_with_time_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_with_time_constraint__plan0_optimized.sql
index 06ea3f5a91..bb3417f1ce 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_with_time_constraint__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Snowflake/test_cumulative_metric_with_time_constraint__plan0_optimized.sql
@@ -4,15 +4,15 @@
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_12.metric_time__day AS metric_time__day
- , SUM(subq_11.txn_revenue) AS trailing_2_months_revenue
+ subq_23.metric_time__day AS metric_time__day
+ , SUM(subq_22.txn_revenue) AS trailing_2_months_revenue
FROM (
-- Time Spine
SELECT
ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_13
+ FROM ***************************.mf_time_spine subq_24
WHERE ds BETWEEN '2020-01-01' AND '2020-01-01'
-) subq_12
+) subq_23
INNER JOIN (
-- Read Elements From Semantic Model 'revenue'
-- Metric Time Dimension 'ds'
@@ -20,15 +20,15 @@ INNER JOIN (
SELECT
DATE_TRUNC('day', created_at) AS metric_time__day
, revenue AS txn_revenue
- FROM ***************************.fct_revenue revenue_src_28007
+ FROM ***************************.fct_revenue revenue_src_28000
WHERE DATE_TRUNC('day', created_at) BETWEEN '2019-11-01' AND '2020-01-01'
-) subq_11
+) subq_22
ON
(
- subq_11.metric_time__day <= subq_12.metric_time__day
+ subq_22.metric_time__day <= subq_23.metric_time__day
) AND (
- subq_11.metric_time__day > DATEADD(month, -2, subq_12.metric_time__day)
+ subq_22.metric_time__day > DATEADD(month, -2, subq_23.metric_time__day)
)
-WHERE subq_12.metric_time__day BETWEEN '2020-01-01' AND '2020-01-01'
+WHERE subq_23.metric_time__day BETWEEN '2020-01-01' AND '2020-01-01'
GROUP BY
- subq_12.metric_time__day
+ subq_23.metric_time__day
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric__plan0.sql
index 8b87e57774..ccda7dabbc 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric__plan0.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric__plan0.sql
@@ -1,88 +1,88 @@
-- Compute Metrics via Expressions
SELECT
- subq_3.ds__day
- , subq_3.txn_revenue AS trailing_2_months_revenue
+ subq_12.ds__day
+ , subq_12.txn_revenue AS trailing_2_months_revenue
FROM (
-- Aggregate Measures
SELECT
- subq_2.ds__day
- , SUM(subq_2.txn_revenue) AS txn_revenue
+ subq_11.ds__day
+ , SUM(subq_11.txn_revenue) AS txn_revenue
FROM (
-- Pass Only Elements: ['txn_revenue', 'ds__day']
SELECT
- subq_1.ds__day
- , subq_1.txn_revenue
+ subq_10.ds__day
+ , subq_10.txn_revenue
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.revenue_instance__ds__day
- , subq_0.revenue_instance__ds__week
- , subq_0.revenue_instance__ds__month
- , subq_0.revenue_instance__ds__quarter
- , subq_0.revenue_instance__ds__year
- , subq_0.revenue_instance__ds__extract_year
- , subq_0.revenue_instance__ds__extract_quarter
- , subq_0.revenue_instance__ds__extract_month
- , subq_0.revenue_instance__ds__extract_day
- , subq_0.revenue_instance__ds__extract_dow
- , subq_0.revenue_instance__ds__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.user
- , subq_0.revenue_instance__user
- , subq_0.txn_revenue
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.revenue_instance__ds__day
+ , subq_9.revenue_instance__ds__week
+ , subq_9.revenue_instance__ds__month
+ , subq_9.revenue_instance__ds__quarter
+ , subq_9.revenue_instance__ds__year
+ , subq_9.revenue_instance__ds__extract_year
+ , subq_9.revenue_instance__ds__extract_quarter
+ , subq_9.revenue_instance__ds__extract_month
+ , subq_9.revenue_instance__ds__extract_day
+ , subq_9.revenue_instance__ds__extract_dow
+ , subq_9.revenue_instance__ds__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.user
+ , subq_9.revenue_instance__user
+ , subq_9.txn_revenue
FROM (
-- Read Elements From Semantic Model 'revenue'
SELECT
- revenue_src_28007.revenue AS txn_revenue
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM revenue_src_28007.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy
- , revenue_src_28007.user_id AS user
- , revenue_src_28007.user_id AS revenue_instance__user
- FROM ***************************.fct_revenue revenue_src_28007
- ) subq_0
- ) subq_1
- ) subq_2
+ revenue_src_28000.revenue AS txn_revenue
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , EXTRACT(DAY_OF_WEEK FROM revenue_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS revenue_instance__ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS revenue_instance__ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS revenue_instance__ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS revenue_instance__ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , EXTRACT(day FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_doy
+ , revenue_src_28000.user_id AS user
+ , revenue_src_28000.user_id AS revenue_instance__user
+ FROM ***************************.fct_revenue revenue_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
GROUP BY
- subq_2.ds__day
-) subq_3
+ subq_11.ds__day
+) subq_12
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric__plan0_optimized.sql
index 749250c230..76e8f3252a 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric__plan0_optimized.sql
@@ -6,6 +6,6 @@
SELECT
DATE_TRUNC('day', created_at) AS ds__day
, SUM(revenue) AS trailing_2_months_revenue
-FROM ***************************.fct_revenue revenue_src_28007
+FROM ***************************.fct_revenue revenue_src_28000
GROUP BY
DATE_TRUNC('day', created_at)
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_grain_to_date__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_grain_to_date__plan0.sql
index c3cdc082eb..b2a1f37b3f 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_grain_to_date__plan0.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_grain_to_date__plan0.sql
@@ -1,88 +1,88 @@
-- Compute Metrics via Expressions
SELECT
- subq_3.ds__month
- , subq_3.txn_revenue AS revenue_mtd
+ subq_12.ds__month
+ , subq_12.txn_revenue AS revenue_mtd
FROM (
-- Aggregate Measures
SELECT
- subq_2.ds__month
- , SUM(subq_2.txn_revenue) AS txn_revenue
+ subq_11.ds__month
+ , SUM(subq_11.txn_revenue) AS txn_revenue
FROM (
-- Pass Only Elements: ['txn_revenue', 'ds__month']
SELECT
- subq_1.ds__month
- , subq_1.txn_revenue
+ subq_10.ds__month
+ , subq_10.txn_revenue
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.revenue_instance__ds__day
- , subq_0.revenue_instance__ds__week
- , subq_0.revenue_instance__ds__month
- , subq_0.revenue_instance__ds__quarter
- , subq_0.revenue_instance__ds__year
- , subq_0.revenue_instance__ds__extract_year
- , subq_0.revenue_instance__ds__extract_quarter
- , subq_0.revenue_instance__ds__extract_month
- , subq_0.revenue_instance__ds__extract_day
- , subq_0.revenue_instance__ds__extract_dow
- , subq_0.revenue_instance__ds__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.user
- , subq_0.revenue_instance__user
- , subq_0.txn_revenue
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.revenue_instance__ds__day
+ , subq_9.revenue_instance__ds__week
+ , subq_9.revenue_instance__ds__month
+ , subq_9.revenue_instance__ds__quarter
+ , subq_9.revenue_instance__ds__year
+ , subq_9.revenue_instance__ds__extract_year
+ , subq_9.revenue_instance__ds__extract_quarter
+ , subq_9.revenue_instance__ds__extract_month
+ , subq_9.revenue_instance__ds__extract_day
+ , subq_9.revenue_instance__ds__extract_dow
+ , subq_9.revenue_instance__ds__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.user
+ , subq_9.revenue_instance__user
+ , subq_9.txn_revenue
FROM (
-- Read Elements From Semantic Model 'revenue'
SELECT
- revenue_src_28007.revenue AS txn_revenue
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM revenue_src_28007.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy
- , revenue_src_28007.user_id AS user
- , revenue_src_28007.user_id AS revenue_instance__user
- FROM ***************************.fct_revenue revenue_src_28007
- ) subq_0
- ) subq_1
- ) subq_2
+ revenue_src_28000.revenue AS txn_revenue
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , EXTRACT(DAY_OF_WEEK FROM revenue_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS revenue_instance__ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS revenue_instance__ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS revenue_instance__ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS revenue_instance__ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , EXTRACT(day FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_doy
+ , revenue_src_28000.user_id AS user
+ , revenue_src_28000.user_id AS revenue_instance__user
+ FROM ***************************.fct_revenue revenue_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
GROUP BY
- subq_2.ds__month
-) subq_3
+ subq_11.ds__month
+) subq_12
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_grain_to_date__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_grain_to_date__plan0_optimized.sql
index 6a6dbce8b9..e057084866 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_grain_to_date__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_grain_to_date__plan0_optimized.sql
@@ -6,6 +6,6 @@
SELECT
DATE_TRUNC('month', created_at) AS ds__month
, SUM(revenue) AS revenue_mtd
-FROM ***************************.fct_revenue revenue_src_28007
+FROM ***************************.fct_revenue revenue_src_28000
GROUP BY
DATE_TRUNC('month', created_at)
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_month__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_month__plan0.sql
index 8423ed8494..cab7f99b7f 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_month__plan0.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_month__plan0.sql
@@ -1,103 +1,103 @@
-- Compute Metrics via Expressions
SELECT
- subq_8.metric_time__month
- , subq_8.bookings_monthly AS trailing_3_months_bookings
+ subq_12.metric_time__month
+ , subq_12.bookings_monthly AS trailing_3_months_bookings
FROM (
-- Aggregate Measures
SELECT
- subq_7.metric_time__month
- , SUM(subq_7.bookings_monthly) AS bookings_monthly
+ subq_11.metric_time__month
+ , SUM(subq_11.bookings_monthly) AS bookings_monthly
FROM (
-- Constrain Time Range to [2020-03-05T00:00:00, 2021-01-04T00:00:00]
SELECT
- subq_6.metric_time__month
- , subq_6.bookings_monthly
+ subq_10.metric_time__month
+ , subq_10.bookings_monthly
FROM (
-- Pass Only Elements: ['bookings_monthly', 'metric_time__month']
SELECT
- subq_5.metric_time__month
- , subq_5.bookings_monthly
+ subq_9.metric_time__month
+ , subq_9.bookings_monthly
FROM (
-- Join Self Over Time Range
SELECT
- subq_3.metric_time__month AS metric_time__month
- , subq_2.monthly_ds__month AS monthly_ds__month
- , subq_2.monthly_ds__quarter AS monthly_ds__quarter
- , subq_2.monthly_ds__year AS monthly_ds__year
- , subq_2.monthly_ds__extract_year AS monthly_ds__extract_year
- , subq_2.monthly_ds__extract_quarter AS monthly_ds__extract_quarter
- , subq_2.monthly_ds__extract_month AS monthly_ds__extract_month
- , subq_2.booking__monthly_ds__month AS booking__monthly_ds__month
- , subq_2.booking__monthly_ds__quarter AS booking__monthly_ds__quarter
- , subq_2.booking__monthly_ds__year AS booking__monthly_ds__year
- , subq_2.booking__monthly_ds__extract_year AS booking__monthly_ds__extract_year
- , subq_2.booking__monthly_ds__extract_quarter AS booking__monthly_ds__extract_quarter
- , subq_2.booking__monthly_ds__extract_month AS booking__monthly_ds__extract_month
- , subq_2.metric_time__quarter AS metric_time__quarter
- , subq_2.metric_time__year AS metric_time__year
- , subq_2.metric_time__extract_year AS metric_time__extract_year
- , subq_2.metric_time__extract_quarter AS metric_time__extract_quarter
- , subq_2.metric_time__extract_month AS metric_time__extract_month
- , subq_2.listing AS listing
- , subq_2.booking__listing AS booking__listing
- , subq_2.bookings_monthly AS bookings_monthly
+ subq_7.metric_time__month AS metric_time__month
+ , subq_6.monthly_ds__month AS monthly_ds__month
+ , subq_6.monthly_ds__quarter AS monthly_ds__quarter
+ , subq_6.monthly_ds__year AS monthly_ds__year
+ , subq_6.monthly_ds__extract_year AS monthly_ds__extract_year
+ , subq_6.monthly_ds__extract_quarter AS monthly_ds__extract_quarter
+ , subq_6.monthly_ds__extract_month AS monthly_ds__extract_month
+ , subq_6.booking__monthly_ds__month AS booking__monthly_ds__month
+ , subq_6.booking__monthly_ds__quarter AS booking__monthly_ds__quarter
+ , subq_6.booking__monthly_ds__year AS booking__monthly_ds__year
+ , subq_6.booking__monthly_ds__extract_year AS booking__monthly_ds__extract_year
+ , subq_6.booking__monthly_ds__extract_quarter AS booking__monthly_ds__extract_quarter
+ , subq_6.booking__monthly_ds__extract_month AS booking__monthly_ds__extract_month
+ , subq_6.metric_time__quarter AS metric_time__quarter
+ , subq_6.metric_time__year AS metric_time__year
+ , subq_6.metric_time__extract_year AS metric_time__extract_year
+ , subq_6.metric_time__extract_quarter AS metric_time__extract_quarter
+ , subq_6.metric_time__extract_month AS metric_time__extract_month
+ , subq_6.listing AS listing
+ , subq_6.booking__listing AS booking__listing
+ , subq_6.bookings_monthly AS bookings_monthly
FROM (
-- Time Spine
SELECT
- DATE_TRUNC('month', subq_4.ds) AS metric_time__month
- FROM ***************************.mf_time_spine subq_4
- WHERE subq_4.ds BETWEEN timestamp '2020-03-05' AND timestamp '2021-01-04'
+ DATE_TRUNC('month', subq_8.ds) AS metric_time__month
+ FROM ***************************.mf_time_spine subq_8
+ WHERE subq_8.ds BETWEEN timestamp '2020-03-05' AND timestamp '2021-01-04'
GROUP BY
- DATE_TRUNC('month', subq_4.ds)
- ) subq_3
+ DATE_TRUNC('month', subq_8.ds)
+ ) subq_7
INNER JOIN (
-- Constrain Time Range to [2019-12-05T00:00:00, 2021-01-04T00:00:00]
SELECT
- subq_1.monthly_ds__month
- , subq_1.monthly_ds__quarter
- , subq_1.monthly_ds__year
- , subq_1.monthly_ds__extract_year
- , subq_1.monthly_ds__extract_quarter
- , subq_1.monthly_ds__extract_month
- , subq_1.booking__monthly_ds__month
- , subq_1.booking__monthly_ds__quarter
- , subq_1.booking__monthly_ds__year
- , subq_1.booking__monthly_ds__extract_year
- , subq_1.booking__monthly_ds__extract_quarter
- , subq_1.booking__monthly_ds__extract_month
- , subq_1.metric_time__month
- , subq_1.metric_time__quarter
- , subq_1.metric_time__year
- , subq_1.metric_time__extract_year
- , subq_1.metric_time__extract_quarter
- , subq_1.metric_time__extract_month
- , subq_1.listing
- , subq_1.booking__listing
- , subq_1.bookings_monthly
+ subq_5.monthly_ds__month
+ , subq_5.monthly_ds__quarter
+ , subq_5.monthly_ds__year
+ , subq_5.monthly_ds__extract_year
+ , subq_5.monthly_ds__extract_quarter
+ , subq_5.monthly_ds__extract_month
+ , subq_5.booking__monthly_ds__month
+ , subq_5.booking__monthly_ds__quarter
+ , subq_5.booking__monthly_ds__year
+ , subq_5.booking__monthly_ds__extract_year
+ , subq_5.booking__monthly_ds__extract_quarter
+ , subq_5.booking__monthly_ds__extract_month
+ , subq_5.metric_time__month
+ , subq_5.metric_time__quarter
+ , subq_5.metric_time__year
+ , subq_5.metric_time__extract_year
+ , subq_5.metric_time__extract_quarter
+ , subq_5.metric_time__extract_month
+ , subq_5.listing
+ , subq_5.booking__listing
+ , subq_5.bookings_monthly
FROM (
-- Metric Time Dimension 'monthly_ds'
SELECT
- subq_0.monthly_ds__month
- , subq_0.monthly_ds__quarter
- , subq_0.monthly_ds__year
- , subq_0.monthly_ds__extract_year
- , subq_0.monthly_ds__extract_quarter
- , subq_0.monthly_ds__extract_month
- , subq_0.booking__monthly_ds__month
- , subq_0.booking__monthly_ds__quarter
- , subq_0.booking__monthly_ds__year
- , subq_0.booking__monthly_ds__extract_year
- , subq_0.booking__monthly_ds__extract_quarter
- , subq_0.booking__monthly_ds__extract_month
- , subq_0.monthly_ds__month AS metric_time__month
- , subq_0.monthly_ds__quarter AS metric_time__quarter
- , subq_0.monthly_ds__year AS metric_time__year
- , subq_0.monthly_ds__extract_year AS metric_time__extract_year
- , subq_0.monthly_ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.monthly_ds__extract_month AS metric_time__extract_month
- , subq_0.listing
- , subq_0.booking__listing
- , subq_0.bookings_monthly
+ subq_4.monthly_ds__month
+ , subq_4.monthly_ds__quarter
+ , subq_4.monthly_ds__year
+ , subq_4.monthly_ds__extract_year
+ , subq_4.monthly_ds__extract_quarter
+ , subq_4.monthly_ds__extract_month
+ , subq_4.booking__monthly_ds__month
+ , subq_4.booking__monthly_ds__quarter
+ , subq_4.booking__monthly_ds__year
+ , subq_4.booking__monthly_ds__extract_year
+ , subq_4.booking__monthly_ds__extract_quarter
+ , subq_4.booking__monthly_ds__extract_month
+ , subq_4.monthly_ds__month AS metric_time__month
+ , subq_4.monthly_ds__quarter AS metric_time__quarter
+ , subq_4.monthly_ds__year AS metric_time__year
+ , subq_4.monthly_ds__extract_year AS metric_time__extract_year
+ , subq_4.monthly_ds__extract_quarter AS metric_time__extract_quarter
+ , subq_4.monthly_ds__extract_month AS metric_time__extract_month
+ , subq_4.listing
+ , subq_4.booking__listing
+ , subq_4.bookings_monthly
FROM (
-- Read Elements From Semantic Model 'bookings_monthly_source'
SELECT
@@ -117,20 +117,20 @@ FROM (
, bookings_monthly_source_src_16000.listing_id AS listing
, bookings_monthly_source_src_16000.listing_id AS booking__listing
FROM ***************************.fct_bookings_extended_monthly bookings_monthly_source_src_16000
- ) subq_0
- ) subq_1
- WHERE subq_1.metric_time__month BETWEEN timestamp '2019-12-05' AND timestamp '2021-01-04'
- ) subq_2
+ ) subq_4
+ ) subq_5
+ WHERE subq_5.metric_time__month BETWEEN timestamp '2019-12-05' AND timestamp '2021-01-04'
+ ) subq_6
ON
(
- subq_2.metric_time__month <= subq_3.metric_time__month
+ subq_6.metric_time__month <= subq_7.metric_time__month
) AND (
- subq_2.metric_time__month > DATE_ADD('month', -3, subq_3.metric_time__month)
+ subq_6.metric_time__month > DATE_ADD('month', -3, subq_7.metric_time__month)
)
- ) subq_5
- ) subq_6
- WHERE subq_6.metric_time__month BETWEEN timestamp '2020-03-05' AND timestamp '2021-01-04'
- ) subq_7
+ ) subq_9
+ ) subq_10
+ WHERE subq_10.metric_time__month BETWEEN timestamp '2020-03-05' AND timestamp '2021-01-04'
+ ) subq_11
GROUP BY
- subq_7.metric_time__month
-) subq_8
+ subq_11.metric_time__month
+) subq_12
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_month__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_month__plan0_optimized.sql
index edd17f3f71..aace0fbfd7 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_month__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_month__plan0_optimized.sql
@@ -4,17 +4,17 @@
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_12.metric_time__month AS metric_time__month
- , SUM(subq_11.bookings_monthly) AS trailing_3_months_bookings
+ subq_16.metric_time__month AS metric_time__month
+ , SUM(subq_15.bookings_monthly) AS trailing_3_months_bookings
FROM (
-- Time Spine
SELECT
DATE_TRUNC('month', ds) AS metric_time__month
- FROM ***************************.mf_time_spine subq_13
+ FROM ***************************.mf_time_spine subq_17
WHERE ds BETWEEN timestamp '2020-03-05' AND timestamp '2021-01-04'
GROUP BY
DATE_TRUNC('month', ds)
-) subq_12
+) subq_16
INNER JOIN (
-- Read Elements From Semantic Model 'bookings_monthly_source'
-- Metric Time Dimension 'monthly_ds'
@@ -24,13 +24,13 @@ INNER JOIN (
, bookings_monthly
FROM ***************************.fct_bookings_extended_monthly bookings_monthly_source_src_16000
WHERE DATE_TRUNC('month', ds) BETWEEN timestamp '2019-12-05' AND timestamp '2021-01-04'
-) subq_11
+) subq_15
ON
(
- subq_11.metric_time__month <= subq_12.metric_time__month
+ subq_15.metric_time__month <= subq_16.metric_time__month
) AND (
- subq_11.metric_time__month > DATE_ADD('month', -3, subq_12.metric_time__month)
+ subq_15.metric_time__month > DATE_ADD('month', -3, subq_16.metric_time__month)
)
-WHERE subq_12.metric_time__month BETWEEN timestamp '2020-03-05' AND timestamp '2021-01-04'
+WHERE subq_16.metric_time__month BETWEEN timestamp '2020-03-05' AND timestamp '2021-01-04'
GROUP BY
- subq_12.metric_time__month
+ subq_16.metric_time__month
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_no_ds__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_no_ds__plan0.sql
index e38d3d81a3..6beb28db7a 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_no_ds__plan0.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_no_ds__plan0.sql
@@ -1,83 +1,83 @@
-- Compute Metrics via Expressions
SELECT
- subq_3.txn_revenue AS trailing_2_months_revenue
+ subq_12.txn_revenue AS trailing_2_months_revenue
FROM (
-- Aggregate Measures
SELECT
- SUM(subq_2.txn_revenue) AS txn_revenue
+ SUM(subq_11.txn_revenue) AS txn_revenue
FROM (
-- Pass Only Elements: ['txn_revenue',]
SELECT
- subq_1.txn_revenue
+ subq_10.txn_revenue
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.revenue_instance__ds__day
- , subq_0.revenue_instance__ds__week
- , subq_0.revenue_instance__ds__month
- , subq_0.revenue_instance__ds__quarter
- , subq_0.revenue_instance__ds__year
- , subq_0.revenue_instance__ds__extract_year
- , subq_0.revenue_instance__ds__extract_quarter
- , subq_0.revenue_instance__ds__extract_month
- , subq_0.revenue_instance__ds__extract_day
- , subq_0.revenue_instance__ds__extract_dow
- , subq_0.revenue_instance__ds__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.user
- , subq_0.revenue_instance__user
- , subq_0.txn_revenue
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.revenue_instance__ds__day
+ , subq_9.revenue_instance__ds__week
+ , subq_9.revenue_instance__ds__month
+ , subq_9.revenue_instance__ds__quarter
+ , subq_9.revenue_instance__ds__year
+ , subq_9.revenue_instance__ds__extract_year
+ , subq_9.revenue_instance__ds__extract_quarter
+ , subq_9.revenue_instance__ds__extract_month
+ , subq_9.revenue_instance__ds__extract_day
+ , subq_9.revenue_instance__ds__extract_dow
+ , subq_9.revenue_instance__ds__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.user
+ , subq_9.revenue_instance__user
+ , subq_9.txn_revenue
FROM (
-- Read Elements From Semantic Model 'revenue'
SELECT
- revenue_src_28007.revenue AS txn_revenue
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM revenue_src_28007.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy
- , revenue_src_28007.user_id AS user
- , revenue_src_28007.user_id AS revenue_instance__user
- FROM ***************************.fct_revenue revenue_src_28007
- ) subq_0
- ) subq_1
- ) subq_2
-) subq_3
+ revenue_src_28000.revenue AS txn_revenue
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , EXTRACT(DAY_OF_WEEK FROM revenue_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS revenue_instance__ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS revenue_instance__ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS revenue_instance__ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS revenue_instance__ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , EXTRACT(day FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_doy
+ , revenue_src_28000.user_id AS user
+ , revenue_src_28000.user_id AS revenue_instance__user
+ FROM ***************************.fct_revenue revenue_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
+) subq_12
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_no_ds__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_no_ds__plan0_optimized.sql
index e26a1bdb3d..4a0d5baff3 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_no_ds__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_no_ds__plan0_optimized.sql
@@ -5,4 +5,4 @@
-- Compute Metrics via Expressions
SELECT
SUM(revenue) AS trailing_2_months_revenue
-FROM ***************************.fct_revenue revenue_src_28007
+FROM ***************************.fct_revenue revenue_src_28000
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_no_window__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_no_window__plan0.sql
index f6c99d18f9..1b2358a291 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_no_window__plan0.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_no_window__plan0.sql
@@ -1,88 +1,88 @@
-- Compute Metrics via Expressions
SELECT
- subq_3.ds__month
- , subq_3.txn_revenue AS revenue_all_time
+ subq_12.ds__month
+ , subq_12.txn_revenue AS revenue_all_time
FROM (
-- Aggregate Measures
SELECT
- subq_2.ds__month
- , SUM(subq_2.txn_revenue) AS txn_revenue
+ subq_11.ds__month
+ , SUM(subq_11.txn_revenue) AS txn_revenue
FROM (
-- Pass Only Elements: ['txn_revenue', 'ds__month']
SELECT
- subq_1.ds__month
- , subq_1.txn_revenue
+ subq_10.ds__month
+ , subq_10.txn_revenue
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.revenue_instance__ds__day
- , subq_0.revenue_instance__ds__week
- , subq_0.revenue_instance__ds__month
- , subq_0.revenue_instance__ds__quarter
- , subq_0.revenue_instance__ds__year
- , subq_0.revenue_instance__ds__extract_year
- , subq_0.revenue_instance__ds__extract_quarter
- , subq_0.revenue_instance__ds__extract_month
- , subq_0.revenue_instance__ds__extract_day
- , subq_0.revenue_instance__ds__extract_dow
- , subq_0.revenue_instance__ds__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.user
- , subq_0.revenue_instance__user
- , subq_0.txn_revenue
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.revenue_instance__ds__day
+ , subq_9.revenue_instance__ds__week
+ , subq_9.revenue_instance__ds__month
+ , subq_9.revenue_instance__ds__quarter
+ , subq_9.revenue_instance__ds__year
+ , subq_9.revenue_instance__ds__extract_year
+ , subq_9.revenue_instance__ds__extract_quarter
+ , subq_9.revenue_instance__ds__extract_month
+ , subq_9.revenue_instance__ds__extract_day
+ , subq_9.revenue_instance__ds__extract_dow
+ , subq_9.revenue_instance__ds__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.user
+ , subq_9.revenue_instance__user
+ , subq_9.txn_revenue
FROM (
-- Read Elements From Semantic Model 'revenue'
SELECT
- revenue_src_28007.revenue AS txn_revenue
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM revenue_src_28007.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy
- , revenue_src_28007.user_id AS user
- , revenue_src_28007.user_id AS revenue_instance__user
- FROM ***************************.fct_revenue revenue_src_28007
- ) subq_0
- ) subq_1
- ) subq_2
+ revenue_src_28000.revenue AS txn_revenue
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , EXTRACT(DAY_OF_WEEK FROM revenue_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS revenue_instance__ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS revenue_instance__ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS revenue_instance__ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS revenue_instance__ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , EXTRACT(day FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_doy
+ , revenue_src_28000.user_id AS user
+ , revenue_src_28000.user_id AS revenue_instance__user
+ FROM ***************************.fct_revenue revenue_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
GROUP BY
- subq_2.ds__month
-) subq_3
+ subq_11.ds__month
+) subq_12
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_no_window__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_no_window__plan0_optimized.sql
index a7ca78d4e5..05e48cdae3 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_no_window__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_no_window__plan0_optimized.sql
@@ -6,6 +6,6 @@
SELECT
DATE_TRUNC('month', created_at) AS ds__month
, SUM(revenue) AS revenue_all_time
-FROM ***************************.fct_revenue revenue_src_28007
+FROM ***************************.fct_revenue revenue_src_28000
GROUP BY
DATE_TRUNC('month', created_at)
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_no_window_with_time_constraint__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_no_window_with_time_constraint__plan0.sql
index 6e4cc27833..57d268ed29 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_no_window_with_time_constraint__plan0.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_no_window_with_time_constraint__plan0.sql
@@ -1,187 +1,187 @@
-- Compute Metrics via Expressions
SELECT
- subq_8.metric_time__month
- , subq_8.txn_revenue AS revenue_all_time
+ subq_19.metric_time__month
+ , subq_19.txn_revenue AS revenue_all_time
FROM (
-- Aggregate Measures
SELECT
- subq_7.metric_time__month
- , SUM(subq_7.txn_revenue) AS txn_revenue
+ subq_18.metric_time__month
+ , SUM(subq_18.txn_revenue) AS txn_revenue
FROM (
-- Constrain Time Range to [2020-01-01T00:00:00, 2020-01-01T00:00:00]
SELECT
- subq_6.metric_time__month
- , subq_6.txn_revenue
+ subq_17.metric_time__month
+ , subq_17.txn_revenue
FROM (
-- Pass Only Elements: ['txn_revenue', 'metric_time__month']
SELECT
- subq_5.metric_time__month
- , subq_5.txn_revenue
+ subq_16.metric_time__month
+ , subq_16.txn_revenue
FROM (
-- Join Self Over Time Range
SELECT
- subq_3.metric_time__month AS metric_time__month
- , subq_2.ds__day AS ds__day
- , subq_2.ds__week AS ds__week
- , subq_2.ds__month AS ds__month
- , subq_2.ds__quarter AS ds__quarter
- , subq_2.ds__year AS ds__year
- , subq_2.ds__extract_year AS ds__extract_year
- , subq_2.ds__extract_quarter AS ds__extract_quarter
- , subq_2.ds__extract_month AS ds__extract_month
- , subq_2.ds__extract_day AS ds__extract_day
- , subq_2.ds__extract_dow AS ds__extract_dow
- , subq_2.ds__extract_doy AS ds__extract_doy
- , subq_2.revenue_instance__ds__day AS revenue_instance__ds__day
- , subq_2.revenue_instance__ds__week AS revenue_instance__ds__week
- , subq_2.revenue_instance__ds__month AS revenue_instance__ds__month
- , subq_2.revenue_instance__ds__quarter AS revenue_instance__ds__quarter
- , subq_2.revenue_instance__ds__year AS revenue_instance__ds__year
- , subq_2.revenue_instance__ds__extract_year AS revenue_instance__ds__extract_year
- , subq_2.revenue_instance__ds__extract_quarter AS revenue_instance__ds__extract_quarter
- , subq_2.revenue_instance__ds__extract_month AS revenue_instance__ds__extract_month
- , subq_2.revenue_instance__ds__extract_day AS revenue_instance__ds__extract_day
- , subq_2.revenue_instance__ds__extract_dow AS revenue_instance__ds__extract_dow
- , subq_2.revenue_instance__ds__extract_doy AS revenue_instance__ds__extract_doy
- , subq_2.metric_time__day AS metric_time__day
- , subq_2.metric_time__week AS metric_time__week
- , subq_2.metric_time__quarter AS metric_time__quarter
- , subq_2.metric_time__year AS metric_time__year
- , subq_2.metric_time__extract_year AS metric_time__extract_year
- , subq_2.metric_time__extract_quarter AS metric_time__extract_quarter
- , subq_2.metric_time__extract_month AS metric_time__extract_month
- , subq_2.metric_time__extract_day AS metric_time__extract_day
- , subq_2.metric_time__extract_dow AS metric_time__extract_dow
- , subq_2.metric_time__extract_doy AS metric_time__extract_doy
- , subq_2.user AS user
- , subq_2.revenue_instance__user AS revenue_instance__user
- , subq_2.txn_revenue AS txn_revenue
+ subq_14.metric_time__month AS metric_time__month
+ , subq_13.ds__day AS ds__day
+ , subq_13.ds__week AS ds__week
+ , subq_13.ds__month AS ds__month
+ , subq_13.ds__quarter AS ds__quarter
+ , subq_13.ds__year AS ds__year
+ , subq_13.ds__extract_year AS ds__extract_year
+ , subq_13.ds__extract_quarter AS ds__extract_quarter
+ , subq_13.ds__extract_month AS ds__extract_month
+ , subq_13.ds__extract_day AS ds__extract_day
+ , subq_13.ds__extract_dow AS ds__extract_dow
+ , subq_13.ds__extract_doy AS ds__extract_doy
+ , subq_13.revenue_instance__ds__day AS revenue_instance__ds__day
+ , subq_13.revenue_instance__ds__week AS revenue_instance__ds__week
+ , subq_13.revenue_instance__ds__month AS revenue_instance__ds__month
+ , subq_13.revenue_instance__ds__quarter AS revenue_instance__ds__quarter
+ , subq_13.revenue_instance__ds__year AS revenue_instance__ds__year
+ , subq_13.revenue_instance__ds__extract_year AS revenue_instance__ds__extract_year
+ , subq_13.revenue_instance__ds__extract_quarter AS revenue_instance__ds__extract_quarter
+ , subq_13.revenue_instance__ds__extract_month AS revenue_instance__ds__extract_month
+ , subq_13.revenue_instance__ds__extract_day AS revenue_instance__ds__extract_day
+ , subq_13.revenue_instance__ds__extract_dow AS revenue_instance__ds__extract_dow
+ , subq_13.revenue_instance__ds__extract_doy AS revenue_instance__ds__extract_doy
+ , subq_13.metric_time__day AS metric_time__day
+ , subq_13.metric_time__week AS metric_time__week
+ , subq_13.metric_time__quarter AS metric_time__quarter
+ , subq_13.metric_time__year AS metric_time__year
+ , subq_13.metric_time__extract_year AS metric_time__extract_year
+ , subq_13.metric_time__extract_quarter AS metric_time__extract_quarter
+ , subq_13.metric_time__extract_month AS metric_time__extract_month
+ , subq_13.metric_time__extract_day AS metric_time__extract_day
+ , subq_13.metric_time__extract_dow AS metric_time__extract_dow
+ , subq_13.metric_time__extract_doy AS metric_time__extract_doy
+ , subq_13.user AS user
+ , subq_13.revenue_instance__user AS revenue_instance__user
+ , subq_13.txn_revenue AS txn_revenue
FROM (
-- Time Spine
SELECT
- DATE_TRUNC('month', subq_4.ds) AS metric_time__month
- FROM ***************************.mf_time_spine subq_4
- WHERE subq_4.ds BETWEEN timestamp '2020-01-01' AND timestamp '2020-01-01'
+ DATE_TRUNC('month', subq_15.ds) AS metric_time__month
+ FROM ***************************.mf_time_spine subq_15
+ WHERE subq_15.ds BETWEEN timestamp '2020-01-01' AND timestamp '2020-01-01'
GROUP BY
- DATE_TRUNC('month', subq_4.ds)
- ) subq_3
+ DATE_TRUNC('month', subq_15.ds)
+ ) subq_14
INNER JOIN (
-- Constrain Time Range to [2000-01-01T00:00:00, 2020-01-01T00:00:00]
SELECT
- subq_1.ds__day
- , subq_1.ds__week
- , subq_1.ds__month
- , subq_1.ds__quarter
- , subq_1.ds__year
- , subq_1.ds__extract_year
- , subq_1.ds__extract_quarter
- , subq_1.ds__extract_month
- , subq_1.ds__extract_day
- , subq_1.ds__extract_dow
- , subq_1.ds__extract_doy
- , subq_1.revenue_instance__ds__day
- , subq_1.revenue_instance__ds__week
- , subq_1.revenue_instance__ds__month
- , subq_1.revenue_instance__ds__quarter
- , subq_1.revenue_instance__ds__year
- , subq_1.revenue_instance__ds__extract_year
- , subq_1.revenue_instance__ds__extract_quarter
- , subq_1.revenue_instance__ds__extract_month
- , subq_1.revenue_instance__ds__extract_day
- , subq_1.revenue_instance__ds__extract_dow
- , subq_1.revenue_instance__ds__extract_doy
- , subq_1.metric_time__day
- , subq_1.metric_time__week
- , subq_1.metric_time__month
- , subq_1.metric_time__quarter
- , subq_1.metric_time__year
- , subq_1.metric_time__extract_year
- , subq_1.metric_time__extract_quarter
- , subq_1.metric_time__extract_month
- , subq_1.metric_time__extract_day
- , subq_1.metric_time__extract_dow
- , subq_1.metric_time__extract_doy
- , subq_1.user
- , subq_1.revenue_instance__user
- , subq_1.txn_revenue
+ subq_12.ds__day
+ , subq_12.ds__week
+ , subq_12.ds__month
+ , subq_12.ds__quarter
+ , subq_12.ds__year
+ , subq_12.ds__extract_year
+ , subq_12.ds__extract_quarter
+ , subq_12.ds__extract_month
+ , subq_12.ds__extract_day
+ , subq_12.ds__extract_dow
+ , subq_12.ds__extract_doy
+ , subq_12.revenue_instance__ds__day
+ , subq_12.revenue_instance__ds__week
+ , subq_12.revenue_instance__ds__month
+ , subq_12.revenue_instance__ds__quarter
+ , subq_12.revenue_instance__ds__year
+ , subq_12.revenue_instance__ds__extract_year
+ , subq_12.revenue_instance__ds__extract_quarter
+ , subq_12.revenue_instance__ds__extract_month
+ , subq_12.revenue_instance__ds__extract_day
+ , subq_12.revenue_instance__ds__extract_dow
+ , subq_12.revenue_instance__ds__extract_doy
+ , subq_12.metric_time__day
+ , subq_12.metric_time__week
+ , subq_12.metric_time__month
+ , subq_12.metric_time__quarter
+ , subq_12.metric_time__year
+ , subq_12.metric_time__extract_year
+ , subq_12.metric_time__extract_quarter
+ , subq_12.metric_time__extract_month
+ , subq_12.metric_time__extract_day
+ , subq_12.metric_time__extract_dow
+ , subq_12.metric_time__extract_doy
+ , subq_12.user
+ , subq_12.revenue_instance__user
+ , subq_12.txn_revenue
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.revenue_instance__ds__day
- , subq_0.revenue_instance__ds__week
- , subq_0.revenue_instance__ds__month
- , subq_0.revenue_instance__ds__quarter
- , subq_0.revenue_instance__ds__year
- , subq_0.revenue_instance__ds__extract_year
- , subq_0.revenue_instance__ds__extract_quarter
- , subq_0.revenue_instance__ds__extract_month
- , subq_0.revenue_instance__ds__extract_day
- , subq_0.revenue_instance__ds__extract_dow
- , subq_0.revenue_instance__ds__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.user
- , subq_0.revenue_instance__user
- , subq_0.txn_revenue
+ subq_11.ds__day
+ , subq_11.ds__week
+ , subq_11.ds__month
+ , subq_11.ds__quarter
+ , subq_11.ds__year
+ , subq_11.ds__extract_year
+ , subq_11.ds__extract_quarter
+ , subq_11.ds__extract_month
+ , subq_11.ds__extract_day
+ , subq_11.ds__extract_dow
+ , subq_11.ds__extract_doy
+ , subq_11.revenue_instance__ds__day
+ , subq_11.revenue_instance__ds__week
+ , subq_11.revenue_instance__ds__month
+ , subq_11.revenue_instance__ds__quarter
+ , subq_11.revenue_instance__ds__year
+ , subq_11.revenue_instance__ds__extract_year
+ , subq_11.revenue_instance__ds__extract_quarter
+ , subq_11.revenue_instance__ds__extract_month
+ , subq_11.revenue_instance__ds__extract_day
+ , subq_11.revenue_instance__ds__extract_dow
+ , subq_11.revenue_instance__ds__extract_doy
+ , subq_11.ds__day AS metric_time__day
+ , subq_11.ds__week AS metric_time__week
+ , subq_11.ds__month AS metric_time__month
+ , subq_11.ds__quarter AS metric_time__quarter
+ , subq_11.ds__year AS metric_time__year
+ , subq_11.ds__extract_year AS metric_time__extract_year
+ , subq_11.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_11.ds__extract_month AS metric_time__extract_month
+ , subq_11.ds__extract_day AS metric_time__extract_day
+ , subq_11.ds__extract_dow AS metric_time__extract_dow
+ , subq_11.ds__extract_doy AS metric_time__extract_doy
+ , subq_11.user
+ , subq_11.revenue_instance__user
+ , subq_11.txn_revenue
FROM (
-- Read Elements From Semantic Model 'revenue'
SELECT
- revenue_src_28007.revenue AS txn_revenue
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM revenue_src_28007.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy
- , revenue_src_28007.user_id AS user
- , revenue_src_28007.user_id AS revenue_instance__user
- FROM ***************************.fct_revenue revenue_src_28007
- ) subq_0
- ) subq_1
- WHERE subq_1.metric_time__day BETWEEN timestamp '2000-01-01' AND timestamp '2020-01-01'
- ) subq_2
+ revenue_src_28000.revenue AS txn_revenue
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , EXTRACT(DAY_OF_WEEK FROM revenue_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS revenue_instance__ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS revenue_instance__ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS revenue_instance__ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS revenue_instance__ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , EXTRACT(day FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_doy
+ , revenue_src_28000.user_id AS user
+ , revenue_src_28000.user_id AS revenue_instance__user
+ FROM ***************************.fct_revenue revenue_src_28000
+ ) subq_11
+ ) subq_12
+ WHERE subq_12.metric_time__day BETWEEN timestamp '2000-01-01' AND timestamp '2020-01-01'
+ ) subq_13
ON
- (subq_2.metric_time__month <= subq_3.metric_time__month)
- ) subq_5
- ) subq_6
- WHERE subq_6.metric_time__month BETWEEN timestamp '2020-01-01' AND timestamp '2020-01-01'
- ) subq_7
+ (subq_13.metric_time__month <= subq_14.metric_time__month)
+ ) subq_16
+ ) subq_17
+ WHERE subq_17.metric_time__month BETWEEN timestamp '2020-01-01' AND timestamp '2020-01-01'
+ ) subq_18
GROUP BY
- subq_7.metric_time__month
-) subq_8
+ subq_18.metric_time__month
+) subq_19
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_no_window_with_time_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_no_window_with_time_constraint__plan0_optimized.sql
index 681918b712..767f1f424b 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_no_window_with_time_constraint__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_no_window_with_time_constraint__plan0_optimized.sql
@@ -4,17 +4,17 @@
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_12.metric_time__month AS metric_time__month
- , SUM(subq_11.txn_revenue) AS revenue_all_time
+ subq_23.metric_time__month AS metric_time__month
+ , SUM(subq_22.txn_revenue) AS revenue_all_time
FROM (
-- Time Spine
SELECT
DATE_TRUNC('month', ds) AS metric_time__month
- FROM ***************************.mf_time_spine subq_13
+ FROM ***************************.mf_time_spine subq_24
WHERE ds BETWEEN timestamp '2020-01-01' AND timestamp '2020-01-01'
GROUP BY
DATE_TRUNC('month', ds)
-) subq_12
+) subq_23
INNER JOIN (
-- Read Elements From Semantic Model 'revenue'
-- Metric Time Dimension 'ds'
@@ -22,11 +22,11 @@ INNER JOIN (
SELECT
DATE_TRUNC('month', created_at) AS metric_time__month
, revenue AS txn_revenue
- FROM ***************************.fct_revenue revenue_src_28007
+ FROM ***************************.fct_revenue revenue_src_28000
WHERE DATE_TRUNC('day', created_at) BETWEEN timestamp '2000-01-01' AND timestamp '2020-01-01'
-) subq_11
+) subq_22
ON
- (subq_11.metric_time__month <= subq_12.metric_time__month)
-WHERE subq_12.metric_time__month BETWEEN timestamp '2020-01-01' AND timestamp '2020-01-01'
+ (subq_22.metric_time__month <= subq_23.metric_time__month)
+WHERE subq_23.metric_time__month BETWEEN timestamp '2020-01-01' AND timestamp '2020-01-01'
GROUP BY
- subq_12.metric_time__month
+ subq_23.metric_time__month
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_with_agg_time_dimension__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_with_agg_time_dimension__plan0.sql
index 44ed3501a2..eb8f85ceb2 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_with_agg_time_dimension__plan0.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_with_agg_time_dimension__plan0.sql
@@ -1,140 +1,140 @@
-- Compute Metrics via Expressions
SELECT
- subq_6.revenue_instance__ds__day
- , subq_6.txn_revenue AS trailing_2_months_revenue
+ subq_15.revenue_instance__ds__day
+ , subq_15.txn_revenue AS trailing_2_months_revenue
FROM (
-- Aggregate Measures
SELECT
- subq_5.revenue_instance__ds__day
- , SUM(subq_5.txn_revenue) AS txn_revenue
+ subq_14.revenue_instance__ds__day
+ , SUM(subq_14.txn_revenue) AS txn_revenue
FROM (
-- Pass Only Elements: ['txn_revenue', 'revenue_instance__ds__day']
SELECT
- subq_4.revenue_instance__ds__day
- , subq_4.txn_revenue
+ subq_13.revenue_instance__ds__day
+ , subq_13.txn_revenue
FROM (
-- Join Self Over Time Range
SELECT
- subq_2.revenue_instance__ds__day AS revenue_instance__ds__day
- , subq_1.ds__day AS ds__day
- , subq_1.ds__week AS ds__week
- , subq_1.ds__month AS ds__month
- , subq_1.ds__quarter AS ds__quarter
- , subq_1.ds__year AS ds__year
- , subq_1.ds__extract_year AS ds__extract_year
- , subq_1.ds__extract_quarter AS ds__extract_quarter
- , subq_1.ds__extract_month AS ds__extract_month
- , subq_1.ds__extract_day AS ds__extract_day
- , subq_1.ds__extract_dow AS ds__extract_dow
- , subq_1.ds__extract_doy AS ds__extract_doy
- , subq_1.revenue_instance__ds__week AS revenue_instance__ds__week
- , subq_1.revenue_instance__ds__month AS revenue_instance__ds__month
- , subq_1.revenue_instance__ds__quarter AS revenue_instance__ds__quarter
- , subq_1.revenue_instance__ds__year AS revenue_instance__ds__year
- , subq_1.revenue_instance__ds__extract_year AS revenue_instance__ds__extract_year
- , subq_1.revenue_instance__ds__extract_quarter AS revenue_instance__ds__extract_quarter
- , subq_1.revenue_instance__ds__extract_month AS revenue_instance__ds__extract_month
- , subq_1.revenue_instance__ds__extract_day AS revenue_instance__ds__extract_day
- , subq_1.revenue_instance__ds__extract_dow AS revenue_instance__ds__extract_dow
- , subq_1.revenue_instance__ds__extract_doy AS revenue_instance__ds__extract_doy
- , subq_1.metric_time__day AS metric_time__day
- , subq_1.metric_time__week AS metric_time__week
- , subq_1.metric_time__month AS metric_time__month
- , subq_1.metric_time__quarter AS metric_time__quarter
- , subq_1.metric_time__year AS metric_time__year
- , subq_1.metric_time__extract_year AS metric_time__extract_year
- , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter
- , subq_1.metric_time__extract_month AS metric_time__extract_month
- , subq_1.metric_time__extract_day AS metric_time__extract_day
- , subq_1.metric_time__extract_dow AS metric_time__extract_dow
- , subq_1.metric_time__extract_doy AS metric_time__extract_doy
- , subq_1.user AS user
- , subq_1.revenue_instance__user AS revenue_instance__user
- , subq_1.txn_revenue AS txn_revenue
+ subq_11.revenue_instance__ds__day AS revenue_instance__ds__day
+ , subq_10.ds__day AS ds__day
+ , subq_10.ds__week AS ds__week
+ , subq_10.ds__month AS ds__month
+ , subq_10.ds__quarter AS ds__quarter
+ , subq_10.ds__year AS ds__year
+ , subq_10.ds__extract_year AS ds__extract_year
+ , subq_10.ds__extract_quarter AS ds__extract_quarter
+ , subq_10.ds__extract_month AS ds__extract_month
+ , subq_10.ds__extract_day AS ds__extract_day
+ , subq_10.ds__extract_dow AS ds__extract_dow
+ , subq_10.ds__extract_doy AS ds__extract_doy
+ , subq_10.revenue_instance__ds__week AS revenue_instance__ds__week
+ , subq_10.revenue_instance__ds__month AS revenue_instance__ds__month
+ , subq_10.revenue_instance__ds__quarter AS revenue_instance__ds__quarter
+ , subq_10.revenue_instance__ds__year AS revenue_instance__ds__year
+ , subq_10.revenue_instance__ds__extract_year AS revenue_instance__ds__extract_year
+ , subq_10.revenue_instance__ds__extract_quarter AS revenue_instance__ds__extract_quarter
+ , subq_10.revenue_instance__ds__extract_month AS revenue_instance__ds__extract_month
+ , subq_10.revenue_instance__ds__extract_day AS revenue_instance__ds__extract_day
+ , subq_10.revenue_instance__ds__extract_dow AS revenue_instance__ds__extract_dow
+ , subq_10.revenue_instance__ds__extract_doy AS revenue_instance__ds__extract_doy
+ , subq_10.metric_time__day AS metric_time__day
+ , subq_10.metric_time__week AS metric_time__week
+ , subq_10.metric_time__month AS metric_time__month
+ , subq_10.metric_time__quarter AS metric_time__quarter
+ , subq_10.metric_time__year AS metric_time__year
+ , subq_10.metric_time__extract_year AS metric_time__extract_year
+ , subq_10.metric_time__extract_quarter AS metric_time__extract_quarter
+ , subq_10.metric_time__extract_month AS metric_time__extract_month
+ , subq_10.metric_time__extract_day AS metric_time__extract_day
+ , subq_10.metric_time__extract_dow AS metric_time__extract_dow
+ , subq_10.metric_time__extract_doy AS metric_time__extract_doy
+ , subq_10.user AS user
+ , subq_10.revenue_instance__user AS revenue_instance__user
+ , subq_10.txn_revenue AS txn_revenue
FROM (
-- Time Spine
SELECT
- subq_3.ds AS revenue_instance__ds__day
- FROM ***************************.mf_time_spine subq_3
- ) subq_2
+ subq_12.ds AS revenue_instance__ds__day
+ FROM ***************************.mf_time_spine subq_12
+ ) subq_11
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.revenue_instance__ds__day
- , subq_0.revenue_instance__ds__week
- , subq_0.revenue_instance__ds__month
- , subq_0.revenue_instance__ds__quarter
- , subq_0.revenue_instance__ds__year
- , subq_0.revenue_instance__ds__extract_year
- , subq_0.revenue_instance__ds__extract_quarter
- , subq_0.revenue_instance__ds__extract_month
- , subq_0.revenue_instance__ds__extract_day
- , subq_0.revenue_instance__ds__extract_dow
- , subq_0.revenue_instance__ds__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.user
- , subq_0.revenue_instance__user
- , subq_0.txn_revenue
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.revenue_instance__ds__day
+ , subq_9.revenue_instance__ds__week
+ , subq_9.revenue_instance__ds__month
+ , subq_9.revenue_instance__ds__quarter
+ , subq_9.revenue_instance__ds__year
+ , subq_9.revenue_instance__ds__extract_year
+ , subq_9.revenue_instance__ds__extract_quarter
+ , subq_9.revenue_instance__ds__extract_month
+ , subq_9.revenue_instance__ds__extract_day
+ , subq_9.revenue_instance__ds__extract_dow
+ , subq_9.revenue_instance__ds__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.user
+ , subq_9.revenue_instance__user
+ , subq_9.txn_revenue
FROM (
-- Read Elements From Semantic Model 'revenue'
SELECT
- revenue_src_28007.revenue AS txn_revenue
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM revenue_src_28007.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy
- , revenue_src_28007.user_id AS user
- , revenue_src_28007.user_id AS revenue_instance__user
- FROM ***************************.fct_revenue revenue_src_28007
- ) subq_0
- ) subq_1
+ revenue_src_28000.revenue AS txn_revenue
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , EXTRACT(DAY_OF_WEEK FROM revenue_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS revenue_instance__ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS revenue_instance__ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS revenue_instance__ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS revenue_instance__ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , EXTRACT(day FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_doy
+ , revenue_src_28000.user_id AS user
+ , revenue_src_28000.user_id AS revenue_instance__user
+ FROM ***************************.fct_revenue revenue_src_28000
+ ) subq_9
+ ) subq_10
ON
(
- subq_1.revenue_instance__ds__day <= subq_2.revenue_instance__ds__day
+ subq_10.revenue_instance__ds__day <= subq_11.revenue_instance__ds__day
) AND (
- subq_1.revenue_instance__ds__day > DATE_ADD('month', -2, subq_2.revenue_instance__ds__day)
+ subq_10.revenue_instance__ds__day > DATE_ADD('month', -2, subq_11.revenue_instance__ds__day)
)
- ) subq_4
- ) subq_5
+ ) subq_13
+ ) subq_14
GROUP BY
- subq_5.revenue_instance__ds__day
-) subq_6
+ subq_14.revenue_instance__ds__day
+) subq_15
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_with_agg_time_dimension__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_with_agg_time_dimension__plan0_optimized.sql
index 3a1a9a5fd9..b5c2bc5f23 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_with_agg_time_dimension__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_with_agg_time_dimension__plan0_optimized.sql
@@ -3,16 +3,16 @@
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_10.ds AS revenue_instance__ds__day
- , SUM(revenue_src_28007.revenue) AS trailing_2_months_revenue
-FROM ***************************.mf_time_spine subq_10
+ subq_19.ds AS revenue_instance__ds__day
+ , SUM(revenue_src_28000.revenue) AS trailing_2_months_revenue
+FROM ***************************.mf_time_spine subq_19
INNER JOIN
- ***************************.fct_revenue revenue_src_28007
+ ***************************.fct_revenue revenue_src_28000
ON
(
- DATE_TRUNC('day', revenue_src_28007.created_at) <= subq_10.ds
+ DATE_TRUNC('day', revenue_src_28000.created_at) <= subq_19.ds
) AND (
- DATE_TRUNC('day', revenue_src_28007.created_at) > DATE_ADD('month', -2, subq_10.ds)
+ DATE_TRUNC('day', revenue_src_28000.created_at) > DATE_ADD('month', -2, subq_19.ds)
)
GROUP BY
- subq_10.ds
+ subq_19.ds
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_with_non_adjustable_time_filter__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_with_non_adjustable_time_filter__plan0.sql
index eb8304ee50..863dfcfc8d 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_with_non_adjustable_time_filter__plan0.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_with_non_adjustable_time_filter__plan0.sql
@@ -1,334 +1,334 @@
-- Compute Metrics via Expressions
SELECT
- subq_7.metric_time__day
- , subq_7.bookers AS every_two_days_bookers
+ subq_16.metric_time__day
+ , subq_16.bookers AS every_two_days_bookers
FROM (
-- Aggregate Measures
SELECT
- subq_6.metric_time__day
- , COUNT(DISTINCT subq_6.bookers) AS bookers
+ subq_15.metric_time__day
+ , COUNT(DISTINCT subq_15.bookers) AS bookers
FROM (
-- Constrain Output with WHERE
SELECT
- subq_5.metric_time__day
- , subq_5.bookers
+ subq_14.metric_time__day
+ , subq_14.bookers
FROM (
-- Pass Only Elements: ['bookers', 'metric_time__day']
SELECT
- subq_4.metric_time__day
- , subq_4.bookers
+ subq_13.metric_time__day
+ , subq_13.bookers
FROM (
-- Join Self Over Time Range
SELECT
- subq_2.metric_time__day AS metric_time__day
- , subq_1.ds__day AS ds__day
- , subq_1.ds__week AS ds__week
- , subq_1.ds__month AS ds__month
- , subq_1.ds__quarter AS ds__quarter
- , subq_1.ds__year AS ds__year
- , subq_1.ds__extract_year AS ds__extract_year
- , subq_1.ds__extract_quarter AS ds__extract_quarter
- , subq_1.ds__extract_month AS ds__extract_month
- , subq_1.ds__extract_day AS ds__extract_day
- , subq_1.ds__extract_dow AS ds__extract_dow
- , subq_1.ds__extract_doy AS ds__extract_doy
- , subq_1.ds_partitioned__day AS ds_partitioned__day
- , subq_1.ds_partitioned__week AS ds_partitioned__week
- , subq_1.ds_partitioned__month AS ds_partitioned__month
- , subq_1.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_1.ds_partitioned__year AS ds_partitioned__year
- , subq_1.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_1.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_1.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_1.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_1.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_1.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_1.paid_at__day AS paid_at__day
- , subq_1.paid_at__week AS paid_at__week
- , subq_1.paid_at__month AS paid_at__month
- , subq_1.paid_at__quarter AS paid_at__quarter
- , subq_1.paid_at__year AS paid_at__year
- , subq_1.paid_at__extract_year AS paid_at__extract_year
- , subq_1.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_1.paid_at__extract_month AS paid_at__extract_month
- , subq_1.paid_at__extract_day AS paid_at__extract_day
- , subq_1.paid_at__extract_dow AS paid_at__extract_dow
- , subq_1.paid_at__extract_doy AS paid_at__extract_doy
- , subq_1.booking__ds__day AS booking__ds__day
- , subq_1.booking__ds__week AS booking__ds__week
- , subq_1.booking__ds__month AS booking__ds__month
- , subq_1.booking__ds__quarter AS booking__ds__quarter
- , subq_1.booking__ds__year AS booking__ds__year
- , subq_1.booking__ds__extract_year AS booking__ds__extract_year
- , subq_1.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_1.booking__ds__extract_month AS booking__ds__extract_month
- , subq_1.booking__ds__extract_day AS booking__ds__extract_day
- , subq_1.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_1.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_1.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_1.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_1.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_1.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_1.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_1.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_1.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_1.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_1.booking__paid_at__day AS booking__paid_at__day
- , subq_1.booking__paid_at__week AS booking__paid_at__week
- , subq_1.booking__paid_at__month AS booking__paid_at__month
- , subq_1.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_1.booking__paid_at__year AS booking__paid_at__year
- , subq_1.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_1.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_1.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_1.metric_time__week AS metric_time__week
- , subq_1.metric_time__month AS metric_time__month
- , subq_1.metric_time__quarter AS metric_time__quarter
- , subq_1.metric_time__year AS metric_time__year
- , subq_1.metric_time__extract_year AS metric_time__extract_year
- , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter
- , subq_1.metric_time__extract_month AS metric_time__extract_month
- , subq_1.metric_time__extract_day AS metric_time__extract_day
- , subq_1.metric_time__extract_dow AS metric_time__extract_dow
- , subq_1.metric_time__extract_doy AS metric_time__extract_doy
- , subq_1.listing AS listing
- , subq_1.guest AS guest
- , subq_1.host AS host
- , subq_1.booking__listing AS booking__listing
- , subq_1.booking__guest AS booking__guest
- , subq_1.booking__host AS booking__host
- , subq_1.is_instant AS is_instant
- , subq_1.booking__is_instant AS booking__is_instant
- , subq_1.bookings AS bookings
- , subq_1.instant_bookings AS instant_bookings
- , subq_1.booking_value AS booking_value
- , subq_1.max_booking_value AS max_booking_value
- , subq_1.min_booking_value AS min_booking_value
- , subq_1.bookers AS bookers
- , subq_1.average_booking_value AS average_booking_value
- , subq_1.referred_bookings AS referred_bookings
- , subq_1.median_booking_value AS median_booking_value
- , subq_1.booking_value_p99 AS booking_value_p99
- , subq_1.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_1.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_1.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ subq_11.metric_time__day AS metric_time__day
+ , subq_10.ds__day AS ds__day
+ , subq_10.ds__week AS ds__week
+ , subq_10.ds__month AS ds__month
+ , subq_10.ds__quarter AS ds__quarter
+ , subq_10.ds__year AS ds__year
+ , subq_10.ds__extract_year AS ds__extract_year
+ , subq_10.ds__extract_quarter AS ds__extract_quarter
+ , subq_10.ds__extract_month AS ds__extract_month
+ , subq_10.ds__extract_day AS ds__extract_day
+ , subq_10.ds__extract_dow AS ds__extract_dow
+ , subq_10.ds__extract_doy AS ds__extract_doy
+ , subq_10.ds_partitioned__day AS ds_partitioned__day
+ , subq_10.ds_partitioned__week AS ds_partitioned__week
+ , subq_10.ds_partitioned__month AS ds_partitioned__month
+ , subq_10.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_10.ds_partitioned__year AS ds_partitioned__year
+ , subq_10.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_10.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_10.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_10.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_10.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_10.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_10.paid_at__day AS paid_at__day
+ , subq_10.paid_at__week AS paid_at__week
+ , subq_10.paid_at__month AS paid_at__month
+ , subq_10.paid_at__quarter AS paid_at__quarter
+ , subq_10.paid_at__year AS paid_at__year
+ , subq_10.paid_at__extract_year AS paid_at__extract_year
+ , subq_10.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_10.paid_at__extract_month AS paid_at__extract_month
+ , subq_10.paid_at__extract_day AS paid_at__extract_day
+ , subq_10.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_10.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_10.booking__ds__day AS booking__ds__day
+ , subq_10.booking__ds__week AS booking__ds__week
+ , subq_10.booking__ds__month AS booking__ds__month
+ , subq_10.booking__ds__quarter AS booking__ds__quarter
+ , subq_10.booking__ds__year AS booking__ds__year
+ , subq_10.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_10.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_10.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_10.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_10.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_10.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_10.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_10.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_10.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_10.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_10.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_10.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_10.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_10.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_10.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_10.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_10.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_10.booking__paid_at__day AS booking__paid_at__day
+ , subq_10.booking__paid_at__week AS booking__paid_at__week
+ , subq_10.booking__paid_at__month AS booking__paid_at__month
+ , subq_10.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_10.booking__paid_at__year AS booking__paid_at__year
+ , subq_10.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_10.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_10.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_10.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_10.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_10.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_10.metric_time__week AS metric_time__week
+ , subq_10.metric_time__month AS metric_time__month
+ , subq_10.metric_time__quarter AS metric_time__quarter
+ , subq_10.metric_time__year AS metric_time__year
+ , subq_10.metric_time__extract_year AS metric_time__extract_year
+ , subq_10.metric_time__extract_quarter AS metric_time__extract_quarter
+ , subq_10.metric_time__extract_month AS metric_time__extract_month
+ , subq_10.metric_time__extract_day AS metric_time__extract_day
+ , subq_10.metric_time__extract_dow AS metric_time__extract_dow
+ , subq_10.metric_time__extract_doy AS metric_time__extract_doy
+ , subq_10.listing AS listing
+ , subq_10.guest AS guest
+ , subq_10.host AS host
+ , subq_10.booking__listing AS booking__listing
+ , subq_10.booking__guest AS booking__guest
+ , subq_10.booking__host AS booking__host
+ , subq_10.is_instant AS is_instant
+ , subq_10.booking__is_instant AS booking__is_instant
+ , subq_10.bookings AS bookings
+ , subq_10.instant_bookings AS instant_bookings
+ , subq_10.booking_value AS booking_value
+ , subq_10.max_booking_value AS max_booking_value
+ , subq_10.min_booking_value AS min_booking_value
+ , subq_10.bookers AS bookers
+ , subq_10.average_booking_value AS average_booking_value
+ , subq_10.referred_bookings AS referred_bookings
+ , subq_10.median_booking_value AS median_booking_value
+ , subq_10.booking_value_p99 AS booking_value_p99
+ , subq_10.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_10.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_10.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_3.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_3
- ) subq_2
+ subq_12.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_12
+ ) subq_11
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
ON
(
- subq_1.metric_time__day <= subq_2.metric_time__day
+ subq_10.metric_time__day <= subq_11.metric_time__day
) AND (
- subq_1.metric_time__day > DATE_ADD('day', -2, subq_2.metric_time__day)
+ subq_10.metric_time__day > DATE_ADD('day', -2, subq_11.metric_time__day)
)
- ) subq_4
- ) subq_5
+ ) subq_13
+ ) subq_14
WHERE metric_time__day = '2020-01-03' or metric_time__day = '2020-01-07'
- ) subq_6
+ ) subq_15
GROUP BY
- subq_6.metric_time__day
-) subq_7
+ subq_15.metric_time__day
+) subq_16
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_with_non_adjustable_time_filter__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_with_non_adjustable_time_filter__plan0_optimized.sql
index a58cde372e..226c7dbb63 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_with_non_adjustable_time_filter__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_with_non_adjustable_time_filter__plan0_optimized.sql
@@ -8,18 +8,18 @@ FROM (
-- Join Self Over Time Range
-- Pass Only Elements: ['bookers', 'metric_time__day']
SELECT
- subq_11.ds AS metric_time__day
- , bookings_source_src_28001.guest_id AS bookers
- FROM ***************************.mf_time_spine subq_11
+ subq_20.ds AS metric_time__day
+ , bookings_source_src_28000.guest_id AS bookers
+ FROM ***************************.mf_time_spine subq_20
INNER JOIN
- ***************************.fct_bookings bookings_source_src_28001
+ ***************************.fct_bookings bookings_source_src_28000
ON
(
- DATE_TRUNC('day', bookings_source_src_28001.ds) <= subq_11.ds
+ DATE_TRUNC('day', bookings_source_src_28000.ds) <= subq_20.ds
) AND (
- DATE_TRUNC('day', bookings_source_src_28001.ds) > DATE_ADD('day', -2, subq_11.ds)
+ DATE_TRUNC('day', bookings_source_src_28000.ds) > DATE_ADD('day', -2, subq_20.ds)
)
-) subq_13
+) subq_22
WHERE metric_time__day = '2020-01-03' or metric_time__day = '2020-01-07'
GROUP BY
metric_time__day
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_with_time_constraint__plan0.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_with_time_constraint__plan0.sql
index 9ee18fafc9..f8435e06c4 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_with_time_constraint__plan0.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_with_time_constraint__plan0.sql
@@ -1,189 +1,189 @@
-- Compute Metrics via Expressions
SELECT
- subq_8.metric_time__day
- , subq_8.txn_revenue AS trailing_2_months_revenue
+ subq_19.metric_time__day
+ , subq_19.txn_revenue AS trailing_2_months_revenue
FROM (
-- Aggregate Measures
SELECT
- subq_7.metric_time__day
- , SUM(subq_7.txn_revenue) AS txn_revenue
+ subq_18.metric_time__day
+ , SUM(subq_18.txn_revenue) AS txn_revenue
FROM (
-- Constrain Time Range to [2020-01-01T00:00:00, 2020-01-01T00:00:00]
SELECT
- subq_6.metric_time__day
- , subq_6.txn_revenue
+ subq_17.metric_time__day
+ , subq_17.txn_revenue
FROM (
-- Pass Only Elements: ['txn_revenue', 'metric_time__day']
SELECT
- subq_5.metric_time__day
- , subq_5.txn_revenue
+ subq_16.metric_time__day
+ , subq_16.txn_revenue
FROM (
-- Join Self Over Time Range
SELECT
- subq_3.metric_time__day AS metric_time__day
- , subq_2.ds__day AS ds__day
- , subq_2.ds__week AS ds__week
- , subq_2.ds__month AS ds__month
- , subq_2.ds__quarter AS ds__quarter
- , subq_2.ds__year AS ds__year
- , subq_2.ds__extract_year AS ds__extract_year
- , subq_2.ds__extract_quarter AS ds__extract_quarter
- , subq_2.ds__extract_month AS ds__extract_month
- , subq_2.ds__extract_day AS ds__extract_day
- , subq_2.ds__extract_dow AS ds__extract_dow
- , subq_2.ds__extract_doy AS ds__extract_doy
- , subq_2.revenue_instance__ds__day AS revenue_instance__ds__day
- , subq_2.revenue_instance__ds__week AS revenue_instance__ds__week
- , subq_2.revenue_instance__ds__month AS revenue_instance__ds__month
- , subq_2.revenue_instance__ds__quarter AS revenue_instance__ds__quarter
- , subq_2.revenue_instance__ds__year AS revenue_instance__ds__year
- , subq_2.revenue_instance__ds__extract_year AS revenue_instance__ds__extract_year
- , subq_2.revenue_instance__ds__extract_quarter AS revenue_instance__ds__extract_quarter
- , subq_2.revenue_instance__ds__extract_month AS revenue_instance__ds__extract_month
- , subq_2.revenue_instance__ds__extract_day AS revenue_instance__ds__extract_day
- , subq_2.revenue_instance__ds__extract_dow AS revenue_instance__ds__extract_dow
- , subq_2.revenue_instance__ds__extract_doy AS revenue_instance__ds__extract_doy
- , subq_2.metric_time__week AS metric_time__week
- , subq_2.metric_time__month AS metric_time__month
- , subq_2.metric_time__quarter AS metric_time__quarter
- , subq_2.metric_time__year AS metric_time__year
- , subq_2.metric_time__extract_year AS metric_time__extract_year
- , subq_2.metric_time__extract_quarter AS metric_time__extract_quarter
- , subq_2.metric_time__extract_month AS metric_time__extract_month
- , subq_2.metric_time__extract_day AS metric_time__extract_day
- , subq_2.metric_time__extract_dow AS metric_time__extract_dow
- , subq_2.metric_time__extract_doy AS metric_time__extract_doy
- , subq_2.user AS user
- , subq_2.revenue_instance__user AS revenue_instance__user
- , subq_2.txn_revenue AS txn_revenue
+ subq_14.metric_time__day AS metric_time__day
+ , subq_13.ds__day AS ds__day
+ , subq_13.ds__week AS ds__week
+ , subq_13.ds__month AS ds__month
+ , subq_13.ds__quarter AS ds__quarter
+ , subq_13.ds__year AS ds__year
+ , subq_13.ds__extract_year AS ds__extract_year
+ , subq_13.ds__extract_quarter AS ds__extract_quarter
+ , subq_13.ds__extract_month AS ds__extract_month
+ , subq_13.ds__extract_day AS ds__extract_day
+ , subq_13.ds__extract_dow AS ds__extract_dow
+ , subq_13.ds__extract_doy AS ds__extract_doy
+ , subq_13.revenue_instance__ds__day AS revenue_instance__ds__day
+ , subq_13.revenue_instance__ds__week AS revenue_instance__ds__week
+ , subq_13.revenue_instance__ds__month AS revenue_instance__ds__month
+ , subq_13.revenue_instance__ds__quarter AS revenue_instance__ds__quarter
+ , subq_13.revenue_instance__ds__year AS revenue_instance__ds__year
+ , subq_13.revenue_instance__ds__extract_year AS revenue_instance__ds__extract_year
+ , subq_13.revenue_instance__ds__extract_quarter AS revenue_instance__ds__extract_quarter
+ , subq_13.revenue_instance__ds__extract_month AS revenue_instance__ds__extract_month
+ , subq_13.revenue_instance__ds__extract_day AS revenue_instance__ds__extract_day
+ , subq_13.revenue_instance__ds__extract_dow AS revenue_instance__ds__extract_dow
+ , subq_13.revenue_instance__ds__extract_doy AS revenue_instance__ds__extract_doy
+ , subq_13.metric_time__week AS metric_time__week
+ , subq_13.metric_time__month AS metric_time__month
+ , subq_13.metric_time__quarter AS metric_time__quarter
+ , subq_13.metric_time__year AS metric_time__year
+ , subq_13.metric_time__extract_year AS metric_time__extract_year
+ , subq_13.metric_time__extract_quarter AS metric_time__extract_quarter
+ , subq_13.metric_time__extract_month AS metric_time__extract_month
+ , subq_13.metric_time__extract_day AS metric_time__extract_day
+ , subq_13.metric_time__extract_dow AS metric_time__extract_dow
+ , subq_13.metric_time__extract_doy AS metric_time__extract_doy
+ , subq_13.user AS user
+ , subq_13.revenue_instance__user AS revenue_instance__user
+ , subq_13.txn_revenue AS txn_revenue
FROM (
-- Time Spine
SELECT
- subq_4.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_4
- WHERE subq_4.ds BETWEEN timestamp '2020-01-01' AND timestamp '2020-01-01'
- ) subq_3
+ subq_15.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_15
+ WHERE subq_15.ds BETWEEN timestamp '2020-01-01' AND timestamp '2020-01-01'
+ ) subq_14
INNER JOIN (
-- Constrain Time Range to [2019-11-01T00:00:00, 2020-01-01T00:00:00]
SELECT
- subq_1.ds__day
- , subq_1.ds__week
- , subq_1.ds__month
- , subq_1.ds__quarter
- , subq_1.ds__year
- , subq_1.ds__extract_year
- , subq_1.ds__extract_quarter
- , subq_1.ds__extract_month
- , subq_1.ds__extract_day
- , subq_1.ds__extract_dow
- , subq_1.ds__extract_doy
- , subq_1.revenue_instance__ds__day
- , subq_1.revenue_instance__ds__week
- , subq_1.revenue_instance__ds__month
- , subq_1.revenue_instance__ds__quarter
- , subq_1.revenue_instance__ds__year
- , subq_1.revenue_instance__ds__extract_year
- , subq_1.revenue_instance__ds__extract_quarter
- , subq_1.revenue_instance__ds__extract_month
- , subq_1.revenue_instance__ds__extract_day
- , subq_1.revenue_instance__ds__extract_dow
- , subq_1.revenue_instance__ds__extract_doy
- , subq_1.metric_time__day
- , subq_1.metric_time__week
- , subq_1.metric_time__month
- , subq_1.metric_time__quarter
- , subq_1.metric_time__year
- , subq_1.metric_time__extract_year
- , subq_1.metric_time__extract_quarter
- , subq_1.metric_time__extract_month
- , subq_1.metric_time__extract_day
- , subq_1.metric_time__extract_dow
- , subq_1.metric_time__extract_doy
- , subq_1.user
- , subq_1.revenue_instance__user
- , subq_1.txn_revenue
+ subq_12.ds__day
+ , subq_12.ds__week
+ , subq_12.ds__month
+ , subq_12.ds__quarter
+ , subq_12.ds__year
+ , subq_12.ds__extract_year
+ , subq_12.ds__extract_quarter
+ , subq_12.ds__extract_month
+ , subq_12.ds__extract_day
+ , subq_12.ds__extract_dow
+ , subq_12.ds__extract_doy
+ , subq_12.revenue_instance__ds__day
+ , subq_12.revenue_instance__ds__week
+ , subq_12.revenue_instance__ds__month
+ , subq_12.revenue_instance__ds__quarter
+ , subq_12.revenue_instance__ds__year
+ , subq_12.revenue_instance__ds__extract_year
+ , subq_12.revenue_instance__ds__extract_quarter
+ , subq_12.revenue_instance__ds__extract_month
+ , subq_12.revenue_instance__ds__extract_day
+ , subq_12.revenue_instance__ds__extract_dow
+ , subq_12.revenue_instance__ds__extract_doy
+ , subq_12.metric_time__day
+ , subq_12.metric_time__week
+ , subq_12.metric_time__month
+ , subq_12.metric_time__quarter
+ , subq_12.metric_time__year
+ , subq_12.metric_time__extract_year
+ , subq_12.metric_time__extract_quarter
+ , subq_12.metric_time__extract_month
+ , subq_12.metric_time__extract_day
+ , subq_12.metric_time__extract_dow
+ , subq_12.metric_time__extract_doy
+ , subq_12.user
+ , subq_12.revenue_instance__user
+ , subq_12.txn_revenue
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.revenue_instance__ds__day
- , subq_0.revenue_instance__ds__week
- , subq_0.revenue_instance__ds__month
- , subq_0.revenue_instance__ds__quarter
- , subq_0.revenue_instance__ds__year
- , subq_0.revenue_instance__ds__extract_year
- , subq_0.revenue_instance__ds__extract_quarter
- , subq_0.revenue_instance__ds__extract_month
- , subq_0.revenue_instance__ds__extract_day
- , subq_0.revenue_instance__ds__extract_dow
- , subq_0.revenue_instance__ds__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.user
- , subq_0.revenue_instance__user
- , subq_0.txn_revenue
+ subq_11.ds__day
+ , subq_11.ds__week
+ , subq_11.ds__month
+ , subq_11.ds__quarter
+ , subq_11.ds__year
+ , subq_11.ds__extract_year
+ , subq_11.ds__extract_quarter
+ , subq_11.ds__extract_month
+ , subq_11.ds__extract_day
+ , subq_11.ds__extract_dow
+ , subq_11.ds__extract_doy
+ , subq_11.revenue_instance__ds__day
+ , subq_11.revenue_instance__ds__week
+ , subq_11.revenue_instance__ds__month
+ , subq_11.revenue_instance__ds__quarter
+ , subq_11.revenue_instance__ds__year
+ , subq_11.revenue_instance__ds__extract_year
+ , subq_11.revenue_instance__ds__extract_quarter
+ , subq_11.revenue_instance__ds__extract_month
+ , subq_11.revenue_instance__ds__extract_day
+ , subq_11.revenue_instance__ds__extract_dow
+ , subq_11.revenue_instance__ds__extract_doy
+ , subq_11.ds__day AS metric_time__day
+ , subq_11.ds__week AS metric_time__week
+ , subq_11.ds__month AS metric_time__month
+ , subq_11.ds__quarter AS metric_time__quarter
+ , subq_11.ds__year AS metric_time__year
+ , subq_11.ds__extract_year AS metric_time__extract_year
+ , subq_11.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_11.ds__extract_month AS metric_time__extract_month
+ , subq_11.ds__extract_day AS metric_time__extract_day
+ , subq_11.ds__extract_dow AS metric_time__extract_dow
+ , subq_11.ds__extract_doy AS metric_time__extract_doy
+ , subq_11.user
+ , subq_11.revenue_instance__user
+ , subq_11.txn_revenue
FROM (
-- Read Elements From Semantic Model 'revenue'
SELECT
- revenue_src_28007.revenue AS txn_revenue
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM revenue_src_28007.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', revenue_src_28007.created_at) AS revenue_instance__ds__day
- , DATE_TRUNC('week', revenue_src_28007.created_at) AS revenue_instance__ds__week
- , DATE_TRUNC('month', revenue_src_28007.created_at) AS revenue_instance__ds__month
- , DATE_TRUNC('quarter', revenue_src_28007.created_at) AS revenue_instance__ds__quarter
- , DATE_TRUNC('year', revenue_src_28007.created_at) AS revenue_instance__ds__year
- , EXTRACT(year FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_year
- , EXTRACT(quarter FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_quarter
- , EXTRACT(month FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_month
- , EXTRACT(day FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_dow
- , EXTRACT(doy FROM revenue_src_28007.created_at) AS revenue_instance__ds__extract_doy
- , revenue_src_28007.user_id AS user
- , revenue_src_28007.user_id AS revenue_instance__user
- FROM ***************************.fct_revenue revenue_src_28007
- ) subq_0
- ) subq_1
- WHERE subq_1.metric_time__day BETWEEN timestamp '2019-11-01' AND timestamp '2020-01-01'
- ) subq_2
+ revenue_src_28000.revenue AS txn_revenue
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , EXTRACT(DAY_OF_WEEK FROM revenue_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', revenue_src_28000.created_at) AS revenue_instance__ds__day
+ , DATE_TRUNC('week', revenue_src_28000.created_at) AS revenue_instance__ds__week
+ , DATE_TRUNC('month', revenue_src_28000.created_at) AS revenue_instance__ds__month
+ , DATE_TRUNC('quarter', revenue_src_28000.created_at) AS revenue_instance__ds__quarter
+ , DATE_TRUNC('year', revenue_src_28000.created_at) 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
+ , EXTRACT(day FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_dow
+ , EXTRACT(doy FROM revenue_src_28000.created_at) AS revenue_instance__ds__extract_doy
+ , revenue_src_28000.user_id AS user
+ , revenue_src_28000.user_id AS revenue_instance__user
+ FROM ***************************.fct_revenue revenue_src_28000
+ ) subq_11
+ ) subq_12
+ WHERE subq_12.metric_time__day BETWEEN timestamp '2019-11-01' AND timestamp '2020-01-01'
+ ) subq_13
ON
(
- subq_2.metric_time__day <= subq_3.metric_time__day
+ subq_13.metric_time__day <= subq_14.metric_time__day
) AND (
- subq_2.metric_time__day > DATE_ADD('month', -2, subq_3.metric_time__day)
+ subq_13.metric_time__day > DATE_ADD('month', -2, subq_14.metric_time__day)
)
- ) subq_5
- ) subq_6
- WHERE subq_6.metric_time__day BETWEEN timestamp '2020-01-01' AND timestamp '2020-01-01'
- ) subq_7
+ ) subq_16
+ ) subq_17
+ WHERE subq_17.metric_time__day BETWEEN timestamp '2020-01-01' AND timestamp '2020-01-01'
+ ) subq_18
GROUP BY
- subq_7.metric_time__day
-) subq_8
+ subq_18.metric_time__day
+) subq_19
diff --git a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_with_time_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_with_time_constraint__plan0_optimized.sql
index 07971fda92..cddeddf95e 100644
--- a/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_with_time_constraint__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_cumulative_metric_rendering.py/SqlQueryPlan/Trino/test_cumulative_metric_with_time_constraint__plan0_optimized.sql
@@ -4,15 +4,15 @@
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_12.metric_time__day AS metric_time__day
- , SUM(subq_11.txn_revenue) AS trailing_2_months_revenue
+ subq_23.metric_time__day AS metric_time__day
+ , SUM(subq_22.txn_revenue) AS trailing_2_months_revenue
FROM (
-- Time Spine
SELECT
ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_13
+ FROM ***************************.mf_time_spine subq_24
WHERE ds BETWEEN timestamp '2020-01-01' AND timestamp '2020-01-01'
-) subq_12
+) subq_23
INNER JOIN (
-- Read Elements From Semantic Model 'revenue'
-- Metric Time Dimension 'ds'
@@ -20,15 +20,15 @@ INNER JOIN (
SELECT
DATE_TRUNC('day', created_at) AS metric_time__day
, revenue AS txn_revenue
- FROM ***************************.fct_revenue revenue_src_28007
+ FROM ***************************.fct_revenue revenue_src_28000
WHERE DATE_TRUNC('day', created_at) BETWEEN timestamp '2019-11-01' AND timestamp '2020-01-01'
-) subq_11
+) subq_22
ON
(
- subq_11.metric_time__day <= subq_12.metric_time__day
+ subq_22.metric_time__day <= subq_23.metric_time__day
) AND (
- subq_11.metric_time__day > DATE_ADD('month', -2, subq_12.metric_time__day)
+ subq_22.metric_time__day > DATE_ADD('month', -2, subq_23.metric_time__day)
)
-WHERE subq_12.metric_time__day BETWEEN timestamp '2020-01-01' AND timestamp '2020-01-01'
+WHERE subq_23.metric_time__day BETWEEN timestamp '2020-01-01' AND timestamp '2020-01-01'
GROUP BY
- subq_12.metric_time__day
+ subq_23.metric_time__day
diff --git a/metricflow/test/snapshots/test_data_warehouse_tasks.py/str/BigQuery/test_build_metric_tasks__query0.sql b/metricflow/test/snapshots/test_data_warehouse_tasks.py/str/BigQuery/test_build_metric_tasks__query0.sql
index f6772ae7c3..49fd5edf06 100644
--- a/metricflow/test/snapshots/test_data_warehouse_tasks.py/str/BigQuery/test_build_metric_tasks__query0.sql
+++ b/metricflow/test/snapshots/test_data_warehouse_tasks.py/str/BigQuery/test_build_metric_tasks__query0.sql
@@ -10,7 +10,7 @@ FROM (
SELECT
DATE_TRUNC(ds, day) AS metric_time__day
, 1 AS count_dogs
- FROM ***************************.fct_animals animals_src_0
-) subq_2
+ FROM ***************************.fct_animals animals_src_10000
+) subq_3
GROUP BY
metric_time__day
diff --git a/metricflow/test/snapshots/test_data_warehouse_tasks.py/str/Databricks/test_build_metric_tasks__query0.sql b/metricflow/test/snapshots/test_data_warehouse_tasks.py/str/Databricks/test_build_metric_tasks__query0.sql
index a007292bd9..a4dec7ca57 100644
--- a/metricflow/test/snapshots/test_data_warehouse_tasks.py/str/Databricks/test_build_metric_tasks__query0.sql
+++ b/metricflow/test/snapshots/test_data_warehouse_tasks.py/str/Databricks/test_build_metric_tasks__query0.sql
@@ -10,7 +10,7 @@ FROM (
SELECT
DATE_TRUNC('day', ds) AS metric_time__day
, 1 AS count_dogs
- FROM ***************************.fct_animals animals_src_0
-) subq_2
+ FROM ***************************.fct_animals animals_src_10000
+) subq_3
GROUP BY
metric_time__day
diff --git a/metricflow/test/snapshots/test_data_warehouse_tasks.py/str/DuckDB/test_build_metric_tasks__query0.sql b/metricflow/test/snapshots/test_data_warehouse_tasks.py/str/DuckDB/test_build_metric_tasks__query0.sql
index a007292bd9..a4dec7ca57 100644
--- a/metricflow/test/snapshots/test_data_warehouse_tasks.py/str/DuckDB/test_build_metric_tasks__query0.sql
+++ b/metricflow/test/snapshots/test_data_warehouse_tasks.py/str/DuckDB/test_build_metric_tasks__query0.sql
@@ -10,7 +10,7 @@ FROM (
SELECT
DATE_TRUNC('day', ds) AS metric_time__day
, 1 AS count_dogs
- FROM ***************************.fct_animals animals_src_0
-) subq_2
+ FROM ***************************.fct_animals animals_src_10000
+) subq_3
GROUP BY
metric_time__day
diff --git a/metricflow/test/snapshots/test_data_warehouse_tasks.py/str/Postgres/test_build_metric_tasks__query0.sql b/metricflow/test/snapshots/test_data_warehouse_tasks.py/str/Postgres/test_build_metric_tasks__query0.sql
index a007292bd9..a4dec7ca57 100644
--- a/metricflow/test/snapshots/test_data_warehouse_tasks.py/str/Postgres/test_build_metric_tasks__query0.sql
+++ b/metricflow/test/snapshots/test_data_warehouse_tasks.py/str/Postgres/test_build_metric_tasks__query0.sql
@@ -10,7 +10,7 @@ FROM (
SELECT
DATE_TRUNC('day', ds) AS metric_time__day
, 1 AS count_dogs
- FROM ***************************.fct_animals animals_src_0
-) subq_2
+ FROM ***************************.fct_animals animals_src_10000
+) subq_3
GROUP BY
metric_time__day
diff --git a/metricflow/test/snapshots/test_data_warehouse_tasks.py/str/Redshift/test_build_metric_tasks__query0.sql b/metricflow/test/snapshots/test_data_warehouse_tasks.py/str/Redshift/test_build_metric_tasks__query0.sql
index a007292bd9..a4dec7ca57 100644
--- a/metricflow/test/snapshots/test_data_warehouse_tasks.py/str/Redshift/test_build_metric_tasks__query0.sql
+++ b/metricflow/test/snapshots/test_data_warehouse_tasks.py/str/Redshift/test_build_metric_tasks__query0.sql
@@ -10,7 +10,7 @@ FROM (
SELECT
DATE_TRUNC('day', ds) AS metric_time__day
, 1 AS count_dogs
- FROM ***************************.fct_animals animals_src_0
-) subq_2
+ FROM ***************************.fct_animals animals_src_10000
+) subq_3
GROUP BY
metric_time__day
diff --git a/metricflow/test/snapshots/test_data_warehouse_tasks.py/str/Snowflake/test_build_metric_tasks__query0.sql b/metricflow/test/snapshots/test_data_warehouse_tasks.py/str/Snowflake/test_build_metric_tasks__query0.sql
index a007292bd9..a4dec7ca57 100644
--- a/metricflow/test/snapshots/test_data_warehouse_tasks.py/str/Snowflake/test_build_metric_tasks__query0.sql
+++ b/metricflow/test/snapshots/test_data_warehouse_tasks.py/str/Snowflake/test_build_metric_tasks__query0.sql
@@ -10,7 +10,7 @@ FROM (
SELECT
DATE_TRUNC('day', ds) AS metric_time__day
, 1 AS count_dogs
- FROM ***************************.fct_animals animals_src_0
-) subq_2
+ FROM ***************************.fct_animals animals_src_10000
+) subq_3
GROUP BY
metric_time__day
diff --git a/metricflow/test/snapshots/test_data_warehouse_tasks.py/str/Trino/test_build_metric_tasks__query0.sql b/metricflow/test/snapshots/test_data_warehouse_tasks.py/str/Trino/test_build_metric_tasks__query0.sql
index a007292bd9..a4dec7ca57 100644
--- a/metricflow/test/snapshots/test_data_warehouse_tasks.py/str/Trino/test_build_metric_tasks__query0.sql
+++ b/metricflow/test/snapshots/test_data_warehouse_tasks.py/str/Trino/test_build_metric_tasks__query0.sql
@@ -10,7 +10,7 @@ FROM (
SELECT
DATE_TRUNC('day', ds) AS metric_time__day
, 1 AS count_dogs
- FROM ***************************.fct_animals animals_src_0
-) subq_2
+ FROM ***************************.fct_animals animals_src_10000
+) subq_3
GROUP BY
metric_time__day
diff --git a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/BigQuery/test_combined_metrics_plan__ep_0.xml b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/BigQuery/test_combined_metrics_plan__ep_0.xml
index 40832a68bb..0cf4b800ff 100644
--- a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/BigQuery/test_combined_metrics_plan__ep_0.xml
+++ b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/BigQuery/test_combined_metrics_plan__ep_0.xml
@@ -2,85 +2,85 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/BigQuery/test_joined_plan__ep_0.xml b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/BigQuery/test_joined_plan__ep_0.xml
index 6e06248f38..9b3a02c32a 100644
--- a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/BigQuery/test_joined_plan__ep_0.xml
+++ b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/BigQuery/test_joined_plan__ep_0.xml
@@ -8,9 +8,9 @@
-
-
-
+
+
+
@@ -19,12 +19,12 @@
-
-
+
+
-
+
-
+
diff --git a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/BigQuery/test_multihop_joined_plan__ep_0.xml b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/BigQuery/test_multihop_joined_plan__ep_0.xml
index 758ee8ee45..4ee7fa977d 100644
--- a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/BigQuery/test_multihop_joined_plan__ep_0.xml
+++ b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/BigQuery/test_multihop_joined_plan__ep_0.xml
@@ -2,40 +2,40 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/BigQuery/test_small_combined_metrics_plan__ep_0.xml b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/BigQuery/test_small_combined_metrics_plan__ep_0.xml
index 9d39c9adee..347138a589 100644
--- a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/BigQuery/test_small_combined_metrics_plan__ep_0.xml
+++ b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/BigQuery/test_small_combined_metrics_plan__ep_0.xml
@@ -5,9 +5,9 @@
-
-
-
+
+
+
@@ -21,11 +21,11 @@
-
-
+
+
-
+
@@ -35,12 +35,12 @@
-
+
-
+
-
+
diff --git a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Databricks/test_combined_metrics_plan__ep_0.xml b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Databricks/test_combined_metrics_plan__ep_0.xml
index 35d3e1ed33..0d67248318 100644
--- a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Databricks/test_combined_metrics_plan__ep_0.xml
+++ b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Databricks/test_combined_metrics_plan__ep_0.xml
@@ -2,85 +2,85 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Databricks/test_joined_plan__ep_0.xml b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Databricks/test_joined_plan__ep_0.xml
index cf1f368a88..6d31dd15e4 100644
--- a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Databricks/test_joined_plan__ep_0.xml
+++ b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Databricks/test_joined_plan__ep_0.xml
@@ -8,9 +8,9 @@
-
-
-
+
+
+
@@ -19,14 +19,14 @@
-
-
+
+
-
+
-
+
-
-
+
+
diff --git a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Databricks/test_multihop_joined_plan__ep_0.xml b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Databricks/test_multihop_joined_plan__ep_0.xml
index f77cd373c7..381230ff5b 100644
--- a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Databricks/test_multihop_joined_plan__ep_0.xml
+++ b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Databricks/test_multihop_joined_plan__ep_0.xml
@@ -2,40 +2,40 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Databricks/test_small_combined_metrics_plan__ep_0.xml b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Databricks/test_small_combined_metrics_plan__ep_0.xml
index a41f3173fe..2c6243fd7e 100644
--- a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Databricks/test_small_combined_metrics_plan__ep_0.xml
+++ b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Databricks/test_small_combined_metrics_plan__ep_0.xml
@@ -5,9 +5,9 @@
-
-
-
+
+
+
@@ -21,11 +21,11 @@
-
-
+
+
-
+
@@ -35,13 +35,13 @@
-
+
-
+
-
+
-
+
diff --git a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/DuckDB/test_combined_metrics_plan__ep_0.xml b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/DuckDB/test_combined_metrics_plan__ep_0.xml
index 35d3e1ed33..0d67248318 100644
--- a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/DuckDB/test_combined_metrics_plan__ep_0.xml
+++ b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/DuckDB/test_combined_metrics_plan__ep_0.xml
@@ -2,85 +2,85 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/DuckDB/test_joined_plan__ep_0.xml b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/DuckDB/test_joined_plan__ep_0.xml
index cf1f368a88..6d31dd15e4 100644
--- a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/DuckDB/test_joined_plan__ep_0.xml
+++ b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/DuckDB/test_joined_plan__ep_0.xml
@@ -8,9 +8,9 @@
-
-
-
+
+
+
@@ -19,14 +19,14 @@
-
-
+
+
-
+
-
+
-
-
+
+
diff --git a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/DuckDB/test_multihop_joined_plan__ep_0.xml b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/DuckDB/test_multihop_joined_plan__ep_0.xml
index f77cd373c7..381230ff5b 100644
--- a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/DuckDB/test_multihop_joined_plan__ep_0.xml
+++ b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/DuckDB/test_multihop_joined_plan__ep_0.xml
@@ -2,40 +2,40 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/DuckDB/test_small_combined_metrics_plan__ep_0.xml b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/DuckDB/test_small_combined_metrics_plan__ep_0.xml
index a41f3173fe..2c6243fd7e 100644
--- a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/DuckDB/test_small_combined_metrics_plan__ep_0.xml
+++ b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/DuckDB/test_small_combined_metrics_plan__ep_0.xml
@@ -5,9 +5,9 @@
-
-
-
+
+
+
@@ -21,11 +21,11 @@
-
-
+
+
-
+
@@ -35,13 +35,13 @@
-
+
-
+
-
+
-
+
diff --git a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Postgres/test_combined_metrics_plan__ep_0.xml b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Postgres/test_combined_metrics_plan__ep_0.xml
index 35d3e1ed33..0d67248318 100644
--- a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Postgres/test_combined_metrics_plan__ep_0.xml
+++ b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Postgres/test_combined_metrics_plan__ep_0.xml
@@ -2,85 +2,85 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Postgres/test_joined_plan__ep_0.xml b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Postgres/test_joined_plan__ep_0.xml
index cf1f368a88..6d31dd15e4 100644
--- a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Postgres/test_joined_plan__ep_0.xml
+++ b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Postgres/test_joined_plan__ep_0.xml
@@ -8,9 +8,9 @@
-
-
-
+
+
+
@@ -19,14 +19,14 @@
-
-
+
+
-
+
-
+
-
-
+
+
diff --git a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Postgres/test_multihop_joined_plan__ep_0.xml b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Postgres/test_multihop_joined_plan__ep_0.xml
index f77cd373c7..381230ff5b 100644
--- a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Postgres/test_multihop_joined_plan__ep_0.xml
+++ b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Postgres/test_multihop_joined_plan__ep_0.xml
@@ -2,40 +2,40 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Postgres/test_small_combined_metrics_plan__ep_0.xml b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Postgres/test_small_combined_metrics_plan__ep_0.xml
index a41f3173fe..2c6243fd7e 100644
--- a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Postgres/test_small_combined_metrics_plan__ep_0.xml
+++ b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Postgres/test_small_combined_metrics_plan__ep_0.xml
@@ -5,9 +5,9 @@
-
-
-
+
+
+
@@ -21,11 +21,11 @@
-
-
+
+
-
+
@@ -35,13 +35,13 @@
-
+
-
+
-
+
-
+
diff --git a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Redshift/test_combined_metrics_plan__ep_0.xml b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Redshift/test_combined_metrics_plan__ep_0.xml
index 35d3e1ed33..0d67248318 100644
--- a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Redshift/test_combined_metrics_plan__ep_0.xml
+++ b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Redshift/test_combined_metrics_plan__ep_0.xml
@@ -2,85 +2,85 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Redshift/test_joined_plan__ep_0.xml b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Redshift/test_joined_plan__ep_0.xml
index cf1f368a88..6d31dd15e4 100644
--- a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Redshift/test_joined_plan__ep_0.xml
+++ b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Redshift/test_joined_plan__ep_0.xml
@@ -8,9 +8,9 @@
-
-
-
+
+
+
@@ -19,14 +19,14 @@
-
-
+
+
-
+
-
+
-
-
+
+
diff --git a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Redshift/test_multihop_joined_plan__ep_0.xml b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Redshift/test_multihop_joined_plan__ep_0.xml
index f77cd373c7..381230ff5b 100644
--- a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Redshift/test_multihop_joined_plan__ep_0.xml
+++ b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Redshift/test_multihop_joined_plan__ep_0.xml
@@ -2,40 +2,40 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Redshift/test_small_combined_metrics_plan__ep_0.xml b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Redshift/test_small_combined_metrics_plan__ep_0.xml
index a41f3173fe..2c6243fd7e 100644
--- a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Redshift/test_small_combined_metrics_plan__ep_0.xml
+++ b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Redshift/test_small_combined_metrics_plan__ep_0.xml
@@ -5,9 +5,9 @@
-
-
-
+
+
+
@@ -21,11 +21,11 @@
-
-
+
+
-
+
@@ -35,13 +35,13 @@
-
+
-
+
-
+
-
+
diff --git a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Snowflake/test_combined_metrics_plan__ep_0.xml b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Snowflake/test_combined_metrics_plan__ep_0.xml
index 35d3e1ed33..0d67248318 100644
--- a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Snowflake/test_combined_metrics_plan__ep_0.xml
+++ b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Snowflake/test_combined_metrics_plan__ep_0.xml
@@ -2,85 +2,85 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Snowflake/test_joined_plan__ep_0.xml b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Snowflake/test_joined_plan__ep_0.xml
index cf1f368a88..6d31dd15e4 100644
--- a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Snowflake/test_joined_plan__ep_0.xml
+++ b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Snowflake/test_joined_plan__ep_0.xml
@@ -8,9 +8,9 @@
-
-
-
+
+
+
@@ -19,14 +19,14 @@
-
-
+
+
-
+
-
+
-
-
+
+
diff --git a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Snowflake/test_multihop_joined_plan__ep_0.xml b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Snowflake/test_multihop_joined_plan__ep_0.xml
index f77cd373c7..381230ff5b 100644
--- a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Snowflake/test_multihop_joined_plan__ep_0.xml
+++ b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Snowflake/test_multihop_joined_plan__ep_0.xml
@@ -2,40 +2,40 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Snowflake/test_small_combined_metrics_plan__ep_0.xml b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Snowflake/test_small_combined_metrics_plan__ep_0.xml
index a41f3173fe..2c6243fd7e 100644
--- a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Snowflake/test_small_combined_metrics_plan__ep_0.xml
+++ b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Snowflake/test_small_combined_metrics_plan__ep_0.xml
@@ -5,9 +5,9 @@
-
-
-
+
+
+
@@ -21,11 +21,11 @@
-
-
+
+
-
+
@@ -35,13 +35,13 @@
-
+
-
+
-
+
-
+
diff --git a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Trino/test_combined_metrics_plan__ep_0.xml b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Trino/test_combined_metrics_plan__ep_0.xml
index 35d3e1ed33..0d67248318 100644
--- a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Trino/test_combined_metrics_plan__ep_0.xml
+++ b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Trino/test_combined_metrics_plan__ep_0.xml
@@ -2,85 +2,85 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Trino/test_joined_plan__ep_0.xml b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Trino/test_joined_plan__ep_0.xml
index cf1f368a88..6d31dd15e4 100644
--- a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Trino/test_joined_plan__ep_0.xml
+++ b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Trino/test_joined_plan__ep_0.xml
@@ -8,9 +8,9 @@
-
-
-
+
+
+
@@ -19,14 +19,14 @@
-
-
+
+
-
+
-
+
-
-
+
+
diff --git a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Trino/test_multihop_joined_plan__ep_0.xml b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Trino/test_multihop_joined_plan__ep_0.xml
index f77cd373c7..381230ff5b 100644
--- a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Trino/test_multihop_joined_plan__ep_0.xml
+++ b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Trino/test_multihop_joined_plan__ep_0.xml
@@ -2,40 +2,40 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Trino/test_small_combined_metrics_plan__ep_0.xml b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Trino/test_small_combined_metrics_plan__ep_0.xml
index a41f3173fe..2c6243fd7e 100644
--- a/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Trino/test_small_combined_metrics_plan__ep_0.xml
+++ b/metricflow/test/snapshots/test_dataflow_to_execution.py/ExecutionPlan/Trino/test_small_combined_metrics_plan__ep_0.xml
@@ -5,9 +5,9 @@
-
-
-
+
+
+
@@ -21,11 +21,11 @@
-
-
+
+
-
+
@@ -35,13 +35,13 @@
-
+
-
+
-
+
-
+
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_combine_output_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_combine_output_node__plan0.sql
index 395b5b7783..ede62dadf5 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_combine_output_node__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_combine_output_node__plan0.sql
@@ -19,93 +19,93 @@ FROM (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS booking__paid_at__extract_dow
+ , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
) subq_1
GROUP BY
@@ -128,93 +128,93 @@ FULL OUTER JOIN (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS booking__paid_at__extract_dow
+ , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_3
) subq_4
GROUP BY
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_combine_output_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_combine_output_node__plan0_optimized.sql
index d43506f88a..82d615852d 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_combine_output_node__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_combine_output_node__plan0_optimized.sql
@@ -15,7 +15,7 @@ FROM (
SELECT
is_instant
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_7
GROUP BY
is_instant
@@ -33,7 +33,7 @@ FULL OUTER JOIN (
is_instant
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
, guest_id AS bookers
- FROM ***************************.fct_bookings bookings_source_src_28001
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_10
GROUP BY
is_instant
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node__plan0.sql
index 59667d1092..1d9350f10b 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node__plan0.sql
@@ -25,93 +25,93 @@ FROM (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS booking__paid_at__extract_dow
+ , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
) subq_1
LEFT OUTER JOIN (
@@ -123,62 +123,62 @@ FROM (
-- Read Elements From Semantic Model 'listings_latest'
SELECT
1 AS listings
- , listings_latest_src_28005.capacity AS largest_listing
- , listings_latest_src_28005.capacity AS smallest_listing
- , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS ds__day
- , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS ds__week
- , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS ds__month
- , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS ds__quarter
- , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS ds__extract_doy
- , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS created_at__day
- , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS created_at__week
- , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS created_at__month
- , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS created_at__quarter
- , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day
- , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS created_at__extract_dow
- , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS created_at__extract_doy
- , listings_latest_src_28005.country AS country_latest
- , listings_latest_src_28005.is_lux AS is_lux_latest
- , listings_latest_src_28005.capacity AS capacity_latest
- , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS listing__ds__day
- , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS listing__ds__week
- , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS listing__ds__month
- , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS listing__ds__quarter
- , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS listing__ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day
- , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS listing__ds__extract_dow
- , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy
- , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS listing__created_at__day
- , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS listing__created_at__week
- , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS listing__created_at__month
- , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS listing__created_at__quarter
- , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS listing__created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day
- , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS listing__created_at__extract_dow
- , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy
- , listings_latest_src_28005.country AS listing__country_latest
- , listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , listings_latest_src_28005.capacity AS listing__capacity_latest
- , listings_latest_src_28005.listing_id AS listing
- , listings_latest_src_28005.user_id AS user
- , listings_latest_src_28005.user_id AS listing__user
- FROM ***************************.dim_listings_latest listings_latest_src_28005
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS created_at__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 created_at__extract_dow
+ , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS created_at__extract_doy
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__created_at__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__created_at__extract_dow
+ , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_doy
+ , listings_latest_src_28000.country AS listing__country_latest
+ , listings_latest_src_28000.is_lux AS listing__is_lux_latest
+ , listings_latest_src_28000.capacity AS listing__capacity_latest
+ , listings_latest_src_28000.listing_id AS listing
+ , listings_latest_src_28000.user_id AS user
+ , listings_latest_src_28000.user_id AS listing__user
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
) subq_2
) subq_3
ON
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node__plan0_optimized.sql
index 69b81c39cb..39785fc45b 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node__plan0_optimized.sql
@@ -3,7 +3,7 @@
-- Compute Metrics via Expressions
SELECT
subq_7.listing AS listing
- , listings_latest_src_28005.country AS listing__country_latest
+ , listings_latest_src_28000.country AS listing__country_latest
, SUM(subq_7.bookings) AS bookings
FROM (
-- Read Elements From Semantic Model 'bookings_source'
@@ -11,12 +11,12 @@ FROM (
SELECT
listing_id AS listing
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_7
LEFT OUTER JOIN
- ***************************.dim_listings_latest listings_latest_src_28005
+ ***************************.dim_listings_latest listings_latest_src_28000
ON
- subq_7.listing = listings_latest_src_28005.listing_id
+ subq_7.listing = listings_latest_src_28000.listing_id
GROUP BY
listing
, listing__country_latest
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.sql
index c3bfd5547a..e138fde09b 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.sql
@@ -1,693 +1,693 @@
-- Compute Metrics via Expressions
SELECT
- subq_20.ds__day
- , subq_20.listing__country_latest
- , CAST(subq_20.bookings AS FLOAT64) / CAST(NULLIF(subq_20.views, 0) AS FLOAT64) AS bookings_per_view
+ subq_29.ds__day
+ , subq_29.listing__country_latest
+ , CAST(subq_29.bookings AS FLOAT64) / CAST(NULLIF(subq_29.views, 0) AS FLOAT64) AS bookings_per_view
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_9.ds__day, subq_19.ds__day) AS ds__day
- , COALESCE(subq_9.listing__country_latest, subq_19.listing__country_latest) AS listing__country_latest
- , MAX(subq_9.bookings) AS bookings
- , MAX(subq_19.views) AS views
+ COALESCE(subq_18.ds__day, subq_28.ds__day) AS ds__day
+ , COALESCE(subq_18.listing__country_latest, subq_28.listing__country_latest) AS listing__country_latest
+ , MAX(subq_18.bookings) AS bookings
+ , MAX(subq_28.views) AS views
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_8.ds__day
- , subq_8.listing__country_latest
- , subq_8.bookings
+ subq_17.ds__day
+ , subq_17.listing__country_latest
+ , subq_17.bookings
FROM (
-- Aggregate Measures
SELECT
- subq_7.ds__day
- , subq_7.listing__country_latest
- , SUM(subq_7.bookings) AS bookings
+ subq_16.ds__day
+ , subq_16.listing__country_latest
+ , SUM(subq_16.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'listing__country_latest', 'ds__day']
SELECT
- subq_6.ds__day
- , subq_6.listing__country_latest
- , subq_6.bookings
+ subq_15.ds__day
+ , subq_15.listing__country_latest
+ , subq_15.bookings
FROM (
-- Join Standard Outputs
SELECT
- subq_2.ds__day AS ds__day
- , subq_2.listing AS listing
- , subq_5.country_latest AS listing__country_latest
- , subq_2.bookings AS bookings
+ subq_11.ds__day AS ds__day
+ , subq_11.listing AS listing
+ , subq_14.country_latest AS listing__country_latest
+ , subq_11.bookings AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'ds__day', 'listing']
SELECT
- subq_1.ds__day
- , subq_1.listing
- , subq_1.bookings
+ subq_10.ds__day
+ , subq_10.listing
+ , subq_10.bookings
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
- ) subq_2
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS booking__paid_at__extract_dow
+ , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
LEFT OUTER JOIN (
-- Pass Only Elements: ['country_latest', 'listing']
SELECT
- subq_4.listing
- , subq_4.country_latest
+ subq_13.listing
+ , subq_13.country_latest
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_3.ds__day
- , subq_3.ds__week
- , subq_3.ds__month
- , subq_3.ds__quarter
- , subq_3.ds__year
- , subq_3.ds__extract_year
- , subq_3.ds__extract_quarter
- , subq_3.ds__extract_month
- , subq_3.ds__extract_day
- , subq_3.ds__extract_dow
- , subq_3.ds__extract_doy
- , subq_3.created_at__day
- , subq_3.created_at__week
- , subq_3.created_at__month
- , subq_3.created_at__quarter
- , subq_3.created_at__year
- , subq_3.created_at__extract_year
- , subq_3.created_at__extract_quarter
- , subq_3.created_at__extract_month
- , subq_3.created_at__extract_day
- , subq_3.created_at__extract_dow
- , subq_3.created_at__extract_doy
- , subq_3.listing__ds__day
- , subq_3.listing__ds__week
- , subq_3.listing__ds__month
- , subq_3.listing__ds__quarter
- , subq_3.listing__ds__year
- , subq_3.listing__ds__extract_year
- , subq_3.listing__ds__extract_quarter
- , subq_3.listing__ds__extract_month
- , subq_3.listing__ds__extract_day
- , subq_3.listing__ds__extract_dow
- , subq_3.listing__ds__extract_doy
- , subq_3.listing__created_at__day
- , subq_3.listing__created_at__week
- , subq_3.listing__created_at__month
- , subq_3.listing__created_at__quarter
- , subq_3.listing__created_at__year
- , subq_3.listing__created_at__extract_year
- , subq_3.listing__created_at__extract_quarter
- , subq_3.listing__created_at__extract_month
- , subq_3.listing__created_at__extract_day
- , subq_3.listing__created_at__extract_dow
- , subq_3.listing__created_at__extract_doy
- , subq_3.ds__day AS metric_time__day
- , subq_3.ds__week AS metric_time__week
- , subq_3.ds__month AS metric_time__month
- , subq_3.ds__quarter AS metric_time__quarter
- , subq_3.ds__year AS metric_time__year
- , subq_3.ds__extract_year AS metric_time__extract_year
- , subq_3.ds__extract_quarter AS metric_time__extract_quarter
- , subq_3.ds__extract_month AS metric_time__extract_month
- , subq_3.ds__extract_day AS metric_time__extract_day
- , subq_3.ds__extract_dow AS metric_time__extract_dow
- , subq_3.ds__extract_doy AS metric_time__extract_doy
- , subq_3.listing
- , subq_3.user
- , subq_3.listing__user
- , subq_3.country_latest
- , subq_3.is_lux_latest
- , subq_3.capacity_latest
- , subq_3.listing__country_latest
- , subq_3.listing__is_lux_latest
- , subq_3.listing__capacity_latest
- , subq_3.listings
- , subq_3.largest_listing
- , subq_3.smallest_listing
+ subq_12.ds__day
+ , subq_12.ds__week
+ , subq_12.ds__month
+ , subq_12.ds__quarter
+ , subq_12.ds__year
+ , subq_12.ds__extract_year
+ , subq_12.ds__extract_quarter
+ , subq_12.ds__extract_month
+ , subq_12.ds__extract_day
+ , subq_12.ds__extract_dow
+ , subq_12.ds__extract_doy
+ , subq_12.created_at__day
+ , subq_12.created_at__week
+ , subq_12.created_at__month
+ , subq_12.created_at__quarter
+ , subq_12.created_at__year
+ , subq_12.created_at__extract_year
+ , subq_12.created_at__extract_quarter
+ , subq_12.created_at__extract_month
+ , subq_12.created_at__extract_day
+ , subq_12.created_at__extract_dow
+ , subq_12.created_at__extract_doy
+ , subq_12.listing__ds__day
+ , subq_12.listing__ds__week
+ , subq_12.listing__ds__month
+ , subq_12.listing__ds__quarter
+ , subq_12.listing__ds__year
+ , subq_12.listing__ds__extract_year
+ , subq_12.listing__ds__extract_quarter
+ , subq_12.listing__ds__extract_month
+ , subq_12.listing__ds__extract_day
+ , subq_12.listing__ds__extract_dow
+ , subq_12.listing__ds__extract_doy
+ , subq_12.listing__created_at__day
+ , subq_12.listing__created_at__week
+ , subq_12.listing__created_at__month
+ , subq_12.listing__created_at__quarter
+ , subq_12.listing__created_at__year
+ , subq_12.listing__created_at__extract_year
+ , subq_12.listing__created_at__extract_quarter
+ , subq_12.listing__created_at__extract_month
+ , subq_12.listing__created_at__extract_day
+ , subq_12.listing__created_at__extract_dow
+ , subq_12.listing__created_at__extract_doy
+ , subq_12.ds__day AS metric_time__day
+ , subq_12.ds__week AS metric_time__week
+ , subq_12.ds__month AS metric_time__month
+ , subq_12.ds__quarter AS metric_time__quarter
+ , subq_12.ds__year AS metric_time__year
+ , subq_12.ds__extract_year AS metric_time__extract_year
+ , subq_12.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_12.ds__extract_month AS metric_time__extract_month
+ , subq_12.ds__extract_day AS metric_time__extract_day
+ , subq_12.ds__extract_dow AS metric_time__extract_dow
+ , subq_12.ds__extract_doy AS metric_time__extract_doy
+ , subq_12.listing
+ , subq_12.user
+ , subq_12.listing__user
+ , subq_12.country_latest
+ , subq_12.is_lux_latest
+ , subq_12.capacity_latest
+ , subq_12.listing__country_latest
+ , subq_12.listing__is_lux_latest
+ , subq_12.listing__capacity_latest
+ , subq_12.listings
+ , subq_12.largest_listing
+ , subq_12.smallest_listing
FROM (
-- Read Elements From Semantic Model 'listings_latest'
SELECT
1 AS listings
- , listings_latest_src_28005.capacity AS largest_listing
- , listings_latest_src_28005.capacity AS smallest_listing
- , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS ds__day
- , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS ds__week
- , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS ds__month
- , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS ds__quarter
- , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS ds__extract_doy
- , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS created_at__day
- , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS created_at__week
- , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS created_at__month
- , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS created_at__quarter
- , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day
- , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS created_at__extract_dow
- , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS created_at__extract_doy
- , listings_latest_src_28005.country AS country_latest
- , listings_latest_src_28005.is_lux AS is_lux_latest
- , listings_latest_src_28005.capacity AS capacity_latest
- , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS listing__ds__day
- , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS listing__ds__week
- , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS listing__ds__month
- , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS listing__ds__quarter
- , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS listing__ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day
- , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS listing__ds__extract_dow
- , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy
- , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS listing__created_at__day
- , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS listing__created_at__week
- , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS listing__created_at__month
- , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS listing__created_at__quarter
- , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS listing__created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day
- , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS listing__created_at__extract_dow
- , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy
- , listings_latest_src_28005.country AS listing__country_latest
- , listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , listings_latest_src_28005.capacity AS listing__capacity_latest
- , listings_latest_src_28005.listing_id AS listing
- , listings_latest_src_28005.user_id AS user
- , listings_latest_src_28005.user_id AS listing__user
- FROM ***************************.dim_listings_latest listings_latest_src_28005
- ) subq_3
- ) subq_4
- ) subq_5
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS created_at__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 created_at__extract_dow
+ , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS created_at__extract_doy
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__created_at__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__created_at__extract_dow
+ , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_doy
+ , listings_latest_src_28000.country AS listing__country_latest
+ , listings_latest_src_28000.is_lux AS listing__is_lux_latest
+ , listings_latest_src_28000.capacity AS listing__capacity_latest
+ , listings_latest_src_28000.listing_id AS listing
+ , listings_latest_src_28000.user_id AS user
+ , listings_latest_src_28000.user_id AS listing__user
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
+ ) subq_12
+ ) subq_13
+ ) subq_14
ON
- subq_2.listing = subq_5.listing
- ) subq_6
- ) subq_7
+ subq_11.listing = subq_14.listing
+ ) subq_15
+ ) subq_16
GROUP BY
ds__day
, listing__country_latest
- ) subq_8
- ) subq_9
+ ) subq_17
+ ) subq_18
FULL OUTER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_18.ds__day
- , subq_18.listing__country_latest
- , subq_18.views
+ subq_27.ds__day
+ , subq_27.listing__country_latest
+ , subq_27.views
FROM (
-- Aggregate Measures
SELECT
- subq_17.ds__day
- , subq_17.listing__country_latest
- , SUM(subq_17.views) AS views
+ subq_26.ds__day
+ , subq_26.listing__country_latest
+ , SUM(subq_26.views) AS views
FROM (
-- Pass Only Elements: ['views', 'listing__country_latest', 'ds__day']
SELECT
- subq_16.ds__day
- , subq_16.listing__country_latest
- , subq_16.views
+ subq_25.ds__day
+ , subq_25.listing__country_latest
+ , subq_25.views
FROM (
-- Join Standard Outputs
SELECT
- subq_12.ds__day AS ds__day
- , subq_12.listing AS listing
- , subq_15.country_latest AS listing__country_latest
- , subq_12.views AS views
+ subq_21.ds__day AS ds__day
+ , subq_21.listing AS listing
+ , subq_24.country_latest AS listing__country_latest
+ , subq_21.views AS views
FROM (
-- Pass Only Elements: ['views', 'ds__day', 'listing']
SELECT
- subq_11.ds__day
- , subq_11.listing
- , subq_11.views
+ subq_20.ds__day
+ , subq_20.listing
+ , subq_20.views
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_10.ds__day
- , subq_10.ds__week
- , subq_10.ds__month
- , subq_10.ds__quarter
- , subq_10.ds__year
- , subq_10.ds__extract_year
- , subq_10.ds__extract_quarter
- , subq_10.ds__extract_month
- , subq_10.ds__extract_day
- , subq_10.ds__extract_dow
- , subq_10.ds__extract_doy
- , subq_10.ds_partitioned__day
- , subq_10.ds_partitioned__week
- , subq_10.ds_partitioned__month
- , subq_10.ds_partitioned__quarter
- , subq_10.ds_partitioned__year
- , subq_10.ds_partitioned__extract_year
- , subq_10.ds_partitioned__extract_quarter
- , subq_10.ds_partitioned__extract_month
- , subq_10.ds_partitioned__extract_day
- , subq_10.ds_partitioned__extract_dow
- , subq_10.ds_partitioned__extract_doy
- , subq_10.view__ds__day
- , subq_10.view__ds__week
- , subq_10.view__ds__month
- , subq_10.view__ds__quarter
- , subq_10.view__ds__year
- , subq_10.view__ds__extract_year
- , subq_10.view__ds__extract_quarter
- , subq_10.view__ds__extract_month
- , subq_10.view__ds__extract_day
- , subq_10.view__ds__extract_dow
- , subq_10.view__ds__extract_doy
- , subq_10.view__ds_partitioned__day
- , subq_10.view__ds_partitioned__week
- , subq_10.view__ds_partitioned__month
- , subq_10.view__ds_partitioned__quarter
- , subq_10.view__ds_partitioned__year
- , subq_10.view__ds_partitioned__extract_year
- , subq_10.view__ds_partitioned__extract_quarter
- , subq_10.view__ds_partitioned__extract_month
- , subq_10.view__ds_partitioned__extract_day
- , subq_10.view__ds_partitioned__extract_dow
- , subq_10.view__ds_partitioned__extract_doy
- , subq_10.ds__day AS metric_time__day
- , subq_10.ds__week AS metric_time__week
- , subq_10.ds__month AS metric_time__month
- , subq_10.ds__quarter AS metric_time__quarter
- , subq_10.ds__year AS metric_time__year
- , subq_10.ds__extract_year AS metric_time__extract_year
- , subq_10.ds__extract_quarter AS metric_time__extract_quarter
- , subq_10.ds__extract_month AS metric_time__extract_month
- , subq_10.ds__extract_day AS metric_time__extract_day
- , subq_10.ds__extract_dow AS metric_time__extract_dow
- , subq_10.ds__extract_doy AS metric_time__extract_doy
- , subq_10.listing
- , subq_10.user
- , subq_10.view__listing
- , subq_10.view__user
- , subq_10.views
+ subq_19.ds__day
+ , subq_19.ds__week
+ , subq_19.ds__month
+ , subq_19.ds__quarter
+ , subq_19.ds__year
+ , subq_19.ds__extract_year
+ , subq_19.ds__extract_quarter
+ , subq_19.ds__extract_month
+ , subq_19.ds__extract_day
+ , subq_19.ds__extract_dow
+ , subq_19.ds__extract_doy
+ , subq_19.ds_partitioned__day
+ , subq_19.ds_partitioned__week
+ , subq_19.ds_partitioned__month
+ , subq_19.ds_partitioned__quarter
+ , subq_19.ds_partitioned__year
+ , subq_19.ds_partitioned__extract_year
+ , subq_19.ds_partitioned__extract_quarter
+ , subq_19.ds_partitioned__extract_month
+ , subq_19.ds_partitioned__extract_day
+ , subq_19.ds_partitioned__extract_dow
+ , subq_19.ds_partitioned__extract_doy
+ , subq_19.view__ds__day
+ , subq_19.view__ds__week
+ , subq_19.view__ds__month
+ , subq_19.view__ds__quarter
+ , subq_19.view__ds__year
+ , subq_19.view__ds__extract_year
+ , subq_19.view__ds__extract_quarter
+ , subq_19.view__ds__extract_month
+ , subq_19.view__ds__extract_day
+ , subq_19.view__ds__extract_dow
+ , subq_19.view__ds__extract_doy
+ , subq_19.view__ds_partitioned__day
+ , subq_19.view__ds_partitioned__week
+ , subq_19.view__ds_partitioned__month
+ , subq_19.view__ds_partitioned__quarter
+ , subq_19.view__ds_partitioned__year
+ , subq_19.view__ds_partitioned__extract_year
+ , subq_19.view__ds_partitioned__extract_quarter
+ , subq_19.view__ds_partitioned__extract_month
+ , subq_19.view__ds_partitioned__extract_day
+ , subq_19.view__ds_partitioned__extract_dow
+ , subq_19.view__ds_partitioned__extract_doy
+ , subq_19.ds__day AS metric_time__day
+ , subq_19.ds__week AS metric_time__week
+ , subq_19.ds__month AS metric_time__month
+ , subq_19.ds__quarter AS metric_time__quarter
+ , subq_19.ds__year AS metric_time__year
+ , subq_19.ds__extract_year AS metric_time__extract_year
+ , subq_19.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_19.ds__extract_month AS metric_time__extract_month
+ , subq_19.ds__extract_day AS metric_time__extract_day
+ , subq_19.ds__extract_dow AS metric_time__extract_dow
+ , subq_19.ds__extract_doy AS metric_time__extract_doy
+ , subq_19.listing
+ , subq_19.user
+ , subq_19.view__listing
+ , subq_19.view__user
+ , subq_19.views
FROM (
-- Read Elements From Semantic Model 'views_source'
SELECT
1 AS views
- , DATE_TRUNC(views_source_src_28010.ds, day) AS ds__day
- , DATE_TRUNC(views_source_src_28010.ds, isoweek) AS ds__week
- , DATE_TRUNC(views_source_src_28010.ds, month) AS ds__month
- , DATE_TRUNC(views_source_src_28010.ds, quarter) AS ds__quarter
- , DATE_TRUNC(views_source_src_28010.ds, year) AS ds__year
- , EXTRACT(year FROM views_source_src_28010.ds) AS ds__extract_year
- , EXTRACT(quarter FROM views_source_src_28010.ds) AS ds__extract_quarter
- , EXTRACT(month FROM views_source_src_28010.ds) AS ds__extract_month
- , EXTRACT(day FROM views_source_src_28010.ds) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM views_source_src_28010.ds) = 1, 7, EXTRACT(dayofweek FROM views_source_src_28010.ds) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM views_source_src_28010.ds) AS ds__extract_doy
- , DATE_TRUNC(views_source_src_28010.ds_partitioned, day) AS ds_partitioned__day
- , DATE_TRUNC(views_source_src_28010.ds_partitioned, isoweek) AS ds_partitioned__week
- , DATE_TRUNC(views_source_src_28010.ds_partitioned, month) AS ds_partitioned__month
- , DATE_TRUNC(views_source_src_28010.ds_partitioned, quarter) AS ds_partitioned__quarter
- , DATE_TRUNC(views_source_src_28010.ds_partitioned, year) AS ds_partitioned__year
- , EXTRACT(year FROM views_source_src_28010.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM views_source_src_28010.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM views_source_src_28010.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM views_source_src_28010.ds_partitioned) AS ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM views_source_src_28010.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM views_source_src_28010.ds_partitioned) - 1) AS ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM views_source_src_28010.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC(views_source_src_28010.ds, day) AS view__ds__day
- , DATE_TRUNC(views_source_src_28010.ds, isoweek) AS view__ds__week
- , DATE_TRUNC(views_source_src_28010.ds, month) AS view__ds__month
- , DATE_TRUNC(views_source_src_28010.ds, quarter) AS view__ds__quarter
- , DATE_TRUNC(views_source_src_28010.ds, year) AS view__ds__year
- , EXTRACT(year FROM views_source_src_28010.ds) AS view__ds__extract_year
- , EXTRACT(quarter FROM views_source_src_28010.ds) AS view__ds__extract_quarter
- , EXTRACT(month FROM views_source_src_28010.ds) AS view__ds__extract_month
- , EXTRACT(day FROM views_source_src_28010.ds) AS view__ds__extract_day
- , IF(EXTRACT(dayofweek FROM views_source_src_28010.ds) = 1, 7, EXTRACT(dayofweek FROM views_source_src_28010.ds) - 1) AS view__ds__extract_dow
- , EXTRACT(dayofyear FROM views_source_src_28010.ds) AS view__ds__extract_doy
- , DATE_TRUNC(views_source_src_28010.ds_partitioned, day) AS view__ds_partitioned__day
- , DATE_TRUNC(views_source_src_28010.ds_partitioned, isoweek) AS view__ds_partitioned__week
- , DATE_TRUNC(views_source_src_28010.ds_partitioned, month) AS view__ds_partitioned__month
- , DATE_TRUNC(views_source_src_28010.ds_partitioned, quarter) AS view__ds_partitioned__quarter
- , DATE_TRUNC(views_source_src_28010.ds_partitioned, year) AS view__ds_partitioned__year
- , EXTRACT(year FROM views_source_src_28010.ds_partitioned) AS view__ds_partitioned__extract_year
- , EXTRACT(quarter FROM views_source_src_28010.ds_partitioned) AS view__ds_partitioned__extract_quarter
- , EXTRACT(month FROM views_source_src_28010.ds_partitioned) AS view__ds_partitioned__extract_month
- , EXTRACT(day FROM views_source_src_28010.ds_partitioned) AS view__ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM views_source_src_28010.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM views_source_src_28010.ds_partitioned) - 1) AS view__ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM views_source_src_28010.ds_partitioned) AS view__ds_partitioned__extract_doy
- , views_source_src_28010.listing_id AS listing
- , views_source_src_28010.user_id AS user
- , views_source_src_28010.listing_id AS view__listing
- , views_source_src_28010.user_id AS view__user
- FROM ***************************.fct_views views_source_src_28010
- ) subq_10
- ) subq_11
- ) subq_12
+ , 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
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM views_source_src_28000.ds_partitioned) AS view__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 view__ds_partitioned__extract_dow
+ , EXTRACT(dayofyear FROM views_source_src_28000.ds_partitioned) AS view__ds_partitioned__extract_doy
+ , views_source_src_28000.listing_id AS listing
+ , views_source_src_28000.user_id AS user
+ , views_source_src_28000.listing_id AS view__listing
+ , views_source_src_28000.user_id AS view__user
+ FROM ***************************.fct_views views_source_src_28000
+ ) subq_19
+ ) subq_20
+ ) subq_21
LEFT OUTER JOIN (
-- Pass Only Elements: ['country_latest', 'listing']
SELECT
- subq_14.listing
- , subq_14.country_latest
+ subq_23.listing
+ , subq_23.country_latest
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_13.ds__day
- , subq_13.ds__week
- , subq_13.ds__month
- , subq_13.ds__quarter
- , subq_13.ds__year
- , subq_13.ds__extract_year
- , subq_13.ds__extract_quarter
- , subq_13.ds__extract_month
- , subq_13.ds__extract_day
- , subq_13.ds__extract_dow
- , subq_13.ds__extract_doy
- , subq_13.created_at__day
- , subq_13.created_at__week
- , subq_13.created_at__month
- , subq_13.created_at__quarter
- , subq_13.created_at__year
- , subq_13.created_at__extract_year
- , subq_13.created_at__extract_quarter
- , subq_13.created_at__extract_month
- , subq_13.created_at__extract_day
- , subq_13.created_at__extract_dow
- , subq_13.created_at__extract_doy
- , subq_13.listing__ds__day
- , subq_13.listing__ds__week
- , subq_13.listing__ds__month
- , subq_13.listing__ds__quarter
- , subq_13.listing__ds__year
- , subq_13.listing__ds__extract_year
- , subq_13.listing__ds__extract_quarter
- , subq_13.listing__ds__extract_month
- , subq_13.listing__ds__extract_day
- , subq_13.listing__ds__extract_dow
- , subq_13.listing__ds__extract_doy
- , subq_13.listing__created_at__day
- , subq_13.listing__created_at__week
- , subq_13.listing__created_at__month
- , subq_13.listing__created_at__quarter
- , subq_13.listing__created_at__year
- , subq_13.listing__created_at__extract_year
- , subq_13.listing__created_at__extract_quarter
- , subq_13.listing__created_at__extract_month
- , subq_13.listing__created_at__extract_day
- , subq_13.listing__created_at__extract_dow
- , subq_13.listing__created_at__extract_doy
- , subq_13.ds__day AS metric_time__day
- , subq_13.ds__week AS metric_time__week
- , subq_13.ds__month AS metric_time__month
- , subq_13.ds__quarter AS metric_time__quarter
- , subq_13.ds__year AS metric_time__year
- , subq_13.ds__extract_year AS metric_time__extract_year
- , subq_13.ds__extract_quarter AS metric_time__extract_quarter
- , subq_13.ds__extract_month AS metric_time__extract_month
- , subq_13.ds__extract_day AS metric_time__extract_day
- , subq_13.ds__extract_dow AS metric_time__extract_dow
- , subq_13.ds__extract_doy AS metric_time__extract_doy
- , subq_13.listing
- , subq_13.user
- , subq_13.listing__user
- , subq_13.country_latest
- , subq_13.is_lux_latest
- , subq_13.capacity_latest
- , subq_13.listing__country_latest
- , subq_13.listing__is_lux_latest
- , subq_13.listing__capacity_latest
- , subq_13.listings
- , subq_13.largest_listing
- , subq_13.smallest_listing
+ subq_22.ds__day
+ , subq_22.ds__week
+ , subq_22.ds__month
+ , subq_22.ds__quarter
+ , subq_22.ds__year
+ , subq_22.ds__extract_year
+ , subq_22.ds__extract_quarter
+ , subq_22.ds__extract_month
+ , subq_22.ds__extract_day
+ , subq_22.ds__extract_dow
+ , subq_22.ds__extract_doy
+ , subq_22.created_at__day
+ , subq_22.created_at__week
+ , subq_22.created_at__month
+ , subq_22.created_at__quarter
+ , subq_22.created_at__year
+ , subq_22.created_at__extract_year
+ , subq_22.created_at__extract_quarter
+ , subq_22.created_at__extract_month
+ , subq_22.created_at__extract_day
+ , subq_22.created_at__extract_dow
+ , subq_22.created_at__extract_doy
+ , subq_22.listing__ds__day
+ , subq_22.listing__ds__week
+ , subq_22.listing__ds__month
+ , subq_22.listing__ds__quarter
+ , subq_22.listing__ds__year
+ , subq_22.listing__ds__extract_year
+ , subq_22.listing__ds__extract_quarter
+ , subq_22.listing__ds__extract_month
+ , subq_22.listing__ds__extract_day
+ , subq_22.listing__ds__extract_dow
+ , subq_22.listing__ds__extract_doy
+ , subq_22.listing__created_at__day
+ , subq_22.listing__created_at__week
+ , subq_22.listing__created_at__month
+ , subq_22.listing__created_at__quarter
+ , subq_22.listing__created_at__year
+ , subq_22.listing__created_at__extract_year
+ , subq_22.listing__created_at__extract_quarter
+ , subq_22.listing__created_at__extract_month
+ , subq_22.listing__created_at__extract_day
+ , subq_22.listing__created_at__extract_dow
+ , subq_22.listing__created_at__extract_doy
+ , subq_22.ds__day AS metric_time__day
+ , subq_22.ds__week AS metric_time__week
+ , subq_22.ds__month AS metric_time__month
+ , subq_22.ds__quarter AS metric_time__quarter
+ , subq_22.ds__year AS metric_time__year
+ , subq_22.ds__extract_year AS metric_time__extract_year
+ , subq_22.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_22.ds__extract_month AS metric_time__extract_month
+ , subq_22.ds__extract_day AS metric_time__extract_day
+ , subq_22.ds__extract_dow AS metric_time__extract_dow
+ , subq_22.ds__extract_doy AS metric_time__extract_doy
+ , subq_22.listing
+ , subq_22.user
+ , subq_22.listing__user
+ , subq_22.country_latest
+ , subq_22.is_lux_latest
+ , subq_22.capacity_latest
+ , subq_22.listing__country_latest
+ , subq_22.listing__is_lux_latest
+ , subq_22.listing__capacity_latest
+ , subq_22.listings
+ , subq_22.largest_listing
+ , subq_22.smallest_listing
FROM (
-- Read Elements From Semantic Model 'listings_latest'
SELECT
1 AS listings
- , listings_latest_src_28005.capacity AS largest_listing
- , listings_latest_src_28005.capacity AS smallest_listing
- , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS ds__day
- , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS ds__week
- , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS ds__month
- , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS ds__quarter
- , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS ds__extract_doy
- , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS created_at__day
- , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS created_at__week
- , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS created_at__month
- , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS created_at__quarter
- , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day
- , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS created_at__extract_dow
- , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS created_at__extract_doy
- , listings_latest_src_28005.country AS country_latest
- , listings_latest_src_28005.is_lux AS is_lux_latest
- , listings_latest_src_28005.capacity AS capacity_latest
- , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS listing__ds__day
- , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS listing__ds__week
- , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS listing__ds__month
- , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS listing__ds__quarter
- , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS listing__ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day
- , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS listing__ds__extract_dow
- , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy
- , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS listing__created_at__day
- , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS listing__created_at__week
- , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS listing__created_at__month
- , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS listing__created_at__quarter
- , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS listing__created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day
- , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS listing__created_at__extract_dow
- , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy
- , listings_latest_src_28005.country AS listing__country_latest
- , listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , listings_latest_src_28005.capacity AS listing__capacity_latest
- , listings_latest_src_28005.listing_id AS listing
- , listings_latest_src_28005.user_id AS user
- , listings_latest_src_28005.user_id AS listing__user
- FROM ***************************.dim_listings_latest listings_latest_src_28005
- ) subq_13
- ) subq_14
- ) subq_15
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS created_at__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 created_at__extract_dow
+ , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS created_at__extract_doy
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__created_at__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__created_at__extract_dow
+ , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_doy
+ , listings_latest_src_28000.country AS listing__country_latest
+ , listings_latest_src_28000.is_lux AS listing__is_lux_latest
+ , listings_latest_src_28000.capacity AS listing__capacity_latest
+ , listings_latest_src_28000.listing_id AS listing
+ , listings_latest_src_28000.user_id AS user
+ , listings_latest_src_28000.user_id AS listing__user
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
+ ) subq_22
+ ) subq_23
+ ) subq_24
ON
- subq_12.listing = subq_15.listing
- ) subq_16
- ) subq_17
+ subq_21.listing = subq_24.listing
+ ) subq_25
+ ) subq_26
GROUP BY
ds__day
, listing__country_latest
- ) subq_18
- ) subq_19
+ ) subq_27
+ ) subq_28
ON
(
- subq_9.listing__country_latest = subq_19.listing__country_latest
+ subq_18.listing__country_latest = subq_28.listing__country_latest
) AND (
- subq_9.ds__day = subq_19.ds__day
+ subq_18.ds__day = subq_28.ds__day
)
GROUP BY
ds__day
, listing__country_latest
-) subq_20
+) subq_29
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0_optimized.sql
index 4075d1f5ce..e9b09f77b3 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0_optimized.sql
@@ -6,19 +6,19 @@ SELECT
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_30.ds__day, subq_40.ds__day) AS ds__day
- , COALESCE(subq_30.listing__country_latest, subq_40.listing__country_latest) AS listing__country_latest
- , MAX(subq_30.bookings) AS bookings
- , MAX(subq_40.views) AS views
+ COALESCE(subq_39.ds__day, subq_49.ds__day) AS ds__day
+ , COALESCE(subq_39.listing__country_latest, subq_49.listing__country_latest) AS listing__country_latest
+ , MAX(subq_39.bookings) AS bookings
+ , MAX(subq_49.views) AS views
FROM (
-- Join Standard Outputs
-- Pass Only Elements: ['bookings', 'listing__country_latest', 'ds__day']
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_23.ds__day AS ds__day
- , listings_latest_src_28005.country AS listing__country_latest
- , SUM(subq_23.bookings) AS bookings
+ subq_32.ds__day AS ds__day
+ , listings_latest_src_28000.country AS listing__country_latest
+ , SUM(subq_32.bookings) AS bookings
FROM (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
@@ -27,25 +27,25 @@ FROM (
DATE_TRUNC(ds, day) AS ds__day
, listing_id AS listing
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_23
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_32
LEFT OUTER JOIN
- ***************************.dim_listings_latest listings_latest_src_28005
+ ***************************.dim_listings_latest listings_latest_src_28000
ON
- subq_23.listing = listings_latest_src_28005.listing_id
+ subq_32.listing = listings_latest_src_28000.listing_id
GROUP BY
ds__day
, listing__country_latest
- ) subq_30
+ ) subq_39
FULL OUTER JOIN (
-- Join Standard Outputs
-- Pass Only Elements: ['views', 'listing__country_latest', 'ds__day']
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_33.ds__day AS ds__day
- , listings_latest_src_28005.country AS listing__country_latest
- , SUM(subq_33.views) AS views
+ subq_42.ds__day AS ds__day
+ , listings_latest_src_28000.country AS listing__country_latest
+ , SUM(subq_42.views) AS views
FROM (
-- Read Elements From Semantic Model 'views_source'
-- Metric Time Dimension 'ds'
@@ -54,23 +54,23 @@ FROM (
DATE_TRUNC(ds, day) AS ds__day
, listing_id AS listing
, 1 AS views
- FROM ***************************.fct_views views_source_src_28010
- ) subq_33
+ FROM ***************************.fct_views views_source_src_28000
+ ) subq_42
LEFT OUTER JOIN
- ***************************.dim_listings_latest listings_latest_src_28005
+ ***************************.dim_listings_latest listings_latest_src_28000
ON
- subq_33.listing = listings_latest_src_28005.listing_id
+ subq_42.listing = listings_latest_src_28000.listing_id
GROUP BY
ds__day
, listing__country_latest
- ) subq_40
+ ) subq_49
ON
(
- subq_30.listing__country_latest = subq_40.listing__country_latest
+ subq_39.listing__country_latest = subq_49.listing__country_latest
) AND (
- subq_30.ds__day = subq_40.ds__day
+ subq_39.ds__day = subq_49.ds__day
)
GROUP BY
ds__day
, listing__country_latest
-) subq_41
+) subq_50
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.sql
index 691359df82..53c5458c05 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.sql
@@ -28,93 +28,93 @@ FROM (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS booking__paid_at__extract_dow
+ , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
) subq_1
LEFT OUTER JOIN (
@@ -126,62 +126,62 @@ FROM (
-- Read Elements From Semantic Model 'listings_latest'
SELECT
1 AS listings
- , listings_latest_src_28005.capacity AS largest_listing
- , listings_latest_src_28005.capacity AS smallest_listing
- , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS ds__day
- , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS ds__week
- , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS ds__month
- , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS ds__quarter
- , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS ds__extract_doy
- , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS created_at__day
- , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS created_at__week
- , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS created_at__month
- , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS created_at__quarter
- , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day
- , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS created_at__extract_dow
- , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS created_at__extract_doy
- , listings_latest_src_28005.country AS country_latest
- , listings_latest_src_28005.is_lux AS is_lux_latest
- , listings_latest_src_28005.capacity AS capacity_latest
- , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS listing__ds__day
- , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS listing__ds__week
- , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS listing__ds__month
- , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS listing__ds__quarter
- , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS listing__ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day
- , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS listing__ds__extract_dow
- , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy
- , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS listing__created_at__day
- , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS listing__created_at__week
- , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS listing__created_at__month
- , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS listing__created_at__quarter
- , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS listing__created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day
- , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS listing__created_at__extract_dow
- , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy
- , listings_latest_src_28005.country AS listing__country_latest
- , listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , listings_latest_src_28005.capacity AS listing__capacity_latest
- , listings_latest_src_28005.listing_id AS listing
- , listings_latest_src_28005.user_id AS user
- , listings_latest_src_28005.user_id AS listing__user
- FROM ***************************.dim_listings_latest listings_latest_src_28005
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS created_at__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 created_at__extract_dow
+ , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS created_at__extract_doy
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__created_at__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__created_at__extract_dow
+ , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_doy
+ , listings_latest_src_28000.country AS listing__country_latest
+ , listings_latest_src_28000.is_lux AS listing__is_lux_latest
+ , listings_latest_src_28000.capacity AS listing__capacity_latest
+ , listings_latest_src_28000.listing_id AS listing
+ , listings_latest_src_28000.user_id AS user
+ , listings_latest_src_28000.user_id AS listing__user
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
) subq_2
) subq_3
ON
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node_ratio_from_single_semantic_model__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node_ratio_from_single_semantic_model__plan0_optimized.sql
index e61134a4ec..2d92a0b0ea 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node_ratio_from_single_semantic_model__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node_ratio_from_single_semantic_model__plan0_optimized.sql
@@ -8,7 +8,7 @@ FROM (
-- Aggregate Measures
SELECT
subq_7.listing AS listing
- , listings_latest_src_28005.country AS listing__country_latest
+ , listings_latest_src_28000.country AS listing__country_latest
, SUM(subq_7.bookings) AS bookings
, COUNT(DISTINCT subq_7.bookers) AS bookers
FROM (
@@ -18,12 +18,12 @@ FROM (
listing_id AS listing
, 1 AS bookings
, guest_id AS bookers
- FROM ***************************.fct_bookings bookings_source_src_28001
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_7
LEFT OUTER JOIN
- ***************************.dim_listings_latest listings_latest_src_28005
+ ***************************.dim_listings_latest listings_latest_src_28000
ON
- subq_7.listing = listings_latest_src_28005.listing_id
+ subq_7.listing = listings_latest_src_28000.listing_id
GROUP BY
listing
, listing__country_latest
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node_simple_expr__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node_simple_expr__plan0.sql
index 95a8a594e8..bb6a7cc7c8 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node_simple_expr__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node_simple_expr__plan0.sql
@@ -25,93 +25,93 @@ FROM (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS booking__paid_at__extract_dow
+ , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
) subq_1
LEFT OUTER JOIN (
@@ -123,62 +123,62 @@ FROM (
-- Read Elements From Semantic Model 'listings_latest'
SELECT
1 AS listings
- , listings_latest_src_28005.capacity AS largest_listing
- , listings_latest_src_28005.capacity AS smallest_listing
- , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS ds__day
- , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS ds__week
- , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS ds__month
- , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS ds__quarter
- , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS ds__extract_doy
- , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS created_at__day
- , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS created_at__week
- , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS created_at__month
- , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS created_at__quarter
- , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day
- , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS created_at__extract_dow
- , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS created_at__extract_doy
- , listings_latest_src_28005.country AS country_latest
- , listings_latest_src_28005.is_lux AS is_lux_latest
- , listings_latest_src_28005.capacity AS capacity_latest
- , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS listing__ds__day
- , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS listing__ds__week
- , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS listing__ds__month
- , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS listing__ds__quarter
- , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS listing__ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day
- , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS listing__ds__extract_dow
- , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy
- , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS listing__created_at__day
- , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS listing__created_at__week
- , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS listing__created_at__month
- , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS listing__created_at__quarter
- , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS listing__created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day
- , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS listing__created_at__extract_dow
- , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy
- , listings_latest_src_28005.country AS listing__country_latest
- , listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , listings_latest_src_28005.capacity AS listing__capacity_latest
- , listings_latest_src_28005.listing_id AS listing
- , listings_latest_src_28005.user_id AS user
- , listings_latest_src_28005.user_id AS listing__user
- FROM ***************************.dim_listings_latest listings_latest_src_28005
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS created_at__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 created_at__extract_dow
+ , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS created_at__extract_doy
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__created_at__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__created_at__extract_dow
+ , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_doy
+ , listings_latest_src_28000.country AS listing__country_latest
+ , listings_latest_src_28000.is_lux AS listing__is_lux_latest
+ , listings_latest_src_28000.capacity AS listing__capacity_latest
+ , listings_latest_src_28000.listing_id AS listing
+ , listings_latest_src_28000.user_id AS user
+ , listings_latest_src_28000.user_id AS listing__user
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
) subq_2
) subq_3
ON
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node_simple_expr__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node_simple_expr__plan0_optimized.sql
index 85d8832dfe..d646b7402f 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node_simple_expr__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_compute_metrics_node_simple_expr__plan0_optimized.sql
@@ -7,14 +7,14 @@ FROM (
-- Join Standard Outputs
-- Aggregate Measures
SELECT
- bookings_source_src_28001.listing_id AS listing
- , listings_latest_src_28005.country AS listing__country_latest
- , SUM(bookings_source_src_28001.booking_value) AS booking_value
- FROM ***************************.fct_bookings bookings_source_src_28001
+ bookings_source_src_28000.listing_id AS listing
+ , listings_latest_src_28000.country AS listing__country_latest
+ , SUM(bookings_source_src_28000.booking_value) AS booking_value
+ FROM ***************************.fct_bookings bookings_source_src_28000
LEFT OUTER JOIN
- ***************************.dim_listings_latest listings_latest_src_28005
+ ***************************.dim_listings_latest listings_latest_src_28000
ON
- bookings_source_src_28001.listing_id = listings_latest_src_28005.listing_id
+ bookings_source_src_28000.listing_id = listings_latest_src_28000.listing_id
GROUP BY
listing
, listing__country_latest
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_constrain_time_range_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_constrain_time_range_node__plan0.sql
index a0e9d75a3b..f35d50cc54 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_constrain_time_range_node__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_constrain_time_range_node__plan0.sql
@@ -19,93 +19,93 @@ FROM (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS booking__paid_at__extract_dow
+ , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
) subq_1
) subq_2
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_constrain_time_range_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_constrain_time_range_node__plan0_optimized.sql
index 75eef26f7e..9c5e3ef726 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_constrain_time_range_node__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_constrain_time_range_node__plan0_optimized.sql
@@ -6,5 +6,5 @@ SELECT
DATE_TRUNC(ds, day) AS ds__day
, DATE_TRUNC(ds, day) AS metric_time__day
, 1 AS bookings
-FROM ***************************.fct_bookings bookings_source_src_28001
+FROM ***************************.fct_bookings bookings_source_src_28000
WHERE DATE_TRUNC(ds, day) BETWEEN '2020-01-01' AND '2020-01-02'
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_dimension_with_joined_where_constraint__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_dimension_with_joined_where_constraint__plan0.sql
index 1450c75977..4da4d7d82c 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_dimension_with_joined_where_constraint__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_dimension_with_joined_where_constraint__plan0.sql
@@ -125,62 +125,62 @@ FROM (
-- Read Elements From Semantic Model 'listings_latest'
SELECT
1 AS listings
- , listings_latest_src_28005.capacity AS largest_listing
- , listings_latest_src_28005.capacity AS smallest_listing
- , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS ds__day
- , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS ds__week
- , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS ds__month
- , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS ds__quarter
- , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS ds__extract_doy
- , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS created_at__day
- , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS created_at__week
- , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS created_at__month
- , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS created_at__quarter
- , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day
- , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS created_at__extract_dow
- , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS created_at__extract_doy
- , listings_latest_src_28005.country AS country_latest
- , listings_latest_src_28005.is_lux AS is_lux_latest
- , listings_latest_src_28005.capacity AS capacity_latest
- , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS listing__ds__day
- , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS listing__ds__week
- , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS listing__ds__month
- , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS listing__ds__quarter
- , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS listing__ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day
- , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS listing__ds__extract_dow
- , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy
- , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS listing__created_at__day
- , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS listing__created_at__week
- , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS listing__created_at__month
- , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS listing__created_at__quarter
- , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS listing__created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day
- , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS listing__created_at__extract_dow
- , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy
- , listings_latest_src_28005.country AS listing__country_latest
- , listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , listings_latest_src_28005.capacity AS listing__capacity_latest
- , listings_latest_src_28005.listing_id AS listing
- , listings_latest_src_28005.user_id AS user
- , listings_latest_src_28005.user_id AS listing__user
- FROM ***************************.dim_listings_latest listings_latest_src_28005
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS created_at__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 created_at__extract_dow
+ , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS created_at__extract_doy
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__created_at__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__created_at__extract_dow
+ , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_doy
+ , listings_latest_src_28000.country AS listing__country_latest
+ , listings_latest_src_28000.is_lux AS listing__is_lux_latest
+ , listings_latest_src_28000.capacity AS listing__capacity_latest
+ , listings_latest_src_28000.listing_id AS listing
+ , listings_latest_src_28000.user_id AS user
+ , listings_latest_src_28000.user_id AS listing__user
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
) subq_0
FULL OUTER JOIN (
-- Pass Only Elements: ['home_state_latest', 'user']
@@ -190,32 +190,32 @@ FROM (
FROM (
-- Read Elements From Semantic Model 'users_latest'
SELECT
- DATE_TRUNC(users_latest_src_28009.ds, day) AS ds_latest__day
- , DATE_TRUNC(users_latest_src_28009.ds, isoweek) AS ds_latest__week
- , DATE_TRUNC(users_latest_src_28009.ds, month) AS ds_latest__month
- , DATE_TRUNC(users_latest_src_28009.ds, quarter) AS ds_latest__quarter
- , DATE_TRUNC(users_latest_src_28009.ds, year) AS ds_latest__year
- , EXTRACT(year FROM users_latest_src_28009.ds) AS ds_latest__extract_year
- , EXTRACT(quarter FROM users_latest_src_28009.ds) AS ds_latest__extract_quarter
- , EXTRACT(month FROM users_latest_src_28009.ds) AS ds_latest__extract_month
- , EXTRACT(day FROM users_latest_src_28009.ds) AS ds_latest__extract_day
- , IF(EXTRACT(dayofweek FROM users_latest_src_28009.ds) = 1, 7, EXTRACT(dayofweek FROM users_latest_src_28009.ds) - 1) AS ds_latest__extract_dow
- , EXTRACT(dayofyear FROM users_latest_src_28009.ds) AS ds_latest__extract_doy
- , users_latest_src_28009.home_state_latest
- , DATE_TRUNC(users_latest_src_28009.ds, day) AS user__ds_latest__day
- , DATE_TRUNC(users_latest_src_28009.ds, isoweek) AS user__ds_latest__week
- , DATE_TRUNC(users_latest_src_28009.ds, month) AS user__ds_latest__month
- , DATE_TRUNC(users_latest_src_28009.ds, quarter) AS user__ds_latest__quarter
- , DATE_TRUNC(users_latest_src_28009.ds, year) AS user__ds_latest__year
- , EXTRACT(year FROM users_latest_src_28009.ds) AS user__ds_latest__extract_year
- , EXTRACT(quarter FROM users_latest_src_28009.ds) AS user__ds_latest__extract_quarter
- , EXTRACT(month FROM users_latest_src_28009.ds) AS user__ds_latest__extract_month
- , EXTRACT(day FROM users_latest_src_28009.ds) AS user__ds_latest__extract_day
- , IF(EXTRACT(dayofweek FROM users_latest_src_28009.ds) = 1, 7, EXTRACT(dayofweek FROM users_latest_src_28009.ds) - 1) AS user__ds_latest__extract_dow
- , EXTRACT(dayofyear FROM users_latest_src_28009.ds) AS user__ds_latest__extract_doy
- , users_latest_src_28009.home_state_latest AS user__home_state_latest
- , users_latest_src_28009.user_id AS user
- FROM ***************************.dim_users_latest users_latest_src_28009
+ 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
+ , 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
+ , EXTRACT(day FROM users_latest_src_28000.ds) AS ds_latest__extract_day
+ , 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
+ , 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
+ , EXTRACT(day FROM users_latest_src_28000.ds) AS user__ds_latest__extract_day
+ , IF(EXTRACT(dayofweek FROM users_latest_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM users_latest_src_28000.ds) - 1) AS user__ds_latest__extract_dow
+ , EXTRACT(dayofyear FROM users_latest_src_28000.ds) AS user__ds_latest__extract_doy
+ , users_latest_src_28000.home_state_latest AS user__home_state_latest
+ , users_latest_src_28000.user_id AS user
+ FROM ***************************.dim_users_latest users_latest_src_28000
) subq_1
) subq_2
ON
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_dimension_with_joined_where_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_dimension_with_joined_where_constraint__plan0_optimized.sql
index 8cc8a2b867..c4e57d3c86 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_dimension_with_joined_where_constraint__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_dimension_with_joined_where_constraint__plan0_optimized.sql
@@ -5,13 +5,13 @@ SELECT
FROM (
-- Join Standard Outputs
SELECT
- listings_latest_src_28005.country AS listing__country_latest
- , users_latest_src_28009.home_state_latest AS user__home_state_latest
- FROM ***************************.dim_listings_latest listings_latest_src_28005
+ listings_latest_src_28000.country AS listing__country_latest
+ , users_latest_src_28000.home_state_latest AS user__home_state_latest
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
FULL OUTER JOIN
- ***************************.dim_users_latest users_latest_src_28009
+ ***************************.dim_users_latest users_latest_src_28000
ON
- listings_latest_src_28005.user_id = users_latest_src_28009.user_id
+ listings_latest_src_28000.user_id = users_latest_src_28000.user_id
) subq_8
WHERE listing__country_latest = 'us'
GROUP BY
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_dimensions_requiring_join__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_dimensions_requiring_join__plan0.sql
index 8fdb02c3a8..ebe3631edd 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_dimensions_requiring_join__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_dimensions_requiring_join__plan0.sql
@@ -66,62 +66,62 @@ FROM (
-- Read Elements From Semantic Model 'listings_latest'
SELECT
1 AS listings
- , listings_latest_src_28005.capacity AS largest_listing
- , listings_latest_src_28005.capacity AS smallest_listing
- , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS ds__day
- , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS ds__week
- , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS ds__month
- , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS ds__quarter
- , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS ds__extract_doy
- , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS created_at__day
- , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS created_at__week
- , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS created_at__month
- , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS created_at__quarter
- , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day
- , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS created_at__extract_dow
- , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS created_at__extract_doy
- , listings_latest_src_28005.country AS country_latest
- , listings_latest_src_28005.is_lux AS is_lux_latest
- , listings_latest_src_28005.capacity AS capacity_latest
- , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS listing__ds__day
- , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS listing__ds__week
- , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS listing__ds__month
- , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS listing__ds__quarter
- , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS listing__ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day
- , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS listing__ds__extract_dow
- , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy
- , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS listing__created_at__day
- , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS listing__created_at__week
- , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS listing__created_at__month
- , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS listing__created_at__quarter
- , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS listing__created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day
- , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS listing__created_at__extract_dow
- , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy
- , listings_latest_src_28005.country AS listing__country_latest
- , listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , listings_latest_src_28005.capacity AS listing__capacity_latest
- , listings_latest_src_28005.listing_id AS listing
- , listings_latest_src_28005.user_id AS user
- , listings_latest_src_28005.user_id AS listing__user
- FROM ***************************.dim_listings_latest listings_latest_src_28005
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS created_at__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 created_at__extract_dow
+ , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS created_at__extract_doy
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__created_at__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__created_at__extract_dow
+ , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_doy
+ , listings_latest_src_28000.country AS listing__country_latest
+ , listings_latest_src_28000.is_lux AS listing__is_lux_latest
+ , listings_latest_src_28000.capacity AS listing__capacity_latest
+ , listings_latest_src_28000.listing_id AS listing
+ , listings_latest_src_28000.user_id AS user
+ , listings_latest_src_28000.user_id AS listing__user
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
) subq_0
FULL OUTER JOIN (
-- Pass Only Elements: ['home_state_latest', 'user']
@@ -131,32 +131,32 @@ FROM (
FROM (
-- Read Elements From Semantic Model 'users_latest'
SELECT
- DATE_TRUNC(users_latest_src_28009.ds, day) AS ds_latest__day
- , DATE_TRUNC(users_latest_src_28009.ds, isoweek) AS ds_latest__week
- , DATE_TRUNC(users_latest_src_28009.ds, month) AS ds_latest__month
- , DATE_TRUNC(users_latest_src_28009.ds, quarter) AS ds_latest__quarter
- , DATE_TRUNC(users_latest_src_28009.ds, year) AS ds_latest__year
- , EXTRACT(year FROM users_latest_src_28009.ds) AS ds_latest__extract_year
- , EXTRACT(quarter FROM users_latest_src_28009.ds) AS ds_latest__extract_quarter
- , EXTRACT(month FROM users_latest_src_28009.ds) AS ds_latest__extract_month
- , EXTRACT(day FROM users_latest_src_28009.ds) AS ds_latest__extract_day
- , IF(EXTRACT(dayofweek FROM users_latest_src_28009.ds) = 1, 7, EXTRACT(dayofweek FROM users_latest_src_28009.ds) - 1) AS ds_latest__extract_dow
- , EXTRACT(dayofyear FROM users_latest_src_28009.ds) AS ds_latest__extract_doy
- , users_latest_src_28009.home_state_latest
- , DATE_TRUNC(users_latest_src_28009.ds, day) AS user__ds_latest__day
- , DATE_TRUNC(users_latest_src_28009.ds, isoweek) AS user__ds_latest__week
- , DATE_TRUNC(users_latest_src_28009.ds, month) AS user__ds_latest__month
- , DATE_TRUNC(users_latest_src_28009.ds, quarter) AS user__ds_latest__quarter
- , DATE_TRUNC(users_latest_src_28009.ds, year) AS user__ds_latest__year
- , EXTRACT(year FROM users_latest_src_28009.ds) AS user__ds_latest__extract_year
- , EXTRACT(quarter FROM users_latest_src_28009.ds) AS user__ds_latest__extract_quarter
- , EXTRACT(month FROM users_latest_src_28009.ds) AS user__ds_latest__extract_month
- , EXTRACT(day FROM users_latest_src_28009.ds) AS user__ds_latest__extract_day
- , IF(EXTRACT(dayofweek FROM users_latest_src_28009.ds) = 1, 7, EXTRACT(dayofweek FROM users_latest_src_28009.ds) - 1) AS user__ds_latest__extract_dow
- , EXTRACT(dayofyear FROM users_latest_src_28009.ds) AS user__ds_latest__extract_doy
- , users_latest_src_28009.home_state_latest AS user__home_state_latest
- , users_latest_src_28009.user_id AS user
- FROM ***************************.dim_users_latest users_latest_src_28009
+ 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
+ , 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
+ , EXTRACT(day FROM users_latest_src_28000.ds) AS ds_latest__extract_day
+ , 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
+ , 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
+ , EXTRACT(day FROM users_latest_src_28000.ds) AS user__ds_latest__extract_day
+ , IF(EXTRACT(dayofweek FROM users_latest_src_28000.ds) = 1, 7, EXTRACT(dayofweek FROM users_latest_src_28000.ds) - 1) AS user__ds_latest__extract_dow
+ , EXTRACT(dayofyear FROM users_latest_src_28000.ds) AS user__ds_latest__extract_doy
+ , users_latest_src_28000.home_state_latest AS user__home_state_latest
+ , users_latest_src_28000.user_id AS user
+ FROM ***************************.dim_users_latest users_latest_src_28000
) subq_1
) subq_2
ON
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_dimensions_requiring_join__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_dimensions_requiring_join__plan0_optimized.sql
index 8be14ae725..4365193bed 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_dimensions_requiring_join__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_dimensions_requiring_join__plan0_optimized.sql
@@ -1,13 +1,13 @@
-- Join Standard Outputs
-- Pass Only Elements: ['user__home_state_latest', 'listing__is_lux_latest']
SELECT
- listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , users_latest_src_28009.home_state_latest AS user__home_state_latest
-FROM ***************************.dim_listings_latest listings_latest_src_28005
+ 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
FULL OUTER JOIN
- ***************************.dim_users_latest users_latest_src_28009
+ ***************************.dim_users_latest users_latest_src_28000
ON
- listings_latest_src_28005.user_id = users_latest_src_28009.user_id
+ listings_latest_src_28000.user_id = users_latest_src_28000.user_id
GROUP BY
listing__is_lux_latest
, user__home_state_latest
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_filter_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_filter_node__plan0.sql
index 5bb3c3d1a9..b5ff0578b8 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_filter_node__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_filter_node__plan0.sql
@@ -6,91 +6,91 @@ FROM (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS booking__paid_at__extract_dow
+ , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_filter_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_filter_node__plan0_optimized.sql
index bfbf5ff951..554ce484fb 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_filter_node__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_filter_node__plan0_optimized.sql
@@ -2,4 +2,4 @@
-- Pass Only Elements: ['bookings',]
SELECT
1 AS bookings
-FROM ***************************.fct_bookings bookings_source_src_28001
+FROM ***************************.fct_bookings bookings_source_src_28000
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_filter_with_where_constraint_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_filter_with_where_constraint_node__plan0.sql
index ecc9bba0c8..c6f25b8c6b 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_filter_with_where_constraint_node__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_filter_with_where_constraint_node__plan0.sql
@@ -12,93 +12,93 @@ FROM (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS booking__paid_at__extract_dow
+ , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
) subq_1
WHERE booking__ds__day = '2020-01-01'
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_filter_with_where_constraint_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_filter_with_where_constraint_node__plan0_optimized.sql
index 6f43403722..2ab56070e3 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_filter_with_where_constraint_node__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_filter_with_where_constraint_node__plan0_optimized.sql
@@ -8,6 +8,6 @@ FROM (
SELECT
DATE_TRUNC(ds, day) AS ds__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_3
WHERE booking__ds__day = '2020-01-01'
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_node_with_offset_to_grain__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_node_with_offset_to_grain__plan0.sql
index 2566084583..52483571be 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_node_with_offset_to_grain__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_node_with_offset_to_grain__plan0.sql
@@ -134,93 +134,93 @@ INNER JOIN (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS booking__paid_at__extract_dow
+ , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
) subq_1
) subq_2
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_node_with_offset_to_grain__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_node_with_offset_to_grain__plan0_optimized.sql
index 605c639d2c..de1c51339b 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_node_with_offset_to_grain__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_node_with_offset_to_grain__plan0_optimized.sql
@@ -25,7 +25,7 @@ INNER JOIN (
DATE_TRUNC(ds, day) AS metric_time__day
, listing_id AS listing
, SUM(booking_value) AS booking_value
- FROM ***************************.fct_bookings bookings_source_src_28001
+ FROM ***************************.fct_bookings bookings_source_src_28000
GROUP BY
metric_time__day
, listing
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_node_with_offset_window__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_node_with_offset_window__plan0.sql
index c9b4153e21..4d85900d84 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_node_with_offset_window__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_node_with_offset_window__plan0.sql
@@ -134,93 +134,93 @@ INNER JOIN (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS booking__paid_at__extract_dow
+ , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
) subq_1
) subq_2
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_node_with_offset_window__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_node_with_offset_window__plan0_optimized.sql
index 2174faa702..33bf45f967 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_node_with_offset_window__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_node_with_offset_window__plan0_optimized.sql
@@ -25,7 +25,7 @@ INNER JOIN (
DATE_TRUNC(ds, day) AS metric_time__day
, listing_id AS listing
, SUM(booking_value) AS booking_value
- FROM ***************************.fct_bookings bookings_source_src_28001
+ FROM ***************************.fct_bookings bookings_source_src_28000
GROUP BY
metric_time__day
, listing
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_node_without_offset__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_node_without_offset__plan0.sql
index 9bf9f87b20..b890725bb3 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_node_without_offset__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_node_without_offset__plan0.sql
@@ -134,93 +134,93 @@ INNER JOIN (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS booking__paid_at__extract_dow
+ , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
) subq_1
) subq_2
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_node_without_offset__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_node_without_offset__plan0_optimized.sql
index 0dc2b15fa5..22fd39eb0b 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_node_without_offset__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_join_to_time_spine_node_without_offset__plan0_optimized.sql
@@ -25,7 +25,7 @@ INNER JOIN (
DATE_TRUNC(ds, day) AS metric_time__day
, listing_id AS listing
, SUM(booking_value) AS booking_value
- FROM ***************************.fct_bookings bookings_source_src_28001
+ FROM ***************************.fct_bookings bookings_source_src_28000
GROUP BY
metric_time__day
, listing
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_measure_aggregation_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_measure_aggregation_node__plan0.sql
index d37595fcab..64a83506ab 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_measure_aggregation_node__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_measure_aggregation_node__plan0.sql
@@ -16,92 +16,92 @@ FROM (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS booking__paid_at__extract_dow
+ , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
) subq_1
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_measure_aggregation_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_measure_aggregation_node__plan0_optimized.sql
index 64fc2826b9..6e5528a6c9 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_measure_aggregation_node__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_measure_aggregation_node__plan0_optimized.sql
@@ -6,4 +6,4 @@ SELECT
, SUM(CASE WHEN is_instant THEN 1 ELSE 0 END) AS instant_bookings
, COUNT(DISTINCT guest_id) AS bookers
, AVG(booking_value) AS average_booking_value
-FROM ***************************.fct_bookings bookings_source_src_28001
+FROM ***************************.fct_bookings bookings_source_src_28000
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_multi_join_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_multi_join_node__plan0.sql
index 8538ea9e3f..a184642565 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_multi_join_node__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_multi_join_node__plan0.sql
@@ -14,93 +14,93 @@ FROM (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS booking__paid_at__extract_dow
+ , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
) subq_1
LEFT OUTER JOIN (
@@ -112,62 +112,62 @@ LEFT OUTER JOIN (
-- Read Elements From Semantic Model 'listings_latest'
SELECT
1 AS listings
- , listings_latest_src_28005.capacity AS largest_listing
- , listings_latest_src_28005.capacity AS smallest_listing
- , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS ds__day
- , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS ds__week
- , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS ds__month
- , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS ds__quarter
- , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS ds__extract_doy
- , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS created_at__day
- , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS created_at__week
- , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS created_at__month
- , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS created_at__quarter
- , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day
- , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS created_at__extract_dow
- , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS created_at__extract_doy
- , listings_latest_src_28005.country AS country_latest
- , listings_latest_src_28005.is_lux AS is_lux_latest
- , listings_latest_src_28005.capacity AS capacity_latest
- , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS listing__ds__day
- , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS listing__ds__week
- , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS listing__ds__month
- , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS listing__ds__quarter
- , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS listing__ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day
- , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS listing__ds__extract_dow
- , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy
- , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS listing__created_at__day
- , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS listing__created_at__week
- , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS listing__created_at__month
- , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS listing__created_at__quarter
- , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS listing__created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day
- , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS listing__created_at__extract_dow
- , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy
- , listings_latest_src_28005.country AS listing__country_latest
- , listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , listings_latest_src_28005.capacity AS listing__capacity_latest
- , listings_latest_src_28005.listing_id AS listing
- , listings_latest_src_28005.user_id AS user
- , listings_latest_src_28005.user_id AS listing__user
- FROM ***************************.dim_listings_latest listings_latest_src_28005
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS created_at__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 created_at__extract_dow
+ , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS created_at__extract_doy
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__created_at__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__created_at__extract_dow
+ , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_doy
+ , listings_latest_src_28000.country AS listing__country_latest
+ , listings_latest_src_28000.is_lux AS listing__is_lux_latest
+ , listings_latest_src_28000.capacity AS listing__capacity_latest
+ , listings_latest_src_28000.listing_id AS listing
+ , listings_latest_src_28000.user_id AS user
+ , listings_latest_src_28000.user_id AS listing__user
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
) subq_2
) subq_3
ON
@@ -181,62 +181,62 @@ LEFT OUTER JOIN (
-- Read Elements From Semantic Model 'listings_latest'
SELECT
1 AS listings
- , listings_latest_src_28005.capacity AS largest_listing
- , listings_latest_src_28005.capacity AS smallest_listing
- , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS ds__day
- , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS ds__week
- , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS ds__month
- , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS ds__quarter
- , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS ds__extract_doy
- , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS created_at__day
- , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS created_at__week
- , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS created_at__month
- , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS created_at__quarter
- , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day
- , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS created_at__extract_dow
- , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS created_at__extract_doy
- , listings_latest_src_28005.country AS country_latest
- , listings_latest_src_28005.is_lux AS is_lux_latest
- , listings_latest_src_28005.capacity AS capacity_latest
- , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS listing__ds__day
- , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS listing__ds__week
- , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS listing__ds__month
- , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS listing__ds__quarter
- , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS listing__ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day
- , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS listing__ds__extract_dow
- , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy
- , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS listing__created_at__day
- , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS listing__created_at__week
- , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS listing__created_at__month
- , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS listing__created_at__quarter
- , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS listing__created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day
- , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS listing__created_at__extract_dow
- , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy
- , listings_latest_src_28005.country AS listing__country_latest
- , listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , listings_latest_src_28005.capacity AS listing__capacity_latest
- , listings_latest_src_28005.listing_id AS listing
- , listings_latest_src_28005.user_id AS user
- , listings_latest_src_28005.user_id AS listing__user
- FROM ***************************.dim_listings_latest listings_latest_src_28005
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS created_at__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 created_at__extract_dow
+ , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS created_at__extract_doy
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__created_at__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__created_at__extract_dow
+ , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_doy
+ , listings_latest_src_28000.country AS listing__country_latest
+ , listings_latest_src_28000.is_lux AS listing__is_lux_latest
+ , listings_latest_src_28000.capacity AS listing__capacity_latest
+ , listings_latest_src_28000.listing_id AS listing
+ , listings_latest_src_28000.user_id AS user
+ , listings_latest_src_28000.user_id AS listing__user
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
) subq_4
) subq_5
ON
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_multi_join_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_multi_join_node__plan0_optimized.sql
index b9cecc48d8..7d9c669f54 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_multi_join_node__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_multi_join_node__plan0_optimized.sql
@@ -10,7 +10,7 @@ FROM (
SELECT
listing_id AS listing
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_7
LEFT OUTER JOIN (
-- Read Elements From Semantic Model 'listings_latest'
@@ -18,7 +18,7 @@ LEFT OUTER JOIN (
SELECT
listing_id AS listing
, country AS country_latest
- FROM ***************************.dim_listings_latest listings_latest_src_28005
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
) subq_9
ON
subq_7.listing = subq_9.listing
@@ -28,7 +28,7 @@ LEFT OUTER JOIN (
SELECT
listing_id AS listing
, country AS country_latest
- FROM ***************************.dim_listings_latest listings_latest_src_28005
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
) subq_11
ON
subq_7.listing = subq_11.listing
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_order_by_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_order_by_node__plan0.sql
index c609e114ee..33b3ebed38 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_order_by_node__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_order_by_node__plan0.sql
@@ -26,93 +26,93 @@ FROM (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS booking__paid_at__extract_dow
+ , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
) subq_1
GROUP BY
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_order_by_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_order_by_node__plan0_optimized.sql
index 28767fcd6f..e755ce8680 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_order_by_node__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_order_by_node__plan0_optimized.sql
@@ -12,7 +12,7 @@ FROM (
DATE_TRUNC(ds, day) AS ds__day
, is_instant
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_5
GROUP BY
ds__day
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_single_join_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_single_join_node__plan0.sql
index 6d9849d14f..2baea3c2d6 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_single_join_node__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_single_join_node__plan0.sql
@@ -12,93 +12,93 @@ FROM (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS booking__paid_at__extract_dow
+ , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
) subq_1
LEFT OUTER JOIN (
@@ -110,62 +110,62 @@ LEFT OUTER JOIN (
-- Read Elements From Semantic Model 'listings_latest'
SELECT
1 AS listings
- , listings_latest_src_28005.capacity AS largest_listing
- , listings_latest_src_28005.capacity AS smallest_listing
- , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS ds__day
- , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS ds__week
- , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS ds__month
- , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS ds__quarter
- , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS ds__extract_doy
- , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS created_at__day
- , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS created_at__week
- , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS created_at__month
- , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS created_at__quarter
- , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day
- , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS created_at__extract_dow
- , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS created_at__extract_doy
- , listings_latest_src_28005.country AS country_latest
- , listings_latest_src_28005.is_lux AS is_lux_latest
- , listings_latest_src_28005.capacity AS capacity_latest
- , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS listing__ds__day
- , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS listing__ds__week
- , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS listing__ds__month
- , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS listing__ds__quarter
- , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS listing__ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day
- , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS listing__ds__extract_dow
- , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy
- , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS listing__created_at__day
- , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS listing__created_at__week
- , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS listing__created_at__month
- , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS listing__created_at__quarter
- , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS listing__created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day
- , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS listing__created_at__extract_dow
- , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy
- , listings_latest_src_28005.country AS listing__country_latest
- , listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , listings_latest_src_28005.capacity AS listing__capacity_latest
- , listings_latest_src_28005.listing_id AS listing
- , listings_latest_src_28005.user_id AS user
- , listings_latest_src_28005.user_id AS listing__user
- FROM ***************************.dim_listings_latest listings_latest_src_28005
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS created_at__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 created_at__extract_dow
+ , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS created_at__extract_doy
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__created_at__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__created_at__extract_dow
+ , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_doy
+ , listings_latest_src_28000.country AS listing__country_latest
+ , listings_latest_src_28000.is_lux AS listing__is_lux_latest
+ , listings_latest_src_28000.capacity AS listing__capacity_latest
+ , listings_latest_src_28000.listing_id AS listing
+ , listings_latest_src_28000.user_id AS user
+ , listings_latest_src_28000.user_id AS listing__user
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
) subq_2
) subq_3
ON
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_single_join_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_single_join_node__plan0_optimized.sql
index e03ffcce64..a1cd7ac335 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_single_join_node__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_single_join_node__plan0_optimized.sql
@@ -8,9 +8,9 @@ FROM (
SELECT
listing_id AS listing
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_5
LEFT OUTER JOIN
- ***************************.dim_listings_latest listings_latest_src_28005
+ ***************************.dim_listings_latest listings_latest_src_28000
ON
- subq_5.listing = listings_latest_src_28005.listing_id
+ subq_5.listing = listings_latest_src_28000.listing_id
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_source_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_source_node__plan0.sql
index 69189e43bb..c614493864 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_source_node__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_source_node__plan0.sql
@@ -2,90 +2,90 @@
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
-FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS booking__paid_at__extract_dow
+ , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+FROM ***************************.fct_bookings bookings_source_src_28000
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_source_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_source_node__plan0_optimized.sql
index 2778fb000b..641da95a40 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_source_node__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/BigQuery/test_source_node__plan0_optimized.sql
@@ -88,4 +88,4 @@ SELECT
, listing_id AS booking__listing
, guest_id AS booking__guest
, host_id AS booking__host
-FROM ***************************.fct_bookings bookings_source_src_28001
+FROM ***************************.fct_bookings bookings_source_src_28000
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_combine_output_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_combine_output_node__plan0.sql
index f350d5ead8..b66a332135 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_combine_output_node__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_combine_output_node__plan0.sql
@@ -19,93 +19,93 @@ FROM (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
) subq_1
GROUP BY
@@ -128,93 +128,93 @@ FULL OUTER JOIN (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_3
) subq_4
GROUP BY
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_combine_output_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_combine_output_node__plan0_optimized.sql
index a8375510d7..ad81788114 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_combine_output_node__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_combine_output_node__plan0_optimized.sql
@@ -15,7 +15,7 @@ FROM (
SELECT
is_instant
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_7
GROUP BY
is_instant
@@ -33,7 +33,7 @@ FULL OUTER JOIN (
is_instant
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
, guest_id AS bookers
- FROM ***************************.fct_bookings bookings_source_src_28001
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_10
GROUP BY
is_instant
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_compute_metrics_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_compute_metrics_node__plan0.sql
index 4c6fec948c..b6d83b8cf4 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_compute_metrics_node__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_compute_metrics_node__plan0.sql
@@ -25,93 +25,93 @@ FROM (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
) subq_1
LEFT OUTER JOIN (
@@ -123,62 +123,62 @@ FROM (
-- Read Elements From Semantic Model 'listings_latest'
SELECT
1 AS listings
- , listings_latest_src_28005.capacity AS largest_listing
- , listings_latest_src_28005.capacity AS smallest_listing
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy
- , listings_latest_src_28005.country AS country_latest
- , listings_latest_src_28005.is_lux AS is_lux_latest
- , listings_latest_src_28005.capacity AS capacity_latest
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy
- , listings_latest_src_28005.country AS listing__country_latest
- , listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , listings_latest_src_28005.capacity AS listing__capacity_latest
- , listings_latest_src_28005.listing_id AS listing
- , listings_latest_src_28005.user_id AS user
- , listings_latest_src_28005.user_id AS listing__user
- FROM ***************************.dim_listings_latest listings_latest_src_28005
+ , listings_latest_src_28000.capacity AS largest_listing
+ , listings_latest_src_28000.capacity AS smallest_listing
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS created_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28000.created_at) AS created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS created_at__extract_doy
+ , 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('day', listings_latest_src_28000.created_at) AS listing__ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28000.created_at) AS listing__ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS listing__created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_doy
+ , listings_latest_src_28000.country AS listing__country_latest
+ , listings_latest_src_28000.is_lux AS listing__is_lux_latest
+ , listings_latest_src_28000.capacity AS listing__capacity_latest
+ , listings_latest_src_28000.listing_id AS listing
+ , listings_latest_src_28000.user_id AS user
+ , listings_latest_src_28000.user_id AS listing__user
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
) subq_2
) subq_3
ON
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_compute_metrics_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_compute_metrics_node__plan0_optimized.sql
index cf47afc6bf..5ebe7177e8 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_compute_metrics_node__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_compute_metrics_node__plan0_optimized.sql
@@ -3,7 +3,7 @@
-- Compute Metrics via Expressions
SELECT
subq_7.listing AS listing
- , listings_latest_src_28005.country AS listing__country_latest
+ , listings_latest_src_28000.country AS listing__country_latest
, SUM(subq_7.bookings) AS bookings
FROM (
-- Read Elements From Semantic Model 'bookings_source'
@@ -11,12 +11,12 @@ FROM (
SELECT
listing_id AS listing
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_7
LEFT OUTER JOIN
- ***************************.dim_listings_latest listings_latest_src_28005
+ ***************************.dim_listings_latest listings_latest_src_28000
ON
- subq_7.listing = listings_latest_src_28005.listing_id
+ subq_7.listing = listings_latest_src_28000.listing_id
GROUP BY
subq_7.listing
- , listings_latest_src_28005.country
+ , listings_latest_src_28000.country
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.sql
index ae05dce9db..dcb28780fe 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.sql
@@ -1,693 +1,693 @@
-- Compute Metrics via Expressions
SELECT
- subq_20.ds__day
- , subq_20.listing__country_latest
- , CAST(subq_20.bookings AS DOUBLE) / CAST(NULLIF(subq_20.views, 0) AS DOUBLE) AS bookings_per_view
+ subq_29.ds__day
+ , subq_29.listing__country_latest
+ , CAST(subq_29.bookings AS DOUBLE) / CAST(NULLIF(subq_29.views, 0) AS DOUBLE) AS bookings_per_view
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_9.ds__day, subq_19.ds__day) AS ds__day
- , COALESCE(subq_9.listing__country_latest, subq_19.listing__country_latest) AS listing__country_latest
- , MAX(subq_9.bookings) AS bookings
- , MAX(subq_19.views) AS views
+ COALESCE(subq_18.ds__day, subq_28.ds__day) AS ds__day
+ , COALESCE(subq_18.listing__country_latest, subq_28.listing__country_latest) AS listing__country_latest
+ , MAX(subq_18.bookings) AS bookings
+ , MAX(subq_28.views) AS views
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_8.ds__day
- , subq_8.listing__country_latest
- , subq_8.bookings
+ subq_17.ds__day
+ , subq_17.listing__country_latest
+ , subq_17.bookings
FROM (
-- Aggregate Measures
SELECT
- subq_7.ds__day
- , subq_7.listing__country_latest
- , SUM(subq_7.bookings) AS bookings
+ subq_16.ds__day
+ , subq_16.listing__country_latest
+ , SUM(subq_16.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'listing__country_latest', 'ds__day']
SELECT
- subq_6.ds__day
- , subq_6.listing__country_latest
- , subq_6.bookings
+ subq_15.ds__day
+ , subq_15.listing__country_latest
+ , subq_15.bookings
FROM (
-- Join Standard Outputs
SELECT
- subq_2.ds__day AS ds__day
- , subq_2.listing AS listing
- , subq_5.country_latest AS listing__country_latest
- , subq_2.bookings AS bookings
+ subq_11.ds__day AS ds__day
+ , subq_11.listing AS listing
+ , subq_14.country_latest AS listing__country_latest
+ , subq_11.bookings AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'ds__day', 'listing']
SELECT
- subq_1.ds__day
- , subq_1.listing
- , subq_1.bookings
+ subq_10.ds__day
+ , subq_10.listing
+ , subq_10.bookings
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
- ) subq_2
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
LEFT OUTER JOIN (
-- Pass Only Elements: ['country_latest', 'listing']
SELECT
- subq_4.listing
- , subq_4.country_latest
+ subq_13.listing
+ , subq_13.country_latest
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_3.ds__day
- , subq_3.ds__week
- , subq_3.ds__month
- , subq_3.ds__quarter
- , subq_3.ds__year
- , subq_3.ds__extract_year
- , subq_3.ds__extract_quarter
- , subq_3.ds__extract_month
- , subq_3.ds__extract_day
- , subq_3.ds__extract_dow
- , subq_3.ds__extract_doy
- , subq_3.created_at__day
- , subq_3.created_at__week
- , subq_3.created_at__month
- , subq_3.created_at__quarter
- , subq_3.created_at__year
- , subq_3.created_at__extract_year
- , subq_3.created_at__extract_quarter
- , subq_3.created_at__extract_month
- , subq_3.created_at__extract_day
- , subq_3.created_at__extract_dow
- , subq_3.created_at__extract_doy
- , subq_3.listing__ds__day
- , subq_3.listing__ds__week
- , subq_3.listing__ds__month
- , subq_3.listing__ds__quarter
- , subq_3.listing__ds__year
- , subq_3.listing__ds__extract_year
- , subq_3.listing__ds__extract_quarter
- , subq_3.listing__ds__extract_month
- , subq_3.listing__ds__extract_day
- , subq_3.listing__ds__extract_dow
- , subq_3.listing__ds__extract_doy
- , subq_3.listing__created_at__day
- , subq_3.listing__created_at__week
- , subq_3.listing__created_at__month
- , subq_3.listing__created_at__quarter
- , subq_3.listing__created_at__year
- , subq_3.listing__created_at__extract_year
- , subq_3.listing__created_at__extract_quarter
- , subq_3.listing__created_at__extract_month
- , subq_3.listing__created_at__extract_day
- , subq_3.listing__created_at__extract_dow
- , subq_3.listing__created_at__extract_doy
- , subq_3.ds__day AS metric_time__day
- , subq_3.ds__week AS metric_time__week
- , subq_3.ds__month AS metric_time__month
- , subq_3.ds__quarter AS metric_time__quarter
- , subq_3.ds__year AS metric_time__year
- , subq_3.ds__extract_year AS metric_time__extract_year
- , subq_3.ds__extract_quarter AS metric_time__extract_quarter
- , subq_3.ds__extract_month AS metric_time__extract_month
- , subq_3.ds__extract_day AS metric_time__extract_day
- , subq_3.ds__extract_dow AS metric_time__extract_dow
- , subq_3.ds__extract_doy AS metric_time__extract_doy
- , subq_3.listing
- , subq_3.user
- , subq_3.listing__user
- , subq_3.country_latest
- , subq_3.is_lux_latest
- , subq_3.capacity_latest
- , subq_3.listing__country_latest
- , subq_3.listing__is_lux_latest
- , subq_3.listing__capacity_latest
- , subq_3.listings
- , subq_3.largest_listing
- , subq_3.smallest_listing
+ subq_12.ds__day
+ , subq_12.ds__week
+ , subq_12.ds__month
+ , subq_12.ds__quarter
+ , subq_12.ds__year
+ , subq_12.ds__extract_year
+ , subq_12.ds__extract_quarter
+ , subq_12.ds__extract_month
+ , subq_12.ds__extract_day
+ , subq_12.ds__extract_dow
+ , subq_12.ds__extract_doy
+ , subq_12.created_at__day
+ , subq_12.created_at__week
+ , subq_12.created_at__month
+ , subq_12.created_at__quarter
+ , subq_12.created_at__year
+ , subq_12.created_at__extract_year
+ , subq_12.created_at__extract_quarter
+ , subq_12.created_at__extract_month
+ , subq_12.created_at__extract_day
+ , subq_12.created_at__extract_dow
+ , subq_12.created_at__extract_doy
+ , subq_12.listing__ds__day
+ , subq_12.listing__ds__week
+ , subq_12.listing__ds__month
+ , subq_12.listing__ds__quarter
+ , subq_12.listing__ds__year
+ , subq_12.listing__ds__extract_year
+ , subq_12.listing__ds__extract_quarter
+ , subq_12.listing__ds__extract_month
+ , subq_12.listing__ds__extract_day
+ , subq_12.listing__ds__extract_dow
+ , subq_12.listing__ds__extract_doy
+ , subq_12.listing__created_at__day
+ , subq_12.listing__created_at__week
+ , subq_12.listing__created_at__month
+ , subq_12.listing__created_at__quarter
+ , subq_12.listing__created_at__year
+ , subq_12.listing__created_at__extract_year
+ , subq_12.listing__created_at__extract_quarter
+ , subq_12.listing__created_at__extract_month
+ , subq_12.listing__created_at__extract_day
+ , subq_12.listing__created_at__extract_dow
+ , subq_12.listing__created_at__extract_doy
+ , subq_12.ds__day AS metric_time__day
+ , subq_12.ds__week AS metric_time__week
+ , subq_12.ds__month AS metric_time__month
+ , subq_12.ds__quarter AS metric_time__quarter
+ , subq_12.ds__year AS metric_time__year
+ , subq_12.ds__extract_year AS metric_time__extract_year
+ , subq_12.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_12.ds__extract_month AS metric_time__extract_month
+ , subq_12.ds__extract_day AS metric_time__extract_day
+ , subq_12.ds__extract_dow AS metric_time__extract_dow
+ , subq_12.ds__extract_doy AS metric_time__extract_doy
+ , subq_12.listing
+ , subq_12.user
+ , subq_12.listing__user
+ , subq_12.country_latest
+ , subq_12.is_lux_latest
+ , subq_12.capacity_latest
+ , subq_12.listing__country_latest
+ , subq_12.listing__is_lux_latest
+ , subq_12.listing__capacity_latest
+ , subq_12.listings
+ , subq_12.largest_listing
+ , subq_12.smallest_listing
FROM (
-- Read Elements From Semantic Model 'listings_latest'
SELECT
1 AS listings
- , listings_latest_src_28005.capacity AS largest_listing
- , listings_latest_src_28005.capacity AS smallest_listing
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy
- , listings_latest_src_28005.country AS country_latest
- , listings_latest_src_28005.is_lux AS is_lux_latest
- , listings_latest_src_28005.capacity AS capacity_latest
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy
- , listings_latest_src_28005.country AS listing__country_latest
- , listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , listings_latest_src_28005.capacity AS listing__capacity_latest
- , listings_latest_src_28005.listing_id AS listing
- , listings_latest_src_28005.user_id AS user
- , listings_latest_src_28005.user_id AS listing__user
- FROM ***************************.dim_listings_latest listings_latest_src_28005
- ) subq_3
- ) subq_4
- ) subq_5
+ , listings_latest_src_28000.capacity AS largest_listing
+ , listings_latest_src_28000.capacity AS smallest_listing
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS created_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28000.created_at) AS created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS created_at__extract_doy
+ , 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('day', listings_latest_src_28000.created_at) AS listing__ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28000.created_at) AS listing__ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS listing__created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_doy
+ , listings_latest_src_28000.country AS listing__country_latest
+ , listings_latest_src_28000.is_lux AS listing__is_lux_latest
+ , listings_latest_src_28000.capacity AS listing__capacity_latest
+ , listings_latest_src_28000.listing_id AS listing
+ , listings_latest_src_28000.user_id AS user
+ , listings_latest_src_28000.user_id AS listing__user
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
+ ) subq_12
+ ) subq_13
+ ) subq_14
ON
- subq_2.listing = subq_5.listing
- ) subq_6
- ) subq_7
+ subq_11.listing = subq_14.listing
+ ) subq_15
+ ) subq_16
GROUP BY
- subq_7.ds__day
- , subq_7.listing__country_latest
- ) subq_8
- ) subq_9
+ subq_16.ds__day
+ , subq_16.listing__country_latest
+ ) subq_17
+ ) subq_18
FULL OUTER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_18.ds__day
- , subq_18.listing__country_latest
- , subq_18.views
+ subq_27.ds__day
+ , subq_27.listing__country_latest
+ , subq_27.views
FROM (
-- Aggregate Measures
SELECT
- subq_17.ds__day
- , subq_17.listing__country_latest
- , SUM(subq_17.views) AS views
+ subq_26.ds__day
+ , subq_26.listing__country_latest
+ , SUM(subq_26.views) AS views
FROM (
-- Pass Only Elements: ['views', 'listing__country_latest', 'ds__day']
SELECT
- subq_16.ds__day
- , subq_16.listing__country_latest
- , subq_16.views
+ subq_25.ds__day
+ , subq_25.listing__country_latest
+ , subq_25.views
FROM (
-- Join Standard Outputs
SELECT
- subq_12.ds__day AS ds__day
- , subq_12.listing AS listing
- , subq_15.country_latest AS listing__country_latest
- , subq_12.views AS views
+ subq_21.ds__day AS ds__day
+ , subq_21.listing AS listing
+ , subq_24.country_latest AS listing__country_latest
+ , subq_21.views AS views
FROM (
-- Pass Only Elements: ['views', 'ds__day', 'listing']
SELECT
- subq_11.ds__day
- , subq_11.listing
- , subq_11.views
+ subq_20.ds__day
+ , subq_20.listing
+ , subq_20.views
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_10.ds__day
- , subq_10.ds__week
- , subq_10.ds__month
- , subq_10.ds__quarter
- , subq_10.ds__year
- , subq_10.ds__extract_year
- , subq_10.ds__extract_quarter
- , subq_10.ds__extract_month
- , subq_10.ds__extract_day
- , subq_10.ds__extract_dow
- , subq_10.ds__extract_doy
- , subq_10.ds_partitioned__day
- , subq_10.ds_partitioned__week
- , subq_10.ds_partitioned__month
- , subq_10.ds_partitioned__quarter
- , subq_10.ds_partitioned__year
- , subq_10.ds_partitioned__extract_year
- , subq_10.ds_partitioned__extract_quarter
- , subq_10.ds_partitioned__extract_month
- , subq_10.ds_partitioned__extract_day
- , subq_10.ds_partitioned__extract_dow
- , subq_10.ds_partitioned__extract_doy
- , subq_10.view__ds__day
- , subq_10.view__ds__week
- , subq_10.view__ds__month
- , subq_10.view__ds__quarter
- , subq_10.view__ds__year
- , subq_10.view__ds__extract_year
- , subq_10.view__ds__extract_quarter
- , subq_10.view__ds__extract_month
- , subq_10.view__ds__extract_day
- , subq_10.view__ds__extract_dow
- , subq_10.view__ds__extract_doy
- , subq_10.view__ds_partitioned__day
- , subq_10.view__ds_partitioned__week
- , subq_10.view__ds_partitioned__month
- , subq_10.view__ds_partitioned__quarter
- , subq_10.view__ds_partitioned__year
- , subq_10.view__ds_partitioned__extract_year
- , subq_10.view__ds_partitioned__extract_quarter
- , subq_10.view__ds_partitioned__extract_month
- , subq_10.view__ds_partitioned__extract_day
- , subq_10.view__ds_partitioned__extract_dow
- , subq_10.view__ds_partitioned__extract_doy
- , subq_10.ds__day AS metric_time__day
- , subq_10.ds__week AS metric_time__week
- , subq_10.ds__month AS metric_time__month
- , subq_10.ds__quarter AS metric_time__quarter
- , subq_10.ds__year AS metric_time__year
- , subq_10.ds__extract_year AS metric_time__extract_year
- , subq_10.ds__extract_quarter AS metric_time__extract_quarter
- , subq_10.ds__extract_month AS metric_time__extract_month
- , subq_10.ds__extract_day AS metric_time__extract_day
- , subq_10.ds__extract_dow AS metric_time__extract_dow
- , subq_10.ds__extract_doy AS metric_time__extract_doy
- , subq_10.listing
- , subq_10.user
- , subq_10.view__listing
- , subq_10.view__user
- , subq_10.views
+ subq_19.ds__day
+ , subq_19.ds__week
+ , subq_19.ds__month
+ , subq_19.ds__quarter
+ , subq_19.ds__year
+ , subq_19.ds__extract_year
+ , subq_19.ds__extract_quarter
+ , subq_19.ds__extract_month
+ , subq_19.ds__extract_day
+ , subq_19.ds__extract_dow
+ , subq_19.ds__extract_doy
+ , subq_19.ds_partitioned__day
+ , subq_19.ds_partitioned__week
+ , subq_19.ds_partitioned__month
+ , subq_19.ds_partitioned__quarter
+ , subq_19.ds_partitioned__year
+ , subq_19.ds_partitioned__extract_year
+ , subq_19.ds_partitioned__extract_quarter
+ , subq_19.ds_partitioned__extract_month
+ , subq_19.ds_partitioned__extract_day
+ , subq_19.ds_partitioned__extract_dow
+ , subq_19.ds_partitioned__extract_doy
+ , subq_19.view__ds__day
+ , subq_19.view__ds__week
+ , subq_19.view__ds__month
+ , subq_19.view__ds__quarter
+ , subq_19.view__ds__year
+ , subq_19.view__ds__extract_year
+ , subq_19.view__ds__extract_quarter
+ , subq_19.view__ds__extract_month
+ , subq_19.view__ds__extract_day
+ , subq_19.view__ds__extract_dow
+ , subq_19.view__ds__extract_doy
+ , subq_19.view__ds_partitioned__day
+ , subq_19.view__ds_partitioned__week
+ , subq_19.view__ds_partitioned__month
+ , subq_19.view__ds_partitioned__quarter
+ , subq_19.view__ds_partitioned__year
+ , subq_19.view__ds_partitioned__extract_year
+ , subq_19.view__ds_partitioned__extract_quarter
+ , subq_19.view__ds_partitioned__extract_month
+ , subq_19.view__ds_partitioned__extract_day
+ , subq_19.view__ds_partitioned__extract_dow
+ , subq_19.view__ds_partitioned__extract_doy
+ , subq_19.ds__day AS metric_time__day
+ , subq_19.ds__week AS metric_time__week
+ , subq_19.ds__month AS metric_time__month
+ , subq_19.ds__quarter AS metric_time__quarter
+ , subq_19.ds__year AS metric_time__year
+ , subq_19.ds__extract_year AS metric_time__extract_year
+ , subq_19.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_19.ds__extract_month AS metric_time__extract_month
+ , subq_19.ds__extract_day AS metric_time__extract_day
+ , subq_19.ds__extract_dow AS metric_time__extract_dow
+ , subq_19.ds__extract_doy AS metric_time__extract_doy
+ , subq_19.listing
+ , subq_19.user
+ , subq_19.view__listing
+ , subq_19.view__user
+ , subq_19.views
FROM (
-- Read Elements From Semantic Model 'views_source'
SELECT
1 AS views
- , DATE_TRUNC('day', views_source_src_28010.ds) AS ds__day
- , DATE_TRUNC('week', views_source_src_28010.ds) AS ds__week
- , DATE_TRUNC('month', views_source_src_28010.ds) AS ds__month
- , DATE_TRUNC('quarter', views_source_src_28010.ds) AS ds__quarter
- , DATE_TRUNC('year', views_source_src_28010.ds) AS ds__year
- , EXTRACT(year FROM views_source_src_28010.ds) AS ds__extract_year
- , EXTRACT(quarter FROM views_source_src_28010.ds) AS ds__extract_quarter
- , EXTRACT(month FROM views_source_src_28010.ds) AS ds__extract_month
- , EXTRACT(day FROM views_source_src_28010.ds) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM views_source_src_28010.ds) AS ds__extract_dow
- , EXTRACT(doy FROM views_source_src_28010.ds) AS ds__extract_doy
- , DATE_TRUNC('day', views_source_src_28010.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', views_source_src_28010.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', views_source_src_28010.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', views_source_src_28010.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', views_source_src_28010.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM views_source_src_28010.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM views_source_src_28010.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM views_source_src_28010.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM views_source_src_28010.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM views_source_src_28010.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM views_source_src_28010.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', views_source_src_28010.ds) AS view__ds__day
- , DATE_TRUNC('week', views_source_src_28010.ds) AS view__ds__week
- , DATE_TRUNC('month', views_source_src_28010.ds) AS view__ds__month
- , DATE_TRUNC('quarter', views_source_src_28010.ds) AS view__ds__quarter
- , DATE_TRUNC('year', views_source_src_28010.ds) AS view__ds__year
- , EXTRACT(year FROM views_source_src_28010.ds) AS view__ds__extract_year
- , EXTRACT(quarter FROM views_source_src_28010.ds) AS view__ds__extract_quarter
- , EXTRACT(month FROM views_source_src_28010.ds) AS view__ds__extract_month
- , EXTRACT(day FROM views_source_src_28010.ds) AS view__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM views_source_src_28010.ds) AS view__ds__extract_dow
- , EXTRACT(doy FROM views_source_src_28010.ds) AS view__ds__extract_doy
- , DATE_TRUNC('day', views_source_src_28010.ds_partitioned) AS view__ds_partitioned__day
- , DATE_TRUNC('week', views_source_src_28010.ds_partitioned) AS view__ds_partitioned__week
- , DATE_TRUNC('month', views_source_src_28010.ds_partitioned) AS view__ds_partitioned__month
- , DATE_TRUNC('quarter', views_source_src_28010.ds_partitioned) AS view__ds_partitioned__quarter
- , DATE_TRUNC('year', views_source_src_28010.ds_partitioned) AS view__ds_partitioned__year
- , EXTRACT(year FROM views_source_src_28010.ds_partitioned) AS view__ds_partitioned__extract_year
- , EXTRACT(quarter FROM views_source_src_28010.ds_partitioned) AS view__ds_partitioned__extract_quarter
- , EXTRACT(month FROM views_source_src_28010.ds_partitioned) AS view__ds_partitioned__extract_month
- , EXTRACT(day FROM views_source_src_28010.ds_partitioned) AS view__ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM views_source_src_28010.ds_partitioned) AS view__ds_partitioned__extract_dow
- , EXTRACT(doy FROM views_source_src_28010.ds_partitioned) AS view__ds_partitioned__extract_doy
- , views_source_src_28010.listing_id AS listing
- , views_source_src_28010.user_id AS user
- , views_source_src_28010.listing_id AS view__listing
- , views_source_src_28010.user_id AS view__user
- FROM ***************************.fct_views views_source_src_28010
- ) subq_10
- ) subq_11
- ) subq_12
+ , DATE_TRUNC('day', views_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', views_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', views_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', views_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', views_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM views_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM views_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', views_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', views_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', views_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', views_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', views_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM views_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM views_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', views_source_src_28000.ds) AS view__ds__day
+ , DATE_TRUNC('week', views_source_src_28000.ds) AS view__ds__week
+ , DATE_TRUNC('month', views_source_src_28000.ds) AS view__ds__month
+ , DATE_TRUNC('quarter', views_source_src_28000.ds) AS view__ds__quarter
+ , DATE_TRUNC('year', views_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM views_source_src_28000.ds) AS view__ds__extract_dow
+ , EXTRACT(doy FROM views_source_src_28000.ds) AS view__ds__extract_doy
+ , DATE_TRUNC('day', views_source_src_28000.ds_partitioned) AS view__ds_partitioned__day
+ , DATE_TRUNC('week', views_source_src_28000.ds_partitioned) AS view__ds_partitioned__week
+ , DATE_TRUNC('month', views_source_src_28000.ds_partitioned) AS view__ds_partitioned__month
+ , DATE_TRUNC('quarter', views_source_src_28000.ds_partitioned) AS view__ds_partitioned__quarter
+ , DATE_TRUNC('year', views_source_src_28000.ds_partitioned) 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
+ , EXTRACT(day FROM views_source_src_28000.ds_partitioned) AS view__ds_partitioned__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM views_source_src_28000.ds_partitioned) AS view__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM views_source_src_28000.ds_partitioned) AS view__ds_partitioned__extract_doy
+ , views_source_src_28000.listing_id AS listing
+ , views_source_src_28000.user_id AS user
+ , views_source_src_28000.listing_id AS view__listing
+ , views_source_src_28000.user_id AS view__user
+ FROM ***************************.fct_views views_source_src_28000
+ ) subq_19
+ ) subq_20
+ ) subq_21
LEFT OUTER JOIN (
-- Pass Only Elements: ['country_latest', 'listing']
SELECT
- subq_14.listing
- , subq_14.country_latest
+ subq_23.listing
+ , subq_23.country_latest
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_13.ds__day
- , subq_13.ds__week
- , subq_13.ds__month
- , subq_13.ds__quarter
- , subq_13.ds__year
- , subq_13.ds__extract_year
- , subq_13.ds__extract_quarter
- , subq_13.ds__extract_month
- , subq_13.ds__extract_day
- , subq_13.ds__extract_dow
- , subq_13.ds__extract_doy
- , subq_13.created_at__day
- , subq_13.created_at__week
- , subq_13.created_at__month
- , subq_13.created_at__quarter
- , subq_13.created_at__year
- , subq_13.created_at__extract_year
- , subq_13.created_at__extract_quarter
- , subq_13.created_at__extract_month
- , subq_13.created_at__extract_day
- , subq_13.created_at__extract_dow
- , subq_13.created_at__extract_doy
- , subq_13.listing__ds__day
- , subq_13.listing__ds__week
- , subq_13.listing__ds__month
- , subq_13.listing__ds__quarter
- , subq_13.listing__ds__year
- , subq_13.listing__ds__extract_year
- , subq_13.listing__ds__extract_quarter
- , subq_13.listing__ds__extract_month
- , subq_13.listing__ds__extract_day
- , subq_13.listing__ds__extract_dow
- , subq_13.listing__ds__extract_doy
- , subq_13.listing__created_at__day
- , subq_13.listing__created_at__week
- , subq_13.listing__created_at__month
- , subq_13.listing__created_at__quarter
- , subq_13.listing__created_at__year
- , subq_13.listing__created_at__extract_year
- , subq_13.listing__created_at__extract_quarter
- , subq_13.listing__created_at__extract_month
- , subq_13.listing__created_at__extract_day
- , subq_13.listing__created_at__extract_dow
- , subq_13.listing__created_at__extract_doy
- , subq_13.ds__day AS metric_time__day
- , subq_13.ds__week AS metric_time__week
- , subq_13.ds__month AS metric_time__month
- , subq_13.ds__quarter AS metric_time__quarter
- , subq_13.ds__year AS metric_time__year
- , subq_13.ds__extract_year AS metric_time__extract_year
- , subq_13.ds__extract_quarter AS metric_time__extract_quarter
- , subq_13.ds__extract_month AS metric_time__extract_month
- , subq_13.ds__extract_day AS metric_time__extract_day
- , subq_13.ds__extract_dow AS metric_time__extract_dow
- , subq_13.ds__extract_doy AS metric_time__extract_doy
- , subq_13.listing
- , subq_13.user
- , subq_13.listing__user
- , subq_13.country_latest
- , subq_13.is_lux_latest
- , subq_13.capacity_latest
- , subq_13.listing__country_latest
- , subq_13.listing__is_lux_latest
- , subq_13.listing__capacity_latest
- , subq_13.listings
- , subq_13.largest_listing
- , subq_13.smallest_listing
+ subq_22.ds__day
+ , subq_22.ds__week
+ , subq_22.ds__month
+ , subq_22.ds__quarter
+ , subq_22.ds__year
+ , subq_22.ds__extract_year
+ , subq_22.ds__extract_quarter
+ , subq_22.ds__extract_month
+ , subq_22.ds__extract_day
+ , subq_22.ds__extract_dow
+ , subq_22.ds__extract_doy
+ , subq_22.created_at__day
+ , subq_22.created_at__week
+ , subq_22.created_at__month
+ , subq_22.created_at__quarter
+ , subq_22.created_at__year
+ , subq_22.created_at__extract_year
+ , subq_22.created_at__extract_quarter
+ , subq_22.created_at__extract_month
+ , subq_22.created_at__extract_day
+ , subq_22.created_at__extract_dow
+ , subq_22.created_at__extract_doy
+ , subq_22.listing__ds__day
+ , subq_22.listing__ds__week
+ , subq_22.listing__ds__month
+ , subq_22.listing__ds__quarter
+ , subq_22.listing__ds__year
+ , subq_22.listing__ds__extract_year
+ , subq_22.listing__ds__extract_quarter
+ , subq_22.listing__ds__extract_month
+ , subq_22.listing__ds__extract_day
+ , subq_22.listing__ds__extract_dow
+ , subq_22.listing__ds__extract_doy
+ , subq_22.listing__created_at__day
+ , subq_22.listing__created_at__week
+ , subq_22.listing__created_at__month
+ , subq_22.listing__created_at__quarter
+ , subq_22.listing__created_at__year
+ , subq_22.listing__created_at__extract_year
+ , subq_22.listing__created_at__extract_quarter
+ , subq_22.listing__created_at__extract_month
+ , subq_22.listing__created_at__extract_day
+ , subq_22.listing__created_at__extract_dow
+ , subq_22.listing__created_at__extract_doy
+ , subq_22.ds__day AS metric_time__day
+ , subq_22.ds__week AS metric_time__week
+ , subq_22.ds__month AS metric_time__month
+ , subq_22.ds__quarter AS metric_time__quarter
+ , subq_22.ds__year AS metric_time__year
+ , subq_22.ds__extract_year AS metric_time__extract_year
+ , subq_22.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_22.ds__extract_month AS metric_time__extract_month
+ , subq_22.ds__extract_day AS metric_time__extract_day
+ , subq_22.ds__extract_dow AS metric_time__extract_dow
+ , subq_22.ds__extract_doy AS metric_time__extract_doy
+ , subq_22.listing
+ , subq_22.user
+ , subq_22.listing__user
+ , subq_22.country_latest
+ , subq_22.is_lux_latest
+ , subq_22.capacity_latest
+ , subq_22.listing__country_latest
+ , subq_22.listing__is_lux_latest
+ , subq_22.listing__capacity_latest
+ , subq_22.listings
+ , subq_22.largest_listing
+ , subq_22.smallest_listing
FROM (
-- Read Elements From Semantic Model 'listings_latest'
SELECT
1 AS listings
- , listings_latest_src_28005.capacity AS largest_listing
- , listings_latest_src_28005.capacity AS smallest_listing
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy
- , listings_latest_src_28005.country AS country_latest
- , listings_latest_src_28005.is_lux AS is_lux_latest
- , listings_latest_src_28005.capacity AS capacity_latest
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy
- , listings_latest_src_28005.country AS listing__country_latest
- , listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , listings_latest_src_28005.capacity AS listing__capacity_latest
- , listings_latest_src_28005.listing_id AS listing
- , listings_latest_src_28005.user_id AS user
- , listings_latest_src_28005.user_id AS listing__user
- FROM ***************************.dim_listings_latest listings_latest_src_28005
- ) subq_13
- ) subq_14
- ) subq_15
+ , listings_latest_src_28000.capacity AS largest_listing
+ , listings_latest_src_28000.capacity AS smallest_listing
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS created_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28000.created_at) AS created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS created_at__extract_doy
+ , 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('day', listings_latest_src_28000.created_at) AS listing__ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28000.created_at) AS listing__ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS listing__created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_doy
+ , listings_latest_src_28000.country AS listing__country_latest
+ , listings_latest_src_28000.is_lux AS listing__is_lux_latest
+ , listings_latest_src_28000.capacity AS listing__capacity_latest
+ , listings_latest_src_28000.listing_id AS listing
+ , listings_latest_src_28000.user_id AS user
+ , listings_latest_src_28000.user_id AS listing__user
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
+ ) subq_22
+ ) subq_23
+ ) subq_24
ON
- subq_12.listing = subq_15.listing
- ) subq_16
- ) subq_17
+ subq_21.listing = subq_24.listing
+ ) subq_25
+ ) subq_26
GROUP BY
- subq_17.ds__day
- , subq_17.listing__country_latest
- ) subq_18
- ) subq_19
+ subq_26.ds__day
+ , subq_26.listing__country_latest
+ ) subq_27
+ ) subq_28
ON
(
- subq_9.listing__country_latest = subq_19.listing__country_latest
+ subq_18.listing__country_latest = subq_28.listing__country_latest
) AND (
- subq_9.ds__day = subq_19.ds__day
+ subq_18.ds__day = subq_28.ds__day
)
GROUP BY
- COALESCE(subq_9.ds__day, subq_19.ds__day)
- , COALESCE(subq_9.listing__country_latest, subq_19.listing__country_latest)
-) subq_20
+ COALESCE(subq_18.ds__day, subq_28.ds__day)
+ , COALESCE(subq_18.listing__country_latest, subq_28.listing__country_latest)
+) subq_29
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0_optimized.sql
index 5b65e65d85..75a09cbc63 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0_optimized.sql
@@ -6,19 +6,19 @@ SELECT
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_30.ds__day, subq_40.ds__day) AS ds__day
- , COALESCE(subq_30.listing__country_latest, subq_40.listing__country_latest) AS listing__country_latest
- , MAX(subq_30.bookings) AS bookings
- , MAX(subq_40.views) AS views
+ COALESCE(subq_39.ds__day, subq_49.ds__day) AS ds__day
+ , COALESCE(subq_39.listing__country_latest, subq_49.listing__country_latest) AS listing__country_latest
+ , MAX(subq_39.bookings) AS bookings
+ , MAX(subq_49.views) AS views
FROM (
-- Join Standard Outputs
-- Pass Only Elements: ['bookings', 'listing__country_latest', 'ds__day']
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_23.ds__day AS ds__day
- , listings_latest_src_28005.country AS listing__country_latest
- , SUM(subq_23.bookings) AS bookings
+ subq_32.ds__day AS ds__day
+ , listings_latest_src_28000.country AS listing__country_latest
+ , SUM(subq_32.bookings) AS bookings
FROM (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
@@ -27,25 +27,25 @@ FROM (
DATE_TRUNC('day', ds) AS ds__day
, listing_id AS listing
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_23
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_32
LEFT OUTER JOIN
- ***************************.dim_listings_latest listings_latest_src_28005
+ ***************************.dim_listings_latest listings_latest_src_28000
ON
- subq_23.listing = listings_latest_src_28005.listing_id
+ subq_32.listing = listings_latest_src_28000.listing_id
GROUP BY
- subq_23.ds__day
- , listings_latest_src_28005.country
- ) subq_30
+ subq_32.ds__day
+ , listings_latest_src_28000.country
+ ) subq_39
FULL OUTER JOIN (
-- Join Standard Outputs
-- Pass Only Elements: ['views', 'listing__country_latest', 'ds__day']
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_33.ds__day AS ds__day
- , listings_latest_src_28005.country AS listing__country_latest
- , SUM(subq_33.views) AS views
+ subq_42.ds__day AS ds__day
+ , listings_latest_src_28000.country AS listing__country_latest
+ , SUM(subq_42.views) AS views
FROM (
-- Read Elements From Semantic Model 'views_source'
-- Metric Time Dimension 'ds'
@@ -54,23 +54,23 @@ FROM (
DATE_TRUNC('day', ds) AS ds__day
, listing_id AS listing
, 1 AS views
- FROM ***************************.fct_views views_source_src_28010
- ) subq_33
+ FROM ***************************.fct_views views_source_src_28000
+ ) subq_42
LEFT OUTER JOIN
- ***************************.dim_listings_latest listings_latest_src_28005
+ ***************************.dim_listings_latest listings_latest_src_28000
ON
- subq_33.listing = listings_latest_src_28005.listing_id
+ subq_42.listing = listings_latest_src_28000.listing_id
GROUP BY
- subq_33.ds__day
- , listings_latest_src_28005.country
- ) subq_40
+ subq_42.ds__day
+ , listings_latest_src_28000.country
+ ) subq_49
ON
(
- subq_30.listing__country_latest = subq_40.listing__country_latest
+ subq_39.listing__country_latest = subq_49.listing__country_latest
) AND (
- subq_30.ds__day = subq_40.ds__day
+ subq_39.ds__day = subq_49.ds__day
)
GROUP BY
- COALESCE(subq_30.ds__day, subq_40.ds__day)
- , COALESCE(subq_30.listing__country_latest, subq_40.listing__country_latest)
-) subq_41
+ COALESCE(subq_39.ds__day, subq_49.ds__day)
+ , COALESCE(subq_39.listing__country_latest, subq_49.listing__country_latest)
+) subq_50
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.sql
index c7ad99ba70..f5b5ee6cc2 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.sql
@@ -28,93 +28,93 @@ FROM (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
) subq_1
LEFT OUTER JOIN (
@@ -126,62 +126,62 @@ FROM (
-- Read Elements From Semantic Model 'listings_latest'
SELECT
1 AS listings
- , listings_latest_src_28005.capacity AS largest_listing
- , listings_latest_src_28005.capacity AS smallest_listing
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy
- , listings_latest_src_28005.country AS country_latest
- , listings_latest_src_28005.is_lux AS is_lux_latest
- , listings_latest_src_28005.capacity AS capacity_latest
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy
- , listings_latest_src_28005.country AS listing__country_latest
- , listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , listings_latest_src_28005.capacity AS listing__capacity_latest
- , listings_latest_src_28005.listing_id AS listing
- , listings_latest_src_28005.user_id AS user
- , listings_latest_src_28005.user_id AS listing__user
- FROM ***************************.dim_listings_latest listings_latest_src_28005
+ , listings_latest_src_28000.capacity AS largest_listing
+ , listings_latest_src_28000.capacity AS smallest_listing
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS created_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28000.created_at) AS created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS created_at__extract_doy
+ , 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('day', listings_latest_src_28000.created_at) AS listing__ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28000.created_at) AS listing__ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS listing__created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_doy
+ , listings_latest_src_28000.country AS listing__country_latest
+ , listings_latest_src_28000.is_lux AS listing__is_lux_latest
+ , listings_latest_src_28000.capacity AS listing__capacity_latest
+ , listings_latest_src_28000.listing_id AS listing
+ , listings_latest_src_28000.user_id AS user
+ , listings_latest_src_28000.user_id AS listing__user
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
) subq_2
) subq_3
ON
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_compute_metrics_node_ratio_from_single_semantic_model__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_compute_metrics_node_ratio_from_single_semantic_model__plan0_optimized.sql
index 7c57c360fb..c943b1a8d9 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_compute_metrics_node_ratio_from_single_semantic_model__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_compute_metrics_node_ratio_from_single_semantic_model__plan0_optimized.sql
@@ -8,7 +8,7 @@ FROM (
-- Aggregate Measures
SELECT
subq_7.listing AS listing
- , listings_latest_src_28005.country AS listing__country_latest
+ , listings_latest_src_28000.country AS listing__country_latest
, SUM(subq_7.bookings) AS bookings
, COUNT(DISTINCT subq_7.bookers) AS bookers
FROM (
@@ -18,13 +18,13 @@ FROM (
listing_id AS listing
, 1 AS bookings
, guest_id AS bookers
- FROM ***************************.fct_bookings bookings_source_src_28001
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_7
LEFT OUTER JOIN
- ***************************.dim_listings_latest listings_latest_src_28005
+ ***************************.dim_listings_latest listings_latest_src_28000
ON
- subq_7.listing = listings_latest_src_28005.listing_id
+ subq_7.listing = listings_latest_src_28000.listing_id
GROUP BY
subq_7.listing
- , listings_latest_src_28005.country
+ , listings_latest_src_28000.country
) subq_11
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_compute_metrics_node_simple_expr__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_compute_metrics_node_simple_expr__plan0.sql
index e4ff7804c2..e0efb20972 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_compute_metrics_node_simple_expr__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_compute_metrics_node_simple_expr__plan0.sql
@@ -25,93 +25,93 @@ FROM (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
) subq_1
LEFT OUTER JOIN (
@@ -123,62 +123,62 @@ FROM (
-- Read Elements From Semantic Model 'listings_latest'
SELECT
1 AS listings
- , listings_latest_src_28005.capacity AS largest_listing
- , listings_latest_src_28005.capacity AS smallest_listing
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy
- , listings_latest_src_28005.country AS country_latest
- , listings_latest_src_28005.is_lux AS is_lux_latest
- , listings_latest_src_28005.capacity AS capacity_latest
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy
- , listings_latest_src_28005.country AS listing__country_latest
- , listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , listings_latest_src_28005.capacity AS listing__capacity_latest
- , listings_latest_src_28005.listing_id AS listing
- , listings_latest_src_28005.user_id AS user
- , listings_latest_src_28005.user_id AS listing__user
- FROM ***************************.dim_listings_latest listings_latest_src_28005
+ , listings_latest_src_28000.capacity AS largest_listing
+ , listings_latest_src_28000.capacity AS smallest_listing
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS created_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28000.created_at) AS created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS created_at__extract_doy
+ , 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('day', listings_latest_src_28000.created_at) AS listing__ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28000.created_at) AS listing__ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS listing__created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_doy
+ , listings_latest_src_28000.country AS listing__country_latest
+ , listings_latest_src_28000.is_lux AS listing__is_lux_latest
+ , listings_latest_src_28000.capacity AS listing__capacity_latest
+ , listings_latest_src_28000.listing_id AS listing
+ , listings_latest_src_28000.user_id AS user
+ , listings_latest_src_28000.user_id AS listing__user
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
) subq_2
) subq_3
ON
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_compute_metrics_node_simple_expr__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_compute_metrics_node_simple_expr__plan0_optimized.sql
index 3bda7562bf..65e701e3dd 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_compute_metrics_node_simple_expr__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_compute_metrics_node_simple_expr__plan0_optimized.sql
@@ -7,15 +7,15 @@ FROM (
-- Join Standard Outputs
-- Aggregate Measures
SELECT
- bookings_source_src_28001.listing_id AS listing
- , listings_latest_src_28005.country AS listing__country_latest
- , SUM(bookings_source_src_28001.booking_value) AS booking_value
- FROM ***************************.fct_bookings bookings_source_src_28001
+ bookings_source_src_28000.listing_id AS listing
+ , listings_latest_src_28000.country AS listing__country_latest
+ , SUM(bookings_source_src_28000.booking_value) AS booking_value
+ FROM ***************************.fct_bookings bookings_source_src_28000
LEFT OUTER JOIN
- ***************************.dim_listings_latest listings_latest_src_28005
+ ***************************.dim_listings_latest listings_latest_src_28000
ON
- bookings_source_src_28001.listing_id = listings_latest_src_28005.listing_id
+ bookings_source_src_28000.listing_id = listings_latest_src_28000.listing_id
GROUP BY
- bookings_source_src_28001.listing_id
- , listings_latest_src_28005.country
+ bookings_source_src_28000.listing_id
+ , listings_latest_src_28000.country
) subq_11
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_constrain_time_range_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_constrain_time_range_node__plan0.sql
index a9d000576c..a767f9cc0b 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_constrain_time_range_node__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_constrain_time_range_node__plan0.sql
@@ -19,93 +19,93 @@ FROM (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
) subq_1
) subq_2
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_constrain_time_range_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_constrain_time_range_node__plan0_optimized.sql
index db53f26587..d0d15f6943 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_constrain_time_range_node__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_constrain_time_range_node__plan0_optimized.sql
@@ -6,5 +6,5 @@ SELECT
DATE_TRUNC('day', ds) AS ds__day
, DATE_TRUNC('day', ds) AS metric_time__day
, 1 AS bookings
-FROM ***************************.fct_bookings bookings_source_src_28001
+FROM ***************************.fct_bookings bookings_source_src_28000
WHERE DATE_TRUNC('day', ds) BETWEEN '2020-01-01' AND '2020-01-02'
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_dimension_with_joined_where_constraint__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_dimension_with_joined_where_constraint__plan0.sql
index 96f3e16f3c..1d8a2bddf2 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_dimension_with_joined_where_constraint__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_dimension_with_joined_where_constraint__plan0.sql
@@ -125,62 +125,62 @@ FROM (
-- Read Elements From Semantic Model 'listings_latest'
SELECT
1 AS listings
- , listings_latest_src_28005.capacity AS largest_listing
- , listings_latest_src_28005.capacity AS smallest_listing
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy
- , listings_latest_src_28005.country AS country_latest
- , listings_latest_src_28005.is_lux AS is_lux_latest
- , listings_latest_src_28005.capacity AS capacity_latest
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy
- , listings_latest_src_28005.country AS listing__country_latest
- , listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , listings_latest_src_28005.capacity AS listing__capacity_latest
- , listings_latest_src_28005.listing_id AS listing
- , listings_latest_src_28005.user_id AS user
- , listings_latest_src_28005.user_id AS listing__user
- FROM ***************************.dim_listings_latest listings_latest_src_28005
+ , listings_latest_src_28000.capacity AS largest_listing
+ , listings_latest_src_28000.capacity AS smallest_listing
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS created_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28000.created_at) AS created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS created_at__extract_doy
+ , 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('day', listings_latest_src_28000.created_at) AS listing__ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28000.created_at) AS listing__ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS listing__created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_doy
+ , listings_latest_src_28000.country AS listing__country_latest
+ , listings_latest_src_28000.is_lux AS listing__is_lux_latest
+ , listings_latest_src_28000.capacity AS listing__capacity_latest
+ , listings_latest_src_28000.listing_id AS listing
+ , listings_latest_src_28000.user_id AS user
+ , listings_latest_src_28000.user_id AS listing__user
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
) subq_0
FULL OUTER JOIN (
-- Pass Only Elements: ['home_state_latest', 'user']
@@ -190,32 +190,32 @@ FROM (
FROM (
-- Read Elements From Semantic Model 'users_latest'
SELECT
- DATE_TRUNC('day', users_latest_src_28009.ds) AS ds_latest__day
- , DATE_TRUNC('week', users_latest_src_28009.ds) AS ds_latest__week
- , DATE_TRUNC('month', users_latest_src_28009.ds) AS ds_latest__month
- , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS ds_latest__quarter
- , DATE_TRUNC('year', users_latest_src_28009.ds) AS ds_latest__year
- , EXTRACT(year FROM users_latest_src_28009.ds) AS ds_latest__extract_year
- , EXTRACT(quarter FROM users_latest_src_28009.ds) AS ds_latest__extract_quarter
- , EXTRACT(month FROM users_latest_src_28009.ds) AS ds_latest__extract_month
- , EXTRACT(day FROM users_latest_src_28009.ds) AS ds_latest__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM users_latest_src_28009.ds) AS ds_latest__extract_dow
- , EXTRACT(doy FROM users_latest_src_28009.ds) AS ds_latest__extract_doy
- , users_latest_src_28009.home_state_latest
- , DATE_TRUNC('day', users_latest_src_28009.ds) AS user__ds_latest__day
- , DATE_TRUNC('week', users_latest_src_28009.ds) AS user__ds_latest__week
- , DATE_TRUNC('month', users_latest_src_28009.ds) AS user__ds_latest__month
- , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS user__ds_latest__quarter
- , DATE_TRUNC('year', users_latest_src_28009.ds) AS user__ds_latest__year
- , EXTRACT(year FROM users_latest_src_28009.ds) AS user__ds_latest__extract_year
- , EXTRACT(quarter FROM users_latest_src_28009.ds) AS user__ds_latest__extract_quarter
- , EXTRACT(month FROM users_latest_src_28009.ds) AS user__ds_latest__extract_month
- , EXTRACT(day FROM users_latest_src_28009.ds) AS user__ds_latest__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM users_latest_src_28009.ds) AS user__ds_latest__extract_dow
- , EXTRACT(doy FROM users_latest_src_28009.ds) AS user__ds_latest__extract_doy
- , users_latest_src_28009.home_state_latest AS user__home_state_latest
- , users_latest_src_28009.user_id AS user
- FROM ***************************.dim_users_latest users_latest_src_28009
+ DATE_TRUNC('day', users_latest_src_28000.ds) AS ds_latest__day
+ , DATE_TRUNC('week', users_latest_src_28000.ds) AS ds_latest__week
+ , DATE_TRUNC('month', users_latest_src_28000.ds) AS ds_latest__month
+ , DATE_TRUNC('quarter', users_latest_src_28000.ds) AS ds_latest__quarter
+ , DATE_TRUNC('year', users_latest_src_28000.ds) 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
+ , EXTRACT(day FROM users_latest_src_28000.ds) AS ds_latest__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM users_latest_src_28000.ds) AS ds_latest__extract_dow
+ , EXTRACT(doy FROM users_latest_src_28000.ds) AS ds_latest__extract_doy
+ , users_latest_src_28000.home_state_latest
+ , DATE_TRUNC('day', users_latest_src_28000.ds) AS user__ds_latest__day
+ , DATE_TRUNC('week', users_latest_src_28000.ds) AS user__ds_latest__week
+ , DATE_TRUNC('month', users_latest_src_28000.ds) AS user__ds_latest__month
+ , DATE_TRUNC('quarter', users_latest_src_28000.ds) AS user__ds_latest__quarter
+ , DATE_TRUNC('year', users_latest_src_28000.ds) 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
+ , EXTRACT(day FROM users_latest_src_28000.ds) AS user__ds_latest__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM users_latest_src_28000.ds) AS user__ds_latest__extract_dow
+ , EXTRACT(doy FROM users_latest_src_28000.ds) AS user__ds_latest__extract_doy
+ , users_latest_src_28000.home_state_latest AS user__home_state_latest
+ , users_latest_src_28000.user_id AS user
+ FROM ***************************.dim_users_latest users_latest_src_28000
) subq_1
) subq_2
ON
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_dimension_with_joined_where_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_dimension_with_joined_where_constraint__plan0_optimized.sql
index 8cc8a2b867..c4e57d3c86 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_dimension_with_joined_where_constraint__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_dimension_with_joined_where_constraint__plan0_optimized.sql
@@ -5,13 +5,13 @@ SELECT
FROM (
-- Join Standard Outputs
SELECT
- listings_latest_src_28005.country AS listing__country_latest
- , users_latest_src_28009.home_state_latest AS user__home_state_latest
- FROM ***************************.dim_listings_latest listings_latest_src_28005
+ listings_latest_src_28000.country AS listing__country_latest
+ , users_latest_src_28000.home_state_latest AS user__home_state_latest
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
FULL OUTER JOIN
- ***************************.dim_users_latest users_latest_src_28009
+ ***************************.dim_users_latest users_latest_src_28000
ON
- listings_latest_src_28005.user_id = users_latest_src_28009.user_id
+ listings_latest_src_28000.user_id = users_latest_src_28000.user_id
) subq_8
WHERE listing__country_latest = 'us'
GROUP BY
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_dimensions_requiring_join__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_dimensions_requiring_join__plan0.sql
index 5fd13a23f2..d66932d7d4 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_dimensions_requiring_join__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_dimensions_requiring_join__plan0.sql
@@ -66,62 +66,62 @@ FROM (
-- Read Elements From Semantic Model 'listings_latest'
SELECT
1 AS listings
- , listings_latest_src_28005.capacity AS largest_listing
- , listings_latest_src_28005.capacity AS smallest_listing
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy
- , listings_latest_src_28005.country AS country_latest
- , listings_latest_src_28005.is_lux AS is_lux_latest
- , listings_latest_src_28005.capacity AS capacity_latest
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy
- , listings_latest_src_28005.country AS listing__country_latest
- , listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , listings_latest_src_28005.capacity AS listing__capacity_latest
- , listings_latest_src_28005.listing_id AS listing
- , listings_latest_src_28005.user_id AS user
- , listings_latest_src_28005.user_id AS listing__user
- FROM ***************************.dim_listings_latest listings_latest_src_28005
+ , listings_latest_src_28000.capacity AS largest_listing
+ , listings_latest_src_28000.capacity AS smallest_listing
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS created_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28000.created_at) AS created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS created_at__extract_doy
+ , 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('day', listings_latest_src_28000.created_at) AS listing__ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28000.created_at) AS listing__ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS listing__created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_doy
+ , listings_latest_src_28000.country AS listing__country_latest
+ , listings_latest_src_28000.is_lux AS listing__is_lux_latest
+ , listings_latest_src_28000.capacity AS listing__capacity_latest
+ , listings_latest_src_28000.listing_id AS listing
+ , listings_latest_src_28000.user_id AS user
+ , listings_latest_src_28000.user_id AS listing__user
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
) subq_0
FULL OUTER JOIN (
-- Pass Only Elements: ['home_state_latest', 'user']
@@ -131,32 +131,32 @@ FROM (
FROM (
-- Read Elements From Semantic Model 'users_latest'
SELECT
- DATE_TRUNC('day', users_latest_src_28009.ds) AS ds_latest__day
- , DATE_TRUNC('week', users_latest_src_28009.ds) AS ds_latest__week
- , DATE_TRUNC('month', users_latest_src_28009.ds) AS ds_latest__month
- , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS ds_latest__quarter
- , DATE_TRUNC('year', users_latest_src_28009.ds) AS ds_latest__year
- , EXTRACT(year FROM users_latest_src_28009.ds) AS ds_latest__extract_year
- , EXTRACT(quarter FROM users_latest_src_28009.ds) AS ds_latest__extract_quarter
- , EXTRACT(month FROM users_latest_src_28009.ds) AS ds_latest__extract_month
- , EXTRACT(day FROM users_latest_src_28009.ds) AS ds_latest__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM users_latest_src_28009.ds) AS ds_latest__extract_dow
- , EXTRACT(doy FROM users_latest_src_28009.ds) AS ds_latest__extract_doy
- , users_latest_src_28009.home_state_latest
- , DATE_TRUNC('day', users_latest_src_28009.ds) AS user__ds_latest__day
- , DATE_TRUNC('week', users_latest_src_28009.ds) AS user__ds_latest__week
- , DATE_TRUNC('month', users_latest_src_28009.ds) AS user__ds_latest__month
- , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS user__ds_latest__quarter
- , DATE_TRUNC('year', users_latest_src_28009.ds) AS user__ds_latest__year
- , EXTRACT(year FROM users_latest_src_28009.ds) AS user__ds_latest__extract_year
- , EXTRACT(quarter FROM users_latest_src_28009.ds) AS user__ds_latest__extract_quarter
- , EXTRACT(month FROM users_latest_src_28009.ds) AS user__ds_latest__extract_month
- , EXTRACT(day FROM users_latest_src_28009.ds) AS user__ds_latest__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM users_latest_src_28009.ds) AS user__ds_latest__extract_dow
- , EXTRACT(doy FROM users_latest_src_28009.ds) AS user__ds_latest__extract_doy
- , users_latest_src_28009.home_state_latest AS user__home_state_latest
- , users_latest_src_28009.user_id AS user
- FROM ***************************.dim_users_latest users_latest_src_28009
+ DATE_TRUNC('day', users_latest_src_28000.ds) AS ds_latest__day
+ , DATE_TRUNC('week', users_latest_src_28000.ds) AS ds_latest__week
+ , DATE_TRUNC('month', users_latest_src_28000.ds) AS ds_latest__month
+ , DATE_TRUNC('quarter', users_latest_src_28000.ds) AS ds_latest__quarter
+ , DATE_TRUNC('year', users_latest_src_28000.ds) 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
+ , EXTRACT(day FROM users_latest_src_28000.ds) AS ds_latest__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM users_latest_src_28000.ds) AS ds_latest__extract_dow
+ , EXTRACT(doy FROM users_latest_src_28000.ds) AS ds_latest__extract_doy
+ , users_latest_src_28000.home_state_latest
+ , DATE_TRUNC('day', users_latest_src_28000.ds) AS user__ds_latest__day
+ , DATE_TRUNC('week', users_latest_src_28000.ds) AS user__ds_latest__week
+ , DATE_TRUNC('month', users_latest_src_28000.ds) AS user__ds_latest__month
+ , DATE_TRUNC('quarter', users_latest_src_28000.ds) AS user__ds_latest__quarter
+ , DATE_TRUNC('year', users_latest_src_28000.ds) 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
+ , EXTRACT(day FROM users_latest_src_28000.ds) AS user__ds_latest__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM users_latest_src_28000.ds) AS user__ds_latest__extract_dow
+ , EXTRACT(doy FROM users_latest_src_28000.ds) AS user__ds_latest__extract_doy
+ , users_latest_src_28000.home_state_latest AS user__home_state_latest
+ , users_latest_src_28000.user_id AS user
+ FROM ***************************.dim_users_latest users_latest_src_28000
) subq_1
) subq_2
ON
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_dimensions_requiring_join__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_dimensions_requiring_join__plan0_optimized.sql
index bee3a232b6..96c5d5bb3a 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_dimensions_requiring_join__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_dimensions_requiring_join__plan0_optimized.sql
@@ -1,13 +1,13 @@
-- Join Standard Outputs
-- Pass Only Elements: ['user__home_state_latest', 'listing__is_lux_latest']
SELECT
- listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , users_latest_src_28009.home_state_latest AS user__home_state_latest
-FROM ***************************.dim_listings_latest listings_latest_src_28005
+ 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
FULL OUTER JOIN
- ***************************.dim_users_latest users_latest_src_28009
+ ***************************.dim_users_latest users_latest_src_28000
ON
- listings_latest_src_28005.user_id = users_latest_src_28009.user_id
+ listings_latest_src_28000.user_id = users_latest_src_28000.user_id
GROUP BY
- listings_latest_src_28005.is_lux
- , users_latest_src_28009.home_state_latest
+ listings_latest_src_28000.is_lux
+ , users_latest_src_28000.home_state_latest
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_filter_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_filter_node__plan0.sql
index 5f826772a6..343ccdb7e8 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_filter_node__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_filter_node__plan0.sql
@@ -6,91 +6,91 @@ FROM (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_filter_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_filter_node__plan0_optimized.sql
index bfbf5ff951..554ce484fb 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_filter_node__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_filter_node__plan0_optimized.sql
@@ -2,4 +2,4 @@
-- Pass Only Elements: ['bookings',]
SELECT
1 AS bookings
-FROM ***************************.fct_bookings bookings_source_src_28001
+FROM ***************************.fct_bookings bookings_source_src_28000
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_filter_with_where_constraint_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_filter_with_where_constraint_node__plan0.sql
index 08de4a04d0..a39a7e7609 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_filter_with_where_constraint_node__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_filter_with_where_constraint_node__plan0.sql
@@ -12,93 +12,93 @@ FROM (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
) subq_1
WHERE booking__ds__day = '2020-01-01'
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_filter_with_where_constraint_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_filter_with_where_constraint_node__plan0_optimized.sql
index 755a4d39e2..5ee87ba25f 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_filter_with_where_constraint_node__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_filter_with_where_constraint_node__plan0_optimized.sql
@@ -8,6 +8,6 @@ FROM (
SELECT
DATE_TRUNC('day', ds) AS ds__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_3
WHERE booking__ds__day = '2020-01-01'
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_join_to_time_spine_node_with_offset_to_grain__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_join_to_time_spine_node_with_offset_to_grain__plan0.sql
index 152b0e013c..eec56d28b8 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_join_to_time_spine_node_with_offset_to_grain__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_join_to_time_spine_node_with_offset_to_grain__plan0.sql
@@ -134,93 +134,93 @@ INNER JOIN (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
) subq_1
) subq_2
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_join_to_time_spine_node_with_offset_to_grain__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_join_to_time_spine_node_with_offset_to_grain__plan0_optimized.sql
index d5d4ba056e..6054b232dc 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_join_to_time_spine_node_with_offset_to_grain__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_join_to_time_spine_node_with_offset_to_grain__plan0_optimized.sql
@@ -25,7 +25,7 @@ INNER JOIN (
DATE_TRUNC('day', ds) AS metric_time__day
, listing_id AS listing
, SUM(booking_value) AS booking_value
- FROM ***************************.fct_bookings bookings_source_src_28001
+ FROM ***************************.fct_bookings bookings_source_src_28000
GROUP BY
DATE_TRUNC('day', ds)
, listing_id
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_join_to_time_spine_node_with_offset_window__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_join_to_time_spine_node_with_offset_window__plan0.sql
index 9d60cb466a..278352a1b4 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_join_to_time_spine_node_with_offset_window__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_join_to_time_spine_node_with_offset_window__plan0.sql
@@ -134,93 +134,93 @@ INNER JOIN (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
) subq_1
) subq_2
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_join_to_time_spine_node_with_offset_window__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_join_to_time_spine_node_with_offset_window__plan0_optimized.sql
index cb1797bad8..61bc9299ec 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_join_to_time_spine_node_with_offset_window__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_join_to_time_spine_node_with_offset_window__plan0_optimized.sql
@@ -25,7 +25,7 @@ INNER JOIN (
DATE_TRUNC('day', ds) AS metric_time__day
, listing_id AS listing
, SUM(booking_value) AS booking_value
- FROM ***************************.fct_bookings bookings_source_src_28001
+ FROM ***************************.fct_bookings bookings_source_src_28000
GROUP BY
DATE_TRUNC('day', ds)
, listing_id
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_join_to_time_spine_node_without_offset__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_join_to_time_spine_node_without_offset__plan0.sql
index 784e5f265a..84ae7ad473 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_join_to_time_spine_node_without_offset__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_join_to_time_spine_node_without_offset__plan0.sql
@@ -134,93 +134,93 @@ INNER JOIN (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
) subq_1
) subq_2
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_join_to_time_spine_node_without_offset__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_join_to_time_spine_node_without_offset__plan0_optimized.sql
index 695cf9c062..e4f47734b0 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_join_to_time_spine_node_without_offset__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_join_to_time_spine_node_without_offset__plan0_optimized.sql
@@ -25,7 +25,7 @@ INNER JOIN (
DATE_TRUNC('day', ds) AS metric_time__day
, listing_id AS listing
, SUM(booking_value) AS booking_value
- FROM ***************************.fct_bookings bookings_source_src_28001
+ FROM ***************************.fct_bookings bookings_source_src_28000
GROUP BY
DATE_TRUNC('day', ds)
, listing_id
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_measure_aggregation_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_measure_aggregation_node__plan0.sql
index 7ed2fad1d8..15f15c236e 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_measure_aggregation_node__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_measure_aggregation_node__plan0.sql
@@ -16,92 +16,92 @@ FROM (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
) subq_1
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_measure_aggregation_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_measure_aggregation_node__plan0_optimized.sql
index 64fc2826b9..6e5528a6c9 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_measure_aggregation_node__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_measure_aggregation_node__plan0_optimized.sql
@@ -6,4 +6,4 @@ SELECT
, SUM(CASE WHEN is_instant THEN 1 ELSE 0 END) AS instant_bookings
, COUNT(DISTINCT guest_id) AS bookers
, AVG(booking_value) AS average_booking_value
-FROM ***************************.fct_bookings bookings_source_src_28001
+FROM ***************************.fct_bookings bookings_source_src_28000
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_multi_join_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_multi_join_node__plan0.sql
index 570d1f67eb..27a7f61bce 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_multi_join_node__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_multi_join_node__plan0.sql
@@ -14,93 +14,93 @@ FROM (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
) subq_1
LEFT OUTER JOIN (
@@ -112,62 +112,62 @@ LEFT OUTER JOIN (
-- Read Elements From Semantic Model 'listings_latest'
SELECT
1 AS listings
- , listings_latest_src_28005.capacity AS largest_listing
- , listings_latest_src_28005.capacity AS smallest_listing
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy
- , listings_latest_src_28005.country AS country_latest
- , listings_latest_src_28005.is_lux AS is_lux_latest
- , listings_latest_src_28005.capacity AS capacity_latest
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy
- , listings_latest_src_28005.country AS listing__country_latest
- , listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , listings_latest_src_28005.capacity AS listing__capacity_latest
- , listings_latest_src_28005.listing_id AS listing
- , listings_latest_src_28005.user_id AS user
- , listings_latest_src_28005.user_id AS listing__user
- FROM ***************************.dim_listings_latest listings_latest_src_28005
+ , listings_latest_src_28000.capacity AS largest_listing
+ , listings_latest_src_28000.capacity AS smallest_listing
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS created_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28000.created_at) AS created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS created_at__extract_doy
+ , 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('day', listings_latest_src_28000.created_at) AS listing__ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28000.created_at) AS listing__ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS listing__created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_doy
+ , listings_latest_src_28000.country AS listing__country_latest
+ , listings_latest_src_28000.is_lux AS listing__is_lux_latest
+ , listings_latest_src_28000.capacity AS listing__capacity_latest
+ , listings_latest_src_28000.listing_id AS listing
+ , listings_latest_src_28000.user_id AS user
+ , listings_latest_src_28000.user_id AS listing__user
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
) subq_2
) subq_3
ON
@@ -181,62 +181,62 @@ LEFT OUTER JOIN (
-- Read Elements From Semantic Model 'listings_latest'
SELECT
1 AS listings
- , listings_latest_src_28005.capacity AS largest_listing
- , listings_latest_src_28005.capacity AS smallest_listing
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy
- , listings_latest_src_28005.country AS country_latest
- , listings_latest_src_28005.is_lux AS is_lux_latest
- , listings_latest_src_28005.capacity AS capacity_latest
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy
- , listings_latest_src_28005.country AS listing__country_latest
- , listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , listings_latest_src_28005.capacity AS listing__capacity_latest
- , listings_latest_src_28005.listing_id AS listing
- , listings_latest_src_28005.user_id AS user
- , listings_latest_src_28005.user_id AS listing__user
- FROM ***************************.dim_listings_latest listings_latest_src_28005
+ , listings_latest_src_28000.capacity AS largest_listing
+ , listings_latest_src_28000.capacity AS smallest_listing
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS created_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28000.created_at) AS created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS created_at__extract_doy
+ , 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('day', listings_latest_src_28000.created_at) AS listing__ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28000.created_at) AS listing__ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS listing__created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_doy
+ , listings_latest_src_28000.country AS listing__country_latest
+ , listings_latest_src_28000.is_lux AS listing__is_lux_latest
+ , listings_latest_src_28000.capacity AS listing__capacity_latest
+ , listings_latest_src_28000.listing_id AS listing
+ , listings_latest_src_28000.user_id AS user
+ , listings_latest_src_28000.user_id AS listing__user
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
) subq_4
) subq_5
ON
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_multi_join_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_multi_join_node__plan0_optimized.sql
index b9cecc48d8..7d9c669f54 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_multi_join_node__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_multi_join_node__plan0_optimized.sql
@@ -10,7 +10,7 @@ FROM (
SELECT
listing_id AS listing
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_7
LEFT OUTER JOIN (
-- Read Elements From Semantic Model 'listings_latest'
@@ -18,7 +18,7 @@ LEFT OUTER JOIN (
SELECT
listing_id AS listing
, country AS country_latest
- FROM ***************************.dim_listings_latest listings_latest_src_28005
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
) subq_9
ON
subq_7.listing = subq_9.listing
@@ -28,7 +28,7 @@ LEFT OUTER JOIN (
SELECT
listing_id AS listing
, country AS country_latest
- FROM ***************************.dim_listings_latest listings_latest_src_28005
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
) subq_11
ON
subq_7.listing = subq_11.listing
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_order_by_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_order_by_node__plan0.sql
index 73a9be7514..6c7a1e644c 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_order_by_node__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_order_by_node__plan0.sql
@@ -26,93 +26,93 @@ FROM (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
) subq_1
GROUP BY
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_order_by_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_order_by_node__plan0_optimized.sql
index fd8a1ff597..bcebfe9d5f 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_order_by_node__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_order_by_node__plan0_optimized.sql
@@ -12,7 +12,7 @@ FROM (
DATE_TRUNC('day', ds) AS ds__day
, is_instant
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_5
GROUP BY
ds__day
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_single_join_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_single_join_node__plan0.sql
index 67e5f3fe2d..05e59e291e 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_single_join_node__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_single_join_node__plan0.sql
@@ -12,93 +12,93 @@ FROM (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
) subq_1
LEFT OUTER JOIN (
@@ -110,62 +110,62 @@ LEFT OUTER JOIN (
-- Read Elements From Semantic Model 'listings_latest'
SELECT
1 AS listings
- , listings_latest_src_28005.capacity AS largest_listing
- , listings_latest_src_28005.capacity AS smallest_listing
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy
- , listings_latest_src_28005.country AS country_latest
- , listings_latest_src_28005.is_lux AS is_lux_latest
- , listings_latest_src_28005.capacity AS capacity_latest
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy
- , listings_latest_src_28005.country AS listing__country_latest
- , listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , listings_latest_src_28005.capacity AS listing__capacity_latest
- , listings_latest_src_28005.listing_id AS listing
- , listings_latest_src_28005.user_id AS user
- , listings_latest_src_28005.user_id AS listing__user
- FROM ***************************.dim_listings_latest listings_latest_src_28005
+ , listings_latest_src_28000.capacity AS largest_listing
+ , listings_latest_src_28000.capacity AS smallest_listing
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS created_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28000.created_at) AS created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS created_at__extract_doy
+ , 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('day', listings_latest_src_28000.created_at) AS listing__ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28000.created_at) AS listing__ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS listing__created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_doy
+ , listings_latest_src_28000.country AS listing__country_latest
+ , listings_latest_src_28000.is_lux AS listing__is_lux_latest
+ , listings_latest_src_28000.capacity AS listing__capacity_latest
+ , listings_latest_src_28000.listing_id AS listing
+ , listings_latest_src_28000.user_id AS user
+ , listings_latest_src_28000.user_id AS listing__user
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
) subq_2
) subq_3
ON
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_single_join_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_single_join_node__plan0_optimized.sql
index e03ffcce64..a1cd7ac335 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_single_join_node__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_single_join_node__plan0_optimized.sql
@@ -8,9 +8,9 @@ FROM (
SELECT
listing_id AS listing
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_5
LEFT OUTER JOIN
- ***************************.dim_listings_latest listings_latest_src_28005
+ ***************************.dim_listings_latest listings_latest_src_28000
ON
- subq_5.listing = listings_latest_src_28005.listing_id
+ subq_5.listing = listings_latest_src_28000.listing_id
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_source_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_source_node__plan0.sql
index 00c7139994..da33eea744 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_source_node__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_source_node__plan0.sql
@@ -2,90 +2,90 @@
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
-FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+FROM ***************************.fct_bookings bookings_source_src_28000
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_source_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_source_node__plan0_optimized.sql
index 32dc9ad747..5987daa5e3 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_source_node__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Databricks/test_source_node__plan0_optimized.sql
@@ -88,4 +88,4 @@ SELECT
, listing_id AS booking__listing
, guest_id AS booking__guest
, host_id AS booking__host
-FROM ***************************.fct_bookings bookings_source_src_28001
+FROM ***************************.fct_bookings bookings_source_src_28000
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_combine_output_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_combine_output_node__plan0.sql
index a8375b02dd..a8d97dae7f 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_combine_output_node__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_combine_output_node__plan0.sql
@@ -19,93 +19,93 @@ FROM (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
) subq_1
GROUP BY
@@ -128,93 +128,93 @@ FULL OUTER JOIN (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_3
) subq_4
GROUP BY
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_combine_output_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_combine_output_node__plan0_optimized.sql
index a8375510d7..ad81788114 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_combine_output_node__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_combine_output_node__plan0_optimized.sql
@@ -15,7 +15,7 @@ FROM (
SELECT
is_instant
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_7
GROUP BY
is_instant
@@ -33,7 +33,7 @@ FULL OUTER JOIN (
is_instant
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
, guest_id AS bookers
- FROM ***************************.fct_bookings bookings_source_src_28001
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_10
GROUP BY
is_instant
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node__plan0.sql
index 760f45c973..08fdfa6034 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node__plan0.sql
@@ -25,93 +25,93 @@ FROM (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
) subq_1
LEFT OUTER JOIN (
@@ -123,62 +123,62 @@ FROM (
-- Read Elements From Semantic Model 'listings_latest'
SELECT
1 AS listings
- , listings_latest_src_28005.capacity AS largest_listing
- , listings_latest_src_28005.capacity AS smallest_listing
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy
- , listings_latest_src_28005.country AS country_latest
- , listings_latest_src_28005.is_lux AS is_lux_latest
- , listings_latest_src_28005.capacity AS capacity_latest
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy
- , listings_latest_src_28005.country AS listing__country_latest
- , listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , listings_latest_src_28005.capacity AS listing__capacity_latest
- , listings_latest_src_28005.listing_id AS listing
- , listings_latest_src_28005.user_id AS user
- , listings_latest_src_28005.user_id AS listing__user
- FROM ***************************.dim_listings_latest listings_latest_src_28005
+ , listings_latest_src_28000.capacity AS largest_listing
+ , listings_latest_src_28000.capacity AS smallest_listing
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS created_at__extract_day
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS created_at__extract_doy
+ , 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('day', listings_latest_src_28000.created_at) AS listing__ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS listing__ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS listing__created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_day
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_doy
+ , listings_latest_src_28000.country AS listing__country_latest
+ , listings_latest_src_28000.is_lux AS listing__is_lux_latest
+ , listings_latest_src_28000.capacity AS listing__capacity_latest
+ , listings_latest_src_28000.listing_id AS listing
+ , listings_latest_src_28000.user_id AS user
+ , listings_latest_src_28000.user_id AS listing__user
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
) subq_2
) subq_3
ON
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node__plan0_optimized.sql
index cf47afc6bf..5ebe7177e8 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node__plan0_optimized.sql
@@ -3,7 +3,7 @@
-- Compute Metrics via Expressions
SELECT
subq_7.listing AS listing
- , listings_latest_src_28005.country AS listing__country_latest
+ , listings_latest_src_28000.country AS listing__country_latest
, SUM(subq_7.bookings) AS bookings
FROM (
-- Read Elements From Semantic Model 'bookings_source'
@@ -11,12 +11,12 @@ FROM (
SELECT
listing_id AS listing
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_7
LEFT OUTER JOIN
- ***************************.dim_listings_latest listings_latest_src_28005
+ ***************************.dim_listings_latest listings_latest_src_28000
ON
- subq_7.listing = listings_latest_src_28005.listing_id
+ subq_7.listing = listings_latest_src_28000.listing_id
GROUP BY
subq_7.listing
- , listings_latest_src_28005.country
+ , listings_latest_src_28000.country
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.sql
index 0b73a89b54..385d922587 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.sql
@@ -1,693 +1,693 @@
-- Compute Metrics via Expressions
SELECT
- subq_20.ds__day
- , subq_20.listing__country_latest
- , CAST(subq_20.bookings AS DOUBLE) / CAST(NULLIF(subq_20.views, 0) AS DOUBLE) AS bookings_per_view
+ subq_29.ds__day
+ , subq_29.listing__country_latest
+ , CAST(subq_29.bookings AS DOUBLE) / CAST(NULLIF(subq_29.views, 0) AS DOUBLE) AS bookings_per_view
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_9.ds__day, subq_19.ds__day) AS ds__day
- , COALESCE(subq_9.listing__country_latest, subq_19.listing__country_latest) AS listing__country_latest
- , MAX(subq_9.bookings) AS bookings
- , MAX(subq_19.views) AS views
+ COALESCE(subq_18.ds__day, subq_28.ds__day) AS ds__day
+ , COALESCE(subq_18.listing__country_latest, subq_28.listing__country_latest) AS listing__country_latest
+ , MAX(subq_18.bookings) AS bookings
+ , MAX(subq_28.views) AS views
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_8.ds__day
- , subq_8.listing__country_latest
- , subq_8.bookings
+ subq_17.ds__day
+ , subq_17.listing__country_latest
+ , subq_17.bookings
FROM (
-- Aggregate Measures
SELECT
- subq_7.ds__day
- , subq_7.listing__country_latest
- , SUM(subq_7.bookings) AS bookings
+ subq_16.ds__day
+ , subq_16.listing__country_latest
+ , SUM(subq_16.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'listing__country_latest', 'ds__day']
SELECT
- subq_6.ds__day
- , subq_6.listing__country_latest
- , subq_6.bookings
+ subq_15.ds__day
+ , subq_15.listing__country_latest
+ , subq_15.bookings
FROM (
-- Join Standard Outputs
SELECT
- subq_2.ds__day AS ds__day
- , subq_2.listing AS listing
- , subq_5.country_latest AS listing__country_latest
- , subq_2.bookings AS bookings
+ subq_11.ds__day AS ds__day
+ , subq_11.listing AS listing
+ , subq_14.country_latest AS listing__country_latest
+ , subq_11.bookings AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'ds__day', 'listing']
SELECT
- subq_1.ds__day
- , subq_1.listing
- , subq_1.bookings
+ subq_10.ds__day
+ , subq_10.listing
+ , subq_10.bookings
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
- ) subq_2
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
LEFT OUTER JOIN (
-- Pass Only Elements: ['country_latest', 'listing']
SELECT
- subq_4.listing
- , subq_4.country_latest
+ subq_13.listing
+ , subq_13.country_latest
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_3.ds__day
- , subq_3.ds__week
- , subq_3.ds__month
- , subq_3.ds__quarter
- , subq_3.ds__year
- , subq_3.ds__extract_year
- , subq_3.ds__extract_quarter
- , subq_3.ds__extract_month
- , subq_3.ds__extract_day
- , subq_3.ds__extract_dow
- , subq_3.ds__extract_doy
- , subq_3.created_at__day
- , subq_3.created_at__week
- , subq_3.created_at__month
- , subq_3.created_at__quarter
- , subq_3.created_at__year
- , subq_3.created_at__extract_year
- , subq_3.created_at__extract_quarter
- , subq_3.created_at__extract_month
- , subq_3.created_at__extract_day
- , subq_3.created_at__extract_dow
- , subq_3.created_at__extract_doy
- , subq_3.listing__ds__day
- , subq_3.listing__ds__week
- , subq_3.listing__ds__month
- , subq_3.listing__ds__quarter
- , subq_3.listing__ds__year
- , subq_3.listing__ds__extract_year
- , subq_3.listing__ds__extract_quarter
- , subq_3.listing__ds__extract_month
- , subq_3.listing__ds__extract_day
- , subq_3.listing__ds__extract_dow
- , subq_3.listing__ds__extract_doy
- , subq_3.listing__created_at__day
- , subq_3.listing__created_at__week
- , subq_3.listing__created_at__month
- , subq_3.listing__created_at__quarter
- , subq_3.listing__created_at__year
- , subq_3.listing__created_at__extract_year
- , subq_3.listing__created_at__extract_quarter
- , subq_3.listing__created_at__extract_month
- , subq_3.listing__created_at__extract_day
- , subq_3.listing__created_at__extract_dow
- , subq_3.listing__created_at__extract_doy
- , subq_3.ds__day AS metric_time__day
- , subq_3.ds__week AS metric_time__week
- , subq_3.ds__month AS metric_time__month
- , subq_3.ds__quarter AS metric_time__quarter
- , subq_3.ds__year AS metric_time__year
- , subq_3.ds__extract_year AS metric_time__extract_year
- , subq_3.ds__extract_quarter AS metric_time__extract_quarter
- , subq_3.ds__extract_month AS metric_time__extract_month
- , subq_3.ds__extract_day AS metric_time__extract_day
- , subq_3.ds__extract_dow AS metric_time__extract_dow
- , subq_3.ds__extract_doy AS metric_time__extract_doy
- , subq_3.listing
- , subq_3.user
- , subq_3.listing__user
- , subq_3.country_latest
- , subq_3.is_lux_latest
- , subq_3.capacity_latest
- , subq_3.listing__country_latest
- , subq_3.listing__is_lux_latest
- , subq_3.listing__capacity_latest
- , subq_3.listings
- , subq_3.largest_listing
- , subq_3.smallest_listing
+ subq_12.ds__day
+ , subq_12.ds__week
+ , subq_12.ds__month
+ , subq_12.ds__quarter
+ , subq_12.ds__year
+ , subq_12.ds__extract_year
+ , subq_12.ds__extract_quarter
+ , subq_12.ds__extract_month
+ , subq_12.ds__extract_day
+ , subq_12.ds__extract_dow
+ , subq_12.ds__extract_doy
+ , subq_12.created_at__day
+ , subq_12.created_at__week
+ , subq_12.created_at__month
+ , subq_12.created_at__quarter
+ , subq_12.created_at__year
+ , subq_12.created_at__extract_year
+ , subq_12.created_at__extract_quarter
+ , subq_12.created_at__extract_month
+ , subq_12.created_at__extract_day
+ , subq_12.created_at__extract_dow
+ , subq_12.created_at__extract_doy
+ , subq_12.listing__ds__day
+ , subq_12.listing__ds__week
+ , subq_12.listing__ds__month
+ , subq_12.listing__ds__quarter
+ , subq_12.listing__ds__year
+ , subq_12.listing__ds__extract_year
+ , subq_12.listing__ds__extract_quarter
+ , subq_12.listing__ds__extract_month
+ , subq_12.listing__ds__extract_day
+ , subq_12.listing__ds__extract_dow
+ , subq_12.listing__ds__extract_doy
+ , subq_12.listing__created_at__day
+ , subq_12.listing__created_at__week
+ , subq_12.listing__created_at__month
+ , subq_12.listing__created_at__quarter
+ , subq_12.listing__created_at__year
+ , subq_12.listing__created_at__extract_year
+ , subq_12.listing__created_at__extract_quarter
+ , subq_12.listing__created_at__extract_month
+ , subq_12.listing__created_at__extract_day
+ , subq_12.listing__created_at__extract_dow
+ , subq_12.listing__created_at__extract_doy
+ , subq_12.ds__day AS metric_time__day
+ , subq_12.ds__week AS metric_time__week
+ , subq_12.ds__month AS metric_time__month
+ , subq_12.ds__quarter AS metric_time__quarter
+ , subq_12.ds__year AS metric_time__year
+ , subq_12.ds__extract_year AS metric_time__extract_year
+ , subq_12.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_12.ds__extract_month AS metric_time__extract_month
+ , subq_12.ds__extract_day AS metric_time__extract_day
+ , subq_12.ds__extract_dow AS metric_time__extract_dow
+ , subq_12.ds__extract_doy AS metric_time__extract_doy
+ , subq_12.listing
+ , subq_12.user
+ , subq_12.listing__user
+ , subq_12.country_latest
+ , subq_12.is_lux_latest
+ , subq_12.capacity_latest
+ , subq_12.listing__country_latest
+ , subq_12.listing__is_lux_latest
+ , subq_12.listing__capacity_latest
+ , subq_12.listings
+ , subq_12.largest_listing
+ , subq_12.smallest_listing
FROM (
-- Read Elements From Semantic Model 'listings_latest'
SELECT
1 AS listings
- , listings_latest_src_28005.capacity AS largest_listing
- , listings_latest_src_28005.capacity AS smallest_listing
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy
- , listings_latest_src_28005.country AS country_latest
- , listings_latest_src_28005.is_lux AS is_lux_latest
- , listings_latest_src_28005.capacity AS capacity_latest
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy
- , listings_latest_src_28005.country AS listing__country_latest
- , listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , listings_latest_src_28005.capacity AS listing__capacity_latest
- , listings_latest_src_28005.listing_id AS listing
- , listings_latest_src_28005.user_id AS user
- , listings_latest_src_28005.user_id AS listing__user
- FROM ***************************.dim_listings_latest listings_latest_src_28005
- ) subq_3
- ) subq_4
- ) subq_5
+ , listings_latest_src_28000.capacity AS largest_listing
+ , listings_latest_src_28000.capacity AS smallest_listing
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS created_at__extract_day
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS created_at__extract_doy
+ , 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('day', listings_latest_src_28000.created_at) AS listing__ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS listing__ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS listing__created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_day
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_doy
+ , listings_latest_src_28000.country AS listing__country_latest
+ , listings_latest_src_28000.is_lux AS listing__is_lux_latest
+ , listings_latest_src_28000.capacity AS listing__capacity_latest
+ , listings_latest_src_28000.listing_id AS listing
+ , listings_latest_src_28000.user_id AS user
+ , listings_latest_src_28000.user_id AS listing__user
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
+ ) subq_12
+ ) subq_13
+ ) subq_14
ON
- subq_2.listing = subq_5.listing
- ) subq_6
- ) subq_7
+ subq_11.listing = subq_14.listing
+ ) subq_15
+ ) subq_16
GROUP BY
- subq_7.ds__day
- , subq_7.listing__country_latest
- ) subq_8
- ) subq_9
+ subq_16.ds__day
+ , subq_16.listing__country_latest
+ ) subq_17
+ ) subq_18
FULL OUTER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_18.ds__day
- , subq_18.listing__country_latest
- , subq_18.views
+ subq_27.ds__day
+ , subq_27.listing__country_latest
+ , subq_27.views
FROM (
-- Aggregate Measures
SELECT
- subq_17.ds__day
- , subq_17.listing__country_latest
- , SUM(subq_17.views) AS views
+ subq_26.ds__day
+ , subq_26.listing__country_latest
+ , SUM(subq_26.views) AS views
FROM (
-- Pass Only Elements: ['views', 'listing__country_latest', 'ds__day']
SELECT
- subq_16.ds__day
- , subq_16.listing__country_latest
- , subq_16.views
+ subq_25.ds__day
+ , subq_25.listing__country_latest
+ , subq_25.views
FROM (
-- Join Standard Outputs
SELECT
- subq_12.ds__day AS ds__day
- , subq_12.listing AS listing
- , subq_15.country_latest AS listing__country_latest
- , subq_12.views AS views
+ subq_21.ds__day AS ds__day
+ , subq_21.listing AS listing
+ , subq_24.country_latest AS listing__country_latest
+ , subq_21.views AS views
FROM (
-- Pass Only Elements: ['views', 'ds__day', 'listing']
SELECT
- subq_11.ds__day
- , subq_11.listing
- , subq_11.views
+ subq_20.ds__day
+ , subq_20.listing
+ , subq_20.views
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_10.ds__day
- , subq_10.ds__week
- , subq_10.ds__month
- , subq_10.ds__quarter
- , subq_10.ds__year
- , subq_10.ds__extract_year
- , subq_10.ds__extract_quarter
- , subq_10.ds__extract_month
- , subq_10.ds__extract_day
- , subq_10.ds__extract_dow
- , subq_10.ds__extract_doy
- , subq_10.ds_partitioned__day
- , subq_10.ds_partitioned__week
- , subq_10.ds_partitioned__month
- , subq_10.ds_partitioned__quarter
- , subq_10.ds_partitioned__year
- , subq_10.ds_partitioned__extract_year
- , subq_10.ds_partitioned__extract_quarter
- , subq_10.ds_partitioned__extract_month
- , subq_10.ds_partitioned__extract_day
- , subq_10.ds_partitioned__extract_dow
- , subq_10.ds_partitioned__extract_doy
- , subq_10.view__ds__day
- , subq_10.view__ds__week
- , subq_10.view__ds__month
- , subq_10.view__ds__quarter
- , subq_10.view__ds__year
- , subq_10.view__ds__extract_year
- , subq_10.view__ds__extract_quarter
- , subq_10.view__ds__extract_month
- , subq_10.view__ds__extract_day
- , subq_10.view__ds__extract_dow
- , subq_10.view__ds__extract_doy
- , subq_10.view__ds_partitioned__day
- , subq_10.view__ds_partitioned__week
- , subq_10.view__ds_partitioned__month
- , subq_10.view__ds_partitioned__quarter
- , subq_10.view__ds_partitioned__year
- , subq_10.view__ds_partitioned__extract_year
- , subq_10.view__ds_partitioned__extract_quarter
- , subq_10.view__ds_partitioned__extract_month
- , subq_10.view__ds_partitioned__extract_day
- , subq_10.view__ds_partitioned__extract_dow
- , subq_10.view__ds_partitioned__extract_doy
- , subq_10.ds__day AS metric_time__day
- , subq_10.ds__week AS metric_time__week
- , subq_10.ds__month AS metric_time__month
- , subq_10.ds__quarter AS metric_time__quarter
- , subq_10.ds__year AS metric_time__year
- , subq_10.ds__extract_year AS metric_time__extract_year
- , subq_10.ds__extract_quarter AS metric_time__extract_quarter
- , subq_10.ds__extract_month AS metric_time__extract_month
- , subq_10.ds__extract_day AS metric_time__extract_day
- , subq_10.ds__extract_dow AS metric_time__extract_dow
- , subq_10.ds__extract_doy AS metric_time__extract_doy
- , subq_10.listing
- , subq_10.user
- , subq_10.view__listing
- , subq_10.view__user
- , subq_10.views
+ subq_19.ds__day
+ , subq_19.ds__week
+ , subq_19.ds__month
+ , subq_19.ds__quarter
+ , subq_19.ds__year
+ , subq_19.ds__extract_year
+ , subq_19.ds__extract_quarter
+ , subq_19.ds__extract_month
+ , subq_19.ds__extract_day
+ , subq_19.ds__extract_dow
+ , subq_19.ds__extract_doy
+ , subq_19.ds_partitioned__day
+ , subq_19.ds_partitioned__week
+ , subq_19.ds_partitioned__month
+ , subq_19.ds_partitioned__quarter
+ , subq_19.ds_partitioned__year
+ , subq_19.ds_partitioned__extract_year
+ , subq_19.ds_partitioned__extract_quarter
+ , subq_19.ds_partitioned__extract_month
+ , subq_19.ds_partitioned__extract_day
+ , subq_19.ds_partitioned__extract_dow
+ , subq_19.ds_partitioned__extract_doy
+ , subq_19.view__ds__day
+ , subq_19.view__ds__week
+ , subq_19.view__ds__month
+ , subq_19.view__ds__quarter
+ , subq_19.view__ds__year
+ , subq_19.view__ds__extract_year
+ , subq_19.view__ds__extract_quarter
+ , subq_19.view__ds__extract_month
+ , subq_19.view__ds__extract_day
+ , subq_19.view__ds__extract_dow
+ , subq_19.view__ds__extract_doy
+ , subq_19.view__ds_partitioned__day
+ , subq_19.view__ds_partitioned__week
+ , subq_19.view__ds_partitioned__month
+ , subq_19.view__ds_partitioned__quarter
+ , subq_19.view__ds_partitioned__year
+ , subq_19.view__ds_partitioned__extract_year
+ , subq_19.view__ds_partitioned__extract_quarter
+ , subq_19.view__ds_partitioned__extract_month
+ , subq_19.view__ds_partitioned__extract_day
+ , subq_19.view__ds_partitioned__extract_dow
+ , subq_19.view__ds_partitioned__extract_doy
+ , subq_19.ds__day AS metric_time__day
+ , subq_19.ds__week AS metric_time__week
+ , subq_19.ds__month AS metric_time__month
+ , subq_19.ds__quarter AS metric_time__quarter
+ , subq_19.ds__year AS metric_time__year
+ , subq_19.ds__extract_year AS metric_time__extract_year
+ , subq_19.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_19.ds__extract_month AS metric_time__extract_month
+ , subq_19.ds__extract_day AS metric_time__extract_day
+ , subq_19.ds__extract_dow AS metric_time__extract_dow
+ , subq_19.ds__extract_doy AS metric_time__extract_doy
+ , subq_19.listing
+ , subq_19.user
+ , subq_19.view__listing
+ , subq_19.view__user
+ , subq_19.views
FROM (
-- Read Elements From Semantic Model 'views_source'
SELECT
1 AS views
- , DATE_TRUNC('day', views_source_src_28010.ds) AS ds__day
- , DATE_TRUNC('week', views_source_src_28010.ds) AS ds__week
- , DATE_TRUNC('month', views_source_src_28010.ds) AS ds__month
- , DATE_TRUNC('quarter', views_source_src_28010.ds) AS ds__quarter
- , DATE_TRUNC('year', views_source_src_28010.ds) AS ds__year
- , EXTRACT(year FROM views_source_src_28010.ds) AS ds__extract_year
- , EXTRACT(quarter FROM views_source_src_28010.ds) AS ds__extract_quarter
- , EXTRACT(month FROM views_source_src_28010.ds) AS ds__extract_month
- , EXTRACT(day FROM views_source_src_28010.ds) AS ds__extract_day
- , EXTRACT(isodow FROM views_source_src_28010.ds) AS ds__extract_dow
- , EXTRACT(doy FROM views_source_src_28010.ds) AS ds__extract_doy
- , DATE_TRUNC('day', views_source_src_28010.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', views_source_src_28010.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', views_source_src_28010.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', views_source_src_28010.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', views_source_src_28010.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM views_source_src_28010.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM views_source_src_28010.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM views_source_src_28010.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM views_source_src_28010.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM views_source_src_28010.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM views_source_src_28010.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', views_source_src_28010.ds) AS view__ds__day
- , DATE_TRUNC('week', views_source_src_28010.ds) AS view__ds__week
- , DATE_TRUNC('month', views_source_src_28010.ds) AS view__ds__month
- , DATE_TRUNC('quarter', views_source_src_28010.ds) AS view__ds__quarter
- , DATE_TRUNC('year', views_source_src_28010.ds) AS view__ds__year
- , EXTRACT(year FROM views_source_src_28010.ds) AS view__ds__extract_year
- , EXTRACT(quarter FROM views_source_src_28010.ds) AS view__ds__extract_quarter
- , EXTRACT(month FROM views_source_src_28010.ds) AS view__ds__extract_month
- , EXTRACT(day FROM views_source_src_28010.ds) AS view__ds__extract_day
- , EXTRACT(isodow FROM views_source_src_28010.ds) AS view__ds__extract_dow
- , EXTRACT(doy FROM views_source_src_28010.ds) AS view__ds__extract_doy
- , DATE_TRUNC('day', views_source_src_28010.ds_partitioned) AS view__ds_partitioned__day
- , DATE_TRUNC('week', views_source_src_28010.ds_partitioned) AS view__ds_partitioned__week
- , DATE_TRUNC('month', views_source_src_28010.ds_partitioned) AS view__ds_partitioned__month
- , DATE_TRUNC('quarter', views_source_src_28010.ds_partitioned) AS view__ds_partitioned__quarter
- , DATE_TRUNC('year', views_source_src_28010.ds_partitioned) AS view__ds_partitioned__year
- , EXTRACT(year FROM views_source_src_28010.ds_partitioned) AS view__ds_partitioned__extract_year
- , EXTRACT(quarter FROM views_source_src_28010.ds_partitioned) AS view__ds_partitioned__extract_quarter
- , EXTRACT(month FROM views_source_src_28010.ds_partitioned) AS view__ds_partitioned__extract_month
- , EXTRACT(day FROM views_source_src_28010.ds_partitioned) AS view__ds_partitioned__extract_day
- , EXTRACT(isodow FROM views_source_src_28010.ds_partitioned) AS view__ds_partitioned__extract_dow
- , EXTRACT(doy FROM views_source_src_28010.ds_partitioned) AS view__ds_partitioned__extract_doy
- , views_source_src_28010.listing_id AS listing
- , views_source_src_28010.user_id AS user
- , views_source_src_28010.listing_id AS view__listing
- , views_source_src_28010.user_id AS view__user
- FROM ***************************.fct_views views_source_src_28010
- ) subq_10
- ) subq_11
- ) subq_12
+ , DATE_TRUNC('day', views_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', views_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', views_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', views_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', views_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM views_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM views_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', views_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', views_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', views_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', views_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', views_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM views_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM views_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', views_source_src_28000.ds) AS view__ds__day
+ , DATE_TRUNC('week', views_source_src_28000.ds) AS view__ds__week
+ , DATE_TRUNC('month', views_source_src_28000.ds) AS view__ds__month
+ , DATE_TRUNC('quarter', views_source_src_28000.ds) AS view__ds__quarter
+ , DATE_TRUNC('year', views_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM views_source_src_28000.ds) AS view__ds__extract_dow
+ , EXTRACT(doy FROM views_source_src_28000.ds) AS view__ds__extract_doy
+ , DATE_TRUNC('day', views_source_src_28000.ds_partitioned) AS view__ds_partitioned__day
+ , DATE_TRUNC('week', views_source_src_28000.ds_partitioned) AS view__ds_partitioned__week
+ , DATE_TRUNC('month', views_source_src_28000.ds_partitioned) AS view__ds_partitioned__month
+ , DATE_TRUNC('quarter', views_source_src_28000.ds_partitioned) AS view__ds_partitioned__quarter
+ , DATE_TRUNC('year', views_source_src_28000.ds_partitioned) 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
+ , EXTRACT(day FROM views_source_src_28000.ds_partitioned) AS view__ds_partitioned__extract_day
+ , EXTRACT(isodow FROM views_source_src_28000.ds_partitioned) AS view__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM views_source_src_28000.ds_partitioned) AS view__ds_partitioned__extract_doy
+ , views_source_src_28000.listing_id AS listing
+ , views_source_src_28000.user_id AS user
+ , views_source_src_28000.listing_id AS view__listing
+ , views_source_src_28000.user_id AS view__user
+ FROM ***************************.fct_views views_source_src_28000
+ ) subq_19
+ ) subq_20
+ ) subq_21
LEFT OUTER JOIN (
-- Pass Only Elements: ['country_latest', 'listing']
SELECT
- subq_14.listing
- , subq_14.country_latest
+ subq_23.listing
+ , subq_23.country_latest
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_13.ds__day
- , subq_13.ds__week
- , subq_13.ds__month
- , subq_13.ds__quarter
- , subq_13.ds__year
- , subq_13.ds__extract_year
- , subq_13.ds__extract_quarter
- , subq_13.ds__extract_month
- , subq_13.ds__extract_day
- , subq_13.ds__extract_dow
- , subq_13.ds__extract_doy
- , subq_13.created_at__day
- , subq_13.created_at__week
- , subq_13.created_at__month
- , subq_13.created_at__quarter
- , subq_13.created_at__year
- , subq_13.created_at__extract_year
- , subq_13.created_at__extract_quarter
- , subq_13.created_at__extract_month
- , subq_13.created_at__extract_day
- , subq_13.created_at__extract_dow
- , subq_13.created_at__extract_doy
- , subq_13.listing__ds__day
- , subq_13.listing__ds__week
- , subq_13.listing__ds__month
- , subq_13.listing__ds__quarter
- , subq_13.listing__ds__year
- , subq_13.listing__ds__extract_year
- , subq_13.listing__ds__extract_quarter
- , subq_13.listing__ds__extract_month
- , subq_13.listing__ds__extract_day
- , subq_13.listing__ds__extract_dow
- , subq_13.listing__ds__extract_doy
- , subq_13.listing__created_at__day
- , subq_13.listing__created_at__week
- , subq_13.listing__created_at__month
- , subq_13.listing__created_at__quarter
- , subq_13.listing__created_at__year
- , subq_13.listing__created_at__extract_year
- , subq_13.listing__created_at__extract_quarter
- , subq_13.listing__created_at__extract_month
- , subq_13.listing__created_at__extract_day
- , subq_13.listing__created_at__extract_dow
- , subq_13.listing__created_at__extract_doy
- , subq_13.ds__day AS metric_time__day
- , subq_13.ds__week AS metric_time__week
- , subq_13.ds__month AS metric_time__month
- , subq_13.ds__quarter AS metric_time__quarter
- , subq_13.ds__year AS metric_time__year
- , subq_13.ds__extract_year AS metric_time__extract_year
- , subq_13.ds__extract_quarter AS metric_time__extract_quarter
- , subq_13.ds__extract_month AS metric_time__extract_month
- , subq_13.ds__extract_day AS metric_time__extract_day
- , subq_13.ds__extract_dow AS metric_time__extract_dow
- , subq_13.ds__extract_doy AS metric_time__extract_doy
- , subq_13.listing
- , subq_13.user
- , subq_13.listing__user
- , subq_13.country_latest
- , subq_13.is_lux_latest
- , subq_13.capacity_latest
- , subq_13.listing__country_latest
- , subq_13.listing__is_lux_latest
- , subq_13.listing__capacity_latest
- , subq_13.listings
- , subq_13.largest_listing
- , subq_13.smallest_listing
+ subq_22.ds__day
+ , subq_22.ds__week
+ , subq_22.ds__month
+ , subq_22.ds__quarter
+ , subq_22.ds__year
+ , subq_22.ds__extract_year
+ , subq_22.ds__extract_quarter
+ , subq_22.ds__extract_month
+ , subq_22.ds__extract_day
+ , subq_22.ds__extract_dow
+ , subq_22.ds__extract_doy
+ , subq_22.created_at__day
+ , subq_22.created_at__week
+ , subq_22.created_at__month
+ , subq_22.created_at__quarter
+ , subq_22.created_at__year
+ , subq_22.created_at__extract_year
+ , subq_22.created_at__extract_quarter
+ , subq_22.created_at__extract_month
+ , subq_22.created_at__extract_day
+ , subq_22.created_at__extract_dow
+ , subq_22.created_at__extract_doy
+ , subq_22.listing__ds__day
+ , subq_22.listing__ds__week
+ , subq_22.listing__ds__month
+ , subq_22.listing__ds__quarter
+ , subq_22.listing__ds__year
+ , subq_22.listing__ds__extract_year
+ , subq_22.listing__ds__extract_quarter
+ , subq_22.listing__ds__extract_month
+ , subq_22.listing__ds__extract_day
+ , subq_22.listing__ds__extract_dow
+ , subq_22.listing__ds__extract_doy
+ , subq_22.listing__created_at__day
+ , subq_22.listing__created_at__week
+ , subq_22.listing__created_at__month
+ , subq_22.listing__created_at__quarter
+ , subq_22.listing__created_at__year
+ , subq_22.listing__created_at__extract_year
+ , subq_22.listing__created_at__extract_quarter
+ , subq_22.listing__created_at__extract_month
+ , subq_22.listing__created_at__extract_day
+ , subq_22.listing__created_at__extract_dow
+ , subq_22.listing__created_at__extract_doy
+ , subq_22.ds__day AS metric_time__day
+ , subq_22.ds__week AS metric_time__week
+ , subq_22.ds__month AS metric_time__month
+ , subq_22.ds__quarter AS metric_time__quarter
+ , subq_22.ds__year AS metric_time__year
+ , subq_22.ds__extract_year AS metric_time__extract_year
+ , subq_22.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_22.ds__extract_month AS metric_time__extract_month
+ , subq_22.ds__extract_day AS metric_time__extract_day
+ , subq_22.ds__extract_dow AS metric_time__extract_dow
+ , subq_22.ds__extract_doy AS metric_time__extract_doy
+ , subq_22.listing
+ , subq_22.user
+ , subq_22.listing__user
+ , subq_22.country_latest
+ , subq_22.is_lux_latest
+ , subq_22.capacity_latest
+ , subq_22.listing__country_latest
+ , subq_22.listing__is_lux_latest
+ , subq_22.listing__capacity_latest
+ , subq_22.listings
+ , subq_22.largest_listing
+ , subq_22.smallest_listing
FROM (
-- Read Elements From Semantic Model 'listings_latest'
SELECT
1 AS listings
- , listings_latest_src_28005.capacity AS largest_listing
- , listings_latest_src_28005.capacity AS smallest_listing
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy
- , listings_latest_src_28005.country AS country_latest
- , listings_latest_src_28005.is_lux AS is_lux_latest
- , listings_latest_src_28005.capacity AS capacity_latest
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy
- , listings_latest_src_28005.country AS listing__country_latest
- , listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , listings_latest_src_28005.capacity AS listing__capacity_latest
- , listings_latest_src_28005.listing_id AS listing
- , listings_latest_src_28005.user_id AS user
- , listings_latest_src_28005.user_id AS listing__user
- FROM ***************************.dim_listings_latest listings_latest_src_28005
- ) subq_13
- ) subq_14
- ) subq_15
+ , listings_latest_src_28000.capacity AS largest_listing
+ , listings_latest_src_28000.capacity AS smallest_listing
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS created_at__extract_day
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS created_at__extract_doy
+ , 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('day', listings_latest_src_28000.created_at) AS listing__ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS listing__ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS listing__created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_day
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_doy
+ , listings_latest_src_28000.country AS listing__country_latest
+ , listings_latest_src_28000.is_lux AS listing__is_lux_latest
+ , listings_latest_src_28000.capacity AS listing__capacity_latest
+ , listings_latest_src_28000.listing_id AS listing
+ , listings_latest_src_28000.user_id AS user
+ , listings_latest_src_28000.user_id AS listing__user
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
+ ) subq_22
+ ) subq_23
+ ) subq_24
ON
- subq_12.listing = subq_15.listing
- ) subq_16
- ) subq_17
+ subq_21.listing = subq_24.listing
+ ) subq_25
+ ) subq_26
GROUP BY
- subq_17.ds__day
- , subq_17.listing__country_latest
- ) subq_18
- ) subq_19
+ subq_26.ds__day
+ , subq_26.listing__country_latest
+ ) subq_27
+ ) subq_28
ON
(
- subq_9.listing__country_latest = subq_19.listing__country_latest
+ subq_18.listing__country_latest = subq_28.listing__country_latest
) AND (
- subq_9.ds__day = subq_19.ds__day
+ subq_18.ds__day = subq_28.ds__day
)
GROUP BY
- COALESCE(subq_9.ds__day, subq_19.ds__day)
- , COALESCE(subq_9.listing__country_latest, subq_19.listing__country_latest)
-) subq_20
+ COALESCE(subq_18.ds__day, subq_28.ds__day)
+ , COALESCE(subq_18.listing__country_latest, subq_28.listing__country_latest)
+) subq_29
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0_optimized.sql
index 5b65e65d85..75a09cbc63 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0_optimized.sql
@@ -6,19 +6,19 @@ SELECT
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_30.ds__day, subq_40.ds__day) AS ds__day
- , COALESCE(subq_30.listing__country_latest, subq_40.listing__country_latest) AS listing__country_latest
- , MAX(subq_30.bookings) AS bookings
- , MAX(subq_40.views) AS views
+ COALESCE(subq_39.ds__day, subq_49.ds__day) AS ds__day
+ , COALESCE(subq_39.listing__country_latest, subq_49.listing__country_latest) AS listing__country_latest
+ , MAX(subq_39.bookings) AS bookings
+ , MAX(subq_49.views) AS views
FROM (
-- Join Standard Outputs
-- Pass Only Elements: ['bookings', 'listing__country_latest', 'ds__day']
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_23.ds__day AS ds__day
- , listings_latest_src_28005.country AS listing__country_latest
- , SUM(subq_23.bookings) AS bookings
+ subq_32.ds__day AS ds__day
+ , listings_latest_src_28000.country AS listing__country_latest
+ , SUM(subq_32.bookings) AS bookings
FROM (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
@@ -27,25 +27,25 @@ FROM (
DATE_TRUNC('day', ds) AS ds__day
, listing_id AS listing
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_23
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_32
LEFT OUTER JOIN
- ***************************.dim_listings_latest listings_latest_src_28005
+ ***************************.dim_listings_latest listings_latest_src_28000
ON
- subq_23.listing = listings_latest_src_28005.listing_id
+ subq_32.listing = listings_latest_src_28000.listing_id
GROUP BY
- subq_23.ds__day
- , listings_latest_src_28005.country
- ) subq_30
+ subq_32.ds__day
+ , listings_latest_src_28000.country
+ ) subq_39
FULL OUTER JOIN (
-- Join Standard Outputs
-- Pass Only Elements: ['views', 'listing__country_latest', 'ds__day']
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_33.ds__day AS ds__day
- , listings_latest_src_28005.country AS listing__country_latest
- , SUM(subq_33.views) AS views
+ subq_42.ds__day AS ds__day
+ , listings_latest_src_28000.country AS listing__country_latest
+ , SUM(subq_42.views) AS views
FROM (
-- Read Elements From Semantic Model 'views_source'
-- Metric Time Dimension 'ds'
@@ -54,23 +54,23 @@ FROM (
DATE_TRUNC('day', ds) AS ds__day
, listing_id AS listing
, 1 AS views
- FROM ***************************.fct_views views_source_src_28010
- ) subq_33
+ FROM ***************************.fct_views views_source_src_28000
+ ) subq_42
LEFT OUTER JOIN
- ***************************.dim_listings_latest listings_latest_src_28005
+ ***************************.dim_listings_latest listings_latest_src_28000
ON
- subq_33.listing = listings_latest_src_28005.listing_id
+ subq_42.listing = listings_latest_src_28000.listing_id
GROUP BY
- subq_33.ds__day
- , listings_latest_src_28005.country
- ) subq_40
+ subq_42.ds__day
+ , listings_latest_src_28000.country
+ ) subq_49
ON
(
- subq_30.listing__country_latest = subq_40.listing__country_latest
+ subq_39.listing__country_latest = subq_49.listing__country_latest
) AND (
- subq_30.ds__day = subq_40.ds__day
+ subq_39.ds__day = subq_49.ds__day
)
GROUP BY
- COALESCE(subq_30.ds__day, subq_40.ds__day)
- , COALESCE(subq_30.listing__country_latest, subq_40.listing__country_latest)
-) subq_41
+ COALESCE(subq_39.ds__day, subq_49.ds__day)
+ , COALESCE(subq_39.listing__country_latest, subq_49.listing__country_latest)
+) subq_50
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.sql
index 3dbab396a9..c7aabe5705 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.sql
@@ -28,93 +28,93 @@ FROM (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
) subq_1
LEFT OUTER JOIN (
@@ -126,62 +126,62 @@ FROM (
-- Read Elements From Semantic Model 'listings_latest'
SELECT
1 AS listings
- , listings_latest_src_28005.capacity AS largest_listing
- , listings_latest_src_28005.capacity AS smallest_listing
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy
- , listings_latest_src_28005.country AS country_latest
- , listings_latest_src_28005.is_lux AS is_lux_latest
- , listings_latest_src_28005.capacity AS capacity_latest
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy
- , listings_latest_src_28005.country AS listing__country_latest
- , listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , listings_latest_src_28005.capacity AS listing__capacity_latest
- , listings_latest_src_28005.listing_id AS listing
- , listings_latest_src_28005.user_id AS user
- , listings_latest_src_28005.user_id AS listing__user
- FROM ***************************.dim_listings_latest listings_latest_src_28005
+ , listings_latest_src_28000.capacity AS largest_listing
+ , listings_latest_src_28000.capacity AS smallest_listing
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS created_at__extract_day
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS created_at__extract_doy
+ , 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('day', listings_latest_src_28000.created_at) AS listing__ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS listing__ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS listing__created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_day
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_doy
+ , listings_latest_src_28000.country AS listing__country_latest
+ , listings_latest_src_28000.is_lux AS listing__is_lux_latest
+ , listings_latest_src_28000.capacity AS listing__capacity_latest
+ , listings_latest_src_28000.listing_id AS listing
+ , listings_latest_src_28000.user_id AS user
+ , listings_latest_src_28000.user_id AS listing__user
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
) subq_2
) subq_3
ON
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node_ratio_from_single_semantic_model__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node_ratio_from_single_semantic_model__plan0_optimized.sql
index 7c57c360fb..c943b1a8d9 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node_ratio_from_single_semantic_model__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node_ratio_from_single_semantic_model__plan0_optimized.sql
@@ -8,7 +8,7 @@ FROM (
-- Aggregate Measures
SELECT
subq_7.listing AS listing
- , listings_latest_src_28005.country AS listing__country_latest
+ , listings_latest_src_28000.country AS listing__country_latest
, SUM(subq_7.bookings) AS bookings
, COUNT(DISTINCT subq_7.bookers) AS bookers
FROM (
@@ -18,13 +18,13 @@ FROM (
listing_id AS listing
, 1 AS bookings
, guest_id AS bookers
- FROM ***************************.fct_bookings bookings_source_src_28001
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_7
LEFT OUTER JOIN
- ***************************.dim_listings_latest listings_latest_src_28005
+ ***************************.dim_listings_latest listings_latest_src_28000
ON
- subq_7.listing = listings_latest_src_28005.listing_id
+ subq_7.listing = listings_latest_src_28000.listing_id
GROUP BY
subq_7.listing
- , listings_latest_src_28005.country
+ , listings_latest_src_28000.country
) subq_11
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node_simple_expr__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node_simple_expr__plan0.sql
index d2b2fe8dad..069df1629d 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node_simple_expr__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node_simple_expr__plan0.sql
@@ -25,93 +25,93 @@ FROM (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
) subq_1
LEFT OUTER JOIN (
@@ -123,62 +123,62 @@ FROM (
-- Read Elements From Semantic Model 'listings_latest'
SELECT
1 AS listings
- , listings_latest_src_28005.capacity AS largest_listing
- , listings_latest_src_28005.capacity AS smallest_listing
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy
- , listings_latest_src_28005.country AS country_latest
- , listings_latest_src_28005.is_lux AS is_lux_latest
- , listings_latest_src_28005.capacity AS capacity_latest
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy
- , listings_latest_src_28005.country AS listing__country_latest
- , listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , listings_latest_src_28005.capacity AS listing__capacity_latest
- , listings_latest_src_28005.listing_id AS listing
- , listings_latest_src_28005.user_id AS user
- , listings_latest_src_28005.user_id AS listing__user
- FROM ***************************.dim_listings_latest listings_latest_src_28005
+ , listings_latest_src_28000.capacity AS largest_listing
+ , listings_latest_src_28000.capacity AS smallest_listing
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS created_at__extract_day
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS created_at__extract_doy
+ , 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('day', listings_latest_src_28000.created_at) AS listing__ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS listing__ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS listing__created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_day
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_doy
+ , listings_latest_src_28000.country AS listing__country_latest
+ , listings_latest_src_28000.is_lux AS listing__is_lux_latest
+ , listings_latest_src_28000.capacity AS listing__capacity_latest
+ , listings_latest_src_28000.listing_id AS listing
+ , listings_latest_src_28000.user_id AS user
+ , listings_latest_src_28000.user_id AS listing__user
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
) subq_2
) subq_3
ON
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node_simple_expr__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node_simple_expr__plan0_optimized.sql
index 3bda7562bf..65e701e3dd 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node_simple_expr__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_compute_metrics_node_simple_expr__plan0_optimized.sql
@@ -7,15 +7,15 @@ FROM (
-- Join Standard Outputs
-- Aggregate Measures
SELECT
- bookings_source_src_28001.listing_id AS listing
- , listings_latest_src_28005.country AS listing__country_latest
- , SUM(bookings_source_src_28001.booking_value) AS booking_value
- FROM ***************************.fct_bookings bookings_source_src_28001
+ bookings_source_src_28000.listing_id AS listing
+ , listings_latest_src_28000.country AS listing__country_latest
+ , SUM(bookings_source_src_28000.booking_value) AS booking_value
+ FROM ***************************.fct_bookings bookings_source_src_28000
LEFT OUTER JOIN
- ***************************.dim_listings_latest listings_latest_src_28005
+ ***************************.dim_listings_latest listings_latest_src_28000
ON
- bookings_source_src_28001.listing_id = listings_latest_src_28005.listing_id
+ bookings_source_src_28000.listing_id = listings_latest_src_28000.listing_id
GROUP BY
- bookings_source_src_28001.listing_id
- , listings_latest_src_28005.country
+ bookings_source_src_28000.listing_id
+ , listings_latest_src_28000.country
) subq_11
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_constrain_time_range_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_constrain_time_range_node__plan0.sql
index 3a0b9aba09..5414f95860 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_constrain_time_range_node__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_constrain_time_range_node__plan0.sql
@@ -19,93 +19,93 @@ FROM (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
) subq_1
) subq_2
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_constrain_time_range_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_constrain_time_range_node__plan0_optimized.sql
index db53f26587..d0d15f6943 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_constrain_time_range_node__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_constrain_time_range_node__plan0_optimized.sql
@@ -6,5 +6,5 @@ SELECT
DATE_TRUNC('day', ds) AS ds__day
, DATE_TRUNC('day', ds) AS metric_time__day
, 1 AS bookings
-FROM ***************************.fct_bookings bookings_source_src_28001
+FROM ***************************.fct_bookings bookings_source_src_28000
WHERE DATE_TRUNC('day', ds) BETWEEN '2020-01-01' AND '2020-01-02'
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_dimension_with_joined_where_constraint__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_dimension_with_joined_where_constraint__plan0.sql
index 8d7833c4da..ed1028fb88 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_dimension_with_joined_where_constraint__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_dimension_with_joined_where_constraint__plan0.sql
@@ -125,62 +125,62 @@ FROM (
-- Read Elements From Semantic Model 'listings_latest'
SELECT
1 AS listings
- , listings_latest_src_28005.capacity AS largest_listing
- , listings_latest_src_28005.capacity AS smallest_listing
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy
- , listings_latest_src_28005.country AS country_latest
- , listings_latest_src_28005.is_lux AS is_lux_latest
- , listings_latest_src_28005.capacity AS capacity_latest
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy
- , listings_latest_src_28005.country AS listing__country_latest
- , listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , listings_latest_src_28005.capacity AS listing__capacity_latest
- , listings_latest_src_28005.listing_id AS listing
- , listings_latest_src_28005.user_id AS user
- , listings_latest_src_28005.user_id AS listing__user
- FROM ***************************.dim_listings_latest listings_latest_src_28005
+ , listings_latest_src_28000.capacity AS largest_listing
+ , listings_latest_src_28000.capacity AS smallest_listing
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS created_at__extract_day
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS created_at__extract_doy
+ , 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('day', listings_latest_src_28000.created_at) AS listing__ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS listing__ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS listing__created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_day
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_doy
+ , listings_latest_src_28000.country AS listing__country_latest
+ , listings_latest_src_28000.is_lux AS listing__is_lux_latest
+ , listings_latest_src_28000.capacity AS listing__capacity_latest
+ , listings_latest_src_28000.listing_id AS listing
+ , listings_latest_src_28000.user_id AS user
+ , listings_latest_src_28000.user_id AS listing__user
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
) subq_0
FULL OUTER JOIN (
-- Pass Only Elements: ['home_state_latest', 'user']
@@ -190,32 +190,32 @@ FROM (
FROM (
-- Read Elements From Semantic Model 'users_latest'
SELECT
- DATE_TRUNC('day', users_latest_src_28009.ds) AS ds_latest__day
- , DATE_TRUNC('week', users_latest_src_28009.ds) AS ds_latest__week
- , DATE_TRUNC('month', users_latest_src_28009.ds) AS ds_latest__month
- , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS ds_latest__quarter
- , DATE_TRUNC('year', users_latest_src_28009.ds) AS ds_latest__year
- , EXTRACT(year FROM users_latest_src_28009.ds) AS ds_latest__extract_year
- , EXTRACT(quarter FROM users_latest_src_28009.ds) AS ds_latest__extract_quarter
- , EXTRACT(month FROM users_latest_src_28009.ds) AS ds_latest__extract_month
- , EXTRACT(day FROM users_latest_src_28009.ds) AS ds_latest__extract_day
- , EXTRACT(isodow FROM users_latest_src_28009.ds) AS ds_latest__extract_dow
- , EXTRACT(doy FROM users_latest_src_28009.ds) AS ds_latest__extract_doy
- , users_latest_src_28009.home_state_latest
- , DATE_TRUNC('day', users_latest_src_28009.ds) AS user__ds_latest__day
- , DATE_TRUNC('week', users_latest_src_28009.ds) AS user__ds_latest__week
- , DATE_TRUNC('month', users_latest_src_28009.ds) AS user__ds_latest__month
- , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS user__ds_latest__quarter
- , DATE_TRUNC('year', users_latest_src_28009.ds) AS user__ds_latest__year
- , EXTRACT(year FROM users_latest_src_28009.ds) AS user__ds_latest__extract_year
- , EXTRACT(quarter FROM users_latest_src_28009.ds) AS user__ds_latest__extract_quarter
- , EXTRACT(month FROM users_latest_src_28009.ds) AS user__ds_latest__extract_month
- , EXTRACT(day FROM users_latest_src_28009.ds) AS user__ds_latest__extract_day
- , EXTRACT(isodow FROM users_latest_src_28009.ds) AS user__ds_latest__extract_dow
- , EXTRACT(doy FROM users_latest_src_28009.ds) AS user__ds_latest__extract_doy
- , users_latest_src_28009.home_state_latest AS user__home_state_latest
- , users_latest_src_28009.user_id AS user
- FROM ***************************.dim_users_latest users_latest_src_28009
+ DATE_TRUNC('day', users_latest_src_28000.ds) AS ds_latest__day
+ , DATE_TRUNC('week', users_latest_src_28000.ds) AS ds_latest__week
+ , DATE_TRUNC('month', users_latest_src_28000.ds) AS ds_latest__month
+ , DATE_TRUNC('quarter', users_latest_src_28000.ds) AS ds_latest__quarter
+ , DATE_TRUNC('year', users_latest_src_28000.ds) 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
+ , EXTRACT(day FROM users_latest_src_28000.ds) AS ds_latest__extract_day
+ , EXTRACT(isodow FROM users_latest_src_28000.ds) AS ds_latest__extract_dow
+ , EXTRACT(doy FROM users_latest_src_28000.ds) AS ds_latest__extract_doy
+ , users_latest_src_28000.home_state_latest
+ , DATE_TRUNC('day', users_latest_src_28000.ds) AS user__ds_latest__day
+ , DATE_TRUNC('week', users_latest_src_28000.ds) AS user__ds_latest__week
+ , DATE_TRUNC('month', users_latest_src_28000.ds) AS user__ds_latest__month
+ , DATE_TRUNC('quarter', users_latest_src_28000.ds) AS user__ds_latest__quarter
+ , DATE_TRUNC('year', users_latest_src_28000.ds) 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
+ , EXTRACT(day FROM users_latest_src_28000.ds) AS user__ds_latest__extract_day
+ , EXTRACT(isodow FROM users_latest_src_28000.ds) AS user__ds_latest__extract_dow
+ , EXTRACT(doy FROM users_latest_src_28000.ds) AS user__ds_latest__extract_doy
+ , users_latest_src_28000.home_state_latest AS user__home_state_latest
+ , users_latest_src_28000.user_id AS user
+ FROM ***************************.dim_users_latest users_latest_src_28000
) subq_1
) subq_2
ON
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_dimension_with_joined_where_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_dimension_with_joined_where_constraint__plan0_optimized.sql
index 8cc8a2b867..c4e57d3c86 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_dimension_with_joined_where_constraint__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_dimension_with_joined_where_constraint__plan0_optimized.sql
@@ -5,13 +5,13 @@ SELECT
FROM (
-- Join Standard Outputs
SELECT
- listings_latest_src_28005.country AS listing__country_latest
- , users_latest_src_28009.home_state_latest AS user__home_state_latest
- FROM ***************************.dim_listings_latest listings_latest_src_28005
+ listings_latest_src_28000.country AS listing__country_latest
+ , users_latest_src_28000.home_state_latest AS user__home_state_latest
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
FULL OUTER JOIN
- ***************************.dim_users_latest users_latest_src_28009
+ ***************************.dim_users_latest users_latest_src_28000
ON
- listings_latest_src_28005.user_id = users_latest_src_28009.user_id
+ listings_latest_src_28000.user_id = users_latest_src_28000.user_id
) subq_8
WHERE listing__country_latest = 'us'
GROUP BY
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_dimensions_requiring_join__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_dimensions_requiring_join__plan0.sql
index 884b765da5..0962aa9958 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_dimensions_requiring_join__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_dimensions_requiring_join__plan0.sql
@@ -66,62 +66,62 @@ FROM (
-- Read Elements From Semantic Model 'listings_latest'
SELECT
1 AS listings
- , listings_latest_src_28005.capacity AS largest_listing
- , listings_latest_src_28005.capacity AS smallest_listing
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy
- , listings_latest_src_28005.country AS country_latest
- , listings_latest_src_28005.is_lux AS is_lux_latest
- , listings_latest_src_28005.capacity AS capacity_latest
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy
- , listings_latest_src_28005.country AS listing__country_latest
- , listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , listings_latest_src_28005.capacity AS listing__capacity_latest
- , listings_latest_src_28005.listing_id AS listing
- , listings_latest_src_28005.user_id AS user
- , listings_latest_src_28005.user_id AS listing__user
- FROM ***************************.dim_listings_latest listings_latest_src_28005
+ , listings_latest_src_28000.capacity AS largest_listing
+ , listings_latest_src_28000.capacity AS smallest_listing
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS created_at__extract_day
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS created_at__extract_doy
+ , 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('day', listings_latest_src_28000.created_at) AS listing__ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS listing__ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS listing__created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_day
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_doy
+ , listings_latest_src_28000.country AS listing__country_latest
+ , listings_latest_src_28000.is_lux AS listing__is_lux_latest
+ , listings_latest_src_28000.capacity AS listing__capacity_latest
+ , listings_latest_src_28000.listing_id AS listing
+ , listings_latest_src_28000.user_id AS user
+ , listings_latest_src_28000.user_id AS listing__user
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
) subq_0
FULL OUTER JOIN (
-- Pass Only Elements: ['home_state_latest', 'user']
@@ -131,32 +131,32 @@ FROM (
FROM (
-- Read Elements From Semantic Model 'users_latest'
SELECT
- DATE_TRUNC('day', users_latest_src_28009.ds) AS ds_latest__day
- , DATE_TRUNC('week', users_latest_src_28009.ds) AS ds_latest__week
- , DATE_TRUNC('month', users_latest_src_28009.ds) AS ds_latest__month
- , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS ds_latest__quarter
- , DATE_TRUNC('year', users_latest_src_28009.ds) AS ds_latest__year
- , EXTRACT(year FROM users_latest_src_28009.ds) AS ds_latest__extract_year
- , EXTRACT(quarter FROM users_latest_src_28009.ds) AS ds_latest__extract_quarter
- , EXTRACT(month FROM users_latest_src_28009.ds) AS ds_latest__extract_month
- , EXTRACT(day FROM users_latest_src_28009.ds) AS ds_latest__extract_day
- , EXTRACT(isodow FROM users_latest_src_28009.ds) AS ds_latest__extract_dow
- , EXTRACT(doy FROM users_latest_src_28009.ds) AS ds_latest__extract_doy
- , users_latest_src_28009.home_state_latest
- , DATE_TRUNC('day', users_latest_src_28009.ds) AS user__ds_latest__day
- , DATE_TRUNC('week', users_latest_src_28009.ds) AS user__ds_latest__week
- , DATE_TRUNC('month', users_latest_src_28009.ds) AS user__ds_latest__month
- , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS user__ds_latest__quarter
- , DATE_TRUNC('year', users_latest_src_28009.ds) AS user__ds_latest__year
- , EXTRACT(year FROM users_latest_src_28009.ds) AS user__ds_latest__extract_year
- , EXTRACT(quarter FROM users_latest_src_28009.ds) AS user__ds_latest__extract_quarter
- , EXTRACT(month FROM users_latest_src_28009.ds) AS user__ds_latest__extract_month
- , EXTRACT(day FROM users_latest_src_28009.ds) AS user__ds_latest__extract_day
- , EXTRACT(isodow FROM users_latest_src_28009.ds) AS user__ds_latest__extract_dow
- , EXTRACT(doy FROM users_latest_src_28009.ds) AS user__ds_latest__extract_doy
- , users_latest_src_28009.home_state_latest AS user__home_state_latest
- , users_latest_src_28009.user_id AS user
- FROM ***************************.dim_users_latest users_latest_src_28009
+ DATE_TRUNC('day', users_latest_src_28000.ds) AS ds_latest__day
+ , DATE_TRUNC('week', users_latest_src_28000.ds) AS ds_latest__week
+ , DATE_TRUNC('month', users_latest_src_28000.ds) AS ds_latest__month
+ , DATE_TRUNC('quarter', users_latest_src_28000.ds) AS ds_latest__quarter
+ , DATE_TRUNC('year', users_latest_src_28000.ds) 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
+ , EXTRACT(day FROM users_latest_src_28000.ds) AS ds_latest__extract_day
+ , EXTRACT(isodow FROM users_latest_src_28000.ds) AS ds_latest__extract_dow
+ , EXTRACT(doy FROM users_latest_src_28000.ds) AS ds_latest__extract_doy
+ , users_latest_src_28000.home_state_latest
+ , DATE_TRUNC('day', users_latest_src_28000.ds) AS user__ds_latest__day
+ , DATE_TRUNC('week', users_latest_src_28000.ds) AS user__ds_latest__week
+ , DATE_TRUNC('month', users_latest_src_28000.ds) AS user__ds_latest__month
+ , DATE_TRUNC('quarter', users_latest_src_28000.ds) AS user__ds_latest__quarter
+ , DATE_TRUNC('year', users_latest_src_28000.ds) 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
+ , EXTRACT(day FROM users_latest_src_28000.ds) AS user__ds_latest__extract_day
+ , EXTRACT(isodow FROM users_latest_src_28000.ds) AS user__ds_latest__extract_dow
+ , EXTRACT(doy FROM users_latest_src_28000.ds) AS user__ds_latest__extract_doy
+ , users_latest_src_28000.home_state_latest AS user__home_state_latest
+ , users_latest_src_28000.user_id AS user
+ FROM ***************************.dim_users_latest users_latest_src_28000
) subq_1
) subq_2
ON
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_dimensions_requiring_join__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_dimensions_requiring_join__plan0_optimized.sql
index bee3a232b6..96c5d5bb3a 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_dimensions_requiring_join__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_dimensions_requiring_join__plan0_optimized.sql
@@ -1,13 +1,13 @@
-- Join Standard Outputs
-- Pass Only Elements: ['user__home_state_latest', 'listing__is_lux_latest']
SELECT
- listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , users_latest_src_28009.home_state_latest AS user__home_state_latest
-FROM ***************************.dim_listings_latest listings_latest_src_28005
+ 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
FULL OUTER JOIN
- ***************************.dim_users_latest users_latest_src_28009
+ ***************************.dim_users_latest users_latest_src_28000
ON
- listings_latest_src_28005.user_id = users_latest_src_28009.user_id
+ listings_latest_src_28000.user_id = users_latest_src_28000.user_id
GROUP BY
- listings_latest_src_28005.is_lux
- , users_latest_src_28009.home_state_latest
+ listings_latest_src_28000.is_lux
+ , users_latest_src_28000.home_state_latest
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_filter_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_filter_node__plan0.sql
index e8e12063d5..4c0230bef5 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_filter_node__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_filter_node__plan0.sql
@@ -6,91 +6,91 @@ FROM (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_filter_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_filter_node__plan0_optimized.sql
index bfbf5ff951..554ce484fb 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_filter_node__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_filter_node__plan0_optimized.sql
@@ -2,4 +2,4 @@
-- Pass Only Elements: ['bookings',]
SELECT
1 AS bookings
-FROM ***************************.fct_bookings bookings_source_src_28001
+FROM ***************************.fct_bookings bookings_source_src_28000
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_filter_with_where_constraint_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_filter_with_where_constraint_node__plan0.sql
index ae00bb04ec..6c7624e9c6 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_filter_with_where_constraint_node__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_filter_with_where_constraint_node__plan0.sql
@@ -12,93 +12,93 @@ FROM (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
) subq_1
WHERE booking__ds__day = '2020-01-01'
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_filter_with_where_constraint_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_filter_with_where_constraint_node__plan0_optimized.sql
index 755a4d39e2..5ee87ba25f 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_filter_with_where_constraint_node__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_filter_with_where_constraint_node__plan0_optimized.sql
@@ -8,6 +8,6 @@ FROM (
SELECT
DATE_TRUNC('day', ds) AS ds__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_3
WHERE booking__ds__day = '2020-01-01'
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_join_to_time_spine_node_with_offset_to_grain__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_join_to_time_spine_node_with_offset_to_grain__plan0.sql
index 21fc0ca626..d1eb9e6cdf 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_join_to_time_spine_node_with_offset_to_grain__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_join_to_time_spine_node_with_offset_to_grain__plan0.sql
@@ -134,93 +134,93 @@ INNER JOIN (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
) subq_1
) subq_2
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_join_to_time_spine_node_with_offset_to_grain__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_join_to_time_spine_node_with_offset_to_grain__plan0_optimized.sql
index d5d4ba056e..6054b232dc 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_join_to_time_spine_node_with_offset_to_grain__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_join_to_time_spine_node_with_offset_to_grain__plan0_optimized.sql
@@ -25,7 +25,7 @@ INNER JOIN (
DATE_TRUNC('day', ds) AS metric_time__day
, listing_id AS listing
, SUM(booking_value) AS booking_value
- FROM ***************************.fct_bookings bookings_source_src_28001
+ FROM ***************************.fct_bookings bookings_source_src_28000
GROUP BY
DATE_TRUNC('day', ds)
, listing_id
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_join_to_time_spine_node_with_offset_window__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_join_to_time_spine_node_with_offset_window__plan0.sql
index 60b8dc17c7..6556fc936f 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_join_to_time_spine_node_with_offset_window__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_join_to_time_spine_node_with_offset_window__plan0.sql
@@ -134,93 +134,93 @@ INNER JOIN (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
) subq_1
) subq_2
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_join_to_time_spine_node_with_offset_window__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_join_to_time_spine_node_with_offset_window__plan0_optimized.sql
index 9c1b9ee488..836bd707a7 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_join_to_time_spine_node_with_offset_window__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_join_to_time_spine_node_with_offset_window__plan0_optimized.sql
@@ -25,7 +25,7 @@ INNER JOIN (
DATE_TRUNC('day', ds) AS metric_time__day
, listing_id AS listing
, SUM(booking_value) AS booking_value
- FROM ***************************.fct_bookings bookings_source_src_28001
+ FROM ***************************.fct_bookings bookings_source_src_28000
GROUP BY
DATE_TRUNC('day', ds)
, listing_id
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_join_to_time_spine_node_without_offset__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_join_to_time_spine_node_without_offset__plan0.sql
index 8573c54b5e..2c925cc021 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_join_to_time_spine_node_without_offset__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_join_to_time_spine_node_without_offset__plan0.sql
@@ -134,93 +134,93 @@ INNER JOIN (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
) subq_1
) subq_2
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_join_to_time_spine_node_without_offset__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_join_to_time_spine_node_without_offset__plan0_optimized.sql
index 695cf9c062..e4f47734b0 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_join_to_time_spine_node_without_offset__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_join_to_time_spine_node_without_offset__plan0_optimized.sql
@@ -25,7 +25,7 @@ INNER JOIN (
DATE_TRUNC('day', ds) AS metric_time__day
, listing_id AS listing
, SUM(booking_value) AS booking_value
- FROM ***************************.fct_bookings bookings_source_src_28001
+ FROM ***************************.fct_bookings bookings_source_src_28000
GROUP BY
DATE_TRUNC('day', ds)
, listing_id
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_measure_aggregation_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_measure_aggregation_node__plan0.sql
index 693664c2e8..d3f9a7fb97 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_measure_aggregation_node__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_measure_aggregation_node__plan0.sql
@@ -16,92 +16,92 @@ FROM (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
) subq_1
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_measure_aggregation_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_measure_aggregation_node__plan0_optimized.sql
index 64fc2826b9..6e5528a6c9 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_measure_aggregation_node__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_measure_aggregation_node__plan0_optimized.sql
@@ -6,4 +6,4 @@ SELECT
, SUM(CASE WHEN is_instant THEN 1 ELSE 0 END) AS instant_bookings
, COUNT(DISTINCT guest_id) AS bookers
, AVG(booking_value) AS average_booking_value
-FROM ***************************.fct_bookings bookings_source_src_28001
+FROM ***************************.fct_bookings bookings_source_src_28000
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_multi_join_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_multi_join_node__plan0.sql
index 2aa11d8ca7..f3ed9fa304 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_multi_join_node__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_multi_join_node__plan0.sql
@@ -14,93 +14,93 @@ FROM (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
) subq_1
LEFT OUTER JOIN (
@@ -112,62 +112,62 @@ LEFT OUTER JOIN (
-- Read Elements From Semantic Model 'listings_latest'
SELECT
1 AS listings
- , listings_latest_src_28005.capacity AS largest_listing
- , listings_latest_src_28005.capacity AS smallest_listing
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy
- , listings_latest_src_28005.country AS country_latest
- , listings_latest_src_28005.is_lux AS is_lux_latest
- , listings_latest_src_28005.capacity AS capacity_latest
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy
- , listings_latest_src_28005.country AS listing__country_latest
- , listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , listings_latest_src_28005.capacity AS listing__capacity_latest
- , listings_latest_src_28005.listing_id AS listing
- , listings_latest_src_28005.user_id AS user
- , listings_latest_src_28005.user_id AS listing__user
- FROM ***************************.dim_listings_latest listings_latest_src_28005
+ , listings_latest_src_28000.capacity AS largest_listing
+ , listings_latest_src_28000.capacity AS smallest_listing
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS created_at__extract_day
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS created_at__extract_doy
+ , 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('day', listings_latest_src_28000.created_at) AS listing__ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS listing__ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS listing__created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_day
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_doy
+ , listings_latest_src_28000.country AS listing__country_latest
+ , listings_latest_src_28000.is_lux AS listing__is_lux_latest
+ , listings_latest_src_28000.capacity AS listing__capacity_latest
+ , listings_latest_src_28000.listing_id AS listing
+ , listings_latest_src_28000.user_id AS user
+ , listings_latest_src_28000.user_id AS listing__user
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
) subq_2
) subq_3
ON
@@ -181,62 +181,62 @@ LEFT OUTER JOIN (
-- Read Elements From Semantic Model 'listings_latest'
SELECT
1 AS listings
- , listings_latest_src_28005.capacity AS largest_listing
- , listings_latest_src_28005.capacity AS smallest_listing
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy
- , listings_latest_src_28005.country AS country_latest
- , listings_latest_src_28005.is_lux AS is_lux_latest
- , listings_latest_src_28005.capacity AS capacity_latest
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy
- , listings_latest_src_28005.country AS listing__country_latest
- , listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , listings_latest_src_28005.capacity AS listing__capacity_latest
- , listings_latest_src_28005.listing_id AS listing
- , listings_latest_src_28005.user_id AS user
- , listings_latest_src_28005.user_id AS listing__user
- FROM ***************************.dim_listings_latest listings_latest_src_28005
+ , listings_latest_src_28000.capacity AS largest_listing
+ , listings_latest_src_28000.capacity AS smallest_listing
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS created_at__extract_day
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS created_at__extract_doy
+ , 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('day', listings_latest_src_28000.created_at) AS listing__ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS listing__ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS listing__created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_day
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_doy
+ , listings_latest_src_28000.country AS listing__country_latest
+ , listings_latest_src_28000.is_lux AS listing__is_lux_latest
+ , listings_latest_src_28000.capacity AS listing__capacity_latest
+ , listings_latest_src_28000.listing_id AS listing
+ , listings_latest_src_28000.user_id AS user
+ , listings_latest_src_28000.user_id AS listing__user
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
) subq_4
) subq_5
ON
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_multi_join_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_multi_join_node__plan0_optimized.sql
index b9cecc48d8..7d9c669f54 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_multi_join_node__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_multi_join_node__plan0_optimized.sql
@@ -10,7 +10,7 @@ FROM (
SELECT
listing_id AS listing
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_7
LEFT OUTER JOIN (
-- Read Elements From Semantic Model 'listings_latest'
@@ -18,7 +18,7 @@ LEFT OUTER JOIN (
SELECT
listing_id AS listing
, country AS country_latest
- FROM ***************************.dim_listings_latest listings_latest_src_28005
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
) subq_9
ON
subq_7.listing = subq_9.listing
@@ -28,7 +28,7 @@ LEFT OUTER JOIN (
SELECT
listing_id AS listing
, country AS country_latest
- FROM ***************************.dim_listings_latest listings_latest_src_28005
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
) subq_11
ON
subq_7.listing = subq_11.listing
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_order_by_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_order_by_node__plan0.sql
index 05e8717a48..49a2ea3b75 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_order_by_node__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_order_by_node__plan0.sql
@@ -26,93 +26,93 @@ FROM (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
) subq_1
GROUP BY
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_order_by_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_order_by_node__plan0_optimized.sql
index fd8a1ff597..bcebfe9d5f 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_order_by_node__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_order_by_node__plan0_optimized.sql
@@ -12,7 +12,7 @@ FROM (
DATE_TRUNC('day', ds) AS ds__day
, is_instant
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_5
GROUP BY
ds__day
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_single_join_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_single_join_node__plan0.sql
index 6a69a7ef1b..1d89d14791 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_single_join_node__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_single_join_node__plan0.sql
@@ -12,93 +12,93 @@ FROM (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
) subq_1
LEFT OUTER JOIN (
@@ -110,62 +110,62 @@ LEFT OUTER JOIN (
-- Read Elements From Semantic Model 'listings_latest'
SELECT
1 AS listings
- , listings_latest_src_28005.capacity AS largest_listing
- , listings_latest_src_28005.capacity AS smallest_listing
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy
- , listings_latest_src_28005.country AS country_latest
- , listings_latest_src_28005.is_lux AS is_lux_latest
- , listings_latest_src_28005.capacity AS capacity_latest
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy
- , listings_latest_src_28005.country AS listing__country_latest
- , listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , listings_latest_src_28005.capacity AS listing__capacity_latest
- , listings_latest_src_28005.listing_id AS listing
- , listings_latest_src_28005.user_id AS user
- , listings_latest_src_28005.user_id AS listing__user
- FROM ***************************.dim_listings_latest listings_latest_src_28005
+ , listings_latest_src_28000.capacity AS largest_listing
+ , listings_latest_src_28000.capacity AS smallest_listing
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS created_at__extract_day
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS created_at__extract_doy
+ , 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('day', listings_latest_src_28000.created_at) AS listing__ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS listing__ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS listing__created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_day
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_doy
+ , listings_latest_src_28000.country AS listing__country_latest
+ , listings_latest_src_28000.is_lux AS listing__is_lux_latest
+ , listings_latest_src_28000.capacity AS listing__capacity_latest
+ , listings_latest_src_28000.listing_id AS listing
+ , listings_latest_src_28000.user_id AS user
+ , listings_latest_src_28000.user_id AS listing__user
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
) subq_2
) subq_3
ON
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_single_join_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_single_join_node__plan0_optimized.sql
index e03ffcce64..a1cd7ac335 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_single_join_node__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_single_join_node__plan0_optimized.sql
@@ -8,9 +8,9 @@ FROM (
SELECT
listing_id AS listing
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_5
LEFT OUTER JOIN
- ***************************.dim_listings_latest listings_latest_src_28005
+ ***************************.dim_listings_latest listings_latest_src_28000
ON
- subq_5.listing = listings_latest_src_28005.listing_id
+ subq_5.listing = listings_latest_src_28000.listing_id
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_source_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_source_node__plan0.sql
index 5360aa4516..d94b68c968 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_source_node__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_source_node__plan0.sql
@@ -2,90 +2,90 @@
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
-FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+FROM ***************************.fct_bookings bookings_source_src_28000
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_source_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_source_node__plan0_optimized.sql
index e15f76d1de..9814c2d0cf 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_source_node__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/DuckDB/test_source_node__plan0_optimized.sql
@@ -88,4 +88,4 @@ SELECT
, listing_id AS booking__listing
, guest_id AS booking__guest
, host_id AS booking__host
-FROM ***************************.fct_bookings bookings_source_src_28001
+FROM ***************************.fct_bookings bookings_source_src_28000
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_combine_output_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_combine_output_node__plan0.sql
index a8375b02dd..a8d97dae7f 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_combine_output_node__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_combine_output_node__plan0.sql
@@ -19,93 +19,93 @@ FROM (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
) subq_1
GROUP BY
@@ -128,93 +128,93 @@ FULL OUTER JOIN (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_3
) subq_4
GROUP BY
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_combine_output_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_combine_output_node__plan0_optimized.sql
index a8375510d7..ad81788114 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_combine_output_node__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_combine_output_node__plan0_optimized.sql
@@ -15,7 +15,7 @@ FROM (
SELECT
is_instant
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_7
GROUP BY
is_instant
@@ -33,7 +33,7 @@ FULL OUTER JOIN (
is_instant
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
, guest_id AS bookers
- FROM ***************************.fct_bookings bookings_source_src_28001
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_10
GROUP BY
is_instant
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_compute_metrics_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_compute_metrics_node__plan0.sql
index 760f45c973..08fdfa6034 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_compute_metrics_node__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_compute_metrics_node__plan0.sql
@@ -25,93 +25,93 @@ FROM (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
) subq_1
LEFT OUTER JOIN (
@@ -123,62 +123,62 @@ FROM (
-- Read Elements From Semantic Model 'listings_latest'
SELECT
1 AS listings
- , listings_latest_src_28005.capacity AS largest_listing
- , listings_latest_src_28005.capacity AS smallest_listing
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy
- , listings_latest_src_28005.country AS country_latest
- , listings_latest_src_28005.is_lux AS is_lux_latest
- , listings_latest_src_28005.capacity AS capacity_latest
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy
- , listings_latest_src_28005.country AS listing__country_latest
- , listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , listings_latest_src_28005.capacity AS listing__capacity_latest
- , listings_latest_src_28005.listing_id AS listing
- , listings_latest_src_28005.user_id AS user
- , listings_latest_src_28005.user_id AS listing__user
- FROM ***************************.dim_listings_latest listings_latest_src_28005
+ , listings_latest_src_28000.capacity AS largest_listing
+ , listings_latest_src_28000.capacity AS smallest_listing
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS created_at__extract_day
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS created_at__extract_doy
+ , 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('day', listings_latest_src_28000.created_at) AS listing__ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS listing__ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS listing__created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_day
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_doy
+ , listings_latest_src_28000.country AS listing__country_latest
+ , listings_latest_src_28000.is_lux AS listing__is_lux_latest
+ , listings_latest_src_28000.capacity AS listing__capacity_latest
+ , listings_latest_src_28000.listing_id AS listing
+ , listings_latest_src_28000.user_id AS user
+ , listings_latest_src_28000.user_id AS listing__user
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
) subq_2
) subq_3
ON
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_compute_metrics_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_compute_metrics_node__plan0_optimized.sql
index cf47afc6bf..5ebe7177e8 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_compute_metrics_node__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_compute_metrics_node__plan0_optimized.sql
@@ -3,7 +3,7 @@
-- Compute Metrics via Expressions
SELECT
subq_7.listing AS listing
- , listings_latest_src_28005.country AS listing__country_latest
+ , listings_latest_src_28000.country AS listing__country_latest
, SUM(subq_7.bookings) AS bookings
FROM (
-- Read Elements From Semantic Model 'bookings_source'
@@ -11,12 +11,12 @@ FROM (
SELECT
listing_id AS listing
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_7
LEFT OUTER JOIN
- ***************************.dim_listings_latest listings_latest_src_28005
+ ***************************.dim_listings_latest listings_latest_src_28000
ON
- subq_7.listing = listings_latest_src_28005.listing_id
+ subq_7.listing = listings_latest_src_28000.listing_id
GROUP BY
subq_7.listing
- , listings_latest_src_28005.country
+ , listings_latest_src_28000.country
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.sql
index 0d00d2347f..a6aaccb999 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.sql
@@ -1,693 +1,693 @@
-- Compute Metrics via Expressions
SELECT
- subq_20.ds__day
- , subq_20.listing__country_latest
- , CAST(subq_20.bookings AS DOUBLE PRECISION) / CAST(NULLIF(subq_20.views, 0) AS DOUBLE PRECISION) AS bookings_per_view
+ subq_29.ds__day
+ , subq_29.listing__country_latest
+ , CAST(subq_29.bookings AS DOUBLE PRECISION) / CAST(NULLIF(subq_29.views, 0) AS DOUBLE PRECISION) AS bookings_per_view
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_9.ds__day, subq_19.ds__day) AS ds__day
- , COALESCE(subq_9.listing__country_latest, subq_19.listing__country_latest) AS listing__country_latest
- , MAX(subq_9.bookings) AS bookings
- , MAX(subq_19.views) AS views
+ COALESCE(subq_18.ds__day, subq_28.ds__day) AS ds__day
+ , COALESCE(subq_18.listing__country_latest, subq_28.listing__country_latest) AS listing__country_latest
+ , MAX(subq_18.bookings) AS bookings
+ , MAX(subq_28.views) AS views
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_8.ds__day
- , subq_8.listing__country_latest
- , subq_8.bookings
+ subq_17.ds__day
+ , subq_17.listing__country_latest
+ , subq_17.bookings
FROM (
-- Aggregate Measures
SELECT
- subq_7.ds__day
- , subq_7.listing__country_latest
- , SUM(subq_7.bookings) AS bookings
+ subq_16.ds__day
+ , subq_16.listing__country_latest
+ , SUM(subq_16.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'listing__country_latest', 'ds__day']
SELECT
- subq_6.ds__day
- , subq_6.listing__country_latest
- , subq_6.bookings
+ subq_15.ds__day
+ , subq_15.listing__country_latest
+ , subq_15.bookings
FROM (
-- Join Standard Outputs
SELECT
- subq_2.ds__day AS ds__day
- , subq_2.listing AS listing
- , subq_5.country_latest AS listing__country_latest
- , subq_2.bookings AS bookings
+ subq_11.ds__day AS ds__day
+ , subq_11.listing AS listing
+ , subq_14.country_latest AS listing__country_latest
+ , subq_11.bookings AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'ds__day', 'listing']
SELECT
- subq_1.ds__day
- , subq_1.listing
- , subq_1.bookings
+ subq_10.ds__day
+ , subq_10.listing
+ , subq_10.bookings
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
- ) subq_2
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
LEFT OUTER JOIN (
-- Pass Only Elements: ['country_latest', 'listing']
SELECT
- subq_4.listing
- , subq_4.country_latest
+ subq_13.listing
+ , subq_13.country_latest
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_3.ds__day
- , subq_3.ds__week
- , subq_3.ds__month
- , subq_3.ds__quarter
- , subq_3.ds__year
- , subq_3.ds__extract_year
- , subq_3.ds__extract_quarter
- , subq_3.ds__extract_month
- , subq_3.ds__extract_day
- , subq_3.ds__extract_dow
- , subq_3.ds__extract_doy
- , subq_3.created_at__day
- , subq_3.created_at__week
- , subq_3.created_at__month
- , subq_3.created_at__quarter
- , subq_3.created_at__year
- , subq_3.created_at__extract_year
- , subq_3.created_at__extract_quarter
- , subq_3.created_at__extract_month
- , subq_3.created_at__extract_day
- , subq_3.created_at__extract_dow
- , subq_3.created_at__extract_doy
- , subq_3.listing__ds__day
- , subq_3.listing__ds__week
- , subq_3.listing__ds__month
- , subq_3.listing__ds__quarter
- , subq_3.listing__ds__year
- , subq_3.listing__ds__extract_year
- , subq_3.listing__ds__extract_quarter
- , subq_3.listing__ds__extract_month
- , subq_3.listing__ds__extract_day
- , subq_3.listing__ds__extract_dow
- , subq_3.listing__ds__extract_doy
- , subq_3.listing__created_at__day
- , subq_3.listing__created_at__week
- , subq_3.listing__created_at__month
- , subq_3.listing__created_at__quarter
- , subq_3.listing__created_at__year
- , subq_3.listing__created_at__extract_year
- , subq_3.listing__created_at__extract_quarter
- , subq_3.listing__created_at__extract_month
- , subq_3.listing__created_at__extract_day
- , subq_3.listing__created_at__extract_dow
- , subq_3.listing__created_at__extract_doy
- , subq_3.ds__day AS metric_time__day
- , subq_3.ds__week AS metric_time__week
- , subq_3.ds__month AS metric_time__month
- , subq_3.ds__quarter AS metric_time__quarter
- , subq_3.ds__year AS metric_time__year
- , subq_3.ds__extract_year AS metric_time__extract_year
- , subq_3.ds__extract_quarter AS metric_time__extract_quarter
- , subq_3.ds__extract_month AS metric_time__extract_month
- , subq_3.ds__extract_day AS metric_time__extract_day
- , subq_3.ds__extract_dow AS metric_time__extract_dow
- , subq_3.ds__extract_doy AS metric_time__extract_doy
- , subq_3.listing
- , subq_3.user
- , subq_3.listing__user
- , subq_3.country_latest
- , subq_3.is_lux_latest
- , subq_3.capacity_latest
- , subq_3.listing__country_latest
- , subq_3.listing__is_lux_latest
- , subq_3.listing__capacity_latest
- , subq_3.listings
- , subq_3.largest_listing
- , subq_3.smallest_listing
+ subq_12.ds__day
+ , subq_12.ds__week
+ , subq_12.ds__month
+ , subq_12.ds__quarter
+ , subq_12.ds__year
+ , subq_12.ds__extract_year
+ , subq_12.ds__extract_quarter
+ , subq_12.ds__extract_month
+ , subq_12.ds__extract_day
+ , subq_12.ds__extract_dow
+ , subq_12.ds__extract_doy
+ , subq_12.created_at__day
+ , subq_12.created_at__week
+ , subq_12.created_at__month
+ , subq_12.created_at__quarter
+ , subq_12.created_at__year
+ , subq_12.created_at__extract_year
+ , subq_12.created_at__extract_quarter
+ , subq_12.created_at__extract_month
+ , subq_12.created_at__extract_day
+ , subq_12.created_at__extract_dow
+ , subq_12.created_at__extract_doy
+ , subq_12.listing__ds__day
+ , subq_12.listing__ds__week
+ , subq_12.listing__ds__month
+ , subq_12.listing__ds__quarter
+ , subq_12.listing__ds__year
+ , subq_12.listing__ds__extract_year
+ , subq_12.listing__ds__extract_quarter
+ , subq_12.listing__ds__extract_month
+ , subq_12.listing__ds__extract_day
+ , subq_12.listing__ds__extract_dow
+ , subq_12.listing__ds__extract_doy
+ , subq_12.listing__created_at__day
+ , subq_12.listing__created_at__week
+ , subq_12.listing__created_at__month
+ , subq_12.listing__created_at__quarter
+ , subq_12.listing__created_at__year
+ , subq_12.listing__created_at__extract_year
+ , subq_12.listing__created_at__extract_quarter
+ , subq_12.listing__created_at__extract_month
+ , subq_12.listing__created_at__extract_day
+ , subq_12.listing__created_at__extract_dow
+ , subq_12.listing__created_at__extract_doy
+ , subq_12.ds__day AS metric_time__day
+ , subq_12.ds__week AS metric_time__week
+ , subq_12.ds__month AS metric_time__month
+ , subq_12.ds__quarter AS metric_time__quarter
+ , subq_12.ds__year AS metric_time__year
+ , subq_12.ds__extract_year AS metric_time__extract_year
+ , subq_12.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_12.ds__extract_month AS metric_time__extract_month
+ , subq_12.ds__extract_day AS metric_time__extract_day
+ , subq_12.ds__extract_dow AS metric_time__extract_dow
+ , subq_12.ds__extract_doy AS metric_time__extract_doy
+ , subq_12.listing
+ , subq_12.user
+ , subq_12.listing__user
+ , subq_12.country_latest
+ , subq_12.is_lux_latest
+ , subq_12.capacity_latest
+ , subq_12.listing__country_latest
+ , subq_12.listing__is_lux_latest
+ , subq_12.listing__capacity_latest
+ , subq_12.listings
+ , subq_12.largest_listing
+ , subq_12.smallest_listing
FROM (
-- Read Elements From Semantic Model 'listings_latest'
SELECT
1 AS listings
- , listings_latest_src_28005.capacity AS largest_listing
- , listings_latest_src_28005.capacity AS smallest_listing
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy
- , listings_latest_src_28005.country AS country_latest
- , listings_latest_src_28005.is_lux AS is_lux_latest
- , listings_latest_src_28005.capacity AS capacity_latest
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy
- , listings_latest_src_28005.country AS listing__country_latest
- , listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , listings_latest_src_28005.capacity AS listing__capacity_latest
- , listings_latest_src_28005.listing_id AS listing
- , listings_latest_src_28005.user_id AS user
- , listings_latest_src_28005.user_id AS listing__user
- FROM ***************************.dim_listings_latest listings_latest_src_28005
- ) subq_3
- ) subq_4
- ) subq_5
+ , listings_latest_src_28000.capacity AS largest_listing
+ , listings_latest_src_28000.capacity AS smallest_listing
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS created_at__extract_day
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS created_at__extract_doy
+ , 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('day', listings_latest_src_28000.created_at) AS listing__ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS listing__ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS listing__created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_day
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_doy
+ , listings_latest_src_28000.country AS listing__country_latest
+ , listings_latest_src_28000.is_lux AS listing__is_lux_latest
+ , listings_latest_src_28000.capacity AS listing__capacity_latest
+ , listings_latest_src_28000.listing_id AS listing
+ , listings_latest_src_28000.user_id AS user
+ , listings_latest_src_28000.user_id AS listing__user
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
+ ) subq_12
+ ) subq_13
+ ) subq_14
ON
- subq_2.listing = subq_5.listing
- ) subq_6
- ) subq_7
+ subq_11.listing = subq_14.listing
+ ) subq_15
+ ) subq_16
GROUP BY
- subq_7.ds__day
- , subq_7.listing__country_latest
- ) subq_8
- ) subq_9
+ subq_16.ds__day
+ , subq_16.listing__country_latest
+ ) subq_17
+ ) subq_18
FULL OUTER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_18.ds__day
- , subq_18.listing__country_latest
- , subq_18.views
+ subq_27.ds__day
+ , subq_27.listing__country_latest
+ , subq_27.views
FROM (
-- Aggregate Measures
SELECT
- subq_17.ds__day
- , subq_17.listing__country_latest
- , SUM(subq_17.views) AS views
+ subq_26.ds__day
+ , subq_26.listing__country_latest
+ , SUM(subq_26.views) AS views
FROM (
-- Pass Only Elements: ['views', 'listing__country_latest', 'ds__day']
SELECT
- subq_16.ds__day
- , subq_16.listing__country_latest
- , subq_16.views
+ subq_25.ds__day
+ , subq_25.listing__country_latest
+ , subq_25.views
FROM (
-- Join Standard Outputs
SELECT
- subq_12.ds__day AS ds__day
- , subq_12.listing AS listing
- , subq_15.country_latest AS listing__country_latest
- , subq_12.views AS views
+ subq_21.ds__day AS ds__day
+ , subq_21.listing AS listing
+ , subq_24.country_latest AS listing__country_latest
+ , subq_21.views AS views
FROM (
-- Pass Only Elements: ['views', 'ds__day', 'listing']
SELECT
- subq_11.ds__day
- , subq_11.listing
- , subq_11.views
+ subq_20.ds__day
+ , subq_20.listing
+ , subq_20.views
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_10.ds__day
- , subq_10.ds__week
- , subq_10.ds__month
- , subq_10.ds__quarter
- , subq_10.ds__year
- , subq_10.ds__extract_year
- , subq_10.ds__extract_quarter
- , subq_10.ds__extract_month
- , subq_10.ds__extract_day
- , subq_10.ds__extract_dow
- , subq_10.ds__extract_doy
- , subq_10.ds_partitioned__day
- , subq_10.ds_partitioned__week
- , subq_10.ds_partitioned__month
- , subq_10.ds_partitioned__quarter
- , subq_10.ds_partitioned__year
- , subq_10.ds_partitioned__extract_year
- , subq_10.ds_partitioned__extract_quarter
- , subq_10.ds_partitioned__extract_month
- , subq_10.ds_partitioned__extract_day
- , subq_10.ds_partitioned__extract_dow
- , subq_10.ds_partitioned__extract_doy
- , subq_10.view__ds__day
- , subq_10.view__ds__week
- , subq_10.view__ds__month
- , subq_10.view__ds__quarter
- , subq_10.view__ds__year
- , subq_10.view__ds__extract_year
- , subq_10.view__ds__extract_quarter
- , subq_10.view__ds__extract_month
- , subq_10.view__ds__extract_day
- , subq_10.view__ds__extract_dow
- , subq_10.view__ds__extract_doy
- , subq_10.view__ds_partitioned__day
- , subq_10.view__ds_partitioned__week
- , subq_10.view__ds_partitioned__month
- , subq_10.view__ds_partitioned__quarter
- , subq_10.view__ds_partitioned__year
- , subq_10.view__ds_partitioned__extract_year
- , subq_10.view__ds_partitioned__extract_quarter
- , subq_10.view__ds_partitioned__extract_month
- , subq_10.view__ds_partitioned__extract_day
- , subq_10.view__ds_partitioned__extract_dow
- , subq_10.view__ds_partitioned__extract_doy
- , subq_10.ds__day AS metric_time__day
- , subq_10.ds__week AS metric_time__week
- , subq_10.ds__month AS metric_time__month
- , subq_10.ds__quarter AS metric_time__quarter
- , subq_10.ds__year AS metric_time__year
- , subq_10.ds__extract_year AS metric_time__extract_year
- , subq_10.ds__extract_quarter AS metric_time__extract_quarter
- , subq_10.ds__extract_month AS metric_time__extract_month
- , subq_10.ds__extract_day AS metric_time__extract_day
- , subq_10.ds__extract_dow AS metric_time__extract_dow
- , subq_10.ds__extract_doy AS metric_time__extract_doy
- , subq_10.listing
- , subq_10.user
- , subq_10.view__listing
- , subq_10.view__user
- , subq_10.views
+ subq_19.ds__day
+ , subq_19.ds__week
+ , subq_19.ds__month
+ , subq_19.ds__quarter
+ , subq_19.ds__year
+ , subq_19.ds__extract_year
+ , subq_19.ds__extract_quarter
+ , subq_19.ds__extract_month
+ , subq_19.ds__extract_day
+ , subq_19.ds__extract_dow
+ , subq_19.ds__extract_doy
+ , subq_19.ds_partitioned__day
+ , subq_19.ds_partitioned__week
+ , subq_19.ds_partitioned__month
+ , subq_19.ds_partitioned__quarter
+ , subq_19.ds_partitioned__year
+ , subq_19.ds_partitioned__extract_year
+ , subq_19.ds_partitioned__extract_quarter
+ , subq_19.ds_partitioned__extract_month
+ , subq_19.ds_partitioned__extract_day
+ , subq_19.ds_partitioned__extract_dow
+ , subq_19.ds_partitioned__extract_doy
+ , subq_19.view__ds__day
+ , subq_19.view__ds__week
+ , subq_19.view__ds__month
+ , subq_19.view__ds__quarter
+ , subq_19.view__ds__year
+ , subq_19.view__ds__extract_year
+ , subq_19.view__ds__extract_quarter
+ , subq_19.view__ds__extract_month
+ , subq_19.view__ds__extract_day
+ , subq_19.view__ds__extract_dow
+ , subq_19.view__ds__extract_doy
+ , subq_19.view__ds_partitioned__day
+ , subq_19.view__ds_partitioned__week
+ , subq_19.view__ds_partitioned__month
+ , subq_19.view__ds_partitioned__quarter
+ , subq_19.view__ds_partitioned__year
+ , subq_19.view__ds_partitioned__extract_year
+ , subq_19.view__ds_partitioned__extract_quarter
+ , subq_19.view__ds_partitioned__extract_month
+ , subq_19.view__ds_partitioned__extract_day
+ , subq_19.view__ds_partitioned__extract_dow
+ , subq_19.view__ds_partitioned__extract_doy
+ , subq_19.ds__day AS metric_time__day
+ , subq_19.ds__week AS metric_time__week
+ , subq_19.ds__month AS metric_time__month
+ , subq_19.ds__quarter AS metric_time__quarter
+ , subq_19.ds__year AS metric_time__year
+ , subq_19.ds__extract_year AS metric_time__extract_year
+ , subq_19.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_19.ds__extract_month AS metric_time__extract_month
+ , subq_19.ds__extract_day AS metric_time__extract_day
+ , subq_19.ds__extract_dow AS metric_time__extract_dow
+ , subq_19.ds__extract_doy AS metric_time__extract_doy
+ , subq_19.listing
+ , subq_19.user
+ , subq_19.view__listing
+ , subq_19.view__user
+ , subq_19.views
FROM (
-- Read Elements From Semantic Model 'views_source'
SELECT
1 AS views
- , DATE_TRUNC('day', views_source_src_28010.ds) AS ds__day
- , DATE_TRUNC('week', views_source_src_28010.ds) AS ds__week
- , DATE_TRUNC('month', views_source_src_28010.ds) AS ds__month
- , DATE_TRUNC('quarter', views_source_src_28010.ds) AS ds__quarter
- , DATE_TRUNC('year', views_source_src_28010.ds) AS ds__year
- , EXTRACT(year FROM views_source_src_28010.ds) AS ds__extract_year
- , EXTRACT(quarter FROM views_source_src_28010.ds) AS ds__extract_quarter
- , EXTRACT(month FROM views_source_src_28010.ds) AS ds__extract_month
- , EXTRACT(day FROM views_source_src_28010.ds) AS ds__extract_day
- , EXTRACT(isodow FROM views_source_src_28010.ds) AS ds__extract_dow
- , EXTRACT(doy FROM views_source_src_28010.ds) AS ds__extract_doy
- , DATE_TRUNC('day', views_source_src_28010.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', views_source_src_28010.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', views_source_src_28010.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', views_source_src_28010.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', views_source_src_28010.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM views_source_src_28010.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM views_source_src_28010.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM views_source_src_28010.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM views_source_src_28010.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM views_source_src_28010.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM views_source_src_28010.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', views_source_src_28010.ds) AS view__ds__day
- , DATE_TRUNC('week', views_source_src_28010.ds) AS view__ds__week
- , DATE_TRUNC('month', views_source_src_28010.ds) AS view__ds__month
- , DATE_TRUNC('quarter', views_source_src_28010.ds) AS view__ds__quarter
- , DATE_TRUNC('year', views_source_src_28010.ds) AS view__ds__year
- , EXTRACT(year FROM views_source_src_28010.ds) AS view__ds__extract_year
- , EXTRACT(quarter FROM views_source_src_28010.ds) AS view__ds__extract_quarter
- , EXTRACT(month FROM views_source_src_28010.ds) AS view__ds__extract_month
- , EXTRACT(day FROM views_source_src_28010.ds) AS view__ds__extract_day
- , EXTRACT(isodow FROM views_source_src_28010.ds) AS view__ds__extract_dow
- , EXTRACT(doy FROM views_source_src_28010.ds) AS view__ds__extract_doy
- , DATE_TRUNC('day', views_source_src_28010.ds_partitioned) AS view__ds_partitioned__day
- , DATE_TRUNC('week', views_source_src_28010.ds_partitioned) AS view__ds_partitioned__week
- , DATE_TRUNC('month', views_source_src_28010.ds_partitioned) AS view__ds_partitioned__month
- , DATE_TRUNC('quarter', views_source_src_28010.ds_partitioned) AS view__ds_partitioned__quarter
- , DATE_TRUNC('year', views_source_src_28010.ds_partitioned) AS view__ds_partitioned__year
- , EXTRACT(year FROM views_source_src_28010.ds_partitioned) AS view__ds_partitioned__extract_year
- , EXTRACT(quarter FROM views_source_src_28010.ds_partitioned) AS view__ds_partitioned__extract_quarter
- , EXTRACT(month FROM views_source_src_28010.ds_partitioned) AS view__ds_partitioned__extract_month
- , EXTRACT(day FROM views_source_src_28010.ds_partitioned) AS view__ds_partitioned__extract_day
- , EXTRACT(isodow FROM views_source_src_28010.ds_partitioned) AS view__ds_partitioned__extract_dow
- , EXTRACT(doy FROM views_source_src_28010.ds_partitioned) AS view__ds_partitioned__extract_doy
- , views_source_src_28010.listing_id AS listing
- , views_source_src_28010.user_id AS user
- , views_source_src_28010.listing_id AS view__listing
- , views_source_src_28010.user_id AS view__user
- FROM ***************************.fct_views views_source_src_28010
- ) subq_10
- ) subq_11
- ) subq_12
+ , DATE_TRUNC('day', views_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', views_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', views_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', views_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', views_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM views_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM views_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', views_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', views_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', views_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', views_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', views_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM views_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM views_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', views_source_src_28000.ds) AS view__ds__day
+ , DATE_TRUNC('week', views_source_src_28000.ds) AS view__ds__week
+ , DATE_TRUNC('month', views_source_src_28000.ds) AS view__ds__month
+ , DATE_TRUNC('quarter', views_source_src_28000.ds) AS view__ds__quarter
+ , DATE_TRUNC('year', views_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM views_source_src_28000.ds) AS view__ds__extract_dow
+ , EXTRACT(doy FROM views_source_src_28000.ds) AS view__ds__extract_doy
+ , DATE_TRUNC('day', views_source_src_28000.ds_partitioned) AS view__ds_partitioned__day
+ , DATE_TRUNC('week', views_source_src_28000.ds_partitioned) AS view__ds_partitioned__week
+ , DATE_TRUNC('month', views_source_src_28000.ds_partitioned) AS view__ds_partitioned__month
+ , DATE_TRUNC('quarter', views_source_src_28000.ds_partitioned) AS view__ds_partitioned__quarter
+ , DATE_TRUNC('year', views_source_src_28000.ds_partitioned) 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
+ , EXTRACT(day FROM views_source_src_28000.ds_partitioned) AS view__ds_partitioned__extract_day
+ , EXTRACT(isodow FROM views_source_src_28000.ds_partitioned) AS view__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM views_source_src_28000.ds_partitioned) AS view__ds_partitioned__extract_doy
+ , views_source_src_28000.listing_id AS listing
+ , views_source_src_28000.user_id AS user
+ , views_source_src_28000.listing_id AS view__listing
+ , views_source_src_28000.user_id AS view__user
+ FROM ***************************.fct_views views_source_src_28000
+ ) subq_19
+ ) subq_20
+ ) subq_21
LEFT OUTER JOIN (
-- Pass Only Elements: ['country_latest', 'listing']
SELECT
- subq_14.listing
- , subq_14.country_latest
+ subq_23.listing
+ , subq_23.country_latest
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_13.ds__day
- , subq_13.ds__week
- , subq_13.ds__month
- , subq_13.ds__quarter
- , subq_13.ds__year
- , subq_13.ds__extract_year
- , subq_13.ds__extract_quarter
- , subq_13.ds__extract_month
- , subq_13.ds__extract_day
- , subq_13.ds__extract_dow
- , subq_13.ds__extract_doy
- , subq_13.created_at__day
- , subq_13.created_at__week
- , subq_13.created_at__month
- , subq_13.created_at__quarter
- , subq_13.created_at__year
- , subq_13.created_at__extract_year
- , subq_13.created_at__extract_quarter
- , subq_13.created_at__extract_month
- , subq_13.created_at__extract_day
- , subq_13.created_at__extract_dow
- , subq_13.created_at__extract_doy
- , subq_13.listing__ds__day
- , subq_13.listing__ds__week
- , subq_13.listing__ds__month
- , subq_13.listing__ds__quarter
- , subq_13.listing__ds__year
- , subq_13.listing__ds__extract_year
- , subq_13.listing__ds__extract_quarter
- , subq_13.listing__ds__extract_month
- , subq_13.listing__ds__extract_day
- , subq_13.listing__ds__extract_dow
- , subq_13.listing__ds__extract_doy
- , subq_13.listing__created_at__day
- , subq_13.listing__created_at__week
- , subq_13.listing__created_at__month
- , subq_13.listing__created_at__quarter
- , subq_13.listing__created_at__year
- , subq_13.listing__created_at__extract_year
- , subq_13.listing__created_at__extract_quarter
- , subq_13.listing__created_at__extract_month
- , subq_13.listing__created_at__extract_day
- , subq_13.listing__created_at__extract_dow
- , subq_13.listing__created_at__extract_doy
- , subq_13.ds__day AS metric_time__day
- , subq_13.ds__week AS metric_time__week
- , subq_13.ds__month AS metric_time__month
- , subq_13.ds__quarter AS metric_time__quarter
- , subq_13.ds__year AS metric_time__year
- , subq_13.ds__extract_year AS metric_time__extract_year
- , subq_13.ds__extract_quarter AS metric_time__extract_quarter
- , subq_13.ds__extract_month AS metric_time__extract_month
- , subq_13.ds__extract_day AS metric_time__extract_day
- , subq_13.ds__extract_dow AS metric_time__extract_dow
- , subq_13.ds__extract_doy AS metric_time__extract_doy
- , subq_13.listing
- , subq_13.user
- , subq_13.listing__user
- , subq_13.country_latest
- , subq_13.is_lux_latest
- , subq_13.capacity_latest
- , subq_13.listing__country_latest
- , subq_13.listing__is_lux_latest
- , subq_13.listing__capacity_latest
- , subq_13.listings
- , subq_13.largest_listing
- , subq_13.smallest_listing
+ subq_22.ds__day
+ , subq_22.ds__week
+ , subq_22.ds__month
+ , subq_22.ds__quarter
+ , subq_22.ds__year
+ , subq_22.ds__extract_year
+ , subq_22.ds__extract_quarter
+ , subq_22.ds__extract_month
+ , subq_22.ds__extract_day
+ , subq_22.ds__extract_dow
+ , subq_22.ds__extract_doy
+ , subq_22.created_at__day
+ , subq_22.created_at__week
+ , subq_22.created_at__month
+ , subq_22.created_at__quarter
+ , subq_22.created_at__year
+ , subq_22.created_at__extract_year
+ , subq_22.created_at__extract_quarter
+ , subq_22.created_at__extract_month
+ , subq_22.created_at__extract_day
+ , subq_22.created_at__extract_dow
+ , subq_22.created_at__extract_doy
+ , subq_22.listing__ds__day
+ , subq_22.listing__ds__week
+ , subq_22.listing__ds__month
+ , subq_22.listing__ds__quarter
+ , subq_22.listing__ds__year
+ , subq_22.listing__ds__extract_year
+ , subq_22.listing__ds__extract_quarter
+ , subq_22.listing__ds__extract_month
+ , subq_22.listing__ds__extract_day
+ , subq_22.listing__ds__extract_dow
+ , subq_22.listing__ds__extract_doy
+ , subq_22.listing__created_at__day
+ , subq_22.listing__created_at__week
+ , subq_22.listing__created_at__month
+ , subq_22.listing__created_at__quarter
+ , subq_22.listing__created_at__year
+ , subq_22.listing__created_at__extract_year
+ , subq_22.listing__created_at__extract_quarter
+ , subq_22.listing__created_at__extract_month
+ , subq_22.listing__created_at__extract_day
+ , subq_22.listing__created_at__extract_dow
+ , subq_22.listing__created_at__extract_doy
+ , subq_22.ds__day AS metric_time__day
+ , subq_22.ds__week AS metric_time__week
+ , subq_22.ds__month AS metric_time__month
+ , subq_22.ds__quarter AS metric_time__quarter
+ , subq_22.ds__year AS metric_time__year
+ , subq_22.ds__extract_year AS metric_time__extract_year
+ , subq_22.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_22.ds__extract_month AS metric_time__extract_month
+ , subq_22.ds__extract_day AS metric_time__extract_day
+ , subq_22.ds__extract_dow AS metric_time__extract_dow
+ , subq_22.ds__extract_doy AS metric_time__extract_doy
+ , subq_22.listing
+ , subq_22.user
+ , subq_22.listing__user
+ , subq_22.country_latest
+ , subq_22.is_lux_latest
+ , subq_22.capacity_latest
+ , subq_22.listing__country_latest
+ , subq_22.listing__is_lux_latest
+ , subq_22.listing__capacity_latest
+ , subq_22.listings
+ , subq_22.largest_listing
+ , subq_22.smallest_listing
FROM (
-- Read Elements From Semantic Model 'listings_latest'
SELECT
1 AS listings
- , listings_latest_src_28005.capacity AS largest_listing
- , listings_latest_src_28005.capacity AS smallest_listing
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy
- , listings_latest_src_28005.country AS country_latest
- , listings_latest_src_28005.is_lux AS is_lux_latest
- , listings_latest_src_28005.capacity AS capacity_latest
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy
- , listings_latest_src_28005.country AS listing__country_latest
- , listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , listings_latest_src_28005.capacity AS listing__capacity_latest
- , listings_latest_src_28005.listing_id AS listing
- , listings_latest_src_28005.user_id AS user
- , listings_latest_src_28005.user_id AS listing__user
- FROM ***************************.dim_listings_latest listings_latest_src_28005
- ) subq_13
- ) subq_14
- ) subq_15
+ , listings_latest_src_28000.capacity AS largest_listing
+ , listings_latest_src_28000.capacity AS smallest_listing
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS created_at__extract_day
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS created_at__extract_doy
+ , 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('day', listings_latest_src_28000.created_at) AS listing__ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS listing__ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS listing__created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_day
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_doy
+ , listings_latest_src_28000.country AS listing__country_latest
+ , listings_latest_src_28000.is_lux AS listing__is_lux_latest
+ , listings_latest_src_28000.capacity AS listing__capacity_latest
+ , listings_latest_src_28000.listing_id AS listing
+ , listings_latest_src_28000.user_id AS user
+ , listings_latest_src_28000.user_id AS listing__user
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
+ ) subq_22
+ ) subq_23
+ ) subq_24
ON
- subq_12.listing = subq_15.listing
- ) subq_16
- ) subq_17
+ subq_21.listing = subq_24.listing
+ ) subq_25
+ ) subq_26
GROUP BY
- subq_17.ds__day
- , subq_17.listing__country_latest
- ) subq_18
- ) subq_19
+ subq_26.ds__day
+ , subq_26.listing__country_latest
+ ) subq_27
+ ) subq_28
ON
(
- subq_9.listing__country_latest = subq_19.listing__country_latest
+ subq_18.listing__country_latest = subq_28.listing__country_latest
) AND (
- subq_9.ds__day = subq_19.ds__day
+ subq_18.ds__day = subq_28.ds__day
)
GROUP BY
- COALESCE(subq_9.ds__day, subq_19.ds__day)
- , COALESCE(subq_9.listing__country_latest, subq_19.listing__country_latest)
-) subq_20
+ COALESCE(subq_18.ds__day, subq_28.ds__day)
+ , COALESCE(subq_18.listing__country_latest, subq_28.listing__country_latest)
+) subq_29
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0_optimized.sql
index 07a0d3efe7..8289fb48f2 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0_optimized.sql
@@ -6,19 +6,19 @@ SELECT
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_30.ds__day, subq_40.ds__day) AS ds__day
- , COALESCE(subq_30.listing__country_latest, subq_40.listing__country_latest) AS listing__country_latest
- , MAX(subq_30.bookings) AS bookings
- , MAX(subq_40.views) AS views
+ COALESCE(subq_39.ds__day, subq_49.ds__day) AS ds__day
+ , COALESCE(subq_39.listing__country_latest, subq_49.listing__country_latest) AS listing__country_latest
+ , MAX(subq_39.bookings) AS bookings
+ , MAX(subq_49.views) AS views
FROM (
-- Join Standard Outputs
-- Pass Only Elements: ['bookings', 'listing__country_latest', 'ds__day']
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_23.ds__day AS ds__day
- , listings_latest_src_28005.country AS listing__country_latest
- , SUM(subq_23.bookings) AS bookings
+ subq_32.ds__day AS ds__day
+ , listings_latest_src_28000.country AS listing__country_latest
+ , SUM(subq_32.bookings) AS bookings
FROM (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
@@ -27,25 +27,25 @@ FROM (
DATE_TRUNC('day', ds) AS ds__day
, listing_id AS listing
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_23
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_32
LEFT OUTER JOIN
- ***************************.dim_listings_latest listings_latest_src_28005
+ ***************************.dim_listings_latest listings_latest_src_28000
ON
- subq_23.listing = listings_latest_src_28005.listing_id
+ subq_32.listing = listings_latest_src_28000.listing_id
GROUP BY
- subq_23.ds__day
- , listings_latest_src_28005.country
- ) subq_30
+ subq_32.ds__day
+ , listings_latest_src_28000.country
+ ) subq_39
FULL OUTER JOIN (
-- Join Standard Outputs
-- Pass Only Elements: ['views', 'listing__country_latest', 'ds__day']
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_33.ds__day AS ds__day
- , listings_latest_src_28005.country AS listing__country_latest
- , SUM(subq_33.views) AS views
+ subq_42.ds__day AS ds__day
+ , listings_latest_src_28000.country AS listing__country_latest
+ , SUM(subq_42.views) AS views
FROM (
-- Read Elements From Semantic Model 'views_source'
-- Metric Time Dimension 'ds'
@@ -54,23 +54,23 @@ FROM (
DATE_TRUNC('day', ds) AS ds__day
, listing_id AS listing
, 1 AS views
- FROM ***************************.fct_views views_source_src_28010
- ) subq_33
+ FROM ***************************.fct_views views_source_src_28000
+ ) subq_42
LEFT OUTER JOIN
- ***************************.dim_listings_latest listings_latest_src_28005
+ ***************************.dim_listings_latest listings_latest_src_28000
ON
- subq_33.listing = listings_latest_src_28005.listing_id
+ subq_42.listing = listings_latest_src_28000.listing_id
GROUP BY
- subq_33.ds__day
- , listings_latest_src_28005.country
- ) subq_40
+ subq_42.ds__day
+ , listings_latest_src_28000.country
+ ) subq_49
ON
(
- subq_30.listing__country_latest = subq_40.listing__country_latest
+ subq_39.listing__country_latest = subq_49.listing__country_latest
) AND (
- subq_30.ds__day = subq_40.ds__day
+ subq_39.ds__day = subq_49.ds__day
)
GROUP BY
- COALESCE(subq_30.ds__day, subq_40.ds__day)
- , COALESCE(subq_30.listing__country_latest, subq_40.listing__country_latest)
-) subq_41
+ COALESCE(subq_39.ds__day, subq_49.ds__day)
+ , COALESCE(subq_39.listing__country_latest, subq_49.listing__country_latest)
+) subq_50
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.sql
index 7134ac9ae1..01a2b684f3 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.sql
@@ -28,93 +28,93 @@ FROM (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
) subq_1
LEFT OUTER JOIN (
@@ -126,62 +126,62 @@ FROM (
-- Read Elements From Semantic Model 'listings_latest'
SELECT
1 AS listings
- , listings_latest_src_28005.capacity AS largest_listing
- , listings_latest_src_28005.capacity AS smallest_listing
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy
- , listings_latest_src_28005.country AS country_latest
- , listings_latest_src_28005.is_lux AS is_lux_latest
- , listings_latest_src_28005.capacity AS capacity_latest
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy
- , listings_latest_src_28005.country AS listing__country_latest
- , listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , listings_latest_src_28005.capacity AS listing__capacity_latest
- , listings_latest_src_28005.listing_id AS listing
- , listings_latest_src_28005.user_id AS user
- , listings_latest_src_28005.user_id AS listing__user
- FROM ***************************.dim_listings_latest listings_latest_src_28005
+ , listings_latest_src_28000.capacity AS largest_listing
+ , listings_latest_src_28000.capacity AS smallest_listing
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS created_at__extract_day
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS created_at__extract_doy
+ , 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('day', listings_latest_src_28000.created_at) AS listing__ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS listing__ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS listing__created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_day
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_doy
+ , listings_latest_src_28000.country AS listing__country_latest
+ , listings_latest_src_28000.is_lux AS listing__is_lux_latest
+ , listings_latest_src_28000.capacity AS listing__capacity_latest
+ , listings_latest_src_28000.listing_id AS listing
+ , listings_latest_src_28000.user_id AS user
+ , listings_latest_src_28000.user_id AS listing__user
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
) subq_2
) subq_3
ON
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_compute_metrics_node_ratio_from_single_semantic_model__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_compute_metrics_node_ratio_from_single_semantic_model__plan0_optimized.sql
index 38e9fae7d2..b2cd839070 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_compute_metrics_node_ratio_from_single_semantic_model__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_compute_metrics_node_ratio_from_single_semantic_model__plan0_optimized.sql
@@ -8,7 +8,7 @@ FROM (
-- Aggregate Measures
SELECT
subq_7.listing AS listing
- , listings_latest_src_28005.country AS listing__country_latest
+ , listings_latest_src_28000.country AS listing__country_latest
, SUM(subq_7.bookings) AS bookings
, COUNT(DISTINCT subq_7.bookers) AS bookers
FROM (
@@ -18,13 +18,13 @@ FROM (
listing_id AS listing
, 1 AS bookings
, guest_id AS bookers
- FROM ***************************.fct_bookings bookings_source_src_28001
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_7
LEFT OUTER JOIN
- ***************************.dim_listings_latest listings_latest_src_28005
+ ***************************.dim_listings_latest listings_latest_src_28000
ON
- subq_7.listing = listings_latest_src_28005.listing_id
+ subq_7.listing = listings_latest_src_28000.listing_id
GROUP BY
subq_7.listing
- , listings_latest_src_28005.country
+ , listings_latest_src_28000.country
) subq_11
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_compute_metrics_node_simple_expr__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_compute_metrics_node_simple_expr__plan0.sql
index d2b2fe8dad..069df1629d 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_compute_metrics_node_simple_expr__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_compute_metrics_node_simple_expr__plan0.sql
@@ -25,93 +25,93 @@ FROM (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
) subq_1
LEFT OUTER JOIN (
@@ -123,62 +123,62 @@ FROM (
-- Read Elements From Semantic Model 'listings_latest'
SELECT
1 AS listings
- , listings_latest_src_28005.capacity AS largest_listing
- , listings_latest_src_28005.capacity AS smallest_listing
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy
- , listings_latest_src_28005.country AS country_latest
- , listings_latest_src_28005.is_lux AS is_lux_latest
- , listings_latest_src_28005.capacity AS capacity_latest
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy
- , listings_latest_src_28005.country AS listing__country_latest
- , listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , listings_latest_src_28005.capacity AS listing__capacity_latest
- , listings_latest_src_28005.listing_id AS listing
- , listings_latest_src_28005.user_id AS user
- , listings_latest_src_28005.user_id AS listing__user
- FROM ***************************.dim_listings_latest listings_latest_src_28005
+ , listings_latest_src_28000.capacity AS largest_listing
+ , listings_latest_src_28000.capacity AS smallest_listing
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS created_at__extract_day
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS created_at__extract_doy
+ , 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('day', listings_latest_src_28000.created_at) AS listing__ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS listing__ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS listing__created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_day
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_doy
+ , listings_latest_src_28000.country AS listing__country_latest
+ , listings_latest_src_28000.is_lux AS listing__is_lux_latest
+ , listings_latest_src_28000.capacity AS listing__capacity_latest
+ , listings_latest_src_28000.listing_id AS listing
+ , listings_latest_src_28000.user_id AS user
+ , listings_latest_src_28000.user_id AS listing__user
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
) subq_2
) subq_3
ON
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_compute_metrics_node_simple_expr__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_compute_metrics_node_simple_expr__plan0_optimized.sql
index 3bda7562bf..65e701e3dd 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_compute_metrics_node_simple_expr__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_compute_metrics_node_simple_expr__plan0_optimized.sql
@@ -7,15 +7,15 @@ FROM (
-- Join Standard Outputs
-- Aggregate Measures
SELECT
- bookings_source_src_28001.listing_id AS listing
- , listings_latest_src_28005.country AS listing__country_latest
- , SUM(bookings_source_src_28001.booking_value) AS booking_value
- FROM ***************************.fct_bookings bookings_source_src_28001
+ bookings_source_src_28000.listing_id AS listing
+ , listings_latest_src_28000.country AS listing__country_latest
+ , SUM(bookings_source_src_28000.booking_value) AS booking_value
+ FROM ***************************.fct_bookings bookings_source_src_28000
LEFT OUTER JOIN
- ***************************.dim_listings_latest listings_latest_src_28005
+ ***************************.dim_listings_latest listings_latest_src_28000
ON
- bookings_source_src_28001.listing_id = listings_latest_src_28005.listing_id
+ bookings_source_src_28000.listing_id = listings_latest_src_28000.listing_id
GROUP BY
- bookings_source_src_28001.listing_id
- , listings_latest_src_28005.country
+ bookings_source_src_28000.listing_id
+ , listings_latest_src_28000.country
) subq_11
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_constrain_time_range_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_constrain_time_range_node__plan0.sql
index 3a0b9aba09..5414f95860 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_constrain_time_range_node__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_constrain_time_range_node__plan0.sql
@@ -19,93 +19,93 @@ FROM (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
) subq_1
) subq_2
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_constrain_time_range_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_constrain_time_range_node__plan0_optimized.sql
index db53f26587..d0d15f6943 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_constrain_time_range_node__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_constrain_time_range_node__plan0_optimized.sql
@@ -6,5 +6,5 @@ SELECT
DATE_TRUNC('day', ds) AS ds__day
, DATE_TRUNC('day', ds) AS metric_time__day
, 1 AS bookings
-FROM ***************************.fct_bookings bookings_source_src_28001
+FROM ***************************.fct_bookings bookings_source_src_28000
WHERE DATE_TRUNC('day', ds) BETWEEN '2020-01-01' AND '2020-01-02'
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_dimension_with_joined_where_constraint__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_dimension_with_joined_where_constraint__plan0.sql
index 8d7833c4da..ed1028fb88 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_dimension_with_joined_where_constraint__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_dimension_with_joined_where_constraint__plan0.sql
@@ -125,62 +125,62 @@ FROM (
-- Read Elements From Semantic Model 'listings_latest'
SELECT
1 AS listings
- , listings_latest_src_28005.capacity AS largest_listing
- , listings_latest_src_28005.capacity AS smallest_listing
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy
- , listings_latest_src_28005.country AS country_latest
- , listings_latest_src_28005.is_lux AS is_lux_latest
- , listings_latest_src_28005.capacity AS capacity_latest
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy
- , listings_latest_src_28005.country AS listing__country_latest
- , listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , listings_latest_src_28005.capacity AS listing__capacity_latest
- , listings_latest_src_28005.listing_id AS listing
- , listings_latest_src_28005.user_id AS user
- , listings_latest_src_28005.user_id AS listing__user
- FROM ***************************.dim_listings_latest listings_latest_src_28005
+ , listings_latest_src_28000.capacity AS largest_listing
+ , listings_latest_src_28000.capacity AS smallest_listing
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS created_at__extract_day
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS created_at__extract_doy
+ , 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('day', listings_latest_src_28000.created_at) AS listing__ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS listing__ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS listing__created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_day
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_doy
+ , listings_latest_src_28000.country AS listing__country_latest
+ , listings_latest_src_28000.is_lux AS listing__is_lux_latest
+ , listings_latest_src_28000.capacity AS listing__capacity_latest
+ , listings_latest_src_28000.listing_id AS listing
+ , listings_latest_src_28000.user_id AS user
+ , listings_latest_src_28000.user_id AS listing__user
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
) subq_0
FULL OUTER JOIN (
-- Pass Only Elements: ['home_state_latest', 'user']
@@ -190,32 +190,32 @@ FROM (
FROM (
-- Read Elements From Semantic Model 'users_latest'
SELECT
- DATE_TRUNC('day', users_latest_src_28009.ds) AS ds_latest__day
- , DATE_TRUNC('week', users_latest_src_28009.ds) AS ds_latest__week
- , DATE_TRUNC('month', users_latest_src_28009.ds) AS ds_latest__month
- , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS ds_latest__quarter
- , DATE_TRUNC('year', users_latest_src_28009.ds) AS ds_latest__year
- , EXTRACT(year FROM users_latest_src_28009.ds) AS ds_latest__extract_year
- , EXTRACT(quarter FROM users_latest_src_28009.ds) AS ds_latest__extract_quarter
- , EXTRACT(month FROM users_latest_src_28009.ds) AS ds_latest__extract_month
- , EXTRACT(day FROM users_latest_src_28009.ds) AS ds_latest__extract_day
- , EXTRACT(isodow FROM users_latest_src_28009.ds) AS ds_latest__extract_dow
- , EXTRACT(doy FROM users_latest_src_28009.ds) AS ds_latest__extract_doy
- , users_latest_src_28009.home_state_latest
- , DATE_TRUNC('day', users_latest_src_28009.ds) AS user__ds_latest__day
- , DATE_TRUNC('week', users_latest_src_28009.ds) AS user__ds_latest__week
- , DATE_TRUNC('month', users_latest_src_28009.ds) AS user__ds_latest__month
- , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS user__ds_latest__quarter
- , DATE_TRUNC('year', users_latest_src_28009.ds) AS user__ds_latest__year
- , EXTRACT(year FROM users_latest_src_28009.ds) AS user__ds_latest__extract_year
- , EXTRACT(quarter FROM users_latest_src_28009.ds) AS user__ds_latest__extract_quarter
- , EXTRACT(month FROM users_latest_src_28009.ds) AS user__ds_latest__extract_month
- , EXTRACT(day FROM users_latest_src_28009.ds) AS user__ds_latest__extract_day
- , EXTRACT(isodow FROM users_latest_src_28009.ds) AS user__ds_latest__extract_dow
- , EXTRACT(doy FROM users_latest_src_28009.ds) AS user__ds_latest__extract_doy
- , users_latest_src_28009.home_state_latest AS user__home_state_latest
- , users_latest_src_28009.user_id AS user
- FROM ***************************.dim_users_latest users_latest_src_28009
+ DATE_TRUNC('day', users_latest_src_28000.ds) AS ds_latest__day
+ , DATE_TRUNC('week', users_latest_src_28000.ds) AS ds_latest__week
+ , DATE_TRUNC('month', users_latest_src_28000.ds) AS ds_latest__month
+ , DATE_TRUNC('quarter', users_latest_src_28000.ds) AS ds_latest__quarter
+ , DATE_TRUNC('year', users_latest_src_28000.ds) 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
+ , EXTRACT(day FROM users_latest_src_28000.ds) AS ds_latest__extract_day
+ , EXTRACT(isodow FROM users_latest_src_28000.ds) AS ds_latest__extract_dow
+ , EXTRACT(doy FROM users_latest_src_28000.ds) AS ds_latest__extract_doy
+ , users_latest_src_28000.home_state_latest
+ , DATE_TRUNC('day', users_latest_src_28000.ds) AS user__ds_latest__day
+ , DATE_TRUNC('week', users_latest_src_28000.ds) AS user__ds_latest__week
+ , DATE_TRUNC('month', users_latest_src_28000.ds) AS user__ds_latest__month
+ , DATE_TRUNC('quarter', users_latest_src_28000.ds) AS user__ds_latest__quarter
+ , DATE_TRUNC('year', users_latest_src_28000.ds) 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
+ , EXTRACT(day FROM users_latest_src_28000.ds) AS user__ds_latest__extract_day
+ , EXTRACT(isodow FROM users_latest_src_28000.ds) AS user__ds_latest__extract_dow
+ , EXTRACT(doy FROM users_latest_src_28000.ds) AS user__ds_latest__extract_doy
+ , users_latest_src_28000.home_state_latest AS user__home_state_latest
+ , users_latest_src_28000.user_id AS user
+ FROM ***************************.dim_users_latest users_latest_src_28000
) subq_1
) subq_2
ON
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_dimension_with_joined_where_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_dimension_with_joined_where_constraint__plan0_optimized.sql
index 8cc8a2b867..c4e57d3c86 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_dimension_with_joined_where_constraint__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_dimension_with_joined_where_constraint__plan0_optimized.sql
@@ -5,13 +5,13 @@ SELECT
FROM (
-- Join Standard Outputs
SELECT
- listings_latest_src_28005.country AS listing__country_latest
- , users_latest_src_28009.home_state_latest AS user__home_state_latest
- FROM ***************************.dim_listings_latest listings_latest_src_28005
+ listings_latest_src_28000.country AS listing__country_latest
+ , users_latest_src_28000.home_state_latest AS user__home_state_latest
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
FULL OUTER JOIN
- ***************************.dim_users_latest users_latest_src_28009
+ ***************************.dim_users_latest users_latest_src_28000
ON
- listings_latest_src_28005.user_id = users_latest_src_28009.user_id
+ listings_latest_src_28000.user_id = users_latest_src_28000.user_id
) subq_8
WHERE listing__country_latest = 'us'
GROUP BY
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_dimensions_requiring_join__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_dimensions_requiring_join__plan0.sql
index 884b765da5..0962aa9958 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_dimensions_requiring_join__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_dimensions_requiring_join__plan0.sql
@@ -66,62 +66,62 @@ FROM (
-- Read Elements From Semantic Model 'listings_latest'
SELECT
1 AS listings
- , listings_latest_src_28005.capacity AS largest_listing
- , listings_latest_src_28005.capacity AS smallest_listing
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy
- , listings_latest_src_28005.country AS country_latest
- , listings_latest_src_28005.is_lux AS is_lux_latest
- , listings_latest_src_28005.capacity AS capacity_latest
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy
- , listings_latest_src_28005.country AS listing__country_latest
- , listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , listings_latest_src_28005.capacity AS listing__capacity_latest
- , listings_latest_src_28005.listing_id AS listing
- , listings_latest_src_28005.user_id AS user
- , listings_latest_src_28005.user_id AS listing__user
- FROM ***************************.dim_listings_latest listings_latest_src_28005
+ , listings_latest_src_28000.capacity AS largest_listing
+ , listings_latest_src_28000.capacity AS smallest_listing
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS created_at__extract_day
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS created_at__extract_doy
+ , 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('day', listings_latest_src_28000.created_at) AS listing__ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS listing__ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS listing__created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_day
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_doy
+ , listings_latest_src_28000.country AS listing__country_latest
+ , listings_latest_src_28000.is_lux AS listing__is_lux_latest
+ , listings_latest_src_28000.capacity AS listing__capacity_latest
+ , listings_latest_src_28000.listing_id AS listing
+ , listings_latest_src_28000.user_id AS user
+ , listings_latest_src_28000.user_id AS listing__user
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
) subq_0
FULL OUTER JOIN (
-- Pass Only Elements: ['home_state_latest', 'user']
@@ -131,32 +131,32 @@ FROM (
FROM (
-- Read Elements From Semantic Model 'users_latest'
SELECT
- DATE_TRUNC('day', users_latest_src_28009.ds) AS ds_latest__day
- , DATE_TRUNC('week', users_latest_src_28009.ds) AS ds_latest__week
- , DATE_TRUNC('month', users_latest_src_28009.ds) AS ds_latest__month
- , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS ds_latest__quarter
- , DATE_TRUNC('year', users_latest_src_28009.ds) AS ds_latest__year
- , EXTRACT(year FROM users_latest_src_28009.ds) AS ds_latest__extract_year
- , EXTRACT(quarter FROM users_latest_src_28009.ds) AS ds_latest__extract_quarter
- , EXTRACT(month FROM users_latest_src_28009.ds) AS ds_latest__extract_month
- , EXTRACT(day FROM users_latest_src_28009.ds) AS ds_latest__extract_day
- , EXTRACT(isodow FROM users_latest_src_28009.ds) AS ds_latest__extract_dow
- , EXTRACT(doy FROM users_latest_src_28009.ds) AS ds_latest__extract_doy
- , users_latest_src_28009.home_state_latest
- , DATE_TRUNC('day', users_latest_src_28009.ds) AS user__ds_latest__day
- , DATE_TRUNC('week', users_latest_src_28009.ds) AS user__ds_latest__week
- , DATE_TRUNC('month', users_latest_src_28009.ds) AS user__ds_latest__month
- , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS user__ds_latest__quarter
- , DATE_TRUNC('year', users_latest_src_28009.ds) AS user__ds_latest__year
- , EXTRACT(year FROM users_latest_src_28009.ds) AS user__ds_latest__extract_year
- , EXTRACT(quarter FROM users_latest_src_28009.ds) AS user__ds_latest__extract_quarter
- , EXTRACT(month FROM users_latest_src_28009.ds) AS user__ds_latest__extract_month
- , EXTRACT(day FROM users_latest_src_28009.ds) AS user__ds_latest__extract_day
- , EXTRACT(isodow FROM users_latest_src_28009.ds) AS user__ds_latest__extract_dow
- , EXTRACT(doy FROM users_latest_src_28009.ds) AS user__ds_latest__extract_doy
- , users_latest_src_28009.home_state_latest AS user__home_state_latest
- , users_latest_src_28009.user_id AS user
- FROM ***************************.dim_users_latest users_latest_src_28009
+ DATE_TRUNC('day', users_latest_src_28000.ds) AS ds_latest__day
+ , DATE_TRUNC('week', users_latest_src_28000.ds) AS ds_latest__week
+ , DATE_TRUNC('month', users_latest_src_28000.ds) AS ds_latest__month
+ , DATE_TRUNC('quarter', users_latest_src_28000.ds) AS ds_latest__quarter
+ , DATE_TRUNC('year', users_latest_src_28000.ds) 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
+ , EXTRACT(day FROM users_latest_src_28000.ds) AS ds_latest__extract_day
+ , EXTRACT(isodow FROM users_latest_src_28000.ds) AS ds_latest__extract_dow
+ , EXTRACT(doy FROM users_latest_src_28000.ds) AS ds_latest__extract_doy
+ , users_latest_src_28000.home_state_latest
+ , DATE_TRUNC('day', users_latest_src_28000.ds) AS user__ds_latest__day
+ , DATE_TRUNC('week', users_latest_src_28000.ds) AS user__ds_latest__week
+ , DATE_TRUNC('month', users_latest_src_28000.ds) AS user__ds_latest__month
+ , DATE_TRUNC('quarter', users_latest_src_28000.ds) AS user__ds_latest__quarter
+ , DATE_TRUNC('year', users_latest_src_28000.ds) 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
+ , EXTRACT(day FROM users_latest_src_28000.ds) AS user__ds_latest__extract_day
+ , EXTRACT(isodow FROM users_latest_src_28000.ds) AS user__ds_latest__extract_dow
+ , EXTRACT(doy FROM users_latest_src_28000.ds) AS user__ds_latest__extract_doy
+ , users_latest_src_28000.home_state_latest AS user__home_state_latest
+ , users_latest_src_28000.user_id AS user
+ FROM ***************************.dim_users_latest users_latest_src_28000
) subq_1
) subq_2
ON
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_dimensions_requiring_join__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_dimensions_requiring_join__plan0_optimized.sql
index bee3a232b6..96c5d5bb3a 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_dimensions_requiring_join__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_dimensions_requiring_join__plan0_optimized.sql
@@ -1,13 +1,13 @@
-- Join Standard Outputs
-- Pass Only Elements: ['user__home_state_latest', 'listing__is_lux_latest']
SELECT
- listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , users_latest_src_28009.home_state_latest AS user__home_state_latest
-FROM ***************************.dim_listings_latest listings_latest_src_28005
+ 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
FULL OUTER JOIN
- ***************************.dim_users_latest users_latest_src_28009
+ ***************************.dim_users_latest users_latest_src_28000
ON
- listings_latest_src_28005.user_id = users_latest_src_28009.user_id
+ listings_latest_src_28000.user_id = users_latest_src_28000.user_id
GROUP BY
- listings_latest_src_28005.is_lux
- , users_latest_src_28009.home_state_latest
+ listings_latest_src_28000.is_lux
+ , users_latest_src_28000.home_state_latest
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_filter_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_filter_node__plan0.sql
index e8e12063d5..4c0230bef5 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_filter_node__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_filter_node__plan0.sql
@@ -6,91 +6,91 @@ FROM (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_filter_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_filter_node__plan0_optimized.sql
index bfbf5ff951..554ce484fb 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_filter_node__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_filter_node__plan0_optimized.sql
@@ -2,4 +2,4 @@
-- Pass Only Elements: ['bookings',]
SELECT
1 AS bookings
-FROM ***************************.fct_bookings bookings_source_src_28001
+FROM ***************************.fct_bookings bookings_source_src_28000
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_filter_with_where_constraint_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_filter_with_where_constraint_node__plan0.sql
index ae00bb04ec..6c7624e9c6 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_filter_with_where_constraint_node__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_filter_with_where_constraint_node__plan0.sql
@@ -12,93 +12,93 @@ FROM (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
) subq_1
WHERE booking__ds__day = '2020-01-01'
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_filter_with_where_constraint_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_filter_with_where_constraint_node__plan0_optimized.sql
index 755a4d39e2..5ee87ba25f 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_filter_with_where_constraint_node__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_filter_with_where_constraint_node__plan0_optimized.sql
@@ -8,6 +8,6 @@ FROM (
SELECT
DATE_TRUNC('day', ds) AS ds__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_3
WHERE booking__ds__day = '2020-01-01'
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_join_to_time_spine_node_with_offset_to_grain__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_join_to_time_spine_node_with_offset_to_grain__plan0.sql
index 21fc0ca626..d1eb9e6cdf 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_join_to_time_spine_node_with_offset_to_grain__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_join_to_time_spine_node_with_offset_to_grain__plan0.sql
@@ -134,93 +134,93 @@ INNER JOIN (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
) subq_1
) subq_2
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_join_to_time_spine_node_with_offset_to_grain__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_join_to_time_spine_node_with_offset_to_grain__plan0_optimized.sql
index d5d4ba056e..6054b232dc 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_join_to_time_spine_node_with_offset_to_grain__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_join_to_time_spine_node_with_offset_to_grain__plan0_optimized.sql
@@ -25,7 +25,7 @@ INNER JOIN (
DATE_TRUNC('day', ds) AS metric_time__day
, listing_id AS listing
, SUM(booking_value) AS booking_value
- FROM ***************************.fct_bookings bookings_source_src_28001
+ FROM ***************************.fct_bookings bookings_source_src_28000
GROUP BY
DATE_TRUNC('day', ds)
, listing_id
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_join_to_time_spine_node_with_offset_window__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_join_to_time_spine_node_with_offset_window__plan0.sql
index 25edad3460..cd070b2730 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_join_to_time_spine_node_with_offset_window__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_join_to_time_spine_node_with_offset_window__plan0.sql
@@ -134,93 +134,93 @@ INNER JOIN (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
) subq_1
) subq_2
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_join_to_time_spine_node_with_offset_window__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_join_to_time_spine_node_with_offset_window__plan0_optimized.sql
index e268d266eb..21b1f16711 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_join_to_time_spine_node_with_offset_window__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_join_to_time_spine_node_with_offset_window__plan0_optimized.sql
@@ -25,7 +25,7 @@ INNER JOIN (
DATE_TRUNC('day', ds) AS metric_time__day
, listing_id AS listing
, SUM(booking_value) AS booking_value
- FROM ***************************.fct_bookings bookings_source_src_28001
+ FROM ***************************.fct_bookings bookings_source_src_28000
GROUP BY
DATE_TRUNC('day', ds)
, listing_id
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_join_to_time_spine_node_without_offset__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_join_to_time_spine_node_without_offset__plan0.sql
index 8573c54b5e..2c925cc021 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_join_to_time_spine_node_without_offset__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_join_to_time_spine_node_without_offset__plan0.sql
@@ -134,93 +134,93 @@ INNER JOIN (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
) subq_1
) subq_2
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_join_to_time_spine_node_without_offset__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_join_to_time_spine_node_without_offset__plan0_optimized.sql
index 695cf9c062..e4f47734b0 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_join_to_time_spine_node_without_offset__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_join_to_time_spine_node_without_offset__plan0_optimized.sql
@@ -25,7 +25,7 @@ INNER JOIN (
DATE_TRUNC('day', ds) AS metric_time__day
, listing_id AS listing
, SUM(booking_value) AS booking_value
- FROM ***************************.fct_bookings bookings_source_src_28001
+ FROM ***************************.fct_bookings bookings_source_src_28000
GROUP BY
DATE_TRUNC('day', ds)
, listing_id
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_measure_aggregation_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_measure_aggregation_node__plan0.sql
index 693664c2e8..d3f9a7fb97 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_measure_aggregation_node__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_measure_aggregation_node__plan0.sql
@@ -16,92 +16,92 @@ FROM (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
) subq_1
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_measure_aggregation_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_measure_aggregation_node__plan0_optimized.sql
index 64fc2826b9..6e5528a6c9 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_measure_aggregation_node__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_measure_aggregation_node__plan0_optimized.sql
@@ -6,4 +6,4 @@ SELECT
, SUM(CASE WHEN is_instant THEN 1 ELSE 0 END) AS instant_bookings
, COUNT(DISTINCT guest_id) AS bookers
, AVG(booking_value) AS average_booking_value
-FROM ***************************.fct_bookings bookings_source_src_28001
+FROM ***************************.fct_bookings bookings_source_src_28000
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_multi_join_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_multi_join_node__plan0.sql
index 2aa11d8ca7..f3ed9fa304 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_multi_join_node__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_multi_join_node__plan0.sql
@@ -14,93 +14,93 @@ FROM (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
) subq_1
LEFT OUTER JOIN (
@@ -112,62 +112,62 @@ LEFT OUTER JOIN (
-- Read Elements From Semantic Model 'listings_latest'
SELECT
1 AS listings
- , listings_latest_src_28005.capacity AS largest_listing
- , listings_latest_src_28005.capacity AS smallest_listing
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy
- , listings_latest_src_28005.country AS country_latest
- , listings_latest_src_28005.is_lux AS is_lux_latest
- , listings_latest_src_28005.capacity AS capacity_latest
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy
- , listings_latest_src_28005.country AS listing__country_latest
- , listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , listings_latest_src_28005.capacity AS listing__capacity_latest
- , listings_latest_src_28005.listing_id AS listing
- , listings_latest_src_28005.user_id AS user
- , listings_latest_src_28005.user_id AS listing__user
- FROM ***************************.dim_listings_latest listings_latest_src_28005
+ , listings_latest_src_28000.capacity AS largest_listing
+ , listings_latest_src_28000.capacity AS smallest_listing
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS created_at__extract_day
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS created_at__extract_doy
+ , 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('day', listings_latest_src_28000.created_at) AS listing__ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS listing__ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS listing__created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_day
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_doy
+ , listings_latest_src_28000.country AS listing__country_latest
+ , listings_latest_src_28000.is_lux AS listing__is_lux_latest
+ , listings_latest_src_28000.capacity AS listing__capacity_latest
+ , listings_latest_src_28000.listing_id AS listing
+ , listings_latest_src_28000.user_id AS user
+ , listings_latest_src_28000.user_id AS listing__user
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
) subq_2
) subq_3
ON
@@ -181,62 +181,62 @@ LEFT OUTER JOIN (
-- Read Elements From Semantic Model 'listings_latest'
SELECT
1 AS listings
- , listings_latest_src_28005.capacity AS largest_listing
- , listings_latest_src_28005.capacity AS smallest_listing
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy
- , listings_latest_src_28005.country AS country_latest
- , listings_latest_src_28005.is_lux AS is_lux_latest
- , listings_latest_src_28005.capacity AS capacity_latest
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy
- , listings_latest_src_28005.country AS listing__country_latest
- , listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , listings_latest_src_28005.capacity AS listing__capacity_latest
- , listings_latest_src_28005.listing_id AS listing
- , listings_latest_src_28005.user_id AS user
- , listings_latest_src_28005.user_id AS listing__user
- FROM ***************************.dim_listings_latest listings_latest_src_28005
+ , listings_latest_src_28000.capacity AS largest_listing
+ , listings_latest_src_28000.capacity AS smallest_listing
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS created_at__extract_day
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS created_at__extract_doy
+ , 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('day', listings_latest_src_28000.created_at) AS listing__ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS listing__ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS listing__created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_day
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_doy
+ , listings_latest_src_28000.country AS listing__country_latest
+ , listings_latest_src_28000.is_lux AS listing__is_lux_latest
+ , listings_latest_src_28000.capacity AS listing__capacity_latest
+ , listings_latest_src_28000.listing_id AS listing
+ , listings_latest_src_28000.user_id AS user
+ , listings_latest_src_28000.user_id AS listing__user
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
) subq_4
) subq_5
ON
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_multi_join_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_multi_join_node__plan0_optimized.sql
index b9cecc48d8..7d9c669f54 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_multi_join_node__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_multi_join_node__plan0_optimized.sql
@@ -10,7 +10,7 @@ FROM (
SELECT
listing_id AS listing
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_7
LEFT OUTER JOIN (
-- Read Elements From Semantic Model 'listings_latest'
@@ -18,7 +18,7 @@ LEFT OUTER JOIN (
SELECT
listing_id AS listing
, country AS country_latest
- FROM ***************************.dim_listings_latest listings_latest_src_28005
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
) subq_9
ON
subq_7.listing = subq_9.listing
@@ -28,7 +28,7 @@ LEFT OUTER JOIN (
SELECT
listing_id AS listing
, country AS country_latest
- FROM ***************************.dim_listings_latest listings_latest_src_28005
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
) subq_11
ON
subq_7.listing = subq_11.listing
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_order_by_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_order_by_node__plan0.sql
index 05e8717a48..49a2ea3b75 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_order_by_node__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_order_by_node__plan0.sql
@@ -26,93 +26,93 @@ FROM (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
) subq_1
GROUP BY
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_order_by_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_order_by_node__plan0_optimized.sql
index fd8a1ff597..bcebfe9d5f 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_order_by_node__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_order_by_node__plan0_optimized.sql
@@ -12,7 +12,7 @@ FROM (
DATE_TRUNC('day', ds) AS ds__day
, is_instant
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_5
GROUP BY
ds__day
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_single_join_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_single_join_node__plan0.sql
index 6a69a7ef1b..1d89d14791 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_single_join_node__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_single_join_node__plan0.sql
@@ -12,93 +12,93 @@ FROM (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
) subq_1
LEFT OUTER JOIN (
@@ -110,62 +110,62 @@ LEFT OUTER JOIN (
-- Read Elements From Semantic Model 'listings_latest'
SELECT
1 AS listings
- , listings_latest_src_28005.capacity AS largest_listing
- , listings_latest_src_28005.capacity AS smallest_listing
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy
- , listings_latest_src_28005.country AS country_latest
- , listings_latest_src_28005.is_lux AS is_lux_latest
- , listings_latest_src_28005.capacity AS capacity_latest
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy
- , listings_latest_src_28005.country AS listing__country_latest
- , listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , listings_latest_src_28005.capacity AS listing__capacity_latest
- , listings_latest_src_28005.listing_id AS listing
- , listings_latest_src_28005.user_id AS user
- , listings_latest_src_28005.user_id AS listing__user
- FROM ***************************.dim_listings_latest listings_latest_src_28005
+ , listings_latest_src_28000.capacity AS largest_listing
+ , listings_latest_src_28000.capacity AS smallest_listing
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS created_at__extract_day
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS created_at__extract_doy
+ , 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('day', listings_latest_src_28000.created_at) AS listing__ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS listing__ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS listing__created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_day
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_doy
+ , listings_latest_src_28000.country AS listing__country_latest
+ , listings_latest_src_28000.is_lux AS listing__is_lux_latest
+ , listings_latest_src_28000.capacity AS listing__capacity_latest
+ , listings_latest_src_28000.listing_id AS listing
+ , listings_latest_src_28000.user_id AS user
+ , listings_latest_src_28000.user_id AS listing__user
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
) subq_2
) subq_3
ON
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_single_join_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_single_join_node__plan0_optimized.sql
index e03ffcce64..a1cd7ac335 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_single_join_node__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_single_join_node__plan0_optimized.sql
@@ -8,9 +8,9 @@ FROM (
SELECT
listing_id AS listing
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_5
LEFT OUTER JOIN
- ***************************.dim_listings_latest listings_latest_src_28005
+ ***************************.dim_listings_latest listings_latest_src_28000
ON
- subq_5.listing = listings_latest_src_28005.listing_id
+ subq_5.listing = listings_latest_src_28000.listing_id
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_source_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_source_node__plan0.sql
index 5360aa4516..d94b68c968 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_source_node__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_source_node__plan0.sql
@@ -2,90 +2,90 @@
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
-FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+FROM ***************************.fct_bookings bookings_source_src_28000
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_source_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_source_node__plan0_optimized.sql
index e15f76d1de..9814c2d0cf 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_source_node__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Postgres/test_source_node__plan0_optimized.sql
@@ -88,4 +88,4 @@ SELECT
, listing_id AS booking__listing
, guest_id AS booking__guest
, host_id AS booking__host
-FROM ***************************.fct_bookings bookings_source_src_28001
+FROM ***************************.fct_bookings bookings_source_src_28000
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_combine_output_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_combine_output_node__plan0.sql
index b4a2ffc5f2..c67c97979c 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_combine_output_node__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_combine_output_node__plan0.sql
@@ -19,93 +19,93 @@ FROM (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds) END AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) END AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.paid_at) END AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds) END AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) END AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.paid_at) END AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
) subq_1
GROUP BY
@@ -128,93 +128,93 @@ FULL OUTER JOIN (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds) END AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) END AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.paid_at) END AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds) END AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) END AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.paid_at) END AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_3
) subq_4
GROUP BY
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_combine_output_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_combine_output_node__plan0_optimized.sql
index a8375510d7..ad81788114 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_combine_output_node__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_combine_output_node__plan0_optimized.sql
@@ -15,7 +15,7 @@ FROM (
SELECT
is_instant
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_7
GROUP BY
is_instant
@@ -33,7 +33,7 @@ FULL OUTER JOIN (
is_instant
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
, guest_id AS bookers
- FROM ***************************.fct_bookings bookings_source_src_28001
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_10
GROUP BY
is_instant
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_compute_metrics_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_compute_metrics_node__plan0.sql
index fcf32197e7..a94865f00e 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_compute_metrics_node__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_compute_metrics_node__plan0.sql
@@ -25,93 +25,93 @@ FROM (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds) END AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) END AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.paid_at) END AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds) END AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) END AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.paid_at) END AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
) subq_1
LEFT OUTER JOIN (
@@ -123,62 +123,62 @@ FROM (
-- Read Elements From Semantic Model 'listings_latest'
SELECT
1 AS listings
- , listings_latest_src_28005.capacity AS largest_listing
- , listings_latest_src_28005.capacity AS smallest_listing
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day
- , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day
- , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy
- , listings_latest_src_28005.country AS country_latest
- , listings_latest_src_28005.is_lux AS is_lux_latest
- , listings_latest_src_28005.capacity AS capacity_latest
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day
- , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS listing__ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day
- , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS listing__created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy
- , listings_latest_src_28005.country AS listing__country_latest
- , listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , listings_latest_src_28005.capacity AS listing__capacity_latest
- , listings_latest_src_28005.listing_id AS listing
- , listings_latest_src_28005.user_id AS user
- , listings_latest_src_28005.user_id AS listing__user
- FROM ***************************.dim_listings_latest listings_latest_src_28005
+ , listings_latest_src_28000.capacity AS largest_listing
+ , listings_latest_src_28000.capacity AS smallest_listing
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , CASE WHEN EXTRACT(dow FROM listings_latest_src_28000.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28000.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28000.created_at) END AS ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS created_at__extract_day
+ , CASE WHEN EXTRACT(dow FROM listings_latest_src_28000.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28000.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28000.created_at) END AS created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS created_at__extract_doy
+ , 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('day', listings_latest_src_28000.created_at) AS listing__ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , CASE WHEN EXTRACT(dow FROM listings_latest_src_28000.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28000.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28000.created_at) END AS listing__ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS listing__created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_day
+ , CASE WHEN EXTRACT(dow FROM listings_latest_src_28000.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28000.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28000.created_at) END AS listing__created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_doy
+ , listings_latest_src_28000.country AS listing__country_latest
+ , listings_latest_src_28000.is_lux AS listing__is_lux_latest
+ , listings_latest_src_28000.capacity AS listing__capacity_latest
+ , listings_latest_src_28000.listing_id AS listing
+ , listings_latest_src_28000.user_id AS user
+ , listings_latest_src_28000.user_id AS listing__user
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
) subq_2
) subq_3
ON
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_compute_metrics_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_compute_metrics_node__plan0_optimized.sql
index cf47afc6bf..5ebe7177e8 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_compute_metrics_node__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_compute_metrics_node__plan0_optimized.sql
@@ -3,7 +3,7 @@
-- Compute Metrics via Expressions
SELECT
subq_7.listing AS listing
- , listings_latest_src_28005.country AS listing__country_latest
+ , listings_latest_src_28000.country AS listing__country_latest
, SUM(subq_7.bookings) AS bookings
FROM (
-- Read Elements From Semantic Model 'bookings_source'
@@ -11,12 +11,12 @@ FROM (
SELECT
listing_id AS listing
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_7
LEFT OUTER JOIN
- ***************************.dim_listings_latest listings_latest_src_28005
+ ***************************.dim_listings_latest listings_latest_src_28000
ON
- subq_7.listing = listings_latest_src_28005.listing_id
+ subq_7.listing = listings_latest_src_28000.listing_id
GROUP BY
subq_7.listing
- , listings_latest_src_28005.country
+ , listings_latest_src_28000.country
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.sql
index f7a597faea..df7e4469bd 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.sql
@@ -1,693 +1,693 @@
-- Compute Metrics via Expressions
SELECT
- subq_20.ds__day
- , subq_20.listing__country_latest
- , CAST(subq_20.bookings AS DOUBLE PRECISION) / CAST(NULLIF(subq_20.views, 0) AS DOUBLE PRECISION) AS bookings_per_view
+ subq_29.ds__day
+ , subq_29.listing__country_latest
+ , CAST(subq_29.bookings AS DOUBLE PRECISION) / CAST(NULLIF(subq_29.views, 0) AS DOUBLE PRECISION) AS bookings_per_view
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_9.ds__day, subq_19.ds__day) AS ds__day
- , COALESCE(subq_9.listing__country_latest, subq_19.listing__country_latest) AS listing__country_latest
- , MAX(subq_9.bookings) AS bookings
- , MAX(subq_19.views) AS views
+ COALESCE(subq_18.ds__day, subq_28.ds__day) AS ds__day
+ , COALESCE(subq_18.listing__country_latest, subq_28.listing__country_latest) AS listing__country_latest
+ , MAX(subq_18.bookings) AS bookings
+ , MAX(subq_28.views) AS views
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_8.ds__day
- , subq_8.listing__country_latest
- , subq_8.bookings
+ subq_17.ds__day
+ , subq_17.listing__country_latest
+ , subq_17.bookings
FROM (
-- Aggregate Measures
SELECT
- subq_7.ds__day
- , subq_7.listing__country_latest
- , SUM(subq_7.bookings) AS bookings
+ subq_16.ds__day
+ , subq_16.listing__country_latest
+ , SUM(subq_16.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'listing__country_latest', 'ds__day']
SELECT
- subq_6.ds__day
- , subq_6.listing__country_latest
- , subq_6.bookings
+ subq_15.ds__day
+ , subq_15.listing__country_latest
+ , subq_15.bookings
FROM (
-- Join Standard Outputs
SELECT
- subq_2.ds__day AS ds__day
- , subq_2.listing AS listing
- , subq_5.country_latest AS listing__country_latest
- , subq_2.bookings AS bookings
+ subq_11.ds__day AS ds__day
+ , subq_11.listing AS listing
+ , subq_14.country_latest AS listing__country_latest
+ , subq_11.bookings AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'ds__day', 'listing']
SELECT
- subq_1.ds__day
- , subq_1.listing
- , subq_1.bookings
+ subq_10.ds__day
+ , subq_10.listing
+ , subq_10.bookings
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
- ) subq_2
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds) END AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) END AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.paid_at) END AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds) END AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) END AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.paid_at) END AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
LEFT OUTER JOIN (
-- Pass Only Elements: ['country_latest', 'listing']
SELECT
- subq_4.listing
- , subq_4.country_latest
+ subq_13.listing
+ , subq_13.country_latest
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_3.ds__day
- , subq_3.ds__week
- , subq_3.ds__month
- , subq_3.ds__quarter
- , subq_3.ds__year
- , subq_3.ds__extract_year
- , subq_3.ds__extract_quarter
- , subq_3.ds__extract_month
- , subq_3.ds__extract_day
- , subq_3.ds__extract_dow
- , subq_3.ds__extract_doy
- , subq_3.created_at__day
- , subq_3.created_at__week
- , subq_3.created_at__month
- , subq_3.created_at__quarter
- , subq_3.created_at__year
- , subq_3.created_at__extract_year
- , subq_3.created_at__extract_quarter
- , subq_3.created_at__extract_month
- , subq_3.created_at__extract_day
- , subq_3.created_at__extract_dow
- , subq_3.created_at__extract_doy
- , subq_3.listing__ds__day
- , subq_3.listing__ds__week
- , subq_3.listing__ds__month
- , subq_3.listing__ds__quarter
- , subq_3.listing__ds__year
- , subq_3.listing__ds__extract_year
- , subq_3.listing__ds__extract_quarter
- , subq_3.listing__ds__extract_month
- , subq_3.listing__ds__extract_day
- , subq_3.listing__ds__extract_dow
- , subq_3.listing__ds__extract_doy
- , subq_3.listing__created_at__day
- , subq_3.listing__created_at__week
- , subq_3.listing__created_at__month
- , subq_3.listing__created_at__quarter
- , subq_3.listing__created_at__year
- , subq_3.listing__created_at__extract_year
- , subq_3.listing__created_at__extract_quarter
- , subq_3.listing__created_at__extract_month
- , subq_3.listing__created_at__extract_day
- , subq_3.listing__created_at__extract_dow
- , subq_3.listing__created_at__extract_doy
- , subq_3.ds__day AS metric_time__day
- , subq_3.ds__week AS metric_time__week
- , subq_3.ds__month AS metric_time__month
- , subq_3.ds__quarter AS metric_time__quarter
- , subq_3.ds__year AS metric_time__year
- , subq_3.ds__extract_year AS metric_time__extract_year
- , subq_3.ds__extract_quarter AS metric_time__extract_quarter
- , subq_3.ds__extract_month AS metric_time__extract_month
- , subq_3.ds__extract_day AS metric_time__extract_day
- , subq_3.ds__extract_dow AS metric_time__extract_dow
- , subq_3.ds__extract_doy AS metric_time__extract_doy
- , subq_3.listing
- , subq_3.user
- , subq_3.listing__user
- , subq_3.country_latest
- , subq_3.is_lux_latest
- , subq_3.capacity_latest
- , subq_3.listing__country_latest
- , subq_3.listing__is_lux_latest
- , subq_3.listing__capacity_latest
- , subq_3.listings
- , subq_3.largest_listing
- , subq_3.smallest_listing
+ subq_12.ds__day
+ , subq_12.ds__week
+ , subq_12.ds__month
+ , subq_12.ds__quarter
+ , subq_12.ds__year
+ , subq_12.ds__extract_year
+ , subq_12.ds__extract_quarter
+ , subq_12.ds__extract_month
+ , subq_12.ds__extract_day
+ , subq_12.ds__extract_dow
+ , subq_12.ds__extract_doy
+ , subq_12.created_at__day
+ , subq_12.created_at__week
+ , subq_12.created_at__month
+ , subq_12.created_at__quarter
+ , subq_12.created_at__year
+ , subq_12.created_at__extract_year
+ , subq_12.created_at__extract_quarter
+ , subq_12.created_at__extract_month
+ , subq_12.created_at__extract_day
+ , subq_12.created_at__extract_dow
+ , subq_12.created_at__extract_doy
+ , subq_12.listing__ds__day
+ , subq_12.listing__ds__week
+ , subq_12.listing__ds__month
+ , subq_12.listing__ds__quarter
+ , subq_12.listing__ds__year
+ , subq_12.listing__ds__extract_year
+ , subq_12.listing__ds__extract_quarter
+ , subq_12.listing__ds__extract_month
+ , subq_12.listing__ds__extract_day
+ , subq_12.listing__ds__extract_dow
+ , subq_12.listing__ds__extract_doy
+ , subq_12.listing__created_at__day
+ , subq_12.listing__created_at__week
+ , subq_12.listing__created_at__month
+ , subq_12.listing__created_at__quarter
+ , subq_12.listing__created_at__year
+ , subq_12.listing__created_at__extract_year
+ , subq_12.listing__created_at__extract_quarter
+ , subq_12.listing__created_at__extract_month
+ , subq_12.listing__created_at__extract_day
+ , subq_12.listing__created_at__extract_dow
+ , subq_12.listing__created_at__extract_doy
+ , subq_12.ds__day AS metric_time__day
+ , subq_12.ds__week AS metric_time__week
+ , subq_12.ds__month AS metric_time__month
+ , subq_12.ds__quarter AS metric_time__quarter
+ , subq_12.ds__year AS metric_time__year
+ , subq_12.ds__extract_year AS metric_time__extract_year
+ , subq_12.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_12.ds__extract_month AS metric_time__extract_month
+ , subq_12.ds__extract_day AS metric_time__extract_day
+ , subq_12.ds__extract_dow AS metric_time__extract_dow
+ , subq_12.ds__extract_doy AS metric_time__extract_doy
+ , subq_12.listing
+ , subq_12.user
+ , subq_12.listing__user
+ , subq_12.country_latest
+ , subq_12.is_lux_latest
+ , subq_12.capacity_latest
+ , subq_12.listing__country_latest
+ , subq_12.listing__is_lux_latest
+ , subq_12.listing__capacity_latest
+ , subq_12.listings
+ , subq_12.largest_listing
+ , subq_12.smallest_listing
FROM (
-- Read Elements From Semantic Model 'listings_latest'
SELECT
1 AS listings
- , listings_latest_src_28005.capacity AS largest_listing
- , listings_latest_src_28005.capacity AS smallest_listing
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day
- , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day
- , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy
- , listings_latest_src_28005.country AS country_latest
- , listings_latest_src_28005.is_lux AS is_lux_latest
- , listings_latest_src_28005.capacity AS capacity_latest
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day
- , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS listing__ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day
- , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS listing__created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy
- , listings_latest_src_28005.country AS listing__country_latest
- , listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , listings_latest_src_28005.capacity AS listing__capacity_latest
- , listings_latest_src_28005.listing_id AS listing
- , listings_latest_src_28005.user_id AS user
- , listings_latest_src_28005.user_id AS listing__user
- FROM ***************************.dim_listings_latest listings_latest_src_28005
- ) subq_3
- ) subq_4
- ) subq_5
+ , listings_latest_src_28000.capacity AS largest_listing
+ , listings_latest_src_28000.capacity AS smallest_listing
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , CASE WHEN EXTRACT(dow FROM listings_latest_src_28000.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28000.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28000.created_at) END AS ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS created_at__extract_day
+ , CASE WHEN EXTRACT(dow FROM listings_latest_src_28000.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28000.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28000.created_at) END AS created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS created_at__extract_doy
+ , 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('day', listings_latest_src_28000.created_at) AS listing__ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , CASE WHEN EXTRACT(dow FROM listings_latest_src_28000.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28000.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28000.created_at) END AS listing__ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS listing__created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_day
+ , CASE WHEN EXTRACT(dow FROM listings_latest_src_28000.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28000.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28000.created_at) END AS listing__created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_doy
+ , listings_latest_src_28000.country AS listing__country_latest
+ , listings_latest_src_28000.is_lux AS listing__is_lux_latest
+ , listings_latest_src_28000.capacity AS listing__capacity_latest
+ , listings_latest_src_28000.listing_id AS listing
+ , listings_latest_src_28000.user_id AS user
+ , listings_latest_src_28000.user_id AS listing__user
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
+ ) subq_12
+ ) subq_13
+ ) subq_14
ON
- subq_2.listing = subq_5.listing
- ) subq_6
- ) subq_7
+ subq_11.listing = subq_14.listing
+ ) subq_15
+ ) subq_16
GROUP BY
- subq_7.ds__day
- , subq_7.listing__country_latest
- ) subq_8
- ) subq_9
+ subq_16.ds__day
+ , subq_16.listing__country_latest
+ ) subq_17
+ ) subq_18
FULL OUTER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_18.ds__day
- , subq_18.listing__country_latest
- , subq_18.views
+ subq_27.ds__day
+ , subq_27.listing__country_latest
+ , subq_27.views
FROM (
-- Aggregate Measures
SELECT
- subq_17.ds__day
- , subq_17.listing__country_latest
- , SUM(subq_17.views) AS views
+ subq_26.ds__day
+ , subq_26.listing__country_latest
+ , SUM(subq_26.views) AS views
FROM (
-- Pass Only Elements: ['views', 'listing__country_latest', 'ds__day']
SELECT
- subq_16.ds__day
- , subq_16.listing__country_latest
- , subq_16.views
+ subq_25.ds__day
+ , subq_25.listing__country_latest
+ , subq_25.views
FROM (
-- Join Standard Outputs
SELECT
- subq_12.ds__day AS ds__day
- , subq_12.listing AS listing
- , subq_15.country_latest AS listing__country_latest
- , subq_12.views AS views
+ subq_21.ds__day AS ds__day
+ , subq_21.listing AS listing
+ , subq_24.country_latest AS listing__country_latest
+ , subq_21.views AS views
FROM (
-- Pass Only Elements: ['views', 'ds__day', 'listing']
SELECT
- subq_11.ds__day
- , subq_11.listing
- , subq_11.views
+ subq_20.ds__day
+ , subq_20.listing
+ , subq_20.views
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_10.ds__day
- , subq_10.ds__week
- , subq_10.ds__month
- , subq_10.ds__quarter
- , subq_10.ds__year
- , subq_10.ds__extract_year
- , subq_10.ds__extract_quarter
- , subq_10.ds__extract_month
- , subq_10.ds__extract_day
- , subq_10.ds__extract_dow
- , subq_10.ds__extract_doy
- , subq_10.ds_partitioned__day
- , subq_10.ds_partitioned__week
- , subq_10.ds_partitioned__month
- , subq_10.ds_partitioned__quarter
- , subq_10.ds_partitioned__year
- , subq_10.ds_partitioned__extract_year
- , subq_10.ds_partitioned__extract_quarter
- , subq_10.ds_partitioned__extract_month
- , subq_10.ds_partitioned__extract_day
- , subq_10.ds_partitioned__extract_dow
- , subq_10.ds_partitioned__extract_doy
- , subq_10.view__ds__day
- , subq_10.view__ds__week
- , subq_10.view__ds__month
- , subq_10.view__ds__quarter
- , subq_10.view__ds__year
- , subq_10.view__ds__extract_year
- , subq_10.view__ds__extract_quarter
- , subq_10.view__ds__extract_month
- , subq_10.view__ds__extract_day
- , subq_10.view__ds__extract_dow
- , subq_10.view__ds__extract_doy
- , subq_10.view__ds_partitioned__day
- , subq_10.view__ds_partitioned__week
- , subq_10.view__ds_partitioned__month
- , subq_10.view__ds_partitioned__quarter
- , subq_10.view__ds_partitioned__year
- , subq_10.view__ds_partitioned__extract_year
- , subq_10.view__ds_partitioned__extract_quarter
- , subq_10.view__ds_partitioned__extract_month
- , subq_10.view__ds_partitioned__extract_day
- , subq_10.view__ds_partitioned__extract_dow
- , subq_10.view__ds_partitioned__extract_doy
- , subq_10.ds__day AS metric_time__day
- , subq_10.ds__week AS metric_time__week
- , subq_10.ds__month AS metric_time__month
- , subq_10.ds__quarter AS metric_time__quarter
- , subq_10.ds__year AS metric_time__year
- , subq_10.ds__extract_year AS metric_time__extract_year
- , subq_10.ds__extract_quarter AS metric_time__extract_quarter
- , subq_10.ds__extract_month AS metric_time__extract_month
- , subq_10.ds__extract_day AS metric_time__extract_day
- , subq_10.ds__extract_dow AS metric_time__extract_dow
- , subq_10.ds__extract_doy AS metric_time__extract_doy
- , subq_10.listing
- , subq_10.user
- , subq_10.view__listing
- , subq_10.view__user
- , subq_10.views
+ subq_19.ds__day
+ , subq_19.ds__week
+ , subq_19.ds__month
+ , subq_19.ds__quarter
+ , subq_19.ds__year
+ , subq_19.ds__extract_year
+ , subq_19.ds__extract_quarter
+ , subq_19.ds__extract_month
+ , subq_19.ds__extract_day
+ , subq_19.ds__extract_dow
+ , subq_19.ds__extract_doy
+ , subq_19.ds_partitioned__day
+ , subq_19.ds_partitioned__week
+ , subq_19.ds_partitioned__month
+ , subq_19.ds_partitioned__quarter
+ , subq_19.ds_partitioned__year
+ , subq_19.ds_partitioned__extract_year
+ , subq_19.ds_partitioned__extract_quarter
+ , subq_19.ds_partitioned__extract_month
+ , subq_19.ds_partitioned__extract_day
+ , subq_19.ds_partitioned__extract_dow
+ , subq_19.ds_partitioned__extract_doy
+ , subq_19.view__ds__day
+ , subq_19.view__ds__week
+ , subq_19.view__ds__month
+ , subq_19.view__ds__quarter
+ , subq_19.view__ds__year
+ , subq_19.view__ds__extract_year
+ , subq_19.view__ds__extract_quarter
+ , subq_19.view__ds__extract_month
+ , subq_19.view__ds__extract_day
+ , subq_19.view__ds__extract_dow
+ , subq_19.view__ds__extract_doy
+ , subq_19.view__ds_partitioned__day
+ , subq_19.view__ds_partitioned__week
+ , subq_19.view__ds_partitioned__month
+ , subq_19.view__ds_partitioned__quarter
+ , subq_19.view__ds_partitioned__year
+ , subq_19.view__ds_partitioned__extract_year
+ , subq_19.view__ds_partitioned__extract_quarter
+ , subq_19.view__ds_partitioned__extract_month
+ , subq_19.view__ds_partitioned__extract_day
+ , subq_19.view__ds_partitioned__extract_dow
+ , subq_19.view__ds_partitioned__extract_doy
+ , subq_19.ds__day AS metric_time__day
+ , subq_19.ds__week AS metric_time__week
+ , subq_19.ds__month AS metric_time__month
+ , subq_19.ds__quarter AS metric_time__quarter
+ , subq_19.ds__year AS metric_time__year
+ , subq_19.ds__extract_year AS metric_time__extract_year
+ , subq_19.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_19.ds__extract_month AS metric_time__extract_month
+ , subq_19.ds__extract_day AS metric_time__extract_day
+ , subq_19.ds__extract_dow AS metric_time__extract_dow
+ , subq_19.ds__extract_doy AS metric_time__extract_doy
+ , subq_19.listing
+ , subq_19.user
+ , subq_19.view__listing
+ , subq_19.view__user
+ , subq_19.views
FROM (
-- Read Elements From Semantic Model 'views_source'
SELECT
1 AS views
- , DATE_TRUNC('day', views_source_src_28010.ds) AS ds__day
- , DATE_TRUNC('week', views_source_src_28010.ds) AS ds__week
- , DATE_TRUNC('month', views_source_src_28010.ds) AS ds__month
- , DATE_TRUNC('quarter', views_source_src_28010.ds) AS ds__quarter
- , DATE_TRUNC('year', views_source_src_28010.ds) AS ds__year
- , EXTRACT(year FROM views_source_src_28010.ds) AS ds__extract_year
- , EXTRACT(quarter FROM views_source_src_28010.ds) AS ds__extract_quarter
- , EXTRACT(month FROM views_source_src_28010.ds) AS ds__extract_month
- , EXTRACT(day FROM views_source_src_28010.ds) AS ds__extract_day
- , CASE WHEN EXTRACT(dow FROM views_source_src_28010.ds) = 0 THEN EXTRACT(dow FROM views_source_src_28010.ds) + 7 ELSE EXTRACT(dow FROM views_source_src_28010.ds) END AS ds__extract_dow
- , EXTRACT(doy FROM views_source_src_28010.ds) AS ds__extract_doy
- , DATE_TRUNC('day', views_source_src_28010.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', views_source_src_28010.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', views_source_src_28010.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', views_source_src_28010.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', views_source_src_28010.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM views_source_src_28010.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM views_source_src_28010.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM views_source_src_28010.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM views_source_src_28010.ds_partitioned) AS ds_partitioned__extract_day
- , CASE WHEN EXTRACT(dow FROM views_source_src_28010.ds_partitioned) = 0 THEN EXTRACT(dow FROM views_source_src_28010.ds_partitioned) + 7 ELSE EXTRACT(dow FROM views_source_src_28010.ds_partitioned) END AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM views_source_src_28010.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', views_source_src_28010.ds) AS view__ds__day
- , DATE_TRUNC('week', views_source_src_28010.ds) AS view__ds__week
- , DATE_TRUNC('month', views_source_src_28010.ds) AS view__ds__month
- , DATE_TRUNC('quarter', views_source_src_28010.ds) AS view__ds__quarter
- , DATE_TRUNC('year', views_source_src_28010.ds) AS view__ds__year
- , EXTRACT(year FROM views_source_src_28010.ds) AS view__ds__extract_year
- , EXTRACT(quarter FROM views_source_src_28010.ds) AS view__ds__extract_quarter
- , EXTRACT(month FROM views_source_src_28010.ds) AS view__ds__extract_month
- , EXTRACT(day FROM views_source_src_28010.ds) AS view__ds__extract_day
- , CASE WHEN EXTRACT(dow FROM views_source_src_28010.ds) = 0 THEN EXTRACT(dow FROM views_source_src_28010.ds) + 7 ELSE EXTRACT(dow FROM views_source_src_28010.ds) END AS view__ds__extract_dow
- , EXTRACT(doy FROM views_source_src_28010.ds) AS view__ds__extract_doy
- , DATE_TRUNC('day', views_source_src_28010.ds_partitioned) AS view__ds_partitioned__day
- , DATE_TRUNC('week', views_source_src_28010.ds_partitioned) AS view__ds_partitioned__week
- , DATE_TRUNC('month', views_source_src_28010.ds_partitioned) AS view__ds_partitioned__month
- , DATE_TRUNC('quarter', views_source_src_28010.ds_partitioned) AS view__ds_partitioned__quarter
- , DATE_TRUNC('year', views_source_src_28010.ds_partitioned) AS view__ds_partitioned__year
- , EXTRACT(year FROM views_source_src_28010.ds_partitioned) AS view__ds_partitioned__extract_year
- , EXTRACT(quarter FROM views_source_src_28010.ds_partitioned) AS view__ds_partitioned__extract_quarter
- , EXTRACT(month FROM views_source_src_28010.ds_partitioned) AS view__ds_partitioned__extract_month
- , EXTRACT(day FROM views_source_src_28010.ds_partitioned) AS view__ds_partitioned__extract_day
- , CASE WHEN EXTRACT(dow FROM views_source_src_28010.ds_partitioned) = 0 THEN EXTRACT(dow FROM views_source_src_28010.ds_partitioned) + 7 ELSE EXTRACT(dow FROM views_source_src_28010.ds_partitioned) END AS view__ds_partitioned__extract_dow
- , EXTRACT(doy FROM views_source_src_28010.ds_partitioned) AS view__ds_partitioned__extract_doy
- , views_source_src_28010.listing_id AS listing
- , views_source_src_28010.user_id AS user
- , views_source_src_28010.listing_id AS view__listing
- , views_source_src_28010.user_id AS view__user
- FROM ***************************.fct_views views_source_src_28010
- ) subq_10
- ) subq_11
- ) subq_12
+ , DATE_TRUNC('day', views_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', views_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', views_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', views_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', views_source_src_28000.ds) 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
+ , CASE WHEN EXTRACT(dow FROM views_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM views_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM views_source_src_28000.ds) END AS ds__extract_dow
+ , EXTRACT(doy FROM views_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', views_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', views_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', views_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', views_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', views_source_src_28000.ds_partitioned) 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
+ , CASE WHEN EXTRACT(dow FROM views_source_src_28000.ds_partitioned) = 0 THEN EXTRACT(dow FROM views_source_src_28000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM views_source_src_28000.ds_partitioned) END AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM views_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', views_source_src_28000.ds) AS view__ds__day
+ , DATE_TRUNC('week', views_source_src_28000.ds) AS view__ds__week
+ , DATE_TRUNC('month', views_source_src_28000.ds) AS view__ds__month
+ , DATE_TRUNC('quarter', views_source_src_28000.ds) AS view__ds__quarter
+ , DATE_TRUNC('year', views_source_src_28000.ds) 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
+ , CASE WHEN EXTRACT(dow FROM views_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM views_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM views_source_src_28000.ds) END AS view__ds__extract_dow
+ , EXTRACT(doy FROM views_source_src_28000.ds) AS view__ds__extract_doy
+ , DATE_TRUNC('day', views_source_src_28000.ds_partitioned) AS view__ds_partitioned__day
+ , DATE_TRUNC('week', views_source_src_28000.ds_partitioned) AS view__ds_partitioned__week
+ , DATE_TRUNC('month', views_source_src_28000.ds_partitioned) AS view__ds_partitioned__month
+ , DATE_TRUNC('quarter', views_source_src_28000.ds_partitioned) AS view__ds_partitioned__quarter
+ , DATE_TRUNC('year', views_source_src_28000.ds_partitioned) 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
+ , EXTRACT(day FROM views_source_src_28000.ds_partitioned) AS view__ds_partitioned__extract_day
+ , CASE WHEN EXTRACT(dow FROM views_source_src_28000.ds_partitioned) = 0 THEN EXTRACT(dow FROM views_source_src_28000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM views_source_src_28000.ds_partitioned) END AS view__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM views_source_src_28000.ds_partitioned) AS view__ds_partitioned__extract_doy
+ , views_source_src_28000.listing_id AS listing
+ , views_source_src_28000.user_id AS user
+ , views_source_src_28000.listing_id AS view__listing
+ , views_source_src_28000.user_id AS view__user
+ FROM ***************************.fct_views views_source_src_28000
+ ) subq_19
+ ) subq_20
+ ) subq_21
LEFT OUTER JOIN (
-- Pass Only Elements: ['country_latest', 'listing']
SELECT
- subq_14.listing
- , subq_14.country_latest
+ subq_23.listing
+ , subq_23.country_latest
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_13.ds__day
- , subq_13.ds__week
- , subq_13.ds__month
- , subq_13.ds__quarter
- , subq_13.ds__year
- , subq_13.ds__extract_year
- , subq_13.ds__extract_quarter
- , subq_13.ds__extract_month
- , subq_13.ds__extract_day
- , subq_13.ds__extract_dow
- , subq_13.ds__extract_doy
- , subq_13.created_at__day
- , subq_13.created_at__week
- , subq_13.created_at__month
- , subq_13.created_at__quarter
- , subq_13.created_at__year
- , subq_13.created_at__extract_year
- , subq_13.created_at__extract_quarter
- , subq_13.created_at__extract_month
- , subq_13.created_at__extract_day
- , subq_13.created_at__extract_dow
- , subq_13.created_at__extract_doy
- , subq_13.listing__ds__day
- , subq_13.listing__ds__week
- , subq_13.listing__ds__month
- , subq_13.listing__ds__quarter
- , subq_13.listing__ds__year
- , subq_13.listing__ds__extract_year
- , subq_13.listing__ds__extract_quarter
- , subq_13.listing__ds__extract_month
- , subq_13.listing__ds__extract_day
- , subq_13.listing__ds__extract_dow
- , subq_13.listing__ds__extract_doy
- , subq_13.listing__created_at__day
- , subq_13.listing__created_at__week
- , subq_13.listing__created_at__month
- , subq_13.listing__created_at__quarter
- , subq_13.listing__created_at__year
- , subq_13.listing__created_at__extract_year
- , subq_13.listing__created_at__extract_quarter
- , subq_13.listing__created_at__extract_month
- , subq_13.listing__created_at__extract_day
- , subq_13.listing__created_at__extract_dow
- , subq_13.listing__created_at__extract_doy
- , subq_13.ds__day AS metric_time__day
- , subq_13.ds__week AS metric_time__week
- , subq_13.ds__month AS metric_time__month
- , subq_13.ds__quarter AS metric_time__quarter
- , subq_13.ds__year AS metric_time__year
- , subq_13.ds__extract_year AS metric_time__extract_year
- , subq_13.ds__extract_quarter AS metric_time__extract_quarter
- , subq_13.ds__extract_month AS metric_time__extract_month
- , subq_13.ds__extract_day AS metric_time__extract_day
- , subq_13.ds__extract_dow AS metric_time__extract_dow
- , subq_13.ds__extract_doy AS metric_time__extract_doy
- , subq_13.listing
- , subq_13.user
- , subq_13.listing__user
- , subq_13.country_latest
- , subq_13.is_lux_latest
- , subq_13.capacity_latest
- , subq_13.listing__country_latest
- , subq_13.listing__is_lux_latest
- , subq_13.listing__capacity_latest
- , subq_13.listings
- , subq_13.largest_listing
- , subq_13.smallest_listing
+ subq_22.ds__day
+ , subq_22.ds__week
+ , subq_22.ds__month
+ , subq_22.ds__quarter
+ , subq_22.ds__year
+ , subq_22.ds__extract_year
+ , subq_22.ds__extract_quarter
+ , subq_22.ds__extract_month
+ , subq_22.ds__extract_day
+ , subq_22.ds__extract_dow
+ , subq_22.ds__extract_doy
+ , subq_22.created_at__day
+ , subq_22.created_at__week
+ , subq_22.created_at__month
+ , subq_22.created_at__quarter
+ , subq_22.created_at__year
+ , subq_22.created_at__extract_year
+ , subq_22.created_at__extract_quarter
+ , subq_22.created_at__extract_month
+ , subq_22.created_at__extract_day
+ , subq_22.created_at__extract_dow
+ , subq_22.created_at__extract_doy
+ , subq_22.listing__ds__day
+ , subq_22.listing__ds__week
+ , subq_22.listing__ds__month
+ , subq_22.listing__ds__quarter
+ , subq_22.listing__ds__year
+ , subq_22.listing__ds__extract_year
+ , subq_22.listing__ds__extract_quarter
+ , subq_22.listing__ds__extract_month
+ , subq_22.listing__ds__extract_day
+ , subq_22.listing__ds__extract_dow
+ , subq_22.listing__ds__extract_doy
+ , subq_22.listing__created_at__day
+ , subq_22.listing__created_at__week
+ , subq_22.listing__created_at__month
+ , subq_22.listing__created_at__quarter
+ , subq_22.listing__created_at__year
+ , subq_22.listing__created_at__extract_year
+ , subq_22.listing__created_at__extract_quarter
+ , subq_22.listing__created_at__extract_month
+ , subq_22.listing__created_at__extract_day
+ , subq_22.listing__created_at__extract_dow
+ , subq_22.listing__created_at__extract_doy
+ , subq_22.ds__day AS metric_time__day
+ , subq_22.ds__week AS metric_time__week
+ , subq_22.ds__month AS metric_time__month
+ , subq_22.ds__quarter AS metric_time__quarter
+ , subq_22.ds__year AS metric_time__year
+ , subq_22.ds__extract_year AS metric_time__extract_year
+ , subq_22.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_22.ds__extract_month AS metric_time__extract_month
+ , subq_22.ds__extract_day AS metric_time__extract_day
+ , subq_22.ds__extract_dow AS metric_time__extract_dow
+ , subq_22.ds__extract_doy AS metric_time__extract_doy
+ , subq_22.listing
+ , subq_22.user
+ , subq_22.listing__user
+ , subq_22.country_latest
+ , subq_22.is_lux_latest
+ , subq_22.capacity_latest
+ , subq_22.listing__country_latest
+ , subq_22.listing__is_lux_latest
+ , subq_22.listing__capacity_latest
+ , subq_22.listings
+ , subq_22.largest_listing
+ , subq_22.smallest_listing
FROM (
-- Read Elements From Semantic Model 'listings_latest'
SELECT
1 AS listings
- , listings_latest_src_28005.capacity AS largest_listing
- , listings_latest_src_28005.capacity AS smallest_listing
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day
- , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day
- , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy
- , listings_latest_src_28005.country AS country_latest
- , listings_latest_src_28005.is_lux AS is_lux_latest
- , listings_latest_src_28005.capacity AS capacity_latest
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day
- , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS listing__ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day
- , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS listing__created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy
- , listings_latest_src_28005.country AS listing__country_latest
- , listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , listings_latest_src_28005.capacity AS listing__capacity_latest
- , listings_latest_src_28005.listing_id AS listing
- , listings_latest_src_28005.user_id AS user
- , listings_latest_src_28005.user_id AS listing__user
- FROM ***************************.dim_listings_latest listings_latest_src_28005
- ) subq_13
- ) subq_14
- ) subq_15
+ , listings_latest_src_28000.capacity AS largest_listing
+ , listings_latest_src_28000.capacity AS smallest_listing
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , CASE WHEN EXTRACT(dow FROM listings_latest_src_28000.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28000.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28000.created_at) END AS ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS created_at__extract_day
+ , CASE WHEN EXTRACT(dow FROM listings_latest_src_28000.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28000.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28000.created_at) END AS created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS created_at__extract_doy
+ , 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('day', listings_latest_src_28000.created_at) AS listing__ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , CASE WHEN EXTRACT(dow FROM listings_latest_src_28000.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28000.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28000.created_at) END AS listing__ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS listing__created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_day
+ , CASE WHEN EXTRACT(dow FROM listings_latest_src_28000.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28000.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28000.created_at) END AS listing__created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_doy
+ , listings_latest_src_28000.country AS listing__country_latest
+ , listings_latest_src_28000.is_lux AS listing__is_lux_latest
+ , listings_latest_src_28000.capacity AS listing__capacity_latest
+ , listings_latest_src_28000.listing_id AS listing
+ , listings_latest_src_28000.user_id AS user
+ , listings_latest_src_28000.user_id AS listing__user
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
+ ) subq_22
+ ) subq_23
+ ) subq_24
ON
- subq_12.listing = subq_15.listing
- ) subq_16
- ) subq_17
+ subq_21.listing = subq_24.listing
+ ) subq_25
+ ) subq_26
GROUP BY
- subq_17.ds__day
- , subq_17.listing__country_latest
- ) subq_18
- ) subq_19
+ subq_26.ds__day
+ , subq_26.listing__country_latest
+ ) subq_27
+ ) subq_28
ON
(
- subq_9.listing__country_latest = subq_19.listing__country_latest
+ subq_18.listing__country_latest = subq_28.listing__country_latest
) AND (
- subq_9.ds__day = subq_19.ds__day
+ subq_18.ds__day = subq_28.ds__day
)
GROUP BY
- COALESCE(subq_9.ds__day, subq_19.ds__day)
- , COALESCE(subq_9.listing__country_latest, subq_19.listing__country_latest)
-) subq_20
+ COALESCE(subq_18.ds__day, subq_28.ds__day)
+ , COALESCE(subq_18.listing__country_latest, subq_28.listing__country_latest)
+) subq_29
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0_optimized.sql
index 07a0d3efe7..8289fb48f2 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0_optimized.sql
@@ -6,19 +6,19 @@ SELECT
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_30.ds__day, subq_40.ds__day) AS ds__day
- , COALESCE(subq_30.listing__country_latest, subq_40.listing__country_latest) AS listing__country_latest
- , MAX(subq_30.bookings) AS bookings
- , MAX(subq_40.views) AS views
+ COALESCE(subq_39.ds__day, subq_49.ds__day) AS ds__day
+ , COALESCE(subq_39.listing__country_latest, subq_49.listing__country_latest) AS listing__country_latest
+ , MAX(subq_39.bookings) AS bookings
+ , MAX(subq_49.views) AS views
FROM (
-- Join Standard Outputs
-- Pass Only Elements: ['bookings', 'listing__country_latest', 'ds__day']
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_23.ds__day AS ds__day
- , listings_latest_src_28005.country AS listing__country_latest
- , SUM(subq_23.bookings) AS bookings
+ subq_32.ds__day AS ds__day
+ , listings_latest_src_28000.country AS listing__country_latest
+ , SUM(subq_32.bookings) AS bookings
FROM (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
@@ -27,25 +27,25 @@ FROM (
DATE_TRUNC('day', ds) AS ds__day
, listing_id AS listing
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_23
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_32
LEFT OUTER JOIN
- ***************************.dim_listings_latest listings_latest_src_28005
+ ***************************.dim_listings_latest listings_latest_src_28000
ON
- subq_23.listing = listings_latest_src_28005.listing_id
+ subq_32.listing = listings_latest_src_28000.listing_id
GROUP BY
- subq_23.ds__day
- , listings_latest_src_28005.country
- ) subq_30
+ subq_32.ds__day
+ , listings_latest_src_28000.country
+ ) subq_39
FULL OUTER JOIN (
-- Join Standard Outputs
-- Pass Only Elements: ['views', 'listing__country_latest', 'ds__day']
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_33.ds__day AS ds__day
- , listings_latest_src_28005.country AS listing__country_latest
- , SUM(subq_33.views) AS views
+ subq_42.ds__day AS ds__day
+ , listings_latest_src_28000.country AS listing__country_latest
+ , SUM(subq_42.views) AS views
FROM (
-- Read Elements From Semantic Model 'views_source'
-- Metric Time Dimension 'ds'
@@ -54,23 +54,23 @@ FROM (
DATE_TRUNC('day', ds) AS ds__day
, listing_id AS listing
, 1 AS views
- FROM ***************************.fct_views views_source_src_28010
- ) subq_33
+ FROM ***************************.fct_views views_source_src_28000
+ ) subq_42
LEFT OUTER JOIN
- ***************************.dim_listings_latest listings_latest_src_28005
+ ***************************.dim_listings_latest listings_latest_src_28000
ON
- subq_33.listing = listings_latest_src_28005.listing_id
+ subq_42.listing = listings_latest_src_28000.listing_id
GROUP BY
- subq_33.ds__day
- , listings_latest_src_28005.country
- ) subq_40
+ subq_42.ds__day
+ , listings_latest_src_28000.country
+ ) subq_49
ON
(
- subq_30.listing__country_latest = subq_40.listing__country_latest
+ subq_39.listing__country_latest = subq_49.listing__country_latest
) AND (
- subq_30.ds__day = subq_40.ds__day
+ subq_39.ds__day = subq_49.ds__day
)
GROUP BY
- COALESCE(subq_30.ds__day, subq_40.ds__day)
- , COALESCE(subq_30.listing__country_latest, subq_40.listing__country_latest)
-) subq_41
+ COALESCE(subq_39.ds__day, subq_49.ds__day)
+ , COALESCE(subq_39.listing__country_latest, subq_49.listing__country_latest)
+) subq_50
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.sql
index 58a8bb791f..c8f22b47b7 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.sql
@@ -28,93 +28,93 @@ FROM (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds) END AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) END AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.paid_at) END AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds) END AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) END AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.paid_at) END AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
) subq_1
LEFT OUTER JOIN (
@@ -126,62 +126,62 @@ FROM (
-- Read Elements From Semantic Model 'listings_latest'
SELECT
1 AS listings
- , listings_latest_src_28005.capacity AS largest_listing
- , listings_latest_src_28005.capacity AS smallest_listing
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day
- , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day
- , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy
- , listings_latest_src_28005.country AS country_latest
- , listings_latest_src_28005.is_lux AS is_lux_latest
- , listings_latest_src_28005.capacity AS capacity_latest
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day
- , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS listing__ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day
- , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS listing__created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy
- , listings_latest_src_28005.country AS listing__country_latest
- , listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , listings_latest_src_28005.capacity AS listing__capacity_latest
- , listings_latest_src_28005.listing_id AS listing
- , listings_latest_src_28005.user_id AS user
- , listings_latest_src_28005.user_id AS listing__user
- FROM ***************************.dim_listings_latest listings_latest_src_28005
+ , listings_latest_src_28000.capacity AS largest_listing
+ , listings_latest_src_28000.capacity AS smallest_listing
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , CASE WHEN EXTRACT(dow FROM listings_latest_src_28000.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28000.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28000.created_at) END AS ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS created_at__extract_day
+ , CASE WHEN EXTRACT(dow FROM listings_latest_src_28000.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28000.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28000.created_at) END AS created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS created_at__extract_doy
+ , 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('day', listings_latest_src_28000.created_at) AS listing__ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , CASE WHEN EXTRACT(dow FROM listings_latest_src_28000.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28000.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28000.created_at) END AS listing__ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS listing__created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_day
+ , CASE WHEN EXTRACT(dow FROM listings_latest_src_28000.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28000.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28000.created_at) END AS listing__created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_doy
+ , listings_latest_src_28000.country AS listing__country_latest
+ , listings_latest_src_28000.is_lux AS listing__is_lux_latest
+ , listings_latest_src_28000.capacity AS listing__capacity_latest
+ , listings_latest_src_28000.listing_id AS listing
+ , listings_latest_src_28000.user_id AS user
+ , listings_latest_src_28000.user_id AS listing__user
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
) subq_2
) subq_3
ON
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_compute_metrics_node_ratio_from_single_semantic_model__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_compute_metrics_node_ratio_from_single_semantic_model__plan0_optimized.sql
index 38e9fae7d2..b2cd839070 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_compute_metrics_node_ratio_from_single_semantic_model__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_compute_metrics_node_ratio_from_single_semantic_model__plan0_optimized.sql
@@ -8,7 +8,7 @@ FROM (
-- Aggregate Measures
SELECT
subq_7.listing AS listing
- , listings_latest_src_28005.country AS listing__country_latest
+ , listings_latest_src_28000.country AS listing__country_latest
, SUM(subq_7.bookings) AS bookings
, COUNT(DISTINCT subq_7.bookers) AS bookers
FROM (
@@ -18,13 +18,13 @@ FROM (
listing_id AS listing
, 1 AS bookings
, guest_id AS bookers
- FROM ***************************.fct_bookings bookings_source_src_28001
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_7
LEFT OUTER JOIN
- ***************************.dim_listings_latest listings_latest_src_28005
+ ***************************.dim_listings_latest listings_latest_src_28000
ON
- subq_7.listing = listings_latest_src_28005.listing_id
+ subq_7.listing = listings_latest_src_28000.listing_id
GROUP BY
subq_7.listing
- , listings_latest_src_28005.country
+ , listings_latest_src_28000.country
) subq_11
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_compute_metrics_node_simple_expr__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_compute_metrics_node_simple_expr__plan0.sql
index d55d97c5b2..a332bba687 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_compute_metrics_node_simple_expr__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_compute_metrics_node_simple_expr__plan0.sql
@@ -25,93 +25,93 @@ FROM (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds) END AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) END AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.paid_at) END AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds) END AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) END AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.paid_at) END AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
) subq_1
LEFT OUTER JOIN (
@@ -123,62 +123,62 @@ FROM (
-- Read Elements From Semantic Model 'listings_latest'
SELECT
1 AS listings
- , listings_latest_src_28005.capacity AS largest_listing
- , listings_latest_src_28005.capacity AS smallest_listing
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day
- , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day
- , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy
- , listings_latest_src_28005.country AS country_latest
- , listings_latest_src_28005.is_lux AS is_lux_latest
- , listings_latest_src_28005.capacity AS capacity_latest
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day
- , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS listing__ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day
- , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS listing__created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy
- , listings_latest_src_28005.country AS listing__country_latest
- , listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , listings_latest_src_28005.capacity AS listing__capacity_latest
- , listings_latest_src_28005.listing_id AS listing
- , listings_latest_src_28005.user_id AS user
- , listings_latest_src_28005.user_id AS listing__user
- FROM ***************************.dim_listings_latest listings_latest_src_28005
+ , listings_latest_src_28000.capacity AS largest_listing
+ , listings_latest_src_28000.capacity AS smallest_listing
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , CASE WHEN EXTRACT(dow FROM listings_latest_src_28000.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28000.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28000.created_at) END AS ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS created_at__extract_day
+ , CASE WHEN EXTRACT(dow FROM listings_latest_src_28000.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28000.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28000.created_at) END AS created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS created_at__extract_doy
+ , 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('day', listings_latest_src_28000.created_at) AS listing__ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , CASE WHEN EXTRACT(dow FROM listings_latest_src_28000.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28000.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28000.created_at) END AS listing__ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS listing__created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_day
+ , CASE WHEN EXTRACT(dow FROM listings_latest_src_28000.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28000.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28000.created_at) END AS listing__created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_doy
+ , listings_latest_src_28000.country AS listing__country_latest
+ , listings_latest_src_28000.is_lux AS listing__is_lux_latest
+ , listings_latest_src_28000.capacity AS listing__capacity_latest
+ , listings_latest_src_28000.listing_id AS listing
+ , listings_latest_src_28000.user_id AS user
+ , listings_latest_src_28000.user_id AS listing__user
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
) subq_2
) subq_3
ON
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_compute_metrics_node_simple_expr__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_compute_metrics_node_simple_expr__plan0_optimized.sql
index 3bda7562bf..65e701e3dd 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_compute_metrics_node_simple_expr__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_compute_metrics_node_simple_expr__plan0_optimized.sql
@@ -7,15 +7,15 @@ FROM (
-- Join Standard Outputs
-- Aggregate Measures
SELECT
- bookings_source_src_28001.listing_id AS listing
- , listings_latest_src_28005.country AS listing__country_latest
- , SUM(bookings_source_src_28001.booking_value) AS booking_value
- FROM ***************************.fct_bookings bookings_source_src_28001
+ bookings_source_src_28000.listing_id AS listing
+ , listings_latest_src_28000.country AS listing__country_latest
+ , SUM(bookings_source_src_28000.booking_value) AS booking_value
+ FROM ***************************.fct_bookings bookings_source_src_28000
LEFT OUTER JOIN
- ***************************.dim_listings_latest listings_latest_src_28005
+ ***************************.dim_listings_latest listings_latest_src_28000
ON
- bookings_source_src_28001.listing_id = listings_latest_src_28005.listing_id
+ bookings_source_src_28000.listing_id = listings_latest_src_28000.listing_id
GROUP BY
- bookings_source_src_28001.listing_id
- , listings_latest_src_28005.country
+ bookings_source_src_28000.listing_id
+ , listings_latest_src_28000.country
) subq_11
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_constrain_time_range_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_constrain_time_range_node__plan0.sql
index 7bbfa4627e..1a515595bf 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_constrain_time_range_node__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_constrain_time_range_node__plan0.sql
@@ -19,93 +19,93 @@ FROM (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds) END AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) END AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.paid_at) END AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds) END AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) END AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.paid_at) END AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
) subq_1
) subq_2
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_constrain_time_range_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_constrain_time_range_node__plan0_optimized.sql
index db53f26587..d0d15f6943 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_constrain_time_range_node__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_constrain_time_range_node__plan0_optimized.sql
@@ -6,5 +6,5 @@ SELECT
DATE_TRUNC('day', ds) AS ds__day
, DATE_TRUNC('day', ds) AS metric_time__day
, 1 AS bookings
-FROM ***************************.fct_bookings bookings_source_src_28001
+FROM ***************************.fct_bookings bookings_source_src_28000
WHERE DATE_TRUNC('day', ds) BETWEEN '2020-01-01' AND '2020-01-02'
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_dimension_with_joined_where_constraint__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_dimension_with_joined_where_constraint__plan0.sql
index 384068ec70..c59a5e39af 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_dimension_with_joined_where_constraint__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_dimension_with_joined_where_constraint__plan0.sql
@@ -125,62 +125,62 @@ FROM (
-- Read Elements From Semantic Model 'listings_latest'
SELECT
1 AS listings
- , listings_latest_src_28005.capacity AS largest_listing
- , listings_latest_src_28005.capacity AS smallest_listing
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day
- , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day
- , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy
- , listings_latest_src_28005.country AS country_latest
- , listings_latest_src_28005.is_lux AS is_lux_latest
- , listings_latest_src_28005.capacity AS capacity_latest
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day
- , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS listing__ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day
- , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS listing__created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy
- , listings_latest_src_28005.country AS listing__country_latest
- , listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , listings_latest_src_28005.capacity AS listing__capacity_latest
- , listings_latest_src_28005.listing_id AS listing
- , listings_latest_src_28005.user_id AS user
- , listings_latest_src_28005.user_id AS listing__user
- FROM ***************************.dim_listings_latest listings_latest_src_28005
+ , listings_latest_src_28000.capacity AS largest_listing
+ , listings_latest_src_28000.capacity AS smallest_listing
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , CASE WHEN EXTRACT(dow FROM listings_latest_src_28000.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28000.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28000.created_at) END AS ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS created_at__extract_day
+ , CASE WHEN EXTRACT(dow FROM listings_latest_src_28000.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28000.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28000.created_at) END AS created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS created_at__extract_doy
+ , 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('day', listings_latest_src_28000.created_at) AS listing__ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , CASE WHEN EXTRACT(dow FROM listings_latest_src_28000.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28000.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28000.created_at) END AS listing__ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS listing__created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_day
+ , CASE WHEN EXTRACT(dow FROM listings_latest_src_28000.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28000.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28000.created_at) END AS listing__created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_doy
+ , listings_latest_src_28000.country AS listing__country_latest
+ , listings_latest_src_28000.is_lux AS listing__is_lux_latest
+ , listings_latest_src_28000.capacity AS listing__capacity_latest
+ , listings_latest_src_28000.listing_id AS listing
+ , listings_latest_src_28000.user_id AS user
+ , listings_latest_src_28000.user_id AS listing__user
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
) subq_0
FULL OUTER JOIN (
-- Pass Only Elements: ['home_state_latest', 'user']
@@ -190,32 +190,32 @@ FROM (
FROM (
-- Read Elements From Semantic Model 'users_latest'
SELECT
- DATE_TRUNC('day', users_latest_src_28009.ds) AS ds_latest__day
- , DATE_TRUNC('week', users_latest_src_28009.ds) AS ds_latest__week
- , DATE_TRUNC('month', users_latest_src_28009.ds) AS ds_latest__month
- , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS ds_latest__quarter
- , DATE_TRUNC('year', users_latest_src_28009.ds) AS ds_latest__year
- , EXTRACT(year FROM users_latest_src_28009.ds) AS ds_latest__extract_year
- , EXTRACT(quarter FROM users_latest_src_28009.ds) AS ds_latest__extract_quarter
- , EXTRACT(month FROM users_latest_src_28009.ds) AS ds_latest__extract_month
- , EXTRACT(day FROM users_latest_src_28009.ds) AS ds_latest__extract_day
- , CASE WHEN EXTRACT(dow FROM users_latest_src_28009.ds) = 0 THEN EXTRACT(dow FROM users_latest_src_28009.ds) + 7 ELSE EXTRACT(dow FROM users_latest_src_28009.ds) END AS ds_latest__extract_dow
- , EXTRACT(doy FROM users_latest_src_28009.ds) AS ds_latest__extract_doy
- , users_latest_src_28009.home_state_latest
- , DATE_TRUNC('day', users_latest_src_28009.ds) AS user__ds_latest__day
- , DATE_TRUNC('week', users_latest_src_28009.ds) AS user__ds_latest__week
- , DATE_TRUNC('month', users_latest_src_28009.ds) AS user__ds_latest__month
- , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS user__ds_latest__quarter
- , DATE_TRUNC('year', users_latest_src_28009.ds) AS user__ds_latest__year
- , EXTRACT(year FROM users_latest_src_28009.ds) AS user__ds_latest__extract_year
- , EXTRACT(quarter FROM users_latest_src_28009.ds) AS user__ds_latest__extract_quarter
- , EXTRACT(month FROM users_latest_src_28009.ds) AS user__ds_latest__extract_month
- , EXTRACT(day FROM users_latest_src_28009.ds) AS user__ds_latest__extract_day
- , CASE WHEN EXTRACT(dow FROM users_latest_src_28009.ds) = 0 THEN EXTRACT(dow FROM users_latest_src_28009.ds) + 7 ELSE EXTRACT(dow FROM users_latest_src_28009.ds) END AS user__ds_latest__extract_dow
- , EXTRACT(doy FROM users_latest_src_28009.ds) AS user__ds_latest__extract_doy
- , users_latest_src_28009.home_state_latest AS user__home_state_latest
- , users_latest_src_28009.user_id AS user
- FROM ***************************.dim_users_latest users_latest_src_28009
+ DATE_TRUNC('day', users_latest_src_28000.ds) AS ds_latest__day
+ , DATE_TRUNC('week', users_latest_src_28000.ds) AS ds_latest__week
+ , DATE_TRUNC('month', users_latest_src_28000.ds) AS ds_latest__month
+ , DATE_TRUNC('quarter', users_latest_src_28000.ds) AS ds_latest__quarter
+ , DATE_TRUNC('year', users_latest_src_28000.ds) 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
+ , EXTRACT(day FROM users_latest_src_28000.ds) AS ds_latest__extract_day
+ , CASE WHEN EXTRACT(dow FROM users_latest_src_28000.ds) = 0 THEN EXTRACT(dow FROM users_latest_src_28000.ds) + 7 ELSE EXTRACT(dow FROM users_latest_src_28000.ds) END AS ds_latest__extract_dow
+ , EXTRACT(doy FROM users_latest_src_28000.ds) AS ds_latest__extract_doy
+ , users_latest_src_28000.home_state_latest
+ , DATE_TRUNC('day', users_latest_src_28000.ds) AS user__ds_latest__day
+ , DATE_TRUNC('week', users_latest_src_28000.ds) AS user__ds_latest__week
+ , DATE_TRUNC('month', users_latest_src_28000.ds) AS user__ds_latest__month
+ , DATE_TRUNC('quarter', users_latest_src_28000.ds) AS user__ds_latest__quarter
+ , DATE_TRUNC('year', users_latest_src_28000.ds) 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
+ , EXTRACT(day FROM users_latest_src_28000.ds) AS user__ds_latest__extract_day
+ , CASE WHEN EXTRACT(dow FROM users_latest_src_28000.ds) = 0 THEN EXTRACT(dow FROM users_latest_src_28000.ds) + 7 ELSE EXTRACT(dow FROM users_latest_src_28000.ds) END AS user__ds_latest__extract_dow
+ , EXTRACT(doy FROM users_latest_src_28000.ds) AS user__ds_latest__extract_doy
+ , users_latest_src_28000.home_state_latest AS user__home_state_latest
+ , users_latest_src_28000.user_id AS user
+ FROM ***************************.dim_users_latest users_latest_src_28000
) subq_1
) subq_2
ON
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_dimension_with_joined_where_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_dimension_with_joined_where_constraint__plan0_optimized.sql
index 8cc8a2b867..c4e57d3c86 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_dimension_with_joined_where_constraint__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_dimension_with_joined_where_constraint__plan0_optimized.sql
@@ -5,13 +5,13 @@ SELECT
FROM (
-- Join Standard Outputs
SELECT
- listings_latest_src_28005.country AS listing__country_latest
- , users_latest_src_28009.home_state_latest AS user__home_state_latest
- FROM ***************************.dim_listings_latest listings_latest_src_28005
+ listings_latest_src_28000.country AS listing__country_latest
+ , users_latest_src_28000.home_state_latest AS user__home_state_latest
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
FULL OUTER JOIN
- ***************************.dim_users_latest users_latest_src_28009
+ ***************************.dim_users_latest users_latest_src_28000
ON
- listings_latest_src_28005.user_id = users_latest_src_28009.user_id
+ listings_latest_src_28000.user_id = users_latest_src_28000.user_id
) subq_8
WHERE listing__country_latest = 'us'
GROUP BY
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_dimensions_requiring_join__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_dimensions_requiring_join__plan0.sql
index 5258faf635..6ada21e5f4 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_dimensions_requiring_join__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_dimensions_requiring_join__plan0.sql
@@ -66,62 +66,62 @@ FROM (
-- Read Elements From Semantic Model 'listings_latest'
SELECT
1 AS listings
- , listings_latest_src_28005.capacity AS largest_listing
- , listings_latest_src_28005.capacity AS smallest_listing
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day
- , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day
- , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy
- , listings_latest_src_28005.country AS country_latest
- , listings_latest_src_28005.is_lux AS is_lux_latest
- , listings_latest_src_28005.capacity AS capacity_latest
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day
- , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS listing__ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day
- , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS listing__created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy
- , listings_latest_src_28005.country AS listing__country_latest
- , listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , listings_latest_src_28005.capacity AS listing__capacity_latest
- , listings_latest_src_28005.listing_id AS listing
- , listings_latest_src_28005.user_id AS user
- , listings_latest_src_28005.user_id AS listing__user
- FROM ***************************.dim_listings_latest listings_latest_src_28005
+ , listings_latest_src_28000.capacity AS largest_listing
+ , listings_latest_src_28000.capacity AS smallest_listing
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , CASE WHEN EXTRACT(dow FROM listings_latest_src_28000.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28000.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28000.created_at) END AS ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS created_at__extract_day
+ , CASE WHEN EXTRACT(dow FROM listings_latest_src_28000.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28000.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28000.created_at) END AS created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS created_at__extract_doy
+ , 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('day', listings_latest_src_28000.created_at) AS listing__ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , CASE WHEN EXTRACT(dow FROM listings_latest_src_28000.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28000.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28000.created_at) END AS listing__ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS listing__created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_day
+ , CASE WHEN EXTRACT(dow FROM listings_latest_src_28000.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28000.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28000.created_at) END AS listing__created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_doy
+ , listings_latest_src_28000.country AS listing__country_latest
+ , listings_latest_src_28000.is_lux AS listing__is_lux_latest
+ , listings_latest_src_28000.capacity AS listing__capacity_latest
+ , listings_latest_src_28000.listing_id AS listing
+ , listings_latest_src_28000.user_id AS user
+ , listings_latest_src_28000.user_id AS listing__user
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
) subq_0
FULL OUTER JOIN (
-- Pass Only Elements: ['home_state_latest', 'user']
@@ -131,32 +131,32 @@ FROM (
FROM (
-- Read Elements From Semantic Model 'users_latest'
SELECT
- DATE_TRUNC('day', users_latest_src_28009.ds) AS ds_latest__day
- , DATE_TRUNC('week', users_latest_src_28009.ds) AS ds_latest__week
- , DATE_TRUNC('month', users_latest_src_28009.ds) AS ds_latest__month
- , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS ds_latest__quarter
- , DATE_TRUNC('year', users_latest_src_28009.ds) AS ds_latest__year
- , EXTRACT(year FROM users_latest_src_28009.ds) AS ds_latest__extract_year
- , EXTRACT(quarter FROM users_latest_src_28009.ds) AS ds_latest__extract_quarter
- , EXTRACT(month FROM users_latest_src_28009.ds) AS ds_latest__extract_month
- , EXTRACT(day FROM users_latest_src_28009.ds) AS ds_latest__extract_day
- , CASE WHEN EXTRACT(dow FROM users_latest_src_28009.ds) = 0 THEN EXTRACT(dow FROM users_latest_src_28009.ds) + 7 ELSE EXTRACT(dow FROM users_latest_src_28009.ds) END AS ds_latest__extract_dow
- , EXTRACT(doy FROM users_latest_src_28009.ds) AS ds_latest__extract_doy
- , users_latest_src_28009.home_state_latest
- , DATE_TRUNC('day', users_latest_src_28009.ds) AS user__ds_latest__day
- , DATE_TRUNC('week', users_latest_src_28009.ds) AS user__ds_latest__week
- , DATE_TRUNC('month', users_latest_src_28009.ds) AS user__ds_latest__month
- , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS user__ds_latest__quarter
- , DATE_TRUNC('year', users_latest_src_28009.ds) AS user__ds_latest__year
- , EXTRACT(year FROM users_latest_src_28009.ds) AS user__ds_latest__extract_year
- , EXTRACT(quarter FROM users_latest_src_28009.ds) AS user__ds_latest__extract_quarter
- , EXTRACT(month FROM users_latest_src_28009.ds) AS user__ds_latest__extract_month
- , EXTRACT(day FROM users_latest_src_28009.ds) AS user__ds_latest__extract_day
- , CASE WHEN EXTRACT(dow FROM users_latest_src_28009.ds) = 0 THEN EXTRACT(dow FROM users_latest_src_28009.ds) + 7 ELSE EXTRACT(dow FROM users_latest_src_28009.ds) END AS user__ds_latest__extract_dow
- , EXTRACT(doy FROM users_latest_src_28009.ds) AS user__ds_latest__extract_doy
- , users_latest_src_28009.home_state_latest AS user__home_state_latest
- , users_latest_src_28009.user_id AS user
- FROM ***************************.dim_users_latest users_latest_src_28009
+ DATE_TRUNC('day', users_latest_src_28000.ds) AS ds_latest__day
+ , DATE_TRUNC('week', users_latest_src_28000.ds) AS ds_latest__week
+ , DATE_TRUNC('month', users_latest_src_28000.ds) AS ds_latest__month
+ , DATE_TRUNC('quarter', users_latest_src_28000.ds) AS ds_latest__quarter
+ , DATE_TRUNC('year', users_latest_src_28000.ds) 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
+ , EXTRACT(day FROM users_latest_src_28000.ds) AS ds_latest__extract_day
+ , CASE WHEN EXTRACT(dow FROM users_latest_src_28000.ds) = 0 THEN EXTRACT(dow FROM users_latest_src_28000.ds) + 7 ELSE EXTRACT(dow FROM users_latest_src_28000.ds) END AS ds_latest__extract_dow
+ , EXTRACT(doy FROM users_latest_src_28000.ds) AS ds_latest__extract_doy
+ , users_latest_src_28000.home_state_latest
+ , DATE_TRUNC('day', users_latest_src_28000.ds) AS user__ds_latest__day
+ , DATE_TRUNC('week', users_latest_src_28000.ds) AS user__ds_latest__week
+ , DATE_TRUNC('month', users_latest_src_28000.ds) AS user__ds_latest__month
+ , DATE_TRUNC('quarter', users_latest_src_28000.ds) AS user__ds_latest__quarter
+ , DATE_TRUNC('year', users_latest_src_28000.ds) 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
+ , EXTRACT(day FROM users_latest_src_28000.ds) AS user__ds_latest__extract_day
+ , CASE WHEN EXTRACT(dow FROM users_latest_src_28000.ds) = 0 THEN EXTRACT(dow FROM users_latest_src_28000.ds) + 7 ELSE EXTRACT(dow FROM users_latest_src_28000.ds) END AS user__ds_latest__extract_dow
+ , EXTRACT(doy FROM users_latest_src_28000.ds) AS user__ds_latest__extract_doy
+ , users_latest_src_28000.home_state_latest AS user__home_state_latest
+ , users_latest_src_28000.user_id AS user
+ FROM ***************************.dim_users_latest users_latest_src_28000
) subq_1
) subq_2
ON
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_dimensions_requiring_join__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_dimensions_requiring_join__plan0_optimized.sql
index bee3a232b6..96c5d5bb3a 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_dimensions_requiring_join__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_dimensions_requiring_join__plan0_optimized.sql
@@ -1,13 +1,13 @@
-- Join Standard Outputs
-- Pass Only Elements: ['user__home_state_latest', 'listing__is_lux_latest']
SELECT
- listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , users_latest_src_28009.home_state_latest AS user__home_state_latest
-FROM ***************************.dim_listings_latest listings_latest_src_28005
+ 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
FULL OUTER JOIN
- ***************************.dim_users_latest users_latest_src_28009
+ ***************************.dim_users_latest users_latest_src_28000
ON
- listings_latest_src_28005.user_id = users_latest_src_28009.user_id
+ listings_latest_src_28000.user_id = users_latest_src_28000.user_id
GROUP BY
- listings_latest_src_28005.is_lux
- , users_latest_src_28009.home_state_latest
+ listings_latest_src_28000.is_lux
+ , users_latest_src_28000.home_state_latest
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_filter_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_filter_node__plan0.sql
index c6bba35a07..f55759536d 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_filter_node__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_filter_node__plan0.sql
@@ -6,91 +6,91 @@ FROM (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds) END AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) END AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.paid_at) END AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds) END AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) END AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.paid_at) END AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_filter_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_filter_node__plan0_optimized.sql
index bfbf5ff951..554ce484fb 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_filter_node__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_filter_node__plan0_optimized.sql
@@ -2,4 +2,4 @@
-- Pass Only Elements: ['bookings',]
SELECT
1 AS bookings
-FROM ***************************.fct_bookings bookings_source_src_28001
+FROM ***************************.fct_bookings bookings_source_src_28000
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_filter_with_where_constraint_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_filter_with_where_constraint_node__plan0.sql
index c07f8c5bca..1cc84ea68b 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_filter_with_where_constraint_node__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_filter_with_where_constraint_node__plan0.sql
@@ -12,93 +12,93 @@ FROM (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds) END AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) END AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.paid_at) END AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds) END AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) END AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.paid_at) END AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
) subq_1
WHERE booking__ds__day = '2020-01-01'
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_filter_with_where_constraint_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_filter_with_where_constraint_node__plan0_optimized.sql
index 755a4d39e2..5ee87ba25f 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_filter_with_where_constraint_node__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_filter_with_where_constraint_node__plan0_optimized.sql
@@ -8,6 +8,6 @@ FROM (
SELECT
DATE_TRUNC('day', ds) AS ds__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_3
WHERE booking__ds__day = '2020-01-01'
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_join_to_time_spine_node_with_offset_to_grain__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_join_to_time_spine_node_with_offset_to_grain__plan0.sql
index ec28e376e6..08f2336170 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_join_to_time_spine_node_with_offset_to_grain__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_join_to_time_spine_node_with_offset_to_grain__plan0.sql
@@ -134,93 +134,93 @@ INNER JOIN (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds) END AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) END AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.paid_at) END AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds) END AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) END AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.paid_at) END AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
) subq_1
) subq_2
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_join_to_time_spine_node_with_offset_to_grain__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_join_to_time_spine_node_with_offset_to_grain__plan0_optimized.sql
index d5d4ba056e..6054b232dc 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_join_to_time_spine_node_with_offset_to_grain__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_join_to_time_spine_node_with_offset_to_grain__plan0_optimized.sql
@@ -25,7 +25,7 @@ INNER JOIN (
DATE_TRUNC('day', ds) AS metric_time__day
, listing_id AS listing
, SUM(booking_value) AS booking_value
- FROM ***************************.fct_bookings bookings_source_src_28001
+ FROM ***************************.fct_bookings bookings_source_src_28000
GROUP BY
DATE_TRUNC('day', ds)
, listing_id
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_join_to_time_spine_node_with_offset_window__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_join_to_time_spine_node_with_offset_window__plan0.sql
index 35a548e0a4..dc9b6b2769 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_join_to_time_spine_node_with_offset_window__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_join_to_time_spine_node_with_offset_window__plan0.sql
@@ -134,93 +134,93 @@ INNER JOIN (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds) END AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) END AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.paid_at) END AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds) END AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) END AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.paid_at) END AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
) subq_1
) subq_2
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_join_to_time_spine_node_with_offset_window__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_join_to_time_spine_node_with_offset_window__plan0_optimized.sql
index cb1797bad8..61bc9299ec 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_join_to_time_spine_node_with_offset_window__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_join_to_time_spine_node_with_offset_window__plan0_optimized.sql
@@ -25,7 +25,7 @@ INNER JOIN (
DATE_TRUNC('day', ds) AS metric_time__day
, listing_id AS listing
, SUM(booking_value) AS booking_value
- FROM ***************************.fct_bookings bookings_source_src_28001
+ FROM ***************************.fct_bookings bookings_source_src_28000
GROUP BY
DATE_TRUNC('day', ds)
, listing_id
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_join_to_time_spine_node_without_offset__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_join_to_time_spine_node_without_offset__plan0.sql
index 1b79c4cf87..b0708bcdc2 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_join_to_time_spine_node_without_offset__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_join_to_time_spine_node_without_offset__plan0.sql
@@ -134,93 +134,93 @@ INNER JOIN (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds) END AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) END AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.paid_at) END AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds) END AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) END AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.paid_at) END AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
) subq_1
) subq_2
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_join_to_time_spine_node_without_offset__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_join_to_time_spine_node_without_offset__plan0_optimized.sql
index 695cf9c062..e4f47734b0 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_join_to_time_spine_node_without_offset__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_join_to_time_spine_node_without_offset__plan0_optimized.sql
@@ -25,7 +25,7 @@ INNER JOIN (
DATE_TRUNC('day', ds) AS metric_time__day
, listing_id AS listing
, SUM(booking_value) AS booking_value
- FROM ***************************.fct_bookings bookings_source_src_28001
+ FROM ***************************.fct_bookings bookings_source_src_28000
GROUP BY
DATE_TRUNC('day', ds)
, listing_id
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_measure_aggregation_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_measure_aggregation_node__plan0.sql
index d67aff3bb0..b6273f4c1f 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_measure_aggregation_node__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_measure_aggregation_node__plan0.sql
@@ -16,92 +16,92 @@ FROM (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds) END AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) END AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.paid_at) END AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds) END AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) END AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.paid_at) END AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
) subq_1
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_measure_aggregation_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_measure_aggregation_node__plan0_optimized.sql
index 64fc2826b9..6e5528a6c9 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_measure_aggregation_node__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_measure_aggregation_node__plan0_optimized.sql
@@ -6,4 +6,4 @@ SELECT
, SUM(CASE WHEN is_instant THEN 1 ELSE 0 END) AS instant_bookings
, COUNT(DISTINCT guest_id) AS bookers
, AVG(booking_value) AS average_booking_value
-FROM ***************************.fct_bookings bookings_source_src_28001
+FROM ***************************.fct_bookings bookings_source_src_28000
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_multi_join_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_multi_join_node__plan0.sql
index 6a96fe1f63..7c1221217a 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_multi_join_node__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_multi_join_node__plan0.sql
@@ -14,93 +14,93 @@ FROM (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds) END AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) END AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.paid_at) END AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds) END AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) END AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.paid_at) END AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
) subq_1
LEFT OUTER JOIN (
@@ -112,62 +112,62 @@ LEFT OUTER JOIN (
-- Read Elements From Semantic Model 'listings_latest'
SELECT
1 AS listings
- , listings_latest_src_28005.capacity AS largest_listing
- , listings_latest_src_28005.capacity AS smallest_listing
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day
- , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day
- , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy
- , listings_latest_src_28005.country AS country_latest
- , listings_latest_src_28005.is_lux AS is_lux_latest
- , listings_latest_src_28005.capacity AS capacity_latest
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day
- , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS listing__ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day
- , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS listing__created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy
- , listings_latest_src_28005.country AS listing__country_latest
- , listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , listings_latest_src_28005.capacity AS listing__capacity_latest
- , listings_latest_src_28005.listing_id AS listing
- , listings_latest_src_28005.user_id AS user
- , listings_latest_src_28005.user_id AS listing__user
- FROM ***************************.dim_listings_latest listings_latest_src_28005
+ , listings_latest_src_28000.capacity AS largest_listing
+ , listings_latest_src_28000.capacity AS smallest_listing
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , CASE WHEN EXTRACT(dow FROM listings_latest_src_28000.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28000.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28000.created_at) END AS ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS created_at__extract_day
+ , CASE WHEN EXTRACT(dow FROM listings_latest_src_28000.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28000.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28000.created_at) END AS created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS created_at__extract_doy
+ , 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('day', listings_latest_src_28000.created_at) AS listing__ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , CASE WHEN EXTRACT(dow FROM listings_latest_src_28000.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28000.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28000.created_at) END AS listing__ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS listing__created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_day
+ , CASE WHEN EXTRACT(dow FROM listings_latest_src_28000.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28000.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28000.created_at) END AS listing__created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_doy
+ , listings_latest_src_28000.country AS listing__country_latest
+ , listings_latest_src_28000.is_lux AS listing__is_lux_latest
+ , listings_latest_src_28000.capacity AS listing__capacity_latest
+ , listings_latest_src_28000.listing_id AS listing
+ , listings_latest_src_28000.user_id AS user
+ , listings_latest_src_28000.user_id AS listing__user
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
) subq_2
) subq_3
ON
@@ -181,62 +181,62 @@ LEFT OUTER JOIN (
-- Read Elements From Semantic Model 'listings_latest'
SELECT
1 AS listings
- , listings_latest_src_28005.capacity AS largest_listing
- , listings_latest_src_28005.capacity AS smallest_listing
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day
- , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day
- , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy
- , listings_latest_src_28005.country AS country_latest
- , listings_latest_src_28005.is_lux AS is_lux_latest
- , listings_latest_src_28005.capacity AS capacity_latest
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day
- , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS listing__ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day
- , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS listing__created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy
- , listings_latest_src_28005.country AS listing__country_latest
- , listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , listings_latest_src_28005.capacity AS listing__capacity_latest
- , listings_latest_src_28005.listing_id AS listing
- , listings_latest_src_28005.user_id AS user
- , listings_latest_src_28005.user_id AS listing__user
- FROM ***************************.dim_listings_latest listings_latest_src_28005
+ , listings_latest_src_28000.capacity AS largest_listing
+ , listings_latest_src_28000.capacity AS smallest_listing
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , CASE WHEN EXTRACT(dow FROM listings_latest_src_28000.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28000.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28000.created_at) END AS ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS created_at__extract_day
+ , CASE WHEN EXTRACT(dow FROM listings_latest_src_28000.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28000.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28000.created_at) END AS created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS created_at__extract_doy
+ , 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('day', listings_latest_src_28000.created_at) AS listing__ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , CASE WHEN EXTRACT(dow FROM listings_latest_src_28000.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28000.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28000.created_at) END AS listing__ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS listing__created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_day
+ , CASE WHEN EXTRACT(dow FROM listings_latest_src_28000.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28000.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28000.created_at) END AS listing__created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_doy
+ , listings_latest_src_28000.country AS listing__country_latest
+ , listings_latest_src_28000.is_lux AS listing__is_lux_latest
+ , listings_latest_src_28000.capacity AS listing__capacity_latest
+ , listings_latest_src_28000.listing_id AS listing
+ , listings_latest_src_28000.user_id AS user
+ , listings_latest_src_28000.user_id AS listing__user
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
) subq_4
) subq_5
ON
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_multi_join_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_multi_join_node__plan0_optimized.sql
index b9cecc48d8..7d9c669f54 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_multi_join_node__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_multi_join_node__plan0_optimized.sql
@@ -10,7 +10,7 @@ FROM (
SELECT
listing_id AS listing
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_7
LEFT OUTER JOIN (
-- Read Elements From Semantic Model 'listings_latest'
@@ -18,7 +18,7 @@ LEFT OUTER JOIN (
SELECT
listing_id AS listing
, country AS country_latest
- FROM ***************************.dim_listings_latest listings_latest_src_28005
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
) subq_9
ON
subq_7.listing = subq_9.listing
@@ -28,7 +28,7 @@ LEFT OUTER JOIN (
SELECT
listing_id AS listing
, country AS country_latest
- FROM ***************************.dim_listings_latest listings_latest_src_28005
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
) subq_11
ON
subq_7.listing = subq_11.listing
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_order_by_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_order_by_node__plan0.sql
index dd8c53b524..64beab1078 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_order_by_node__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_order_by_node__plan0.sql
@@ -26,93 +26,93 @@ FROM (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds) END AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) END AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.paid_at) END AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds) END AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) END AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.paid_at) END AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
) subq_1
GROUP BY
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_order_by_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_order_by_node__plan0_optimized.sql
index fd8a1ff597..bcebfe9d5f 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_order_by_node__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_order_by_node__plan0_optimized.sql
@@ -12,7 +12,7 @@ FROM (
DATE_TRUNC('day', ds) AS ds__day
, is_instant
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_5
GROUP BY
ds__day
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_single_join_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_single_join_node__plan0.sql
index 5eb1ecbbfd..59c21d9f82 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_single_join_node__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_single_join_node__plan0.sql
@@ -12,93 +12,93 @@ FROM (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds) END AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) END AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.paid_at) END AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds) END AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) END AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.paid_at) END AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
) subq_1
LEFT OUTER JOIN (
@@ -110,62 +110,62 @@ LEFT OUTER JOIN (
-- Read Elements From Semantic Model 'listings_latest'
SELECT
1 AS listings
- , listings_latest_src_28005.capacity AS largest_listing
- , listings_latest_src_28005.capacity AS smallest_listing
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day
- , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day
- , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy
- , listings_latest_src_28005.country AS country_latest
- , listings_latest_src_28005.is_lux AS is_lux_latest
- , listings_latest_src_28005.capacity AS capacity_latest
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day
- , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS listing__ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day
- , CASE WHEN EXTRACT(dow FROM listings_latest_src_28005.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28005.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28005.created_at) END AS listing__created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy
- , listings_latest_src_28005.country AS listing__country_latest
- , listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , listings_latest_src_28005.capacity AS listing__capacity_latest
- , listings_latest_src_28005.listing_id AS listing
- , listings_latest_src_28005.user_id AS user
- , listings_latest_src_28005.user_id AS listing__user
- FROM ***************************.dim_listings_latest listings_latest_src_28005
+ , listings_latest_src_28000.capacity AS largest_listing
+ , listings_latest_src_28000.capacity AS smallest_listing
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , CASE WHEN EXTRACT(dow FROM listings_latest_src_28000.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28000.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28000.created_at) END AS ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS created_at__extract_day
+ , CASE WHEN EXTRACT(dow FROM listings_latest_src_28000.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28000.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28000.created_at) END AS created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS created_at__extract_doy
+ , 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('day', listings_latest_src_28000.created_at) AS listing__ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , CASE WHEN EXTRACT(dow FROM listings_latest_src_28000.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28000.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28000.created_at) END AS listing__ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS listing__created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_day
+ , CASE WHEN EXTRACT(dow FROM listings_latest_src_28000.created_at) = 0 THEN EXTRACT(dow FROM listings_latest_src_28000.created_at) + 7 ELSE EXTRACT(dow FROM listings_latest_src_28000.created_at) END AS listing__created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_doy
+ , listings_latest_src_28000.country AS listing__country_latest
+ , listings_latest_src_28000.is_lux AS listing__is_lux_latest
+ , listings_latest_src_28000.capacity AS listing__capacity_latest
+ , listings_latest_src_28000.listing_id AS listing
+ , listings_latest_src_28000.user_id AS user
+ , listings_latest_src_28000.user_id AS listing__user
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
) subq_2
) subq_3
ON
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_single_join_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_single_join_node__plan0_optimized.sql
index e03ffcce64..a1cd7ac335 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_single_join_node__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_single_join_node__plan0_optimized.sql
@@ -8,9 +8,9 @@ FROM (
SELECT
listing_id AS listing
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_5
LEFT OUTER JOIN
- ***************************.dim_listings_latest listings_latest_src_28005
+ ***************************.dim_listings_latest listings_latest_src_28000
ON
- subq_5.listing = listings_latest_src_28005.listing_id
+ subq_5.listing = listings_latest_src_28000.listing_id
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_source_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_source_node__plan0.sql
index 0d0f27eb45..e312066a03 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_source_node__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_source_node__plan0.sql
@@ -2,90 +2,90 @@
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
-FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds) END AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) END AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.paid_at) END AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds) END AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) END AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.paid_at) END AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+FROM ***************************.fct_bookings bookings_source_src_28000
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_source_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_source_node__plan0_optimized.sql
index a8f0120386..430bb9b883 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_source_node__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Redshift/test_source_node__plan0_optimized.sql
@@ -88,4 +88,4 @@ SELECT
, listing_id AS booking__listing
, guest_id AS booking__guest
, host_id AS booking__host
-FROM ***************************.fct_bookings bookings_source_src_28001
+FROM ***************************.fct_bookings bookings_source_src_28000
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_combine_output_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_combine_output_node__plan0.sql
index c9b56f342d..cd50272c26 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_combine_output_node__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_combine_output_node__plan0.sql
@@ -19,93 +19,93 @@ FROM (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
) subq_1
GROUP BY
@@ -128,93 +128,93 @@ FULL OUTER JOIN (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_3
) subq_4
GROUP BY
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_combine_output_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_combine_output_node__plan0_optimized.sql
index a8375510d7..ad81788114 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_combine_output_node__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_combine_output_node__plan0_optimized.sql
@@ -15,7 +15,7 @@ FROM (
SELECT
is_instant
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_7
GROUP BY
is_instant
@@ -33,7 +33,7 @@ FULL OUTER JOIN (
is_instant
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
, guest_id AS bookers
- FROM ***************************.fct_bookings bookings_source_src_28001
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_10
GROUP BY
is_instant
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_compute_metrics_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_compute_metrics_node__plan0.sql
index 6f3082341a..323ea29003 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_compute_metrics_node__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_compute_metrics_node__plan0.sql
@@ -25,93 +25,93 @@ FROM (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
) subq_1
LEFT OUTER JOIN (
@@ -123,62 +123,62 @@ FROM (
-- Read Elements From Semantic Model 'listings_latest'
SELECT
1 AS listings
- , listings_latest_src_28005.capacity AS largest_listing
- , listings_latest_src_28005.capacity AS smallest_listing
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day
- , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day
- , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy
- , listings_latest_src_28005.country AS country_latest
- , listings_latest_src_28005.is_lux AS is_lux_latest
- , listings_latest_src_28005.capacity AS capacity_latest
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day
- , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day
- , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy
- , listings_latest_src_28005.country AS listing__country_latest
- , listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , listings_latest_src_28005.capacity AS listing__capacity_latest
- , listings_latest_src_28005.listing_id AS listing
- , listings_latest_src_28005.user_id AS user
- , listings_latest_src_28005.user_id AS listing__user
- FROM ***************************.dim_listings_latest listings_latest_src_28005
+ , listings_latest_src_28000.capacity AS largest_listing
+ , listings_latest_src_28000.capacity AS smallest_listing
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(dayofweekiso FROM listings_latest_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS created_at__extract_day
+ , EXTRACT(dayofweekiso FROM listings_latest_src_28000.created_at) AS created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS created_at__extract_doy
+ , 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('day', listings_latest_src_28000.created_at) AS listing__ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(dayofweekiso FROM listings_latest_src_28000.created_at) AS listing__ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS listing__created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_day
+ , EXTRACT(dayofweekiso FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_doy
+ , listings_latest_src_28000.country AS listing__country_latest
+ , listings_latest_src_28000.is_lux AS listing__is_lux_latest
+ , listings_latest_src_28000.capacity AS listing__capacity_latest
+ , listings_latest_src_28000.listing_id AS listing
+ , listings_latest_src_28000.user_id AS user
+ , listings_latest_src_28000.user_id AS listing__user
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
) subq_2
) subq_3
ON
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_compute_metrics_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_compute_metrics_node__plan0_optimized.sql
index cf47afc6bf..5ebe7177e8 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_compute_metrics_node__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_compute_metrics_node__plan0_optimized.sql
@@ -3,7 +3,7 @@
-- Compute Metrics via Expressions
SELECT
subq_7.listing AS listing
- , listings_latest_src_28005.country AS listing__country_latest
+ , listings_latest_src_28000.country AS listing__country_latest
, SUM(subq_7.bookings) AS bookings
FROM (
-- Read Elements From Semantic Model 'bookings_source'
@@ -11,12 +11,12 @@ FROM (
SELECT
listing_id AS listing
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_7
LEFT OUTER JOIN
- ***************************.dim_listings_latest listings_latest_src_28005
+ ***************************.dim_listings_latest listings_latest_src_28000
ON
- subq_7.listing = listings_latest_src_28005.listing_id
+ subq_7.listing = listings_latest_src_28000.listing_id
GROUP BY
subq_7.listing
- , listings_latest_src_28005.country
+ , listings_latest_src_28000.country
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.sql
index f1535bf8d2..48ab8d3863 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.sql
@@ -1,693 +1,693 @@
-- Compute Metrics via Expressions
SELECT
- subq_20.ds__day
- , subq_20.listing__country_latest
- , CAST(subq_20.bookings AS DOUBLE) / CAST(NULLIF(subq_20.views, 0) AS DOUBLE) AS bookings_per_view
+ subq_29.ds__day
+ , subq_29.listing__country_latest
+ , CAST(subq_29.bookings AS DOUBLE) / CAST(NULLIF(subq_29.views, 0) AS DOUBLE) AS bookings_per_view
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_9.ds__day, subq_19.ds__day) AS ds__day
- , COALESCE(subq_9.listing__country_latest, subq_19.listing__country_latest) AS listing__country_latest
- , MAX(subq_9.bookings) AS bookings
- , MAX(subq_19.views) AS views
+ COALESCE(subq_18.ds__day, subq_28.ds__day) AS ds__day
+ , COALESCE(subq_18.listing__country_latest, subq_28.listing__country_latest) AS listing__country_latest
+ , MAX(subq_18.bookings) AS bookings
+ , MAX(subq_28.views) AS views
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_8.ds__day
- , subq_8.listing__country_latest
- , subq_8.bookings
+ subq_17.ds__day
+ , subq_17.listing__country_latest
+ , subq_17.bookings
FROM (
-- Aggregate Measures
SELECT
- subq_7.ds__day
- , subq_7.listing__country_latest
- , SUM(subq_7.bookings) AS bookings
+ subq_16.ds__day
+ , subq_16.listing__country_latest
+ , SUM(subq_16.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'listing__country_latest', 'ds__day']
SELECT
- subq_6.ds__day
- , subq_6.listing__country_latest
- , subq_6.bookings
+ subq_15.ds__day
+ , subq_15.listing__country_latest
+ , subq_15.bookings
FROM (
-- Join Standard Outputs
SELECT
- subq_2.ds__day AS ds__day
- , subq_2.listing AS listing
- , subq_5.country_latest AS listing__country_latest
- , subq_2.bookings AS bookings
+ subq_11.ds__day AS ds__day
+ , subq_11.listing AS listing
+ , subq_14.country_latest AS listing__country_latest
+ , subq_11.bookings AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'ds__day', 'listing']
SELECT
- subq_1.ds__day
- , subq_1.listing
- , subq_1.bookings
+ subq_10.ds__day
+ , subq_10.listing
+ , subq_10.bookings
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
- ) subq_2
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
LEFT OUTER JOIN (
-- Pass Only Elements: ['country_latest', 'listing']
SELECT
- subq_4.listing
- , subq_4.country_latest
+ subq_13.listing
+ , subq_13.country_latest
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_3.ds__day
- , subq_3.ds__week
- , subq_3.ds__month
- , subq_3.ds__quarter
- , subq_3.ds__year
- , subq_3.ds__extract_year
- , subq_3.ds__extract_quarter
- , subq_3.ds__extract_month
- , subq_3.ds__extract_day
- , subq_3.ds__extract_dow
- , subq_3.ds__extract_doy
- , subq_3.created_at__day
- , subq_3.created_at__week
- , subq_3.created_at__month
- , subq_3.created_at__quarter
- , subq_3.created_at__year
- , subq_3.created_at__extract_year
- , subq_3.created_at__extract_quarter
- , subq_3.created_at__extract_month
- , subq_3.created_at__extract_day
- , subq_3.created_at__extract_dow
- , subq_3.created_at__extract_doy
- , subq_3.listing__ds__day
- , subq_3.listing__ds__week
- , subq_3.listing__ds__month
- , subq_3.listing__ds__quarter
- , subq_3.listing__ds__year
- , subq_3.listing__ds__extract_year
- , subq_3.listing__ds__extract_quarter
- , subq_3.listing__ds__extract_month
- , subq_3.listing__ds__extract_day
- , subq_3.listing__ds__extract_dow
- , subq_3.listing__ds__extract_doy
- , subq_3.listing__created_at__day
- , subq_3.listing__created_at__week
- , subq_3.listing__created_at__month
- , subq_3.listing__created_at__quarter
- , subq_3.listing__created_at__year
- , subq_3.listing__created_at__extract_year
- , subq_3.listing__created_at__extract_quarter
- , subq_3.listing__created_at__extract_month
- , subq_3.listing__created_at__extract_day
- , subq_3.listing__created_at__extract_dow
- , subq_3.listing__created_at__extract_doy
- , subq_3.ds__day AS metric_time__day
- , subq_3.ds__week AS metric_time__week
- , subq_3.ds__month AS metric_time__month
- , subq_3.ds__quarter AS metric_time__quarter
- , subq_3.ds__year AS metric_time__year
- , subq_3.ds__extract_year AS metric_time__extract_year
- , subq_3.ds__extract_quarter AS metric_time__extract_quarter
- , subq_3.ds__extract_month AS metric_time__extract_month
- , subq_3.ds__extract_day AS metric_time__extract_day
- , subq_3.ds__extract_dow AS metric_time__extract_dow
- , subq_3.ds__extract_doy AS metric_time__extract_doy
- , subq_3.listing
- , subq_3.user
- , subq_3.listing__user
- , subq_3.country_latest
- , subq_3.is_lux_latest
- , subq_3.capacity_latest
- , subq_3.listing__country_latest
- , subq_3.listing__is_lux_latest
- , subq_3.listing__capacity_latest
- , subq_3.listings
- , subq_3.largest_listing
- , subq_3.smallest_listing
+ subq_12.ds__day
+ , subq_12.ds__week
+ , subq_12.ds__month
+ , subq_12.ds__quarter
+ , subq_12.ds__year
+ , subq_12.ds__extract_year
+ , subq_12.ds__extract_quarter
+ , subq_12.ds__extract_month
+ , subq_12.ds__extract_day
+ , subq_12.ds__extract_dow
+ , subq_12.ds__extract_doy
+ , subq_12.created_at__day
+ , subq_12.created_at__week
+ , subq_12.created_at__month
+ , subq_12.created_at__quarter
+ , subq_12.created_at__year
+ , subq_12.created_at__extract_year
+ , subq_12.created_at__extract_quarter
+ , subq_12.created_at__extract_month
+ , subq_12.created_at__extract_day
+ , subq_12.created_at__extract_dow
+ , subq_12.created_at__extract_doy
+ , subq_12.listing__ds__day
+ , subq_12.listing__ds__week
+ , subq_12.listing__ds__month
+ , subq_12.listing__ds__quarter
+ , subq_12.listing__ds__year
+ , subq_12.listing__ds__extract_year
+ , subq_12.listing__ds__extract_quarter
+ , subq_12.listing__ds__extract_month
+ , subq_12.listing__ds__extract_day
+ , subq_12.listing__ds__extract_dow
+ , subq_12.listing__ds__extract_doy
+ , subq_12.listing__created_at__day
+ , subq_12.listing__created_at__week
+ , subq_12.listing__created_at__month
+ , subq_12.listing__created_at__quarter
+ , subq_12.listing__created_at__year
+ , subq_12.listing__created_at__extract_year
+ , subq_12.listing__created_at__extract_quarter
+ , subq_12.listing__created_at__extract_month
+ , subq_12.listing__created_at__extract_day
+ , subq_12.listing__created_at__extract_dow
+ , subq_12.listing__created_at__extract_doy
+ , subq_12.ds__day AS metric_time__day
+ , subq_12.ds__week AS metric_time__week
+ , subq_12.ds__month AS metric_time__month
+ , subq_12.ds__quarter AS metric_time__quarter
+ , subq_12.ds__year AS metric_time__year
+ , subq_12.ds__extract_year AS metric_time__extract_year
+ , subq_12.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_12.ds__extract_month AS metric_time__extract_month
+ , subq_12.ds__extract_day AS metric_time__extract_day
+ , subq_12.ds__extract_dow AS metric_time__extract_dow
+ , subq_12.ds__extract_doy AS metric_time__extract_doy
+ , subq_12.listing
+ , subq_12.user
+ , subq_12.listing__user
+ , subq_12.country_latest
+ , subq_12.is_lux_latest
+ , subq_12.capacity_latest
+ , subq_12.listing__country_latest
+ , subq_12.listing__is_lux_latest
+ , subq_12.listing__capacity_latest
+ , subq_12.listings
+ , subq_12.largest_listing
+ , subq_12.smallest_listing
FROM (
-- Read Elements From Semantic Model 'listings_latest'
SELECT
1 AS listings
- , listings_latest_src_28005.capacity AS largest_listing
- , listings_latest_src_28005.capacity AS smallest_listing
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day
- , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day
- , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy
- , listings_latest_src_28005.country AS country_latest
- , listings_latest_src_28005.is_lux AS is_lux_latest
- , listings_latest_src_28005.capacity AS capacity_latest
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day
- , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day
- , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy
- , listings_latest_src_28005.country AS listing__country_latest
- , listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , listings_latest_src_28005.capacity AS listing__capacity_latest
- , listings_latest_src_28005.listing_id AS listing
- , listings_latest_src_28005.user_id AS user
- , listings_latest_src_28005.user_id AS listing__user
- FROM ***************************.dim_listings_latest listings_latest_src_28005
- ) subq_3
- ) subq_4
- ) subq_5
+ , listings_latest_src_28000.capacity AS largest_listing
+ , listings_latest_src_28000.capacity AS smallest_listing
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(dayofweekiso FROM listings_latest_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS created_at__extract_day
+ , EXTRACT(dayofweekiso FROM listings_latest_src_28000.created_at) AS created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS created_at__extract_doy
+ , 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('day', listings_latest_src_28000.created_at) AS listing__ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(dayofweekiso FROM listings_latest_src_28000.created_at) AS listing__ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS listing__created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_day
+ , EXTRACT(dayofweekiso FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_doy
+ , listings_latest_src_28000.country AS listing__country_latest
+ , listings_latest_src_28000.is_lux AS listing__is_lux_latest
+ , listings_latest_src_28000.capacity AS listing__capacity_latest
+ , listings_latest_src_28000.listing_id AS listing
+ , listings_latest_src_28000.user_id AS user
+ , listings_latest_src_28000.user_id AS listing__user
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
+ ) subq_12
+ ) subq_13
+ ) subq_14
ON
- subq_2.listing = subq_5.listing
- ) subq_6
- ) subq_7
+ subq_11.listing = subq_14.listing
+ ) subq_15
+ ) subq_16
GROUP BY
- subq_7.ds__day
- , subq_7.listing__country_latest
- ) subq_8
- ) subq_9
+ subq_16.ds__day
+ , subq_16.listing__country_latest
+ ) subq_17
+ ) subq_18
FULL OUTER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_18.ds__day
- , subq_18.listing__country_latest
- , subq_18.views
+ subq_27.ds__day
+ , subq_27.listing__country_latest
+ , subq_27.views
FROM (
-- Aggregate Measures
SELECT
- subq_17.ds__day
- , subq_17.listing__country_latest
- , SUM(subq_17.views) AS views
+ subq_26.ds__day
+ , subq_26.listing__country_latest
+ , SUM(subq_26.views) AS views
FROM (
-- Pass Only Elements: ['views', 'listing__country_latest', 'ds__day']
SELECT
- subq_16.ds__day
- , subq_16.listing__country_latest
- , subq_16.views
+ subq_25.ds__day
+ , subq_25.listing__country_latest
+ , subq_25.views
FROM (
-- Join Standard Outputs
SELECT
- subq_12.ds__day AS ds__day
- , subq_12.listing AS listing
- , subq_15.country_latest AS listing__country_latest
- , subq_12.views AS views
+ subq_21.ds__day AS ds__day
+ , subq_21.listing AS listing
+ , subq_24.country_latest AS listing__country_latest
+ , subq_21.views AS views
FROM (
-- Pass Only Elements: ['views', 'ds__day', 'listing']
SELECT
- subq_11.ds__day
- , subq_11.listing
- , subq_11.views
+ subq_20.ds__day
+ , subq_20.listing
+ , subq_20.views
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_10.ds__day
- , subq_10.ds__week
- , subq_10.ds__month
- , subq_10.ds__quarter
- , subq_10.ds__year
- , subq_10.ds__extract_year
- , subq_10.ds__extract_quarter
- , subq_10.ds__extract_month
- , subq_10.ds__extract_day
- , subq_10.ds__extract_dow
- , subq_10.ds__extract_doy
- , subq_10.ds_partitioned__day
- , subq_10.ds_partitioned__week
- , subq_10.ds_partitioned__month
- , subq_10.ds_partitioned__quarter
- , subq_10.ds_partitioned__year
- , subq_10.ds_partitioned__extract_year
- , subq_10.ds_partitioned__extract_quarter
- , subq_10.ds_partitioned__extract_month
- , subq_10.ds_partitioned__extract_day
- , subq_10.ds_partitioned__extract_dow
- , subq_10.ds_partitioned__extract_doy
- , subq_10.view__ds__day
- , subq_10.view__ds__week
- , subq_10.view__ds__month
- , subq_10.view__ds__quarter
- , subq_10.view__ds__year
- , subq_10.view__ds__extract_year
- , subq_10.view__ds__extract_quarter
- , subq_10.view__ds__extract_month
- , subq_10.view__ds__extract_day
- , subq_10.view__ds__extract_dow
- , subq_10.view__ds__extract_doy
- , subq_10.view__ds_partitioned__day
- , subq_10.view__ds_partitioned__week
- , subq_10.view__ds_partitioned__month
- , subq_10.view__ds_partitioned__quarter
- , subq_10.view__ds_partitioned__year
- , subq_10.view__ds_partitioned__extract_year
- , subq_10.view__ds_partitioned__extract_quarter
- , subq_10.view__ds_partitioned__extract_month
- , subq_10.view__ds_partitioned__extract_day
- , subq_10.view__ds_partitioned__extract_dow
- , subq_10.view__ds_partitioned__extract_doy
- , subq_10.ds__day AS metric_time__day
- , subq_10.ds__week AS metric_time__week
- , subq_10.ds__month AS metric_time__month
- , subq_10.ds__quarter AS metric_time__quarter
- , subq_10.ds__year AS metric_time__year
- , subq_10.ds__extract_year AS metric_time__extract_year
- , subq_10.ds__extract_quarter AS metric_time__extract_quarter
- , subq_10.ds__extract_month AS metric_time__extract_month
- , subq_10.ds__extract_day AS metric_time__extract_day
- , subq_10.ds__extract_dow AS metric_time__extract_dow
- , subq_10.ds__extract_doy AS metric_time__extract_doy
- , subq_10.listing
- , subq_10.user
- , subq_10.view__listing
- , subq_10.view__user
- , subq_10.views
+ subq_19.ds__day
+ , subq_19.ds__week
+ , subq_19.ds__month
+ , subq_19.ds__quarter
+ , subq_19.ds__year
+ , subq_19.ds__extract_year
+ , subq_19.ds__extract_quarter
+ , subq_19.ds__extract_month
+ , subq_19.ds__extract_day
+ , subq_19.ds__extract_dow
+ , subq_19.ds__extract_doy
+ , subq_19.ds_partitioned__day
+ , subq_19.ds_partitioned__week
+ , subq_19.ds_partitioned__month
+ , subq_19.ds_partitioned__quarter
+ , subq_19.ds_partitioned__year
+ , subq_19.ds_partitioned__extract_year
+ , subq_19.ds_partitioned__extract_quarter
+ , subq_19.ds_partitioned__extract_month
+ , subq_19.ds_partitioned__extract_day
+ , subq_19.ds_partitioned__extract_dow
+ , subq_19.ds_partitioned__extract_doy
+ , subq_19.view__ds__day
+ , subq_19.view__ds__week
+ , subq_19.view__ds__month
+ , subq_19.view__ds__quarter
+ , subq_19.view__ds__year
+ , subq_19.view__ds__extract_year
+ , subq_19.view__ds__extract_quarter
+ , subq_19.view__ds__extract_month
+ , subq_19.view__ds__extract_day
+ , subq_19.view__ds__extract_dow
+ , subq_19.view__ds__extract_doy
+ , subq_19.view__ds_partitioned__day
+ , subq_19.view__ds_partitioned__week
+ , subq_19.view__ds_partitioned__month
+ , subq_19.view__ds_partitioned__quarter
+ , subq_19.view__ds_partitioned__year
+ , subq_19.view__ds_partitioned__extract_year
+ , subq_19.view__ds_partitioned__extract_quarter
+ , subq_19.view__ds_partitioned__extract_month
+ , subq_19.view__ds_partitioned__extract_day
+ , subq_19.view__ds_partitioned__extract_dow
+ , subq_19.view__ds_partitioned__extract_doy
+ , subq_19.ds__day AS metric_time__day
+ , subq_19.ds__week AS metric_time__week
+ , subq_19.ds__month AS metric_time__month
+ , subq_19.ds__quarter AS metric_time__quarter
+ , subq_19.ds__year AS metric_time__year
+ , subq_19.ds__extract_year AS metric_time__extract_year
+ , subq_19.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_19.ds__extract_month AS metric_time__extract_month
+ , subq_19.ds__extract_day AS metric_time__extract_day
+ , subq_19.ds__extract_dow AS metric_time__extract_dow
+ , subq_19.ds__extract_doy AS metric_time__extract_doy
+ , subq_19.listing
+ , subq_19.user
+ , subq_19.view__listing
+ , subq_19.view__user
+ , subq_19.views
FROM (
-- Read Elements From Semantic Model 'views_source'
SELECT
1 AS views
- , DATE_TRUNC('day', views_source_src_28010.ds) AS ds__day
- , DATE_TRUNC('week', views_source_src_28010.ds) AS ds__week
- , DATE_TRUNC('month', views_source_src_28010.ds) AS ds__month
- , DATE_TRUNC('quarter', views_source_src_28010.ds) AS ds__quarter
- , DATE_TRUNC('year', views_source_src_28010.ds) AS ds__year
- , EXTRACT(year FROM views_source_src_28010.ds) AS ds__extract_year
- , EXTRACT(quarter FROM views_source_src_28010.ds) AS ds__extract_quarter
- , EXTRACT(month FROM views_source_src_28010.ds) AS ds__extract_month
- , EXTRACT(day FROM views_source_src_28010.ds) AS ds__extract_day
- , EXTRACT(dayofweekiso FROM views_source_src_28010.ds) AS ds__extract_dow
- , EXTRACT(doy FROM views_source_src_28010.ds) AS ds__extract_doy
- , DATE_TRUNC('day', views_source_src_28010.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', views_source_src_28010.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', views_source_src_28010.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', views_source_src_28010.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', views_source_src_28010.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM views_source_src_28010.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM views_source_src_28010.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM views_source_src_28010.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM views_source_src_28010.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(dayofweekiso FROM views_source_src_28010.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM views_source_src_28010.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', views_source_src_28010.ds) AS view__ds__day
- , DATE_TRUNC('week', views_source_src_28010.ds) AS view__ds__week
- , DATE_TRUNC('month', views_source_src_28010.ds) AS view__ds__month
- , DATE_TRUNC('quarter', views_source_src_28010.ds) AS view__ds__quarter
- , DATE_TRUNC('year', views_source_src_28010.ds) AS view__ds__year
- , EXTRACT(year FROM views_source_src_28010.ds) AS view__ds__extract_year
- , EXTRACT(quarter FROM views_source_src_28010.ds) AS view__ds__extract_quarter
- , EXTRACT(month FROM views_source_src_28010.ds) AS view__ds__extract_month
- , EXTRACT(day FROM views_source_src_28010.ds) AS view__ds__extract_day
- , EXTRACT(dayofweekiso FROM views_source_src_28010.ds) AS view__ds__extract_dow
- , EXTRACT(doy FROM views_source_src_28010.ds) AS view__ds__extract_doy
- , DATE_TRUNC('day', views_source_src_28010.ds_partitioned) AS view__ds_partitioned__day
- , DATE_TRUNC('week', views_source_src_28010.ds_partitioned) AS view__ds_partitioned__week
- , DATE_TRUNC('month', views_source_src_28010.ds_partitioned) AS view__ds_partitioned__month
- , DATE_TRUNC('quarter', views_source_src_28010.ds_partitioned) AS view__ds_partitioned__quarter
- , DATE_TRUNC('year', views_source_src_28010.ds_partitioned) AS view__ds_partitioned__year
- , EXTRACT(year FROM views_source_src_28010.ds_partitioned) AS view__ds_partitioned__extract_year
- , EXTRACT(quarter FROM views_source_src_28010.ds_partitioned) AS view__ds_partitioned__extract_quarter
- , EXTRACT(month FROM views_source_src_28010.ds_partitioned) AS view__ds_partitioned__extract_month
- , EXTRACT(day FROM views_source_src_28010.ds_partitioned) AS view__ds_partitioned__extract_day
- , EXTRACT(dayofweekiso FROM views_source_src_28010.ds_partitioned) AS view__ds_partitioned__extract_dow
- , EXTRACT(doy FROM views_source_src_28010.ds_partitioned) AS view__ds_partitioned__extract_doy
- , views_source_src_28010.listing_id AS listing
- , views_source_src_28010.user_id AS user
- , views_source_src_28010.listing_id AS view__listing
- , views_source_src_28010.user_id AS view__user
- FROM ***************************.fct_views views_source_src_28010
- ) subq_10
- ) subq_11
- ) subq_12
+ , DATE_TRUNC('day', views_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', views_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', views_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', views_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', views_source_src_28000.ds) 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
+ , EXTRACT(dayofweekiso FROM views_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM views_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', views_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', views_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', views_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', views_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', views_source_src_28000.ds_partitioned) 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
+ , EXTRACT(dayofweekiso FROM views_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM views_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', views_source_src_28000.ds) AS view__ds__day
+ , DATE_TRUNC('week', views_source_src_28000.ds) AS view__ds__week
+ , DATE_TRUNC('month', views_source_src_28000.ds) AS view__ds__month
+ , DATE_TRUNC('quarter', views_source_src_28000.ds) AS view__ds__quarter
+ , DATE_TRUNC('year', views_source_src_28000.ds) 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
+ , EXTRACT(dayofweekiso FROM views_source_src_28000.ds) AS view__ds__extract_dow
+ , EXTRACT(doy FROM views_source_src_28000.ds) AS view__ds__extract_doy
+ , DATE_TRUNC('day', views_source_src_28000.ds_partitioned) AS view__ds_partitioned__day
+ , DATE_TRUNC('week', views_source_src_28000.ds_partitioned) AS view__ds_partitioned__week
+ , DATE_TRUNC('month', views_source_src_28000.ds_partitioned) AS view__ds_partitioned__month
+ , DATE_TRUNC('quarter', views_source_src_28000.ds_partitioned) AS view__ds_partitioned__quarter
+ , DATE_TRUNC('year', views_source_src_28000.ds_partitioned) 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
+ , EXTRACT(day FROM views_source_src_28000.ds_partitioned) AS view__ds_partitioned__extract_day
+ , EXTRACT(dayofweekiso FROM views_source_src_28000.ds_partitioned) AS view__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM views_source_src_28000.ds_partitioned) AS view__ds_partitioned__extract_doy
+ , views_source_src_28000.listing_id AS listing
+ , views_source_src_28000.user_id AS user
+ , views_source_src_28000.listing_id AS view__listing
+ , views_source_src_28000.user_id AS view__user
+ FROM ***************************.fct_views views_source_src_28000
+ ) subq_19
+ ) subq_20
+ ) subq_21
LEFT OUTER JOIN (
-- Pass Only Elements: ['country_latest', 'listing']
SELECT
- subq_14.listing
- , subq_14.country_latest
+ subq_23.listing
+ , subq_23.country_latest
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_13.ds__day
- , subq_13.ds__week
- , subq_13.ds__month
- , subq_13.ds__quarter
- , subq_13.ds__year
- , subq_13.ds__extract_year
- , subq_13.ds__extract_quarter
- , subq_13.ds__extract_month
- , subq_13.ds__extract_day
- , subq_13.ds__extract_dow
- , subq_13.ds__extract_doy
- , subq_13.created_at__day
- , subq_13.created_at__week
- , subq_13.created_at__month
- , subq_13.created_at__quarter
- , subq_13.created_at__year
- , subq_13.created_at__extract_year
- , subq_13.created_at__extract_quarter
- , subq_13.created_at__extract_month
- , subq_13.created_at__extract_day
- , subq_13.created_at__extract_dow
- , subq_13.created_at__extract_doy
- , subq_13.listing__ds__day
- , subq_13.listing__ds__week
- , subq_13.listing__ds__month
- , subq_13.listing__ds__quarter
- , subq_13.listing__ds__year
- , subq_13.listing__ds__extract_year
- , subq_13.listing__ds__extract_quarter
- , subq_13.listing__ds__extract_month
- , subq_13.listing__ds__extract_day
- , subq_13.listing__ds__extract_dow
- , subq_13.listing__ds__extract_doy
- , subq_13.listing__created_at__day
- , subq_13.listing__created_at__week
- , subq_13.listing__created_at__month
- , subq_13.listing__created_at__quarter
- , subq_13.listing__created_at__year
- , subq_13.listing__created_at__extract_year
- , subq_13.listing__created_at__extract_quarter
- , subq_13.listing__created_at__extract_month
- , subq_13.listing__created_at__extract_day
- , subq_13.listing__created_at__extract_dow
- , subq_13.listing__created_at__extract_doy
- , subq_13.ds__day AS metric_time__day
- , subq_13.ds__week AS metric_time__week
- , subq_13.ds__month AS metric_time__month
- , subq_13.ds__quarter AS metric_time__quarter
- , subq_13.ds__year AS metric_time__year
- , subq_13.ds__extract_year AS metric_time__extract_year
- , subq_13.ds__extract_quarter AS metric_time__extract_quarter
- , subq_13.ds__extract_month AS metric_time__extract_month
- , subq_13.ds__extract_day AS metric_time__extract_day
- , subq_13.ds__extract_dow AS metric_time__extract_dow
- , subq_13.ds__extract_doy AS metric_time__extract_doy
- , subq_13.listing
- , subq_13.user
- , subq_13.listing__user
- , subq_13.country_latest
- , subq_13.is_lux_latest
- , subq_13.capacity_latest
- , subq_13.listing__country_latest
- , subq_13.listing__is_lux_latest
- , subq_13.listing__capacity_latest
- , subq_13.listings
- , subq_13.largest_listing
- , subq_13.smallest_listing
+ subq_22.ds__day
+ , subq_22.ds__week
+ , subq_22.ds__month
+ , subq_22.ds__quarter
+ , subq_22.ds__year
+ , subq_22.ds__extract_year
+ , subq_22.ds__extract_quarter
+ , subq_22.ds__extract_month
+ , subq_22.ds__extract_day
+ , subq_22.ds__extract_dow
+ , subq_22.ds__extract_doy
+ , subq_22.created_at__day
+ , subq_22.created_at__week
+ , subq_22.created_at__month
+ , subq_22.created_at__quarter
+ , subq_22.created_at__year
+ , subq_22.created_at__extract_year
+ , subq_22.created_at__extract_quarter
+ , subq_22.created_at__extract_month
+ , subq_22.created_at__extract_day
+ , subq_22.created_at__extract_dow
+ , subq_22.created_at__extract_doy
+ , subq_22.listing__ds__day
+ , subq_22.listing__ds__week
+ , subq_22.listing__ds__month
+ , subq_22.listing__ds__quarter
+ , subq_22.listing__ds__year
+ , subq_22.listing__ds__extract_year
+ , subq_22.listing__ds__extract_quarter
+ , subq_22.listing__ds__extract_month
+ , subq_22.listing__ds__extract_day
+ , subq_22.listing__ds__extract_dow
+ , subq_22.listing__ds__extract_doy
+ , subq_22.listing__created_at__day
+ , subq_22.listing__created_at__week
+ , subq_22.listing__created_at__month
+ , subq_22.listing__created_at__quarter
+ , subq_22.listing__created_at__year
+ , subq_22.listing__created_at__extract_year
+ , subq_22.listing__created_at__extract_quarter
+ , subq_22.listing__created_at__extract_month
+ , subq_22.listing__created_at__extract_day
+ , subq_22.listing__created_at__extract_dow
+ , subq_22.listing__created_at__extract_doy
+ , subq_22.ds__day AS metric_time__day
+ , subq_22.ds__week AS metric_time__week
+ , subq_22.ds__month AS metric_time__month
+ , subq_22.ds__quarter AS metric_time__quarter
+ , subq_22.ds__year AS metric_time__year
+ , subq_22.ds__extract_year AS metric_time__extract_year
+ , subq_22.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_22.ds__extract_month AS metric_time__extract_month
+ , subq_22.ds__extract_day AS metric_time__extract_day
+ , subq_22.ds__extract_dow AS metric_time__extract_dow
+ , subq_22.ds__extract_doy AS metric_time__extract_doy
+ , subq_22.listing
+ , subq_22.user
+ , subq_22.listing__user
+ , subq_22.country_latest
+ , subq_22.is_lux_latest
+ , subq_22.capacity_latest
+ , subq_22.listing__country_latest
+ , subq_22.listing__is_lux_latest
+ , subq_22.listing__capacity_latest
+ , subq_22.listings
+ , subq_22.largest_listing
+ , subq_22.smallest_listing
FROM (
-- Read Elements From Semantic Model 'listings_latest'
SELECT
1 AS listings
- , listings_latest_src_28005.capacity AS largest_listing
- , listings_latest_src_28005.capacity AS smallest_listing
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day
- , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day
- , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy
- , listings_latest_src_28005.country AS country_latest
- , listings_latest_src_28005.is_lux AS is_lux_latest
- , listings_latest_src_28005.capacity AS capacity_latest
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day
- , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day
- , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy
- , listings_latest_src_28005.country AS listing__country_latest
- , listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , listings_latest_src_28005.capacity AS listing__capacity_latest
- , listings_latest_src_28005.listing_id AS listing
- , listings_latest_src_28005.user_id AS user
- , listings_latest_src_28005.user_id AS listing__user
- FROM ***************************.dim_listings_latest listings_latest_src_28005
- ) subq_13
- ) subq_14
- ) subq_15
+ , listings_latest_src_28000.capacity AS largest_listing
+ , listings_latest_src_28000.capacity AS smallest_listing
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(dayofweekiso FROM listings_latest_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS created_at__extract_day
+ , EXTRACT(dayofweekiso FROM listings_latest_src_28000.created_at) AS created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS created_at__extract_doy
+ , 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('day', listings_latest_src_28000.created_at) AS listing__ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(dayofweekiso FROM listings_latest_src_28000.created_at) AS listing__ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS listing__created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_day
+ , EXTRACT(dayofweekiso FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_doy
+ , listings_latest_src_28000.country AS listing__country_latest
+ , listings_latest_src_28000.is_lux AS listing__is_lux_latest
+ , listings_latest_src_28000.capacity AS listing__capacity_latest
+ , listings_latest_src_28000.listing_id AS listing
+ , listings_latest_src_28000.user_id AS user
+ , listings_latest_src_28000.user_id AS listing__user
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
+ ) subq_22
+ ) subq_23
+ ) subq_24
ON
- subq_12.listing = subq_15.listing
- ) subq_16
- ) subq_17
+ subq_21.listing = subq_24.listing
+ ) subq_25
+ ) subq_26
GROUP BY
- subq_17.ds__day
- , subq_17.listing__country_latest
- ) subq_18
- ) subq_19
+ subq_26.ds__day
+ , subq_26.listing__country_latest
+ ) subq_27
+ ) subq_28
ON
(
- subq_9.listing__country_latest = subq_19.listing__country_latest
+ subq_18.listing__country_latest = subq_28.listing__country_latest
) AND (
- subq_9.ds__day = subq_19.ds__day
+ subq_18.ds__day = subq_28.ds__day
)
GROUP BY
- COALESCE(subq_9.ds__day, subq_19.ds__day)
- , COALESCE(subq_9.listing__country_latest, subq_19.listing__country_latest)
-) subq_20
+ COALESCE(subq_18.ds__day, subq_28.ds__day)
+ , COALESCE(subq_18.listing__country_latest, subq_28.listing__country_latest)
+) subq_29
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0_optimized.sql
index 5b65e65d85..75a09cbc63 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0_optimized.sql
@@ -6,19 +6,19 @@ SELECT
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_30.ds__day, subq_40.ds__day) AS ds__day
- , COALESCE(subq_30.listing__country_latest, subq_40.listing__country_latest) AS listing__country_latest
- , MAX(subq_30.bookings) AS bookings
- , MAX(subq_40.views) AS views
+ COALESCE(subq_39.ds__day, subq_49.ds__day) AS ds__day
+ , COALESCE(subq_39.listing__country_latest, subq_49.listing__country_latest) AS listing__country_latest
+ , MAX(subq_39.bookings) AS bookings
+ , MAX(subq_49.views) AS views
FROM (
-- Join Standard Outputs
-- Pass Only Elements: ['bookings', 'listing__country_latest', 'ds__day']
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_23.ds__day AS ds__day
- , listings_latest_src_28005.country AS listing__country_latest
- , SUM(subq_23.bookings) AS bookings
+ subq_32.ds__day AS ds__day
+ , listings_latest_src_28000.country AS listing__country_latest
+ , SUM(subq_32.bookings) AS bookings
FROM (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
@@ -27,25 +27,25 @@ FROM (
DATE_TRUNC('day', ds) AS ds__day
, listing_id AS listing
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_23
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_32
LEFT OUTER JOIN
- ***************************.dim_listings_latest listings_latest_src_28005
+ ***************************.dim_listings_latest listings_latest_src_28000
ON
- subq_23.listing = listings_latest_src_28005.listing_id
+ subq_32.listing = listings_latest_src_28000.listing_id
GROUP BY
- subq_23.ds__day
- , listings_latest_src_28005.country
- ) subq_30
+ subq_32.ds__day
+ , listings_latest_src_28000.country
+ ) subq_39
FULL OUTER JOIN (
-- Join Standard Outputs
-- Pass Only Elements: ['views', 'listing__country_latest', 'ds__day']
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_33.ds__day AS ds__day
- , listings_latest_src_28005.country AS listing__country_latest
- , SUM(subq_33.views) AS views
+ subq_42.ds__day AS ds__day
+ , listings_latest_src_28000.country AS listing__country_latest
+ , SUM(subq_42.views) AS views
FROM (
-- Read Elements From Semantic Model 'views_source'
-- Metric Time Dimension 'ds'
@@ -54,23 +54,23 @@ FROM (
DATE_TRUNC('day', ds) AS ds__day
, listing_id AS listing
, 1 AS views
- FROM ***************************.fct_views views_source_src_28010
- ) subq_33
+ FROM ***************************.fct_views views_source_src_28000
+ ) subq_42
LEFT OUTER JOIN
- ***************************.dim_listings_latest listings_latest_src_28005
+ ***************************.dim_listings_latest listings_latest_src_28000
ON
- subq_33.listing = listings_latest_src_28005.listing_id
+ subq_42.listing = listings_latest_src_28000.listing_id
GROUP BY
- subq_33.ds__day
- , listings_latest_src_28005.country
- ) subq_40
+ subq_42.ds__day
+ , listings_latest_src_28000.country
+ ) subq_49
ON
(
- subq_30.listing__country_latest = subq_40.listing__country_latest
+ subq_39.listing__country_latest = subq_49.listing__country_latest
) AND (
- subq_30.ds__day = subq_40.ds__day
+ subq_39.ds__day = subq_49.ds__day
)
GROUP BY
- COALESCE(subq_30.ds__day, subq_40.ds__day)
- , COALESCE(subq_30.listing__country_latest, subq_40.listing__country_latest)
-) subq_41
+ COALESCE(subq_39.ds__day, subq_49.ds__day)
+ , COALESCE(subq_39.listing__country_latest, subq_49.listing__country_latest)
+) subq_50
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.sql
index 63a16e88aa..390392dacf 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.sql
@@ -28,93 +28,93 @@ FROM (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
) subq_1
LEFT OUTER JOIN (
@@ -126,62 +126,62 @@ FROM (
-- Read Elements From Semantic Model 'listings_latest'
SELECT
1 AS listings
- , listings_latest_src_28005.capacity AS largest_listing
- , listings_latest_src_28005.capacity AS smallest_listing
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day
- , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day
- , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy
- , listings_latest_src_28005.country AS country_latest
- , listings_latest_src_28005.is_lux AS is_lux_latest
- , listings_latest_src_28005.capacity AS capacity_latest
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day
- , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day
- , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy
- , listings_latest_src_28005.country AS listing__country_latest
- , listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , listings_latest_src_28005.capacity AS listing__capacity_latest
- , listings_latest_src_28005.listing_id AS listing
- , listings_latest_src_28005.user_id AS user
- , listings_latest_src_28005.user_id AS listing__user
- FROM ***************************.dim_listings_latest listings_latest_src_28005
+ , listings_latest_src_28000.capacity AS largest_listing
+ , listings_latest_src_28000.capacity AS smallest_listing
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(dayofweekiso FROM listings_latest_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS created_at__extract_day
+ , EXTRACT(dayofweekiso FROM listings_latest_src_28000.created_at) AS created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS created_at__extract_doy
+ , 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('day', listings_latest_src_28000.created_at) AS listing__ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(dayofweekiso FROM listings_latest_src_28000.created_at) AS listing__ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS listing__created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_day
+ , EXTRACT(dayofweekiso FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_doy
+ , listings_latest_src_28000.country AS listing__country_latest
+ , listings_latest_src_28000.is_lux AS listing__is_lux_latest
+ , listings_latest_src_28000.capacity AS listing__capacity_latest
+ , listings_latest_src_28000.listing_id AS listing
+ , listings_latest_src_28000.user_id AS user
+ , listings_latest_src_28000.user_id AS listing__user
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
) subq_2
) subq_3
ON
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_compute_metrics_node_ratio_from_single_semantic_model__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_compute_metrics_node_ratio_from_single_semantic_model__plan0_optimized.sql
index 7c57c360fb..c943b1a8d9 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_compute_metrics_node_ratio_from_single_semantic_model__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_compute_metrics_node_ratio_from_single_semantic_model__plan0_optimized.sql
@@ -8,7 +8,7 @@ FROM (
-- Aggregate Measures
SELECT
subq_7.listing AS listing
- , listings_latest_src_28005.country AS listing__country_latest
+ , listings_latest_src_28000.country AS listing__country_latest
, SUM(subq_7.bookings) AS bookings
, COUNT(DISTINCT subq_7.bookers) AS bookers
FROM (
@@ -18,13 +18,13 @@ FROM (
listing_id AS listing
, 1 AS bookings
, guest_id AS bookers
- FROM ***************************.fct_bookings bookings_source_src_28001
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_7
LEFT OUTER JOIN
- ***************************.dim_listings_latest listings_latest_src_28005
+ ***************************.dim_listings_latest listings_latest_src_28000
ON
- subq_7.listing = listings_latest_src_28005.listing_id
+ subq_7.listing = listings_latest_src_28000.listing_id
GROUP BY
subq_7.listing
- , listings_latest_src_28005.country
+ , listings_latest_src_28000.country
) subq_11
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_compute_metrics_node_simple_expr__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_compute_metrics_node_simple_expr__plan0.sql
index d1ea5963e2..038022f027 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_compute_metrics_node_simple_expr__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_compute_metrics_node_simple_expr__plan0.sql
@@ -25,93 +25,93 @@ FROM (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
) subq_1
LEFT OUTER JOIN (
@@ -123,62 +123,62 @@ FROM (
-- Read Elements From Semantic Model 'listings_latest'
SELECT
1 AS listings
- , listings_latest_src_28005.capacity AS largest_listing
- , listings_latest_src_28005.capacity AS smallest_listing
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day
- , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day
- , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy
- , listings_latest_src_28005.country AS country_latest
- , listings_latest_src_28005.is_lux AS is_lux_latest
- , listings_latest_src_28005.capacity AS capacity_latest
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day
- , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day
- , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy
- , listings_latest_src_28005.country AS listing__country_latest
- , listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , listings_latest_src_28005.capacity AS listing__capacity_latest
- , listings_latest_src_28005.listing_id AS listing
- , listings_latest_src_28005.user_id AS user
- , listings_latest_src_28005.user_id AS listing__user
- FROM ***************************.dim_listings_latest listings_latest_src_28005
+ , listings_latest_src_28000.capacity AS largest_listing
+ , listings_latest_src_28000.capacity AS smallest_listing
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(dayofweekiso FROM listings_latest_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS created_at__extract_day
+ , EXTRACT(dayofweekiso FROM listings_latest_src_28000.created_at) AS created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS created_at__extract_doy
+ , 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('day', listings_latest_src_28000.created_at) AS listing__ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(dayofweekiso FROM listings_latest_src_28000.created_at) AS listing__ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS listing__created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_day
+ , EXTRACT(dayofweekiso FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_doy
+ , listings_latest_src_28000.country AS listing__country_latest
+ , listings_latest_src_28000.is_lux AS listing__is_lux_latest
+ , listings_latest_src_28000.capacity AS listing__capacity_latest
+ , listings_latest_src_28000.listing_id AS listing
+ , listings_latest_src_28000.user_id AS user
+ , listings_latest_src_28000.user_id AS listing__user
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
) subq_2
) subq_3
ON
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_compute_metrics_node_simple_expr__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_compute_metrics_node_simple_expr__plan0_optimized.sql
index 3bda7562bf..65e701e3dd 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_compute_metrics_node_simple_expr__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_compute_metrics_node_simple_expr__plan0_optimized.sql
@@ -7,15 +7,15 @@ FROM (
-- Join Standard Outputs
-- Aggregate Measures
SELECT
- bookings_source_src_28001.listing_id AS listing
- , listings_latest_src_28005.country AS listing__country_latest
- , SUM(bookings_source_src_28001.booking_value) AS booking_value
- FROM ***************************.fct_bookings bookings_source_src_28001
+ bookings_source_src_28000.listing_id AS listing
+ , listings_latest_src_28000.country AS listing__country_latest
+ , SUM(bookings_source_src_28000.booking_value) AS booking_value
+ FROM ***************************.fct_bookings bookings_source_src_28000
LEFT OUTER JOIN
- ***************************.dim_listings_latest listings_latest_src_28005
+ ***************************.dim_listings_latest listings_latest_src_28000
ON
- bookings_source_src_28001.listing_id = listings_latest_src_28005.listing_id
+ bookings_source_src_28000.listing_id = listings_latest_src_28000.listing_id
GROUP BY
- bookings_source_src_28001.listing_id
- , listings_latest_src_28005.country
+ bookings_source_src_28000.listing_id
+ , listings_latest_src_28000.country
) subq_11
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_constrain_time_range_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_constrain_time_range_node__plan0.sql
index 9b413ab923..09fc32dc6c 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_constrain_time_range_node__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_constrain_time_range_node__plan0.sql
@@ -19,93 +19,93 @@ FROM (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
) subq_1
) subq_2
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_constrain_time_range_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_constrain_time_range_node__plan0_optimized.sql
index db53f26587..d0d15f6943 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_constrain_time_range_node__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_constrain_time_range_node__plan0_optimized.sql
@@ -6,5 +6,5 @@ SELECT
DATE_TRUNC('day', ds) AS ds__day
, DATE_TRUNC('day', ds) AS metric_time__day
, 1 AS bookings
-FROM ***************************.fct_bookings bookings_source_src_28001
+FROM ***************************.fct_bookings bookings_source_src_28000
WHERE DATE_TRUNC('day', ds) BETWEEN '2020-01-01' AND '2020-01-02'
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_dimension_with_joined_where_constraint__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_dimension_with_joined_where_constraint__plan0.sql
index 68e27b96e0..d1dedc82a3 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_dimension_with_joined_where_constraint__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_dimension_with_joined_where_constraint__plan0.sql
@@ -125,62 +125,62 @@ FROM (
-- Read Elements From Semantic Model 'listings_latest'
SELECT
1 AS listings
- , listings_latest_src_28005.capacity AS largest_listing
- , listings_latest_src_28005.capacity AS smallest_listing
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day
- , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day
- , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy
- , listings_latest_src_28005.country AS country_latest
- , listings_latest_src_28005.is_lux AS is_lux_latest
- , listings_latest_src_28005.capacity AS capacity_latest
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day
- , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day
- , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy
- , listings_latest_src_28005.country AS listing__country_latest
- , listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , listings_latest_src_28005.capacity AS listing__capacity_latest
- , listings_latest_src_28005.listing_id AS listing
- , listings_latest_src_28005.user_id AS user
- , listings_latest_src_28005.user_id AS listing__user
- FROM ***************************.dim_listings_latest listings_latest_src_28005
+ , listings_latest_src_28000.capacity AS largest_listing
+ , listings_latest_src_28000.capacity AS smallest_listing
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(dayofweekiso FROM listings_latest_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS created_at__extract_day
+ , EXTRACT(dayofweekiso FROM listings_latest_src_28000.created_at) AS created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS created_at__extract_doy
+ , 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('day', listings_latest_src_28000.created_at) AS listing__ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(dayofweekiso FROM listings_latest_src_28000.created_at) AS listing__ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS listing__created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_day
+ , EXTRACT(dayofweekiso FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_doy
+ , listings_latest_src_28000.country AS listing__country_latest
+ , listings_latest_src_28000.is_lux AS listing__is_lux_latest
+ , listings_latest_src_28000.capacity AS listing__capacity_latest
+ , listings_latest_src_28000.listing_id AS listing
+ , listings_latest_src_28000.user_id AS user
+ , listings_latest_src_28000.user_id AS listing__user
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
) subq_0
FULL OUTER JOIN (
-- Pass Only Elements: ['home_state_latest', 'user']
@@ -190,32 +190,32 @@ FROM (
FROM (
-- Read Elements From Semantic Model 'users_latest'
SELECT
- DATE_TRUNC('day', users_latest_src_28009.ds) AS ds_latest__day
- , DATE_TRUNC('week', users_latest_src_28009.ds) AS ds_latest__week
- , DATE_TRUNC('month', users_latest_src_28009.ds) AS ds_latest__month
- , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS ds_latest__quarter
- , DATE_TRUNC('year', users_latest_src_28009.ds) AS ds_latest__year
- , EXTRACT(year FROM users_latest_src_28009.ds) AS ds_latest__extract_year
- , EXTRACT(quarter FROM users_latest_src_28009.ds) AS ds_latest__extract_quarter
- , EXTRACT(month FROM users_latest_src_28009.ds) AS ds_latest__extract_month
- , EXTRACT(day FROM users_latest_src_28009.ds) AS ds_latest__extract_day
- , EXTRACT(dayofweekiso FROM users_latest_src_28009.ds) AS ds_latest__extract_dow
- , EXTRACT(doy FROM users_latest_src_28009.ds) AS ds_latest__extract_doy
- , users_latest_src_28009.home_state_latest
- , DATE_TRUNC('day', users_latest_src_28009.ds) AS user__ds_latest__day
- , DATE_TRUNC('week', users_latest_src_28009.ds) AS user__ds_latest__week
- , DATE_TRUNC('month', users_latest_src_28009.ds) AS user__ds_latest__month
- , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS user__ds_latest__quarter
- , DATE_TRUNC('year', users_latest_src_28009.ds) AS user__ds_latest__year
- , EXTRACT(year FROM users_latest_src_28009.ds) AS user__ds_latest__extract_year
- , EXTRACT(quarter FROM users_latest_src_28009.ds) AS user__ds_latest__extract_quarter
- , EXTRACT(month FROM users_latest_src_28009.ds) AS user__ds_latest__extract_month
- , EXTRACT(day FROM users_latest_src_28009.ds) AS user__ds_latest__extract_day
- , EXTRACT(dayofweekiso FROM users_latest_src_28009.ds) AS user__ds_latest__extract_dow
- , EXTRACT(doy FROM users_latest_src_28009.ds) AS user__ds_latest__extract_doy
- , users_latest_src_28009.home_state_latest AS user__home_state_latest
- , users_latest_src_28009.user_id AS user
- FROM ***************************.dim_users_latest users_latest_src_28009
+ DATE_TRUNC('day', users_latest_src_28000.ds) AS ds_latest__day
+ , DATE_TRUNC('week', users_latest_src_28000.ds) AS ds_latest__week
+ , DATE_TRUNC('month', users_latest_src_28000.ds) AS ds_latest__month
+ , DATE_TRUNC('quarter', users_latest_src_28000.ds) AS ds_latest__quarter
+ , DATE_TRUNC('year', users_latest_src_28000.ds) 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
+ , EXTRACT(day FROM users_latest_src_28000.ds) AS ds_latest__extract_day
+ , EXTRACT(dayofweekiso FROM users_latest_src_28000.ds) AS ds_latest__extract_dow
+ , EXTRACT(doy FROM users_latest_src_28000.ds) AS ds_latest__extract_doy
+ , users_latest_src_28000.home_state_latest
+ , DATE_TRUNC('day', users_latest_src_28000.ds) AS user__ds_latest__day
+ , DATE_TRUNC('week', users_latest_src_28000.ds) AS user__ds_latest__week
+ , DATE_TRUNC('month', users_latest_src_28000.ds) AS user__ds_latest__month
+ , DATE_TRUNC('quarter', users_latest_src_28000.ds) AS user__ds_latest__quarter
+ , DATE_TRUNC('year', users_latest_src_28000.ds) 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
+ , EXTRACT(day FROM users_latest_src_28000.ds) AS user__ds_latest__extract_day
+ , EXTRACT(dayofweekiso FROM users_latest_src_28000.ds) AS user__ds_latest__extract_dow
+ , EXTRACT(doy FROM users_latest_src_28000.ds) AS user__ds_latest__extract_doy
+ , users_latest_src_28000.home_state_latest AS user__home_state_latest
+ , users_latest_src_28000.user_id AS user
+ FROM ***************************.dim_users_latest users_latest_src_28000
) subq_1
) subq_2
ON
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_dimension_with_joined_where_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_dimension_with_joined_where_constraint__plan0_optimized.sql
index 8cc8a2b867..c4e57d3c86 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_dimension_with_joined_where_constraint__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_dimension_with_joined_where_constraint__plan0_optimized.sql
@@ -5,13 +5,13 @@ SELECT
FROM (
-- Join Standard Outputs
SELECT
- listings_latest_src_28005.country AS listing__country_latest
- , users_latest_src_28009.home_state_latest AS user__home_state_latest
- FROM ***************************.dim_listings_latest listings_latest_src_28005
+ listings_latest_src_28000.country AS listing__country_latest
+ , users_latest_src_28000.home_state_latest AS user__home_state_latest
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
FULL OUTER JOIN
- ***************************.dim_users_latest users_latest_src_28009
+ ***************************.dim_users_latest users_latest_src_28000
ON
- listings_latest_src_28005.user_id = users_latest_src_28009.user_id
+ listings_latest_src_28000.user_id = users_latest_src_28000.user_id
) subq_8
WHERE listing__country_latest = 'us'
GROUP BY
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_dimensions_requiring_join__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_dimensions_requiring_join__plan0.sql
index 2d95b7bd1e..651824a182 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_dimensions_requiring_join__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_dimensions_requiring_join__plan0.sql
@@ -66,62 +66,62 @@ FROM (
-- Read Elements From Semantic Model 'listings_latest'
SELECT
1 AS listings
- , listings_latest_src_28005.capacity AS largest_listing
- , listings_latest_src_28005.capacity AS smallest_listing
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day
- , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day
- , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy
- , listings_latest_src_28005.country AS country_latest
- , listings_latest_src_28005.is_lux AS is_lux_latest
- , listings_latest_src_28005.capacity AS capacity_latest
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day
- , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day
- , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy
- , listings_latest_src_28005.country AS listing__country_latest
- , listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , listings_latest_src_28005.capacity AS listing__capacity_latest
- , listings_latest_src_28005.listing_id AS listing
- , listings_latest_src_28005.user_id AS user
- , listings_latest_src_28005.user_id AS listing__user
- FROM ***************************.dim_listings_latest listings_latest_src_28005
+ , listings_latest_src_28000.capacity AS largest_listing
+ , listings_latest_src_28000.capacity AS smallest_listing
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(dayofweekiso FROM listings_latest_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS created_at__extract_day
+ , EXTRACT(dayofweekiso FROM listings_latest_src_28000.created_at) AS created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS created_at__extract_doy
+ , 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('day', listings_latest_src_28000.created_at) AS listing__ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(dayofweekiso FROM listings_latest_src_28000.created_at) AS listing__ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS listing__created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_day
+ , EXTRACT(dayofweekiso FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_doy
+ , listings_latest_src_28000.country AS listing__country_latest
+ , listings_latest_src_28000.is_lux AS listing__is_lux_latest
+ , listings_latest_src_28000.capacity AS listing__capacity_latest
+ , listings_latest_src_28000.listing_id AS listing
+ , listings_latest_src_28000.user_id AS user
+ , listings_latest_src_28000.user_id AS listing__user
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
) subq_0
FULL OUTER JOIN (
-- Pass Only Elements: ['home_state_latest', 'user']
@@ -131,32 +131,32 @@ FROM (
FROM (
-- Read Elements From Semantic Model 'users_latest'
SELECT
- DATE_TRUNC('day', users_latest_src_28009.ds) AS ds_latest__day
- , DATE_TRUNC('week', users_latest_src_28009.ds) AS ds_latest__week
- , DATE_TRUNC('month', users_latest_src_28009.ds) AS ds_latest__month
- , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS ds_latest__quarter
- , DATE_TRUNC('year', users_latest_src_28009.ds) AS ds_latest__year
- , EXTRACT(year FROM users_latest_src_28009.ds) AS ds_latest__extract_year
- , EXTRACT(quarter FROM users_latest_src_28009.ds) AS ds_latest__extract_quarter
- , EXTRACT(month FROM users_latest_src_28009.ds) AS ds_latest__extract_month
- , EXTRACT(day FROM users_latest_src_28009.ds) AS ds_latest__extract_day
- , EXTRACT(dayofweekiso FROM users_latest_src_28009.ds) AS ds_latest__extract_dow
- , EXTRACT(doy FROM users_latest_src_28009.ds) AS ds_latest__extract_doy
- , users_latest_src_28009.home_state_latest
- , DATE_TRUNC('day', users_latest_src_28009.ds) AS user__ds_latest__day
- , DATE_TRUNC('week', users_latest_src_28009.ds) AS user__ds_latest__week
- , DATE_TRUNC('month', users_latest_src_28009.ds) AS user__ds_latest__month
- , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS user__ds_latest__quarter
- , DATE_TRUNC('year', users_latest_src_28009.ds) AS user__ds_latest__year
- , EXTRACT(year FROM users_latest_src_28009.ds) AS user__ds_latest__extract_year
- , EXTRACT(quarter FROM users_latest_src_28009.ds) AS user__ds_latest__extract_quarter
- , EXTRACT(month FROM users_latest_src_28009.ds) AS user__ds_latest__extract_month
- , EXTRACT(day FROM users_latest_src_28009.ds) AS user__ds_latest__extract_day
- , EXTRACT(dayofweekiso FROM users_latest_src_28009.ds) AS user__ds_latest__extract_dow
- , EXTRACT(doy FROM users_latest_src_28009.ds) AS user__ds_latest__extract_doy
- , users_latest_src_28009.home_state_latest AS user__home_state_latest
- , users_latest_src_28009.user_id AS user
- FROM ***************************.dim_users_latest users_latest_src_28009
+ DATE_TRUNC('day', users_latest_src_28000.ds) AS ds_latest__day
+ , DATE_TRUNC('week', users_latest_src_28000.ds) AS ds_latest__week
+ , DATE_TRUNC('month', users_latest_src_28000.ds) AS ds_latest__month
+ , DATE_TRUNC('quarter', users_latest_src_28000.ds) AS ds_latest__quarter
+ , DATE_TRUNC('year', users_latest_src_28000.ds) 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
+ , EXTRACT(day FROM users_latest_src_28000.ds) AS ds_latest__extract_day
+ , EXTRACT(dayofweekiso FROM users_latest_src_28000.ds) AS ds_latest__extract_dow
+ , EXTRACT(doy FROM users_latest_src_28000.ds) AS ds_latest__extract_doy
+ , users_latest_src_28000.home_state_latest
+ , DATE_TRUNC('day', users_latest_src_28000.ds) AS user__ds_latest__day
+ , DATE_TRUNC('week', users_latest_src_28000.ds) AS user__ds_latest__week
+ , DATE_TRUNC('month', users_latest_src_28000.ds) AS user__ds_latest__month
+ , DATE_TRUNC('quarter', users_latest_src_28000.ds) AS user__ds_latest__quarter
+ , DATE_TRUNC('year', users_latest_src_28000.ds) 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
+ , EXTRACT(day FROM users_latest_src_28000.ds) AS user__ds_latest__extract_day
+ , EXTRACT(dayofweekiso FROM users_latest_src_28000.ds) AS user__ds_latest__extract_dow
+ , EXTRACT(doy FROM users_latest_src_28000.ds) AS user__ds_latest__extract_doy
+ , users_latest_src_28000.home_state_latest AS user__home_state_latest
+ , users_latest_src_28000.user_id AS user
+ FROM ***************************.dim_users_latest users_latest_src_28000
) subq_1
) subq_2
ON
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_dimensions_requiring_join__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_dimensions_requiring_join__plan0_optimized.sql
index bee3a232b6..96c5d5bb3a 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_dimensions_requiring_join__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_dimensions_requiring_join__plan0_optimized.sql
@@ -1,13 +1,13 @@
-- Join Standard Outputs
-- Pass Only Elements: ['user__home_state_latest', 'listing__is_lux_latest']
SELECT
- listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , users_latest_src_28009.home_state_latest AS user__home_state_latest
-FROM ***************************.dim_listings_latest listings_latest_src_28005
+ 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
FULL OUTER JOIN
- ***************************.dim_users_latest users_latest_src_28009
+ ***************************.dim_users_latest users_latest_src_28000
ON
- listings_latest_src_28005.user_id = users_latest_src_28009.user_id
+ listings_latest_src_28000.user_id = users_latest_src_28000.user_id
GROUP BY
- listings_latest_src_28005.is_lux
- , users_latest_src_28009.home_state_latest
+ listings_latest_src_28000.is_lux
+ , users_latest_src_28000.home_state_latest
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_filter_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_filter_node__plan0.sql
index 3c43a990ff..2e7a4c5fd0 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_filter_node__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_filter_node__plan0.sql
@@ -6,91 +6,91 @@ FROM (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_filter_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_filter_node__plan0_optimized.sql
index bfbf5ff951..554ce484fb 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_filter_node__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_filter_node__plan0_optimized.sql
@@ -2,4 +2,4 @@
-- Pass Only Elements: ['bookings',]
SELECT
1 AS bookings
-FROM ***************************.fct_bookings bookings_source_src_28001
+FROM ***************************.fct_bookings bookings_source_src_28000
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_filter_with_where_constraint_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_filter_with_where_constraint_node__plan0.sql
index b982200696..01bfb0e712 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_filter_with_where_constraint_node__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_filter_with_where_constraint_node__plan0.sql
@@ -12,93 +12,93 @@ FROM (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
) subq_1
WHERE booking__ds__day = '2020-01-01'
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_filter_with_where_constraint_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_filter_with_where_constraint_node__plan0_optimized.sql
index 755a4d39e2..5ee87ba25f 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_filter_with_where_constraint_node__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_filter_with_where_constraint_node__plan0_optimized.sql
@@ -8,6 +8,6 @@ FROM (
SELECT
DATE_TRUNC('day', ds) AS ds__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_3
WHERE booking__ds__day = '2020-01-01'
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_join_to_time_spine_node_with_offset_to_grain__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_join_to_time_spine_node_with_offset_to_grain__plan0.sql
index 6e3a76c40e..2689896e19 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_join_to_time_spine_node_with_offset_to_grain__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_join_to_time_spine_node_with_offset_to_grain__plan0.sql
@@ -134,93 +134,93 @@ INNER JOIN (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
) subq_1
) subq_2
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_join_to_time_spine_node_with_offset_to_grain__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_join_to_time_spine_node_with_offset_to_grain__plan0_optimized.sql
index d5d4ba056e..6054b232dc 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_join_to_time_spine_node_with_offset_to_grain__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_join_to_time_spine_node_with_offset_to_grain__plan0_optimized.sql
@@ -25,7 +25,7 @@ INNER JOIN (
DATE_TRUNC('day', ds) AS metric_time__day
, listing_id AS listing
, SUM(booking_value) AS booking_value
- FROM ***************************.fct_bookings bookings_source_src_28001
+ FROM ***************************.fct_bookings bookings_source_src_28000
GROUP BY
DATE_TRUNC('day', ds)
, listing_id
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_join_to_time_spine_node_with_offset_window__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_join_to_time_spine_node_with_offset_window__plan0.sql
index dd5074bc47..6fbac4ea91 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_join_to_time_spine_node_with_offset_window__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_join_to_time_spine_node_with_offset_window__plan0.sql
@@ -134,93 +134,93 @@ INNER JOIN (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
) subq_1
) subq_2
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_join_to_time_spine_node_with_offset_window__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_join_to_time_spine_node_with_offset_window__plan0_optimized.sql
index cb1797bad8..61bc9299ec 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_join_to_time_spine_node_with_offset_window__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_join_to_time_spine_node_with_offset_window__plan0_optimized.sql
@@ -25,7 +25,7 @@ INNER JOIN (
DATE_TRUNC('day', ds) AS metric_time__day
, listing_id AS listing
, SUM(booking_value) AS booking_value
- FROM ***************************.fct_bookings bookings_source_src_28001
+ FROM ***************************.fct_bookings bookings_source_src_28000
GROUP BY
DATE_TRUNC('day', ds)
, listing_id
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_join_to_time_spine_node_without_offset__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_join_to_time_spine_node_without_offset__plan0.sql
index 0b5d978d3f..43273b80a2 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_join_to_time_spine_node_without_offset__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_join_to_time_spine_node_without_offset__plan0.sql
@@ -134,93 +134,93 @@ INNER JOIN (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
) subq_1
) subq_2
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_join_to_time_spine_node_without_offset__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_join_to_time_spine_node_without_offset__plan0_optimized.sql
index 695cf9c062..e4f47734b0 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_join_to_time_spine_node_without_offset__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_join_to_time_spine_node_without_offset__plan0_optimized.sql
@@ -25,7 +25,7 @@ INNER JOIN (
DATE_TRUNC('day', ds) AS metric_time__day
, listing_id AS listing
, SUM(booking_value) AS booking_value
- FROM ***************************.fct_bookings bookings_source_src_28001
+ FROM ***************************.fct_bookings bookings_source_src_28000
GROUP BY
DATE_TRUNC('day', ds)
, listing_id
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_measure_aggregation_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_measure_aggregation_node__plan0.sql
index 3e74cf958d..1f8d370137 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_measure_aggregation_node__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_measure_aggregation_node__plan0.sql
@@ -16,92 +16,92 @@ FROM (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
) subq_1
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_measure_aggregation_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_measure_aggregation_node__plan0_optimized.sql
index 64fc2826b9..6e5528a6c9 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_measure_aggregation_node__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_measure_aggregation_node__plan0_optimized.sql
@@ -6,4 +6,4 @@ SELECT
, SUM(CASE WHEN is_instant THEN 1 ELSE 0 END) AS instant_bookings
, COUNT(DISTINCT guest_id) AS bookers
, AVG(booking_value) AS average_booking_value
-FROM ***************************.fct_bookings bookings_source_src_28001
+FROM ***************************.fct_bookings bookings_source_src_28000
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_multi_join_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_multi_join_node__plan0.sql
index 7b8e8ed9ed..4e470ff794 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_multi_join_node__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_multi_join_node__plan0.sql
@@ -14,93 +14,93 @@ FROM (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
) subq_1
LEFT OUTER JOIN (
@@ -112,62 +112,62 @@ LEFT OUTER JOIN (
-- Read Elements From Semantic Model 'listings_latest'
SELECT
1 AS listings
- , listings_latest_src_28005.capacity AS largest_listing
- , listings_latest_src_28005.capacity AS smallest_listing
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day
- , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day
- , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy
- , listings_latest_src_28005.country AS country_latest
- , listings_latest_src_28005.is_lux AS is_lux_latest
- , listings_latest_src_28005.capacity AS capacity_latest
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day
- , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day
- , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy
- , listings_latest_src_28005.country AS listing__country_latest
- , listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , listings_latest_src_28005.capacity AS listing__capacity_latest
- , listings_latest_src_28005.listing_id AS listing
- , listings_latest_src_28005.user_id AS user
- , listings_latest_src_28005.user_id AS listing__user
- FROM ***************************.dim_listings_latest listings_latest_src_28005
+ , listings_latest_src_28000.capacity AS largest_listing
+ , listings_latest_src_28000.capacity AS smallest_listing
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(dayofweekiso FROM listings_latest_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS created_at__extract_day
+ , EXTRACT(dayofweekiso FROM listings_latest_src_28000.created_at) AS created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS created_at__extract_doy
+ , 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('day', listings_latest_src_28000.created_at) AS listing__ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(dayofweekiso FROM listings_latest_src_28000.created_at) AS listing__ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS listing__created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_day
+ , EXTRACT(dayofweekiso FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_doy
+ , listings_latest_src_28000.country AS listing__country_latest
+ , listings_latest_src_28000.is_lux AS listing__is_lux_latest
+ , listings_latest_src_28000.capacity AS listing__capacity_latest
+ , listings_latest_src_28000.listing_id AS listing
+ , listings_latest_src_28000.user_id AS user
+ , listings_latest_src_28000.user_id AS listing__user
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
) subq_2
) subq_3
ON
@@ -181,62 +181,62 @@ LEFT OUTER JOIN (
-- Read Elements From Semantic Model 'listings_latest'
SELECT
1 AS listings
- , listings_latest_src_28005.capacity AS largest_listing
- , listings_latest_src_28005.capacity AS smallest_listing
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day
- , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day
- , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy
- , listings_latest_src_28005.country AS country_latest
- , listings_latest_src_28005.is_lux AS is_lux_latest
- , listings_latest_src_28005.capacity AS capacity_latest
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day
- , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day
- , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy
- , listings_latest_src_28005.country AS listing__country_latest
- , listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , listings_latest_src_28005.capacity AS listing__capacity_latest
- , listings_latest_src_28005.listing_id AS listing
- , listings_latest_src_28005.user_id AS user
- , listings_latest_src_28005.user_id AS listing__user
- FROM ***************************.dim_listings_latest listings_latest_src_28005
+ , listings_latest_src_28000.capacity AS largest_listing
+ , listings_latest_src_28000.capacity AS smallest_listing
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(dayofweekiso FROM listings_latest_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS created_at__extract_day
+ , EXTRACT(dayofweekiso FROM listings_latest_src_28000.created_at) AS created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS created_at__extract_doy
+ , 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('day', listings_latest_src_28000.created_at) AS listing__ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(dayofweekiso FROM listings_latest_src_28000.created_at) AS listing__ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS listing__created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_day
+ , EXTRACT(dayofweekiso FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_doy
+ , listings_latest_src_28000.country AS listing__country_latest
+ , listings_latest_src_28000.is_lux AS listing__is_lux_latest
+ , listings_latest_src_28000.capacity AS listing__capacity_latest
+ , listings_latest_src_28000.listing_id AS listing
+ , listings_latest_src_28000.user_id AS user
+ , listings_latest_src_28000.user_id AS listing__user
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
) subq_4
) subq_5
ON
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_multi_join_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_multi_join_node__plan0_optimized.sql
index b9cecc48d8..7d9c669f54 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_multi_join_node__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_multi_join_node__plan0_optimized.sql
@@ -10,7 +10,7 @@ FROM (
SELECT
listing_id AS listing
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_7
LEFT OUTER JOIN (
-- Read Elements From Semantic Model 'listings_latest'
@@ -18,7 +18,7 @@ LEFT OUTER JOIN (
SELECT
listing_id AS listing
, country AS country_latest
- FROM ***************************.dim_listings_latest listings_latest_src_28005
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
) subq_9
ON
subq_7.listing = subq_9.listing
@@ -28,7 +28,7 @@ LEFT OUTER JOIN (
SELECT
listing_id AS listing
, country AS country_latest
- FROM ***************************.dim_listings_latest listings_latest_src_28005
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
) subq_11
ON
subq_7.listing = subq_11.listing
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_order_by_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_order_by_node__plan0.sql
index 645d50b2fc..3f77093112 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_order_by_node__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_order_by_node__plan0.sql
@@ -26,93 +26,93 @@ FROM (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
) subq_1
GROUP BY
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_order_by_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_order_by_node__plan0_optimized.sql
index fd8a1ff597..bcebfe9d5f 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_order_by_node__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_order_by_node__plan0_optimized.sql
@@ -12,7 +12,7 @@ FROM (
DATE_TRUNC('day', ds) AS ds__day
, is_instant
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_5
GROUP BY
ds__day
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_single_join_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_single_join_node__plan0.sql
index 53a5b7f6bd..c8bcda4fe4 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_single_join_node__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_single_join_node__plan0.sql
@@ -12,93 +12,93 @@ FROM (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
) subq_1
LEFT OUTER JOIN (
@@ -110,62 +110,62 @@ LEFT OUTER JOIN (
-- Read Elements From Semantic Model 'listings_latest'
SELECT
1 AS listings
- , listings_latest_src_28005.capacity AS largest_listing
- , listings_latest_src_28005.capacity AS smallest_listing
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day
- , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day
- , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy
- , listings_latest_src_28005.country AS country_latest
- , listings_latest_src_28005.is_lux AS is_lux_latest
- , listings_latest_src_28005.capacity AS capacity_latest
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day
- , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day
- , EXTRACT(dayofweekiso FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy
- , listings_latest_src_28005.country AS listing__country_latest
- , listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , listings_latest_src_28005.capacity AS listing__capacity_latest
- , listings_latest_src_28005.listing_id AS listing
- , listings_latest_src_28005.user_id AS user
- , listings_latest_src_28005.user_id AS listing__user
- FROM ***************************.dim_listings_latest listings_latest_src_28005
+ , listings_latest_src_28000.capacity AS largest_listing
+ , listings_latest_src_28000.capacity AS smallest_listing
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(dayofweekiso FROM listings_latest_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS created_at__extract_day
+ , EXTRACT(dayofweekiso FROM listings_latest_src_28000.created_at) AS created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS created_at__extract_doy
+ , 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('day', listings_latest_src_28000.created_at) AS listing__ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(dayofweekiso FROM listings_latest_src_28000.created_at) AS listing__ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS listing__created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_day
+ , EXTRACT(dayofweekiso FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_doy
+ , listings_latest_src_28000.country AS listing__country_latest
+ , listings_latest_src_28000.is_lux AS listing__is_lux_latest
+ , listings_latest_src_28000.capacity AS listing__capacity_latest
+ , listings_latest_src_28000.listing_id AS listing
+ , listings_latest_src_28000.user_id AS user
+ , listings_latest_src_28000.user_id AS listing__user
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
) subq_2
) subq_3
ON
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_single_join_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_single_join_node__plan0_optimized.sql
index e03ffcce64..a1cd7ac335 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_single_join_node__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_single_join_node__plan0_optimized.sql
@@ -8,9 +8,9 @@ FROM (
SELECT
listing_id AS listing
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_5
LEFT OUTER JOIN
- ***************************.dim_listings_latest listings_latest_src_28005
+ ***************************.dim_listings_latest listings_latest_src_28000
ON
- subq_5.listing = listings_latest_src_28005.listing_id
+ subq_5.listing = listings_latest_src_28000.listing_id
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_source_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_source_node__plan0.sql
index 46563afc1f..b748a7e6cd 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_source_node__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_source_node__plan0.sql
@@ -2,90 +2,90 @@
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(dayofweekiso FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
-FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(dayofweekiso FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+FROM ***************************.fct_bookings bookings_source_src_28000
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_source_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_source_node__plan0_optimized.sql
index f82aa0eaaf..69c345901c 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_source_node__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Snowflake/test_source_node__plan0_optimized.sql
@@ -88,4 +88,4 @@ SELECT
, listing_id AS booking__listing
, guest_id AS booking__guest
, host_id AS booking__host
-FROM ***************************.fct_bookings bookings_source_src_28001
+FROM ***************************.fct_bookings bookings_source_src_28000
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_combine_output_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_combine_output_node__plan0.sql
index a276e77024..f999c0a475 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_combine_output_node__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_combine_output_node__plan0.sql
@@ -19,93 +19,93 @@ FROM (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
) subq_1
GROUP BY
@@ -128,93 +128,93 @@ FULL OUTER JOIN (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_3
) subq_4
GROUP BY
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_combine_output_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_combine_output_node__plan0_optimized.sql
index a8375510d7..ad81788114 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_combine_output_node__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_combine_output_node__plan0_optimized.sql
@@ -15,7 +15,7 @@ FROM (
SELECT
is_instant
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_7
GROUP BY
is_instant
@@ -33,7 +33,7 @@ FULL OUTER JOIN (
is_instant
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
, guest_id AS bookers
- FROM ***************************.fct_bookings bookings_source_src_28001
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_10
GROUP BY
is_instant
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_compute_metrics_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_compute_metrics_node__plan0.sql
index 36c720c533..169a72688a 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_compute_metrics_node__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_compute_metrics_node__plan0.sql
@@ -25,93 +25,93 @@ FROM (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
) subq_1
LEFT OUTER JOIN (
@@ -123,62 +123,62 @@ FROM (
-- Read Elements From Semantic Model 'listings_latest'
SELECT
1 AS listings
- , listings_latest_src_28005.capacity AS largest_listing
- , listings_latest_src_28005.capacity AS smallest_listing
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day
- , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy
- , listings_latest_src_28005.country AS country_latest
- , listings_latest_src_28005.is_lux AS is_lux_latest
- , listings_latest_src_28005.capacity AS capacity_latest
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day
- , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy
- , listings_latest_src_28005.country AS listing__country_latest
- , listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , listings_latest_src_28005.capacity AS listing__capacity_latest
- , listings_latest_src_28005.listing_id AS listing
- , listings_latest_src_28005.user_id AS user
- , listings_latest_src_28005.user_id AS listing__user
- FROM ***************************.dim_listings_latest listings_latest_src_28005
+ , listings_latest_src_28000.capacity AS largest_listing
+ , listings_latest_src_28000.capacity AS smallest_listing
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS created_at__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28000.created_at) AS created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS created_at__extract_doy
+ , 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('day', listings_latest_src_28000.created_at) AS listing__ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28000.created_at) AS listing__ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS listing__created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_doy
+ , listings_latest_src_28000.country AS listing__country_latest
+ , listings_latest_src_28000.is_lux AS listing__is_lux_latest
+ , listings_latest_src_28000.capacity AS listing__capacity_latest
+ , listings_latest_src_28000.listing_id AS listing
+ , listings_latest_src_28000.user_id AS user
+ , listings_latest_src_28000.user_id AS listing__user
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
) subq_2
) subq_3
ON
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_compute_metrics_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_compute_metrics_node__plan0_optimized.sql
index cf47afc6bf..5ebe7177e8 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_compute_metrics_node__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_compute_metrics_node__plan0_optimized.sql
@@ -3,7 +3,7 @@
-- Compute Metrics via Expressions
SELECT
subq_7.listing AS listing
- , listings_latest_src_28005.country AS listing__country_latest
+ , listings_latest_src_28000.country AS listing__country_latest
, SUM(subq_7.bookings) AS bookings
FROM (
-- Read Elements From Semantic Model 'bookings_source'
@@ -11,12 +11,12 @@ FROM (
SELECT
listing_id AS listing
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_7
LEFT OUTER JOIN
- ***************************.dim_listings_latest listings_latest_src_28005
+ ***************************.dim_listings_latest listings_latest_src_28000
ON
- subq_7.listing = listings_latest_src_28005.listing_id
+ subq_7.listing = listings_latest_src_28000.listing_id
GROUP BY
subq_7.listing
- , listings_latest_src_28005.country
+ , listings_latest_src_28000.country
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.sql
index 1b65412a32..e1b1aefa43 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.sql
@@ -1,693 +1,693 @@
-- Compute Metrics via Expressions
SELECT
- subq_20.ds__day
- , subq_20.listing__country_latest
- , CAST(subq_20.bookings AS DOUBLE) / CAST(NULLIF(subq_20.views, 0) AS DOUBLE) AS bookings_per_view
+ subq_29.ds__day
+ , subq_29.listing__country_latest
+ , CAST(subq_29.bookings AS DOUBLE) / CAST(NULLIF(subq_29.views, 0) AS DOUBLE) AS bookings_per_view
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_9.ds__day, subq_19.ds__day) AS ds__day
- , COALESCE(subq_9.listing__country_latest, subq_19.listing__country_latest) AS listing__country_latest
- , MAX(subq_9.bookings) AS bookings
- , MAX(subq_19.views) AS views
+ COALESCE(subq_18.ds__day, subq_28.ds__day) AS ds__day
+ , COALESCE(subq_18.listing__country_latest, subq_28.listing__country_latest) AS listing__country_latest
+ , MAX(subq_18.bookings) AS bookings
+ , MAX(subq_28.views) AS views
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_8.ds__day
- , subq_8.listing__country_latest
- , subq_8.bookings
+ subq_17.ds__day
+ , subq_17.listing__country_latest
+ , subq_17.bookings
FROM (
-- Aggregate Measures
SELECT
- subq_7.ds__day
- , subq_7.listing__country_latest
- , SUM(subq_7.bookings) AS bookings
+ subq_16.ds__day
+ , subq_16.listing__country_latest
+ , SUM(subq_16.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'listing__country_latest', 'ds__day']
SELECT
- subq_6.ds__day
- , subq_6.listing__country_latest
- , subq_6.bookings
+ subq_15.ds__day
+ , subq_15.listing__country_latest
+ , subq_15.bookings
FROM (
-- Join Standard Outputs
SELECT
- subq_2.ds__day AS ds__day
- , subq_2.listing AS listing
- , subq_5.country_latest AS listing__country_latest
- , subq_2.bookings AS bookings
+ subq_11.ds__day AS ds__day
+ , subq_11.listing AS listing
+ , subq_14.country_latest AS listing__country_latest
+ , subq_11.bookings AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'ds__day', 'listing']
SELECT
- subq_1.ds__day
- , subq_1.listing
- , subq_1.bookings
+ subq_10.ds__day
+ , subq_10.listing
+ , subq_10.bookings
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
- ) subq_2
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
LEFT OUTER JOIN (
-- Pass Only Elements: ['country_latest', 'listing']
SELECT
- subq_4.listing
- , subq_4.country_latest
+ subq_13.listing
+ , subq_13.country_latest
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_3.ds__day
- , subq_3.ds__week
- , subq_3.ds__month
- , subq_3.ds__quarter
- , subq_3.ds__year
- , subq_3.ds__extract_year
- , subq_3.ds__extract_quarter
- , subq_3.ds__extract_month
- , subq_3.ds__extract_day
- , subq_3.ds__extract_dow
- , subq_3.ds__extract_doy
- , subq_3.created_at__day
- , subq_3.created_at__week
- , subq_3.created_at__month
- , subq_3.created_at__quarter
- , subq_3.created_at__year
- , subq_3.created_at__extract_year
- , subq_3.created_at__extract_quarter
- , subq_3.created_at__extract_month
- , subq_3.created_at__extract_day
- , subq_3.created_at__extract_dow
- , subq_3.created_at__extract_doy
- , subq_3.listing__ds__day
- , subq_3.listing__ds__week
- , subq_3.listing__ds__month
- , subq_3.listing__ds__quarter
- , subq_3.listing__ds__year
- , subq_3.listing__ds__extract_year
- , subq_3.listing__ds__extract_quarter
- , subq_3.listing__ds__extract_month
- , subq_3.listing__ds__extract_day
- , subq_3.listing__ds__extract_dow
- , subq_3.listing__ds__extract_doy
- , subq_3.listing__created_at__day
- , subq_3.listing__created_at__week
- , subq_3.listing__created_at__month
- , subq_3.listing__created_at__quarter
- , subq_3.listing__created_at__year
- , subq_3.listing__created_at__extract_year
- , subq_3.listing__created_at__extract_quarter
- , subq_3.listing__created_at__extract_month
- , subq_3.listing__created_at__extract_day
- , subq_3.listing__created_at__extract_dow
- , subq_3.listing__created_at__extract_doy
- , subq_3.ds__day AS metric_time__day
- , subq_3.ds__week AS metric_time__week
- , subq_3.ds__month AS metric_time__month
- , subq_3.ds__quarter AS metric_time__quarter
- , subq_3.ds__year AS metric_time__year
- , subq_3.ds__extract_year AS metric_time__extract_year
- , subq_3.ds__extract_quarter AS metric_time__extract_quarter
- , subq_3.ds__extract_month AS metric_time__extract_month
- , subq_3.ds__extract_day AS metric_time__extract_day
- , subq_3.ds__extract_dow AS metric_time__extract_dow
- , subq_3.ds__extract_doy AS metric_time__extract_doy
- , subq_3.listing
- , subq_3.user
- , subq_3.listing__user
- , subq_3.country_latest
- , subq_3.is_lux_latest
- , subq_3.capacity_latest
- , subq_3.listing__country_latest
- , subq_3.listing__is_lux_latest
- , subq_3.listing__capacity_latest
- , subq_3.listings
- , subq_3.largest_listing
- , subq_3.smallest_listing
+ subq_12.ds__day
+ , subq_12.ds__week
+ , subq_12.ds__month
+ , subq_12.ds__quarter
+ , subq_12.ds__year
+ , subq_12.ds__extract_year
+ , subq_12.ds__extract_quarter
+ , subq_12.ds__extract_month
+ , subq_12.ds__extract_day
+ , subq_12.ds__extract_dow
+ , subq_12.ds__extract_doy
+ , subq_12.created_at__day
+ , subq_12.created_at__week
+ , subq_12.created_at__month
+ , subq_12.created_at__quarter
+ , subq_12.created_at__year
+ , subq_12.created_at__extract_year
+ , subq_12.created_at__extract_quarter
+ , subq_12.created_at__extract_month
+ , subq_12.created_at__extract_day
+ , subq_12.created_at__extract_dow
+ , subq_12.created_at__extract_doy
+ , subq_12.listing__ds__day
+ , subq_12.listing__ds__week
+ , subq_12.listing__ds__month
+ , subq_12.listing__ds__quarter
+ , subq_12.listing__ds__year
+ , subq_12.listing__ds__extract_year
+ , subq_12.listing__ds__extract_quarter
+ , subq_12.listing__ds__extract_month
+ , subq_12.listing__ds__extract_day
+ , subq_12.listing__ds__extract_dow
+ , subq_12.listing__ds__extract_doy
+ , subq_12.listing__created_at__day
+ , subq_12.listing__created_at__week
+ , subq_12.listing__created_at__month
+ , subq_12.listing__created_at__quarter
+ , subq_12.listing__created_at__year
+ , subq_12.listing__created_at__extract_year
+ , subq_12.listing__created_at__extract_quarter
+ , subq_12.listing__created_at__extract_month
+ , subq_12.listing__created_at__extract_day
+ , subq_12.listing__created_at__extract_dow
+ , subq_12.listing__created_at__extract_doy
+ , subq_12.ds__day AS metric_time__day
+ , subq_12.ds__week AS metric_time__week
+ , subq_12.ds__month AS metric_time__month
+ , subq_12.ds__quarter AS metric_time__quarter
+ , subq_12.ds__year AS metric_time__year
+ , subq_12.ds__extract_year AS metric_time__extract_year
+ , subq_12.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_12.ds__extract_month AS metric_time__extract_month
+ , subq_12.ds__extract_day AS metric_time__extract_day
+ , subq_12.ds__extract_dow AS metric_time__extract_dow
+ , subq_12.ds__extract_doy AS metric_time__extract_doy
+ , subq_12.listing
+ , subq_12.user
+ , subq_12.listing__user
+ , subq_12.country_latest
+ , subq_12.is_lux_latest
+ , subq_12.capacity_latest
+ , subq_12.listing__country_latest
+ , subq_12.listing__is_lux_latest
+ , subq_12.listing__capacity_latest
+ , subq_12.listings
+ , subq_12.largest_listing
+ , subq_12.smallest_listing
FROM (
-- Read Elements From Semantic Model 'listings_latest'
SELECT
1 AS listings
- , listings_latest_src_28005.capacity AS largest_listing
- , listings_latest_src_28005.capacity AS smallest_listing
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day
- , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy
- , listings_latest_src_28005.country AS country_latest
- , listings_latest_src_28005.is_lux AS is_lux_latest
- , listings_latest_src_28005.capacity AS capacity_latest
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day
- , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy
- , listings_latest_src_28005.country AS listing__country_latest
- , listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , listings_latest_src_28005.capacity AS listing__capacity_latest
- , listings_latest_src_28005.listing_id AS listing
- , listings_latest_src_28005.user_id AS user
- , listings_latest_src_28005.user_id AS listing__user
- FROM ***************************.dim_listings_latest listings_latest_src_28005
- ) subq_3
- ) subq_4
- ) subq_5
+ , listings_latest_src_28000.capacity AS largest_listing
+ , listings_latest_src_28000.capacity AS smallest_listing
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS created_at__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28000.created_at) AS created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS created_at__extract_doy
+ , 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('day', listings_latest_src_28000.created_at) AS listing__ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28000.created_at) AS listing__ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS listing__created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_doy
+ , listings_latest_src_28000.country AS listing__country_latest
+ , listings_latest_src_28000.is_lux AS listing__is_lux_latest
+ , listings_latest_src_28000.capacity AS listing__capacity_latest
+ , listings_latest_src_28000.listing_id AS listing
+ , listings_latest_src_28000.user_id AS user
+ , listings_latest_src_28000.user_id AS listing__user
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
+ ) subq_12
+ ) subq_13
+ ) subq_14
ON
- subq_2.listing = subq_5.listing
- ) subq_6
- ) subq_7
+ subq_11.listing = subq_14.listing
+ ) subq_15
+ ) subq_16
GROUP BY
- subq_7.ds__day
- , subq_7.listing__country_latest
- ) subq_8
- ) subq_9
+ subq_16.ds__day
+ , subq_16.listing__country_latest
+ ) subq_17
+ ) subq_18
FULL OUTER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_18.ds__day
- , subq_18.listing__country_latest
- , subq_18.views
+ subq_27.ds__day
+ , subq_27.listing__country_latest
+ , subq_27.views
FROM (
-- Aggregate Measures
SELECT
- subq_17.ds__day
- , subq_17.listing__country_latest
- , SUM(subq_17.views) AS views
+ subq_26.ds__day
+ , subq_26.listing__country_latest
+ , SUM(subq_26.views) AS views
FROM (
-- Pass Only Elements: ['views', 'listing__country_latest', 'ds__day']
SELECT
- subq_16.ds__day
- , subq_16.listing__country_latest
- , subq_16.views
+ subq_25.ds__day
+ , subq_25.listing__country_latest
+ , subq_25.views
FROM (
-- Join Standard Outputs
SELECT
- subq_12.ds__day AS ds__day
- , subq_12.listing AS listing
- , subq_15.country_latest AS listing__country_latest
- , subq_12.views AS views
+ subq_21.ds__day AS ds__day
+ , subq_21.listing AS listing
+ , subq_24.country_latest AS listing__country_latest
+ , subq_21.views AS views
FROM (
-- Pass Only Elements: ['views', 'ds__day', 'listing']
SELECT
- subq_11.ds__day
- , subq_11.listing
- , subq_11.views
+ subq_20.ds__day
+ , subq_20.listing
+ , subq_20.views
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_10.ds__day
- , subq_10.ds__week
- , subq_10.ds__month
- , subq_10.ds__quarter
- , subq_10.ds__year
- , subq_10.ds__extract_year
- , subq_10.ds__extract_quarter
- , subq_10.ds__extract_month
- , subq_10.ds__extract_day
- , subq_10.ds__extract_dow
- , subq_10.ds__extract_doy
- , subq_10.ds_partitioned__day
- , subq_10.ds_partitioned__week
- , subq_10.ds_partitioned__month
- , subq_10.ds_partitioned__quarter
- , subq_10.ds_partitioned__year
- , subq_10.ds_partitioned__extract_year
- , subq_10.ds_partitioned__extract_quarter
- , subq_10.ds_partitioned__extract_month
- , subq_10.ds_partitioned__extract_day
- , subq_10.ds_partitioned__extract_dow
- , subq_10.ds_partitioned__extract_doy
- , subq_10.view__ds__day
- , subq_10.view__ds__week
- , subq_10.view__ds__month
- , subq_10.view__ds__quarter
- , subq_10.view__ds__year
- , subq_10.view__ds__extract_year
- , subq_10.view__ds__extract_quarter
- , subq_10.view__ds__extract_month
- , subq_10.view__ds__extract_day
- , subq_10.view__ds__extract_dow
- , subq_10.view__ds__extract_doy
- , subq_10.view__ds_partitioned__day
- , subq_10.view__ds_partitioned__week
- , subq_10.view__ds_partitioned__month
- , subq_10.view__ds_partitioned__quarter
- , subq_10.view__ds_partitioned__year
- , subq_10.view__ds_partitioned__extract_year
- , subq_10.view__ds_partitioned__extract_quarter
- , subq_10.view__ds_partitioned__extract_month
- , subq_10.view__ds_partitioned__extract_day
- , subq_10.view__ds_partitioned__extract_dow
- , subq_10.view__ds_partitioned__extract_doy
- , subq_10.ds__day AS metric_time__day
- , subq_10.ds__week AS metric_time__week
- , subq_10.ds__month AS metric_time__month
- , subq_10.ds__quarter AS metric_time__quarter
- , subq_10.ds__year AS metric_time__year
- , subq_10.ds__extract_year AS metric_time__extract_year
- , subq_10.ds__extract_quarter AS metric_time__extract_quarter
- , subq_10.ds__extract_month AS metric_time__extract_month
- , subq_10.ds__extract_day AS metric_time__extract_day
- , subq_10.ds__extract_dow AS metric_time__extract_dow
- , subq_10.ds__extract_doy AS metric_time__extract_doy
- , subq_10.listing
- , subq_10.user
- , subq_10.view__listing
- , subq_10.view__user
- , subq_10.views
+ subq_19.ds__day
+ , subq_19.ds__week
+ , subq_19.ds__month
+ , subq_19.ds__quarter
+ , subq_19.ds__year
+ , subq_19.ds__extract_year
+ , subq_19.ds__extract_quarter
+ , subq_19.ds__extract_month
+ , subq_19.ds__extract_day
+ , subq_19.ds__extract_dow
+ , subq_19.ds__extract_doy
+ , subq_19.ds_partitioned__day
+ , subq_19.ds_partitioned__week
+ , subq_19.ds_partitioned__month
+ , subq_19.ds_partitioned__quarter
+ , subq_19.ds_partitioned__year
+ , subq_19.ds_partitioned__extract_year
+ , subq_19.ds_partitioned__extract_quarter
+ , subq_19.ds_partitioned__extract_month
+ , subq_19.ds_partitioned__extract_day
+ , subq_19.ds_partitioned__extract_dow
+ , subq_19.ds_partitioned__extract_doy
+ , subq_19.view__ds__day
+ , subq_19.view__ds__week
+ , subq_19.view__ds__month
+ , subq_19.view__ds__quarter
+ , subq_19.view__ds__year
+ , subq_19.view__ds__extract_year
+ , subq_19.view__ds__extract_quarter
+ , subq_19.view__ds__extract_month
+ , subq_19.view__ds__extract_day
+ , subq_19.view__ds__extract_dow
+ , subq_19.view__ds__extract_doy
+ , subq_19.view__ds_partitioned__day
+ , subq_19.view__ds_partitioned__week
+ , subq_19.view__ds_partitioned__month
+ , subq_19.view__ds_partitioned__quarter
+ , subq_19.view__ds_partitioned__year
+ , subq_19.view__ds_partitioned__extract_year
+ , subq_19.view__ds_partitioned__extract_quarter
+ , subq_19.view__ds_partitioned__extract_month
+ , subq_19.view__ds_partitioned__extract_day
+ , subq_19.view__ds_partitioned__extract_dow
+ , subq_19.view__ds_partitioned__extract_doy
+ , subq_19.ds__day AS metric_time__day
+ , subq_19.ds__week AS metric_time__week
+ , subq_19.ds__month AS metric_time__month
+ , subq_19.ds__quarter AS metric_time__quarter
+ , subq_19.ds__year AS metric_time__year
+ , subq_19.ds__extract_year AS metric_time__extract_year
+ , subq_19.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_19.ds__extract_month AS metric_time__extract_month
+ , subq_19.ds__extract_day AS metric_time__extract_day
+ , subq_19.ds__extract_dow AS metric_time__extract_dow
+ , subq_19.ds__extract_doy AS metric_time__extract_doy
+ , subq_19.listing
+ , subq_19.user
+ , subq_19.view__listing
+ , subq_19.view__user
+ , subq_19.views
FROM (
-- Read Elements From Semantic Model 'views_source'
SELECT
1 AS views
- , DATE_TRUNC('day', views_source_src_28010.ds) AS ds__day
- , DATE_TRUNC('week', views_source_src_28010.ds) AS ds__week
- , DATE_TRUNC('month', views_source_src_28010.ds) AS ds__month
- , DATE_TRUNC('quarter', views_source_src_28010.ds) AS ds__quarter
- , DATE_TRUNC('year', views_source_src_28010.ds) AS ds__year
- , EXTRACT(year FROM views_source_src_28010.ds) AS ds__extract_year
- , EXTRACT(quarter FROM views_source_src_28010.ds) AS ds__extract_quarter
- , EXTRACT(month FROM views_source_src_28010.ds) AS ds__extract_month
- , EXTRACT(day FROM views_source_src_28010.ds) AS ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM views_source_src_28010.ds) AS ds__extract_dow
- , EXTRACT(doy FROM views_source_src_28010.ds) AS ds__extract_doy
- , DATE_TRUNC('day', views_source_src_28010.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', views_source_src_28010.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', views_source_src_28010.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', views_source_src_28010.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', views_source_src_28010.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM views_source_src_28010.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM views_source_src_28010.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM views_source_src_28010.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM views_source_src_28010.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(DAY_OF_WEEK FROM views_source_src_28010.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM views_source_src_28010.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', views_source_src_28010.ds) AS view__ds__day
- , DATE_TRUNC('week', views_source_src_28010.ds) AS view__ds__week
- , DATE_TRUNC('month', views_source_src_28010.ds) AS view__ds__month
- , DATE_TRUNC('quarter', views_source_src_28010.ds) AS view__ds__quarter
- , DATE_TRUNC('year', views_source_src_28010.ds) AS view__ds__year
- , EXTRACT(year FROM views_source_src_28010.ds) AS view__ds__extract_year
- , EXTRACT(quarter FROM views_source_src_28010.ds) AS view__ds__extract_quarter
- , EXTRACT(month FROM views_source_src_28010.ds) AS view__ds__extract_month
- , EXTRACT(day FROM views_source_src_28010.ds) AS view__ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM views_source_src_28010.ds) AS view__ds__extract_dow
- , EXTRACT(doy FROM views_source_src_28010.ds) AS view__ds__extract_doy
- , DATE_TRUNC('day', views_source_src_28010.ds_partitioned) AS view__ds_partitioned__day
- , DATE_TRUNC('week', views_source_src_28010.ds_partitioned) AS view__ds_partitioned__week
- , DATE_TRUNC('month', views_source_src_28010.ds_partitioned) AS view__ds_partitioned__month
- , DATE_TRUNC('quarter', views_source_src_28010.ds_partitioned) AS view__ds_partitioned__quarter
- , DATE_TRUNC('year', views_source_src_28010.ds_partitioned) AS view__ds_partitioned__year
- , EXTRACT(year FROM views_source_src_28010.ds_partitioned) AS view__ds_partitioned__extract_year
- , EXTRACT(quarter FROM views_source_src_28010.ds_partitioned) AS view__ds_partitioned__extract_quarter
- , EXTRACT(month FROM views_source_src_28010.ds_partitioned) AS view__ds_partitioned__extract_month
- , EXTRACT(day FROM views_source_src_28010.ds_partitioned) AS view__ds_partitioned__extract_day
- , EXTRACT(DAY_OF_WEEK FROM views_source_src_28010.ds_partitioned) AS view__ds_partitioned__extract_dow
- , EXTRACT(doy FROM views_source_src_28010.ds_partitioned) AS view__ds_partitioned__extract_doy
- , views_source_src_28010.listing_id AS listing
- , views_source_src_28010.user_id AS user
- , views_source_src_28010.listing_id AS view__listing
- , views_source_src_28010.user_id AS view__user
- FROM ***************************.fct_views views_source_src_28010
- ) subq_10
- ) subq_11
- ) subq_12
+ , DATE_TRUNC('day', views_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', views_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', views_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', views_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', views_source_src_28000.ds) 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
+ , EXTRACT(DAY_OF_WEEK FROM views_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM views_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', views_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', views_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', views_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', views_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', views_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAY_OF_WEEK FROM views_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM views_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', views_source_src_28000.ds) AS view__ds__day
+ , DATE_TRUNC('week', views_source_src_28000.ds) AS view__ds__week
+ , DATE_TRUNC('month', views_source_src_28000.ds) AS view__ds__month
+ , DATE_TRUNC('quarter', views_source_src_28000.ds) AS view__ds__quarter
+ , DATE_TRUNC('year', views_source_src_28000.ds) 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
+ , EXTRACT(DAY_OF_WEEK FROM views_source_src_28000.ds) AS view__ds__extract_dow
+ , EXTRACT(doy FROM views_source_src_28000.ds) AS view__ds__extract_doy
+ , DATE_TRUNC('day', views_source_src_28000.ds_partitioned) AS view__ds_partitioned__day
+ , DATE_TRUNC('week', views_source_src_28000.ds_partitioned) AS view__ds_partitioned__week
+ , DATE_TRUNC('month', views_source_src_28000.ds_partitioned) AS view__ds_partitioned__month
+ , DATE_TRUNC('quarter', views_source_src_28000.ds_partitioned) AS view__ds_partitioned__quarter
+ , DATE_TRUNC('year', views_source_src_28000.ds_partitioned) 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
+ , EXTRACT(day FROM views_source_src_28000.ds_partitioned) AS view__ds_partitioned__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM views_source_src_28000.ds_partitioned) AS view__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM views_source_src_28000.ds_partitioned) AS view__ds_partitioned__extract_doy
+ , views_source_src_28000.listing_id AS listing
+ , views_source_src_28000.user_id AS user
+ , views_source_src_28000.listing_id AS view__listing
+ , views_source_src_28000.user_id AS view__user
+ FROM ***************************.fct_views views_source_src_28000
+ ) subq_19
+ ) subq_20
+ ) subq_21
LEFT OUTER JOIN (
-- Pass Only Elements: ['country_latest', 'listing']
SELECT
- subq_14.listing
- , subq_14.country_latest
+ subq_23.listing
+ , subq_23.country_latest
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_13.ds__day
- , subq_13.ds__week
- , subq_13.ds__month
- , subq_13.ds__quarter
- , subq_13.ds__year
- , subq_13.ds__extract_year
- , subq_13.ds__extract_quarter
- , subq_13.ds__extract_month
- , subq_13.ds__extract_day
- , subq_13.ds__extract_dow
- , subq_13.ds__extract_doy
- , subq_13.created_at__day
- , subq_13.created_at__week
- , subq_13.created_at__month
- , subq_13.created_at__quarter
- , subq_13.created_at__year
- , subq_13.created_at__extract_year
- , subq_13.created_at__extract_quarter
- , subq_13.created_at__extract_month
- , subq_13.created_at__extract_day
- , subq_13.created_at__extract_dow
- , subq_13.created_at__extract_doy
- , subq_13.listing__ds__day
- , subq_13.listing__ds__week
- , subq_13.listing__ds__month
- , subq_13.listing__ds__quarter
- , subq_13.listing__ds__year
- , subq_13.listing__ds__extract_year
- , subq_13.listing__ds__extract_quarter
- , subq_13.listing__ds__extract_month
- , subq_13.listing__ds__extract_day
- , subq_13.listing__ds__extract_dow
- , subq_13.listing__ds__extract_doy
- , subq_13.listing__created_at__day
- , subq_13.listing__created_at__week
- , subq_13.listing__created_at__month
- , subq_13.listing__created_at__quarter
- , subq_13.listing__created_at__year
- , subq_13.listing__created_at__extract_year
- , subq_13.listing__created_at__extract_quarter
- , subq_13.listing__created_at__extract_month
- , subq_13.listing__created_at__extract_day
- , subq_13.listing__created_at__extract_dow
- , subq_13.listing__created_at__extract_doy
- , subq_13.ds__day AS metric_time__day
- , subq_13.ds__week AS metric_time__week
- , subq_13.ds__month AS metric_time__month
- , subq_13.ds__quarter AS metric_time__quarter
- , subq_13.ds__year AS metric_time__year
- , subq_13.ds__extract_year AS metric_time__extract_year
- , subq_13.ds__extract_quarter AS metric_time__extract_quarter
- , subq_13.ds__extract_month AS metric_time__extract_month
- , subq_13.ds__extract_day AS metric_time__extract_day
- , subq_13.ds__extract_dow AS metric_time__extract_dow
- , subq_13.ds__extract_doy AS metric_time__extract_doy
- , subq_13.listing
- , subq_13.user
- , subq_13.listing__user
- , subq_13.country_latest
- , subq_13.is_lux_latest
- , subq_13.capacity_latest
- , subq_13.listing__country_latest
- , subq_13.listing__is_lux_latest
- , subq_13.listing__capacity_latest
- , subq_13.listings
- , subq_13.largest_listing
- , subq_13.smallest_listing
+ subq_22.ds__day
+ , subq_22.ds__week
+ , subq_22.ds__month
+ , subq_22.ds__quarter
+ , subq_22.ds__year
+ , subq_22.ds__extract_year
+ , subq_22.ds__extract_quarter
+ , subq_22.ds__extract_month
+ , subq_22.ds__extract_day
+ , subq_22.ds__extract_dow
+ , subq_22.ds__extract_doy
+ , subq_22.created_at__day
+ , subq_22.created_at__week
+ , subq_22.created_at__month
+ , subq_22.created_at__quarter
+ , subq_22.created_at__year
+ , subq_22.created_at__extract_year
+ , subq_22.created_at__extract_quarter
+ , subq_22.created_at__extract_month
+ , subq_22.created_at__extract_day
+ , subq_22.created_at__extract_dow
+ , subq_22.created_at__extract_doy
+ , subq_22.listing__ds__day
+ , subq_22.listing__ds__week
+ , subq_22.listing__ds__month
+ , subq_22.listing__ds__quarter
+ , subq_22.listing__ds__year
+ , subq_22.listing__ds__extract_year
+ , subq_22.listing__ds__extract_quarter
+ , subq_22.listing__ds__extract_month
+ , subq_22.listing__ds__extract_day
+ , subq_22.listing__ds__extract_dow
+ , subq_22.listing__ds__extract_doy
+ , subq_22.listing__created_at__day
+ , subq_22.listing__created_at__week
+ , subq_22.listing__created_at__month
+ , subq_22.listing__created_at__quarter
+ , subq_22.listing__created_at__year
+ , subq_22.listing__created_at__extract_year
+ , subq_22.listing__created_at__extract_quarter
+ , subq_22.listing__created_at__extract_month
+ , subq_22.listing__created_at__extract_day
+ , subq_22.listing__created_at__extract_dow
+ , subq_22.listing__created_at__extract_doy
+ , subq_22.ds__day AS metric_time__day
+ , subq_22.ds__week AS metric_time__week
+ , subq_22.ds__month AS metric_time__month
+ , subq_22.ds__quarter AS metric_time__quarter
+ , subq_22.ds__year AS metric_time__year
+ , subq_22.ds__extract_year AS metric_time__extract_year
+ , subq_22.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_22.ds__extract_month AS metric_time__extract_month
+ , subq_22.ds__extract_day AS metric_time__extract_day
+ , subq_22.ds__extract_dow AS metric_time__extract_dow
+ , subq_22.ds__extract_doy AS metric_time__extract_doy
+ , subq_22.listing
+ , subq_22.user
+ , subq_22.listing__user
+ , subq_22.country_latest
+ , subq_22.is_lux_latest
+ , subq_22.capacity_latest
+ , subq_22.listing__country_latest
+ , subq_22.listing__is_lux_latest
+ , subq_22.listing__capacity_latest
+ , subq_22.listings
+ , subq_22.largest_listing
+ , subq_22.smallest_listing
FROM (
-- Read Elements From Semantic Model 'listings_latest'
SELECT
1 AS listings
- , listings_latest_src_28005.capacity AS largest_listing
- , listings_latest_src_28005.capacity AS smallest_listing
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day
- , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy
- , listings_latest_src_28005.country AS country_latest
- , listings_latest_src_28005.is_lux AS is_lux_latest
- , listings_latest_src_28005.capacity AS capacity_latest
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day
- , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy
- , listings_latest_src_28005.country AS listing__country_latest
- , listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , listings_latest_src_28005.capacity AS listing__capacity_latest
- , listings_latest_src_28005.listing_id AS listing
- , listings_latest_src_28005.user_id AS user
- , listings_latest_src_28005.user_id AS listing__user
- FROM ***************************.dim_listings_latest listings_latest_src_28005
- ) subq_13
- ) subq_14
- ) subq_15
+ , listings_latest_src_28000.capacity AS largest_listing
+ , listings_latest_src_28000.capacity AS smallest_listing
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS created_at__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28000.created_at) AS created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS created_at__extract_doy
+ , 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('day', listings_latest_src_28000.created_at) AS listing__ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28000.created_at) AS listing__ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS listing__created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_doy
+ , listings_latest_src_28000.country AS listing__country_latest
+ , listings_latest_src_28000.is_lux AS listing__is_lux_latest
+ , listings_latest_src_28000.capacity AS listing__capacity_latest
+ , listings_latest_src_28000.listing_id AS listing
+ , listings_latest_src_28000.user_id AS user
+ , listings_latest_src_28000.user_id AS listing__user
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
+ ) subq_22
+ ) subq_23
+ ) subq_24
ON
- subq_12.listing = subq_15.listing
- ) subq_16
- ) subq_17
+ subq_21.listing = subq_24.listing
+ ) subq_25
+ ) subq_26
GROUP BY
- subq_17.ds__day
- , subq_17.listing__country_latest
- ) subq_18
- ) subq_19
+ subq_26.ds__day
+ , subq_26.listing__country_latest
+ ) subq_27
+ ) subq_28
ON
(
- subq_9.listing__country_latest = subq_19.listing__country_latest
+ subq_18.listing__country_latest = subq_28.listing__country_latest
) AND (
- subq_9.ds__day = subq_19.ds__day
+ subq_18.ds__day = subq_28.ds__day
)
GROUP BY
- COALESCE(subq_9.ds__day, subq_19.ds__day)
- , COALESCE(subq_9.listing__country_latest, subq_19.listing__country_latest)
-) subq_20
+ COALESCE(subq_18.ds__day, subq_28.ds__day)
+ , COALESCE(subq_18.listing__country_latest, subq_28.listing__country_latest)
+) subq_29
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0_optimized.sql
index 5b65e65d85..75a09cbc63 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0_optimized.sql
@@ -6,19 +6,19 @@ SELECT
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_30.ds__day, subq_40.ds__day) AS ds__day
- , COALESCE(subq_30.listing__country_latest, subq_40.listing__country_latest) AS listing__country_latest
- , MAX(subq_30.bookings) AS bookings
- , MAX(subq_40.views) AS views
+ COALESCE(subq_39.ds__day, subq_49.ds__day) AS ds__day
+ , COALESCE(subq_39.listing__country_latest, subq_49.listing__country_latest) AS listing__country_latest
+ , MAX(subq_39.bookings) AS bookings
+ , MAX(subq_49.views) AS views
FROM (
-- Join Standard Outputs
-- Pass Only Elements: ['bookings', 'listing__country_latest', 'ds__day']
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_23.ds__day AS ds__day
- , listings_latest_src_28005.country AS listing__country_latest
- , SUM(subq_23.bookings) AS bookings
+ subq_32.ds__day AS ds__day
+ , listings_latest_src_28000.country AS listing__country_latest
+ , SUM(subq_32.bookings) AS bookings
FROM (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
@@ -27,25 +27,25 @@ FROM (
DATE_TRUNC('day', ds) AS ds__day
, listing_id AS listing
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_23
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_32
LEFT OUTER JOIN
- ***************************.dim_listings_latest listings_latest_src_28005
+ ***************************.dim_listings_latest listings_latest_src_28000
ON
- subq_23.listing = listings_latest_src_28005.listing_id
+ subq_32.listing = listings_latest_src_28000.listing_id
GROUP BY
- subq_23.ds__day
- , listings_latest_src_28005.country
- ) subq_30
+ subq_32.ds__day
+ , listings_latest_src_28000.country
+ ) subq_39
FULL OUTER JOIN (
-- Join Standard Outputs
-- Pass Only Elements: ['views', 'listing__country_latest', 'ds__day']
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_33.ds__day AS ds__day
- , listings_latest_src_28005.country AS listing__country_latest
- , SUM(subq_33.views) AS views
+ subq_42.ds__day AS ds__day
+ , listings_latest_src_28000.country AS listing__country_latest
+ , SUM(subq_42.views) AS views
FROM (
-- Read Elements From Semantic Model 'views_source'
-- Metric Time Dimension 'ds'
@@ -54,23 +54,23 @@ FROM (
DATE_TRUNC('day', ds) AS ds__day
, listing_id AS listing
, 1 AS views
- FROM ***************************.fct_views views_source_src_28010
- ) subq_33
+ FROM ***************************.fct_views views_source_src_28000
+ ) subq_42
LEFT OUTER JOIN
- ***************************.dim_listings_latest listings_latest_src_28005
+ ***************************.dim_listings_latest listings_latest_src_28000
ON
- subq_33.listing = listings_latest_src_28005.listing_id
+ subq_42.listing = listings_latest_src_28000.listing_id
GROUP BY
- subq_33.ds__day
- , listings_latest_src_28005.country
- ) subq_40
+ subq_42.ds__day
+ , listings_latest_src_28000.country
+ ) subq_49
ON
(
- subq_30.listing__country_latest = subq_40.listing__country_latest
+ subq_39.listing__country_latest = subq_49.listing__country_latest
) AND (
- subq_30.ds__day = subq_40.ds__day
+ subq_39.ds__day = subq_49.ds__day
)
GROUP BY
- COALESCE(subq_30.ds__day, subq_40.ds__day)
- , COALESCE(subq_30.listing__country_latest, subq_40.listing__country_latest)
-) subq_41
+ COALESCE(subq_39.ds__day, subq_49.ds__day)
+ , COALESCE(subq_39.listing__country_latest, subq_49.listing__country_latest)
+) subq_50
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.sql
index 812ca8344a..c2f25848d4 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_compute_metrics_node_ratio_from_single_semantic_model__plan0.sql
@@ -28,93 +28,93 @@ FROM (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
) subq_1
LEFT OUTER JOIN (
@@ -126,62 +126,62 @@ FROM (
-- Read Elements From Semantic Model 'listings_latest'
SELECT
1 AS listings
- , listings_latest_src_28005.capacity AS largest_listing
- , listings_latest_src_28005.capacity AS smallest_listing
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day
- , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy
- , listings_latest_src_28005.country AS country_latest
- , listings_latest_src_28005.is_lux AS is_lux_latest
- , listings_latest_src_28005.capacity AS capacity_latest
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day
- , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy
- , listings_latest_src_28005.country AS listing__country_latest
- , listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , listings_latest_src_28005.capacity AS listing__capacity_latest
- , listings_latest_src_28005.listing_id AS listing
- , listings_latest_src_28005.user_id AS user
- , listings_latest_src_28005.user_id AS listing__user
- FROM ***************************.dim_listings_latest listings_latest_src_28005
+ , listings_latest_src_28000.capacity AS largest_listing
+ , listings_latest_src_28000.capacity AS smallest_listing
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS created_at__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28000.created_at) AS created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS created_at__extract_doy
+ , 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('day', listings_latest_src_28000.created_at) AS listing__ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28000.created_at) AS listing__ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS listing__created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_doy
+ , listings_latest_src_28000.country AS listing__country_latest
+ , listings_latest_src_28000.is_lux AS listing__is_lux_latest
+ , listings_latest_src_28000.capacity AS listing__capacity_latest
+ , listings_latest_src_28000.listing_id AS listing
+ , listings_latest_src_28000.user_id AS user
+ , listings_latest_src_28000.user_id AS listing__user
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
) subq_2
) subq_3
ON
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_compute_metrics_node_ratio_from_single_semantic_model__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_compute_metrics_node_ratio_from_single_semantic_model__plan0_optimized.sql
index 7c57c360fb..c943b1a8d9 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_compute_metrics_node_ratio_from_single_semantic_model__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_compute_metrics_node_ratio_from_single_semantic_model__plan0_optimized.sql
@@ -8,7 +8,7 @@ FROM (
-- Aggregate Measures
SELECT
subq_7.listing AS listing
- , listings_latest_src_28005.country AS listing__country_latest
+ , listings_latest_src_28000.country AS listing__country_latest
, SUM(subq_7.bookings) AS bookings
, COUNT(DISTINCT subq_7.bookers) AS bookers
FROM (
@@ -18,13 +18,13 @@ FROM (
listing_id AS listing
, 1 AS bookings
, guest_id AS bookers
- FROM ***************************.fct_bookings bookings_source_src_28001
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_7
LEFT OUTER JOIN
- ***************************.dim_listings_latest listings_latest_src_28005
+ ***************************.dim_listings_latest listings_latest_src_28000
ON
- subq_7.listing = listings_latest_src_28005.listing_id
+ subq_7.listing = listings_latest_src_28000.listing_id
GROUP BY
subq_7.listing
- , listings_latest_src_28005.country
+ , listings_latest_src_28000.country
) subq_11
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_compute_metrics_node_simple_expr__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_compute_metrics_node_simple_expr__plan0.sql
index 2bd5c9d86e..1d72a8ab11 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_compute_metrics_node_simple_expr__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_compute_metrics_node_simple_expr__plan0.sql
@@ -25,93 +25,93 @@ FROM (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
) subq_1
LEFT OUTER JOIN (
@@ -123,62 +123,62 @@ FROM (
-- Read Elements From Semantic Model 'listings_latest'
SELECT
1 AS listings
- , listings_latest_src_28005.capacity AS largest_listing
- , listings_latest_src_28005.capacity AS smallest_listing
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day
- , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy
- , listings_latest_src_28005.country AS country_latest
- , listings_latest_src_28005.is_lux AS is_lux_latest
- , listings_latest_src_28005.capacity AS capacity_latest
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day
- , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy
- , listings_latest_src_28005.country AS listing__country_latest
- , listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , listings_latest_src_28005.capacity AS listing__capacity_latest
- , listings_latest_src_28005.listing_id AS listing
- , listings_latest_src_28005.user_id AS user
- , listings_latest_src_28005.user_id AS listing__user
- FROM ***************************.dim_listings_latest listings_latest_src_28005
+ , listings_latest_src_28000.capacity AS largest_listing
+ , listings_latest_src_28000.capacity AS smallest_listing
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS created_at__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28000.created_at) AS created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS created_at__extract_doy
+ , 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('day', listings_latest_src_28000.created_at) AS listing__ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28000.created_at) AS listing__ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS listing__created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_doy
+ , listings_latest_src_28000.country AS listing__country_latest
+ , listings_latest_src_28000.is_lux AS listing__is_lux_latest
+ , listings_latest_src_28000.capacity AS listing__capacity_latest
+ , listings_latest_src_28000.listing_id AS listing
+ , listings_latest_src_28000.user_id AS user
+ , listings_latest_src_28000.user_id AS listing__user
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
) subq_2
) subq_3
ON
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_compute_metrics_node_simple_expr__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_compute_metrics_node_simple_expr__plan0_optimized.sql
index 3bda7562bf..65e701e3dd 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_compute_metrics_node_simple_expr__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_compute_metrics_node_simple_expr__plan0_optimized.sql
@@ -7,15 +7,15 @@ FROM (
-- Join Standard Outputs
-- Aggregate Measures
SELECT
- bookings_source_src_28001.listing_id AS listing
- , listings_latest_src_28005.country AS listing__country_latest
- , SUM(bookings_source_src_28001.booking_value) AS booking_value
- FROM ***************************.fct_bookings bookings_source_src_28001
+ bookings_source_src_28000.listing_id AS listing
+ , listings_latest_src_28000.country AS listing__country_latest
+ , SUM(bookings_source_src_28000.booking_value) AS booking_value
+ FROM ***************************.fct_bookings bookings_source_src_28000
LEFT OUTER JOIN
- ***************************.dim_listings_latest listings_latest_src_28005
+ ***************************.dim_listings_latest listings_latest_src_28000
ON
- bookings_source_src_28001.listing_id = listings_latest_src_28005.listing_id
+ bookings_source_src_28000.listing_id = listings_latest_src_28000.listing_id
GROUP BY
- bookings_source_src_28001.listing_id
- , listings_latest_src_28005.country
+ bookings_source_src_28000.listing_id
+ , listings_latest_src_28000.country
) subq_11
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_constrain_time_range_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_constrain_time_range_node__plan0.sql
index bba1d890d8..21d79f30ae 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_constrain_time_range_node__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_constrain_time_range_node__plan0.sql
@@ -19,93 +19,93 @@ FROM (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
) subq_1
) subq_2
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_constrain_time_range_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_constrain_time_range_node__plan0_optimized.sql
index b8eb96e8e9..137bae5f65 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_constrain_time_range_node__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_constrain_time_range_node__plan0_optimized.sql
@@ -6,5 +6,5 @@ SELECT
DATE_TRUNC('day', ds) AS ds__day
, DATE_TRUNC('day', ds) AS metric_time__day
, 1 AS bookings
-FROM ***************************.fct_bookings bookings_source_src_28001
+FROM ***************************.fct_bookings bookings_source_src_28000
WHERE DATE_TRUNC('day', ds) BETWEEN timestamp '2020-01-01' AND timestamp '2020-01-02'
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_dimension_with_joined_where_constraint__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_dimension_with_joined_where_constraint__plan0.sql
index 9bf2a562f5..c30f2c64e7 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_dimension_with_joined_where_constraint__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_dimension_with_joined_where_constraint__plan0.sql
@@ -125,62 +125,62 @@ FROM (
-- Read Elements From Semantic Model 'listings_latest'
SELECT
1 AS listings
- , listings_latest_src_28005.capacity AS largest_listing
- , listings_latest_src_28005.capacity AS smallest_listing
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day
- , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy
- , listings_latest_src_28005.country AS country_latest
- , listings_latest_src_28005.is_lux AS is_lux_latest
- , listings_latest_src_28005.capacity AS capacity_latest
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day
- , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy
- , listings_latest_src_28005.country AS listing__country_latest
- , listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , listings_latest_src_28005.capacity AS listing__capacity_latest
- , listings_latest_src_28005.listing_id AS listing
- , listings_latest_src_28005.user_id AS user
- , listings_latest_src_28005.user_id AS listing__user
- FROM ***************************.dim_listings_latest listings_latest_src_28005
+ , listings_latest_src_28000.capacity AS largest_listing
+ , listings_latest_src_28000.capacity AS smallest_listing
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS created_at__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28000.created_at) AS created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS created_at__extract_doy
+ , 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('day', listings_latest_src_28000.created_at) AS listing__ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28000.created_at) AS listing__ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS listing__created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_doy
+ , listings_latest_src_28000.country AS listing__country_latest
+ , listings_latest_src_28000.is_lux AS listing__is_lux_latest
+ , listings_latest_src_28000.capacity AS listing__capacity_latest
+ , listings_latest_src_28000.listing_id AS listing
+ , listings_latest_src_28000.user_id AS user
+ , listings_latest_src_28000.user_id AS listing__user
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
) subq_0
FULL OUTER JOIN (
-- Pass Only Elements: ['home_state_latest', 'user']
@@ -190,32 +190,32 @@ FROM (
FROM (
-- Read Elements From Semantic Model 'users_latest'
SELECT
- DATE_TRUNC('day', users_latest_src_28009.ds) AS ds_latest__day
- , DATE_TRUNC('week', users_latest_src_28009.ds) AS ds_latest__week
- , DATE_TRUNC('month', users_latest_src_28009.ds) AS ds_latest__month
- , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS ds_latest__quarter
- , DATE_TRUNC('year', users_latest_src_28009.ds) AS ds_latest__year
- , EXTRACT(year FROM users_latest_src_28009.ds) AS ds_latest__extract_year
- , EXTRACT(quarter FROM users_latest_src_28009.ds) AS ds_latest__extract_quarter
- , EXTRACT(month FROM users_latest_src_28009.ds) AS ds_latest__extract_month
- , EXTRACT(day FROM users_latest_src_28009.ds) AS ds_latest__extract_day
- , EXTRACT(DAY_OF_WEEK FROM users_latest_src_28009.ds) AS ds_latest__extract_dow
- , EXTRACT(doy FROM users_latest_src_28009.ds) AS ds_latest__extract_doy
- , users_latest_src_28009.home_state_latest
- , DATE_TRUNC('day', users_latest_src_28009.ds) AS user__ds_latest__day
- , DATE_TRUNC('week', users_latest_src_28009.ds) AS user__ds_latest__week
- , DATE_TRUNC('month', users_latest_src_28009.ds) AS user__ds_latest__month
- , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS user__ds_latest__quarter
- , DATE_TRUNC('year', users_latest_src_28009.ds) AS user__ds_latest__year
- , EXTRACT(year FROM users_latest_src_28009.ds) AS user__ds_latest__extract_year
- , EXTRACT(quarter FROM users_latest_src_28009.ds) AS user__ds_latest__extract_quarter
- , EXTRACT(month FROM users_latest_src_28009.ds) AS user__ds_latest__extract_month
- , EXTRACT(day FROM users_latest_src_28009.ds) AS user__ds_latest__extract_day
- , EXTRACT(DAY_OF_WEEK FROM users_latest_src_28009.ds) AS user__ds_latest__extract_dow
- , EXTRACT(doy FROM users_latest_src_28009.ds) AS user__ds_latest__extract_doy
- , users_latest_src_28009.home_state_latest AS user__home_state_latest
- , users_latest_src_28009.user_id AS user
- FROM ***************************.dim_users_latest users_latest_src_28009
+ DATE_TRUNC('day', users_latest_src_28000.ds) AS ds_latest__day
+ , DATE_TRUNC('week', users_latest_src_28000.ds) AS ds_latest__week
+ , DATE_TRUNC('month', users_latest_src_28000.ds) AS ds_latest__month
+ , DATE_TRUNC('quarter', users_latest_src_28000.ds) AS ds_latest__quarter
+ , DATE_TRUNC('year', users_latest_src_28000.ds) 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
+ , EXTRACT(day FROM users_latest_src_28000.ds) AS ds_latest__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM users_latest_src_28000.ds) AS ds_latest__extract_dow
+ , EXTRACT(doy FROM users_latest_src_28000.ds) AS ds_latest__extract_doy
+ , users_latest_src_28000.home_state_latest
+ , DATE_TRUNC('day', users_latest_src_28000.ds) AS user__ds_latest__day
+ , DATE_TRUNC('week', users_latest_src_28000.ds) AS user__ds_latest__week
+ , DATE_TRUNC('month', users_latest_src_28000.ds) AS user__ds_latest__month
+ , DATE_TRUNC('quarter', users_latest_src_28000.ds) AS user__ds_latest__quarter
+ , DATE_TRUNC('year', users_latest_src_28000.ds) 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
+ , EXTRACT(day FROM users_latest_src_28000.ds) AS user__ds_latest__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM users_latest_src_28000.ds) AS user__ds_latest__extract_dow
+ , EXTRACT(doy FROM users_latest_src_28000.ds) AS user__ds_latest__extract_doy
+ , users_latest_src_28000.home_state_latest AS user__home_state_latest
+ , users_latest_src_28000.user_id AS user
+ FROM ***************************.dim_users_latest users_latest_src_28000
) subq_1
) subq_2
ON
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_dimension_with_joined_where_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_dimension_with_joined_where_constraint__plan0_optimized.sql
index 8cc8a2b867..c4e57d3c86 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_dimension_with_joined_where_constraint__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_dimension_with_joined_where_constraint__plan0_optimized.sql
@@ -5,13 +5,13 @@ SELECT
FROM (
-- Join Standard Outputs
SELECT
- listings_latest_src_28005.country AS listing__country_latest
- , users_latest_src_28009.home_state_latest AS user__home_state_latest
- FROM ***************************.dim_listings_latest listings_latest_src_28005
+ listings_latest_src_28000.country AS listing__country_latest
+ , users_latest_src_28000.home_state_latest AS user__home_state_latest
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
FULL OUTER JOIN
- ***************************.dim_users_latest users_latest_src_28009
+ ***************************.dim_users_latest users_latest_src_28000
ON
- listings_latest_src_28005.user_id = users_latest_src_28009.user_id
+ listings_latest_src_28000.user_id = users_latest_src_28000.user_id
) subq_8
WHERE listing__country_latest = 'us'
GROUP BY
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_dimensions_requiring_join__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_dimensions_requiring_join__plan0.sql
index 9dea907a17..28f04502f2 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_dimensions_requiring_join__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_dimensions_requiring_join__plan0.sql
@@ -66,62 +66,62 @@ FROM (
-- Read Elements From Semantic Model 'listings_latest'
SELECT
1 AS listings
- , listings_latest_src_28005.capacity AS largest_listing
- , listings_latest_src_28005.capacity AS smallest_listing
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day
- , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy
- , listings_latest_src_28005.country AS country_latest
- , listings_latest_src_28005.is_lux AS is_lux_latest
- , listings_latest_src_28005.capacity AS capacity_latest
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day
- , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy
- , listings_latest_src_28005.country AS listing__country_latest
- , listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , listings_latest_src_28005.capacity AS listing__capacity_latest
- , listings_latest_src_28005.listing_id AS listing
- , listings_latest_src_28005.user_id AS user
- , listings_latest_src_28005.user_id AS listing__user
- FROM ***************************.dim_listings_latest listings_latest_src_28005
+ , listings_latest_src_28000.capacity AS largest_listing
+ , listings_latest_src_28000.capacity AS smallest_listing
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS created_at__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28000.created_at) AS created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS created_at__extract_doy
+ , 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('day', listings_latest_src_28000.created_at) AS listing__ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28000.created_at) AS listing__ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS listing__created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_doy
+ , listings_latest_src_28000.country AS listing__country_latest
+ , listings_latest_src_28000.is_lux AS listing__is_lux_latest
+ , listings_latest_src_28000.capacity AS listing__capacity_latest
+ , listings_latest_src_28000.listing_id AS listing
+ , listings_latest_src_28000.user_id AS user
+ , listings_latest_src_28000.user_id AS listing__user
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
) subq_0
FULL OUTER JOIN (
-- Pass Only Elements: ['home_state_latest', 'user']
@@ -131,32 +131,32 @@ FROM (
FROM (
-- Read Elements From Semantic Model 'users_latest'
SELECT
- DATE_TRUNC('day', users_latest_src_28009.ds) AS ds_latest__day
- , DATE_TRUNC('week', users_latest_src_28009.ds) AS ds_latest__week
- , DATE_TRUNC('month', users_latest_src_28009.ds) AS ds_latest__month
- , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS ds_latest__quarter
- , DATE_TRUNC('year', users_latest_src_28009.ds) AS ds_latest__year
- , EXTRACT(year FROM users_latest_src_28009.ds) AS ds_latest__extract_year
- , EXTRACT(quarter FROM users_latest_src_28009.ds) AS ds_latest__extract_quarter
- , EXTRACT(month FROM users_latest_src_28009.ds) AS ds_latest__extract_month
- , EXTRACT(day FROM users_latest_src_28009.ds) AS ds_latest__extract_day
- , EXTRACT(DAY_OF_WEEK FROM users_latest_src_28009.ds) AS ds_latest__extract_dow
- , EXTRACT(doy FROM users_latest_src_28009.ds) AS ds_latest__extract_doy
- , users_latest_src_28009.home_state_latest
- , DATE_TRUNC('day', users_latest_src_28009.ds) AS user__ds_latest__day
- , DATE_TRUNC('week', users_latest_src_28009.ds) AS user__ds_latest__week
- , DATE_TRUNC('month', users_latest_src_28009.ds) AS user__ds_latest__month
- , DATE_TRUNC('quarter', users_latest_src_28009.ds) AS user__ds_latest__quarter
- , DATE_TRUNC('year', users_latest_src_28009.ds) AS user__ds_latest__year
- , EXTRACT(year FROM users_latest_src_28009.ds) AS user__ds_latest__extract_year
- , EXTRACT(quarter FROM users_latest_src_28009.ds) AS user__ds_latest__extract_quarter
- , EXTRACT(month FROM users_latest_src_28009.ds) AS user__ds_latest__extract_month
- , EXTRACT(day FROM users_latest_src_28009.ds) AS user__ds_latest__extract_day
- , EXTRACT(DAY_OF_WEEK FROM users_latest_src_28009.ds) AS user__ds_latest__extract_dow
- , EXTRACT(doy FROM users_latest_src_28009.ds) AS user__ds_latest__extract_doy
- , users_latest_src_28009.home_state_latest AS user__home_state_latest
- , users_latest_src_28009.user_id AS user
- FROM ***************************.dim_users_latest users_latest_src_28009
+ DATE_TRUNC('day', users_latest_src_28000.ds) AS ds_latest__day
+ , DATE_TRUNC('week', users_latest_src_28000.ds) AS ds_latest__week
+ , DATE_TRUNC('month', users_latest_src_28000.ds) AS ds_latest__month
+ , DATE_TRUNC('quarter', users_latest_src_28000.ds) AS ds_latest__quarter
+ , DATE_TRUNC('year', users_latest_src_28000.ds) 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
+ , EXTRACT(day FROM users_latest_src_28000.ds) AS ds_latest__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM users_latest_src_28000.ds) AS ds_latest__extract_dow
+ , EXTRACT(doy FROM users_latest_src_28000.ds) AS ds_latest__extract_doy
+ , users_latest_src_28000.home_state_latest
+ , DATE_TRUNC('day', users_latest_src_28000.ds) AS user__ds_latest__day
+ , DATE_TRUNC('week', users_latest_src_28000.ds) AS user__ds_latest__week
+ , DATE_TRUNC('month', users_latest_src_28000.ds) AS user__ds_latest__month
+ , DATE_TRUNC('quarter', users_latest_src_28000.ds) AS user__ds_latest__quarter
+ , DATE_TRUNC('year', users_latest_src_28000.ds) 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
+ , EXTRACT(day FROM users_latest_src_28000.ds) AS user__ds_latest__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM users_latest_src_28000.ds) AS user__ds_latest__extract_dow
+ , EXTRACT(doy FROM users_latest_src_28000.ds) AS user__ds_latest__extract_doy
+ , users_latest_src_28000.home_state_latest AS user__home_state_latest
+ , users_latest_src_28000.user_id AS user
+ FROM ***************************.dim_users_latest users_latest_src_28000
) subq_1
) subq_2
ON
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_dimensions_requiring_join__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_dimensions_requiring_join__plan0_optimized.sql
index bee3a232b6..96c5d5bb3a 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_dimensions_requiring_join__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_dimensions_requiring_join__plan0_optimized.sql
@@ -1,13 +1,13 @@
-- Join Standard Outputs
-- Pass Only Elements: ['user__home_state_latest', 'listing__is_lux_latest']
SELECT
- listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , users_latest_src_28009.home_state_latest AS user__home_state_latest
-FROM ***************************.dim_listings_latest listings_latest_src_28005
+ 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
FULL OUTER JOIN
- ***************************.dim_users_latest users_latest_src_28009
+ ***************************.dim_users_latest users_latest_src_28000
ON
- listings_latest_src_28005.user_id = users_latest_src_28009.user_id
+ listings_latest_src_28000.user_id = users_latest_src_28000.user_id
GROUP BY
- listings_latest_src_28005.is_lux
- , users_latest_src_28009.home_state_latest
+ listings_latest_src_28000.is_lux
+ , users_latest_src_28000.home_state_latest
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_filter_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_filter_node__plan0.sql
index 27231f192b..8b3794a47b 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_filter_node__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_filter_node__plan0.sql
@@ -6,91 +6,91 @@ FROM (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_filter_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_filter_node__plan0_optimized.sql
index bfbf5ff951..554ce484fb 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_filter_node__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_filter_node__plan0_optimized.sql
@@ -2,4 +2,4 @@
-- Pass Only Elements: ['bookings',]
SELECT
1 AS bookings
-FROM ***************************.fct_bookings bookings_source_src_28001
+FROM ***************************.fct_bookings bookings_source_src_28000
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_filter_with_where_constraint_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_filter_with_where_constraint_node__plan0.sql
index a0f5744171..29197c39d7 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_filter_with_where_constraint_node__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_filter_with_where_constraint_node__plan0.sql
@@ -12,93 +12,93 @@ FROM (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
) subq_1
WHERE booking__ds__day = '2020-01-01'
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_filter_with_where_constraint_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_filter_with_where_constraint_node__plan0_optimized.sql
index 755a4d39e2..5ee87ba25f 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_filter_with_where_constraint_node__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_filter_with_where_constraint_node__plan0_optimized.sql
@@ -8,6 +8,6 @@ FROM (
SELECT
DATE_TRUNC('day', ds) AS ds__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_3
WHERE booking__ds__day = '2020-01-01'
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_join_to_time_spine_node_with_offset_to_grain__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_join_to_time_spine_node_with_offset_to_grain__plan0.sql
index ec47dfdc83..e8a3b24016 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_join_to_time_spine_node_with_offset_to_grain__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_join_to_time_spine_node_with_offset_to_grain__plan0.sql
@@ -134,93 +134,93 @@ INNER JOIN (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
) subq_1
) subq_2
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_join_to_time_spine_node_with_offset_to_grain__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_join_to_time_spine_node_with_offset_to_grain__plan0_optimized.sql
index 55f87d10bc..dfbf45320a 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_join_to_time_spine_node_with_offset_to_grain__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_join_to_time_spine_node_with_offset_to_grain__plan0_optimized.sql
@@ -25,7 +25,7 @@ INNER JOIN (
DATE_TRUNC('day', ds) AS metric_time__day
, listing_id AS listing
, SUM(booking_value) AS booking_value
- FROM ***************************.fct_bookings bookings_source_src_28001
+ FROM ***************************.fct_bookings bookings_source_src_28000
GROUP BY
DATE_TRUNC('day', ds)
, listing_id
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_join_to_time_spine_node_with_offset_window__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_join_to_time_spine_node_with_offset_window__plan0.sql
index 079efbd3b0..02c8875b37 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_join_to_time_spine_node_with_offset_window__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_join_to_time_spine_node_with_offset_window__plan0.sql
@@ -134,93 +134,93 @@ INNER JOIN (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
) subq_1
) subq_2
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_join_to_time_spine_node_with_offset_window__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_join_to_time_spine_node_with_offset_window__plan0_optimized.sql
index 1219f9e494..46290a43a2 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_join_to_time_spine_node_with_offset_window__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_join_to_time_spine_node_with_offset_window__plan0_optimized.sql
@@ -25,7 +25,7 @@ INNER JOIN (
DATE_TRUNC('day', ds) AS metric_time__day
, listing_id AS listing
, SUM(booking_value) AS booking_value
- FROM ***************************.fct_bookings bookings_source_src_28001
+ FROM ***************************.fct_bookings bookings_source_src_28000
GROUP BY
DATE_TRUNC('day', ds)
, listing_id
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_join_to_time_spine_node_without_offset__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_join_to_time_spine_node_without_offset__plan0.sql
index 3cd1a50096..a6b2e3622c 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_join_to_time_spine_node_without_offset__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_join_to_time_spine_node_without_offset__plan0.sql
@@ -134,93 +134,93 @@ INNER JOIN (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
) subq_1
) subq_2
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_join_to_time_spine_node_without_offset__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_join_to_time_spine_node_without_offset__plan0_optimized.sql
index 8ea0c288dc..079f6f5209 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_join_to_time_spine_node_without_offset__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_join_to_time_spine_node_without_offset__plan0_optimized.sql
@@ -25,7 +25,7 @@ INNER JOIN (
DATE_TRUNC('day', ds) AS metric_time__day
, listing_id AS listing
, SUM(booking_value) AS booking_value
- FROM ***************************.fct_bookings bookings_source_src_28001
+ FROM ***************************.fct_bookings bookings_source_src_28000
GROUP BY
DATE_TRUNC('day', ds)
, listing_id
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_measure_aggregation_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_measure_aggregation_node__plan0.sql
index dba9ded776..a2fc874608 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_measure_aggregation_node__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_measure_aggregation_node__plan0.sql
@@ -16,92 +16,92 @@ FROM (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
) subq_1
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_measure_aggregation_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_measure_aggregation_node__plan0_optimized.sql
index 64fc2826b9..6e5528a6c9 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_measure_aggregation_node__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_measure_aggregation_node__plan0_optimized.sql
@@ -6,4 +6,4 @@ SELECT
, SUM(CASE WHEN is_instant THEN 1 ELSE 0 END) AS instant_bookings
, COUNT(DISTINCT guest_id) AS bookers
, AVG(booking_value) AS average_booking_value
-FROM ***************************.fct_bookings bookings_source_src_28001
+FROM ***************************.fct_bookings bookings_source_src_28000
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_multi_join_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_multi_join_node__plan0.sql
index 679926be9f..bf4d3b9719 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_multi_join_node__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_multi_join_node__plan0.sql
@@ -14,93 +14,93 @@ FROM (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
) subq_1
LEFT OUTER JOIN (
@@ -112,62 +112,62 @@ LEFT OUTER JOIN (
-- Read Elements From Semantic Model 'listings_latest'
SELECT
1 AS listings
- , listings_latest_src_28005.capacity AS largest_listing
- , listings_latest_src_28005.capacity AS smallest_listing
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day
- , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy
- , listings_latest_src_28005.country AS country_latest
- , listings_latest_src_28005.is_lux AS is_lux_latest
- , listings_latest_src_28005.capacity AS capacity_latest
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day
- , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy
- , listings_latest_src_28005.country AS listing__country_latest
- , listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , listings_latest_src_28005.capacity AS listing__capacity_latest
- , listings_latest_src_28005.listing_id AS listing
- , listings_latest_src_28005.user_id AS user
- , listings_latest_src_28005.user_id AS listing__user
- FROM ***************************.dim_listings_latest listings_latest_src_28005
+ , listings_latest_src_28000.capacity AS largest_listing
+ , listings_latest_src_28000.capacity AS smallest_listing
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS created_at__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28000.created_at) AS created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS created_at__extract_doy
+ , 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('day', listings_latest_src_28000.created_at) AS listing__ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28000.created_at) AS listing__ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS listing__created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_doy
+ , listings_latest_src_28000.country AS listing__country_latest
+ , listings_latest_src_28000.is_lux AS listing__is_lux_latest
+ , listings_latest_src_28000.capacity AS listing__capacity_latest
+ , listings_latest_src_28000.listing_id AS listing
+ , listings_latest_src_28000.user_id AS user
+ , listings_latest_src_28000.user_id AS listing__user
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
) subq_2
) subq_3
ON
@@ -181,62 +181,62 @@ LEFT OUTER JOIN (
-- Read Elements From Semantic Model 'listings_latest'
SELECT
1 AS listings
- , listings_latest_src_28005.capacity AS largest_listing
- , listings_latest_src_28005.capacity AS smallest_listing
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day
- , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy
- , listings_latest_src_28005.country AS country_latest
- , listings_latest_src_28005.is_lux AS is_lux_latest
- , listings_latest_src_28005.capacity AS capacity_latest
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day
- , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy
- , listings_latest_src_28005.country AS listing__country_latest
- , listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , listings_latest_src_28005.capacity AS listing__capacity_latest
- , listings_latest_src_28005.listing_id AS listing
- , listings_latest_src_28005.user_id AS user
- , listings_latest_src_28005.user_id AS listing__user
- FROM ***************************.dim_listings_latest listings_latest_src_28005
+ , listings_latest_src_28000.capacity AS largest_listing
+ , listings_latest_src_28000.capacity AS smallest_listing
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS created_at__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28000.created_at) AS created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS created_at__extract_doy
+ , 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('day', listings_latest_src_28000.created_at) AS listing__ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28000.created_at) AS listing__ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS listing__created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_doy
+ , listings_latest_src_28000.country AS listing__country_latest
+ , listings_latest_src_28000.is_lux AS listing__is_lux_latest
+ , listings_latest_src_28000.capacity AS listing__capacity_latest
+ , listings_latest_src_28000.listing_id AS listing
+ , listings_latest_src_28000.user_id AS user
+ , listings_latest_src_28000.user_id AS listing__user
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
) subq_4
) subq_5
ON
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_multi_join_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_multi_join_node__plan0_optimized.sql
index b9cecc48d8..7d9c669f54 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_multi_join_node__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_multi_join_node__plan0_optimized.sql
@@ -10,7 +10,7 @@ FROM (
SELECT
listing_id AS listing
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_7
LEFT OUTER JOIN (
-- Read Elements From Semantic Model 'listings_latest'
@@ -18,7 +18,7 @@ LEFT OUTER JOIN (
SELECT
listing_id AS listing
, country AS country_latest
- FROM ***************************.dim_listings_latest listings_latest_src_28005
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
) subq_9
ON
subq_7.listing = subq_9.listing
@@ -28,7 +28,7 @@ LEFT OUTER JOIN (
SELECT
listing_id AS listing
, country AS country_latest
- FROM ***************************.dim_listings_latest listings_latest_src_28005
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
) subq_11
ON
subq_7.listing = subq_11.listing
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_order_by_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_order_by_node__plan0.sql
index f77b20ceac..b06170c5ce 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_order_by_node__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_order_by_node__plan0.sql
@@ -26,93 +26,93 @@ FROM (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
) subq_1
GROUP BY
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_order_by_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_order_by_node__plan0_optimized.sql
index fd8a1ff597..bcebfe9d5f 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_order_by_node__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_order_by_node__plan0_optimized.sql
@@ -12,7 +12,7 @@ FROM (
DATE_TRUNC('day', ds) AS ds__day
, is_instant
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_5
GROUP BY
ds__day
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_single_join_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_single_join_node__plan0.sql
index ffd4bbce0f..15bec31d75 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_single_join_node__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_single_join_node__plan0.sql
@@ -12,93 +12,93 @@ FROM (
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_0
) subq_1
LEFT OUTER JOIN (
@@ -110,62 +110,62 @@ LEFT OUTER JOIN (
-- Read Elements From Semantic Model 'listings_latest'
SELECT
1 AS listings
- , listings_latest_src_28005.capacity AS largest_listing
- , listings_latest_src_28005.capacity AS smallest_listing
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day
- , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy
- , listings_latest_src_28005.country AS country_latest
- , listings_latest_src_28005.is_lux AS is_lux_latest
- , listings_latest_src_28005.capacity AS capacity_latest
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day
- , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy
- , listings_latest_src_28005.country AS listing__country_latest
- , listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , listings_latest_src_28005.capacity AS listing__capacity_latest
- , listings_latest_src_28005.listing_id AS listing
- , listings_latest_src_28005.user_id AS user
- , listings_latest_src_28005.user_id AS listing__user
- FROM ***************************.dim_listings_latest listings_latest_src_28005
+ , listings_latest_src_28000.capacity AS largest_listing
+ , listings_latest_src_28000.capacity AS smallest_listing
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS created_at__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28000.created_at) AS created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS created_at__extract_doy
+ , 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('day', listings_latest_src_28000.created_at) AS listing__ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28000.created_at) AS listing__ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS listing__created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_doy
+ , listings_latest_src_28000.country AS listing__country_latest
+ , listings_latest_src_28000.is_lux AS listing__is_lux_latest
+ , listings_latest_src_28000.capacity AS listing__capacity_latest
+ , listings_latest_src_28000.listing_id AS listing
+ , listings_latest_src_28000.user_id AS user
+ , listings_latest_src_28000.user_id AS listing__user
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
) subq_2
) subq_3
ON
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_single_join_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_single_join_node__plan0_optimized.sql
index e03ffcce64..a1cd7ac335 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_single_join_node__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_single_join_node__plan0_optimized.sql
@@ -8,9 +8,9 @@ FROM (
SELECT
listing_id AS listing
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
+ FROM ***************************.fct_bookings bookings_source_src_28000
) subq_5
LEFT OUTER JOIN
- ***************************.dim_listings_latest listings_latest_src_28005
+ ***************************.dim_listings_latest listings_latest_src_28000
ON
- subq_5.listing = listings_latest_src_28005.listing_id
+ subq_5.listing = listings_latest_src_28000.listing_id
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_source_node__plan0.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_source_node__plan0.sql
index 29278dc9f7..cf384bbdbe 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_source_node__plan0.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_source_node__plan0.sql
@@ -2,90 +2,90 @@
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
-FROM ***************************.fct_bookings bookings_source_src_28001
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(DAY_OF_WEEK FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+FROM ***************************.fct_bookings bookings_source_src_28000
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_source_node__plan0_optimized.sql b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_source_node__plan0_optimized.sql
index eb73e0c58e..1ee93a834a 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_source_node__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/Trino/test_source_node__plan0_optimized.sql
@@ -88,4 +88,4 @@ SELECT
, listing_id AS booking__listing
, guest_id AS booking__guest
, host_id AS booking__host
-FROM ***************************.fct_bookings bookings_source_src_28001
+FROM ***************************.fct_bookings bookings_source_src_28000
diff --git a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.xml b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.xml
index 61f123ca07..53634d56af 100644
--- a/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.xml
+++ b/metricflow/test/snapshots/test_dataflow_to_sql_plan.py/SqlQueryPlan/test_compute_metrics_node_ratio_from_multiple_semantic_models__plan0.xml
@@ -36,7 +36,7 @@
-
+
@@ -132,7 +132,7 @@
-
+
@@ -1845,7 +1845,7 @@
-
+
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_time_offset_metric_with_time_constraint__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_time_offset_metric_with_time_constraint__plan0.sql
index f4d266a946..38ae05a24f 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_time_offset_metric_with_time_constraint__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_time_offset_metric_with_time_constraint__plan0.sql
@@ -1,441 +1,441 @@
-- Compute Metrics via Expressions
SELECT
- subq_11.metric_time__day
+ subq_20.metric_time__day
, every_2_days_bookers_2_days_ago AS every_2_days_bookers_2_days_ago
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_10.metric_time__day
- , subq_10.bookers AS every_2_days_bookers_2_days_ago
+ subq_19.metric_time__day
+ , subq_19.bookers AS every_2_days_bookers_2_days_ago
FROM (
-- Aggregate Measures
SELECT
- subq_9.metric_time__day
- , COUNT(DISTINCT subq_9.bookers) AS bookers
+ subq_18.metric_time__day
+ , COUNT(DISTINCT subq_18.bookers) AS bookers
FROM (
-- Constrain Time Range to [2019-12-19T00:00:00, 2020-01-02T00:00:00]
SELECT
- subq_8.metric_time__day
- , subq_8.bookers
+ subq_17.metric_time__day
+ , subq_17.bookers
FROM (
-- Pass Only Elements: ['bookers', 'metric_time__day']
SELECT
- subq_7.metric_time__day
- , subq_7.bookers
+ subq_16.metric_time__day
+ , subq_16.bookers
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_5.metric_time__day AS metric_time__day
- , subq_4.ds__day AS ds__day
- , subq_4.ds__week AS ds__week
- , subq_4.ds__month AS ds__month
- , subq_4.ds__quarter AS ds__quarter
- , subq_4.ds__year AS ds__year
- , subq_4.ds__extract_year AS ds__extract_year
- , subq_4.ds__extract_quarter AS ds__extract_quarter
- , subq_4.ds__extract_month AS ds__extract_month
- , subq_4.ds__extract_day AS ds__extract_day
- , subq_4.ds__extract_dow AS ds__extract_dow
- , subq_4.ds__extract_doy AS ds__extract_doy
- , subq_4.ds_partitioned__day AS ds_partitioned__day
- , subq_4.ds_partitioned__week AS ds_partitioned__week
- , subq_4.ds_partitioned__month AS ds_partitioned__month
- , subq_4.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_4.ds_partitioned__year AS ds_partitioned__year
- , subq_4.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_4.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_4.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_4.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_4.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_4.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_4.paid_at__day AS paid_at__day
- , subq_4.paid_at__week AS paid_at__week
- , subq_4.paid_at__month AS paid_at__month
- , subq_4.paid_at__quarter AS paid_at__quarter
- , subq_4.paid_at__year AS paid_at__year
- , subq_4.paid_at__extract_year AS paid_at__extract_year
- , subq_4.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_4.paid_at__extract_month AS paid_at__extract_month
- , subq_4.paid_at__extract_day AS paid_at__extract_day
- , subq_4.paid_at__extract_dow AS paid_at__extract_dow
- , subq_4.paid_at__extract_doy AS paid_at__extract_doy
- , subq_4.booking__ds__day AS booking__ds__day
- , subq_4.booking__ds__week AS booking__ds__week
- , subq_4.booking__ds__month AS booking__ds__month
- , subq_4.booking__ds__quarter AS booking__ds__quarter
- , subq_4.booking__ds__year AS booking__ds__year
- , subq_4.booking__ds__extract_year AS booking__ds__extract_year
- , subq_4.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_4.booking__ds__extract_month AS booking__ds__extract_month
- , subq_4.booking__ds__extract_day AS booking__ds__extract_day
- , subq_4.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_4.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_4.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_4.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_4.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_4.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_4.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_4.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_4.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_4.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_4.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_4.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_4.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_4.booking__paid_at__day AS booking__paid_at__day
- , subq_4.booking__paid_at__week AS booking__paid_at__week
- , subq_4.booking__paid_at__month AS booking__paid_at__month
- , subq_4.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_4.booking__paid_at__year AS booking__paid_at__year
- , subq_4.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_4.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_4.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_4.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_4.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_4.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_4.listing AS listing
- , subq_4.guest AS guest
- , subq_4.host AS host
- , subq_4.booking__listing AS booking__listing
- , subq_4.booking__guest AS booking__guest
- , subq_4.booking__host AS booking__host
- , subq_4.is_instant AS is_instant
- , subq_4.booking__is_instant AS booking__is_instant
- , subq_4.bookings AS bookings
- , subq_4.instant_bookings AS instant_bookings
- , subq_4.booking_value AS booking_value
- , subq_4.max_booking_value AS max_booking_value
- , subq_4.min_booking_value AS min_booking_value
- , subq_4.bookers AS bookers
- , subq_4.average_booking_value AS average_booking_value
- , subq_4.referred_bookings AS referred_bookings
- , subq_4.median_booking_value AS median_booking_value
- , subq_4.booking_value_p99 AS booking_value_p99
- , subq_4.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_4.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_4.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ subq_14.metric_time__day AS metric_time__day
+ , subq_13.ds__day AS ds__day
+ , subq_13.ds__week AS ds__week
+ , subq_13.ds__month AS ds__month
+ , subq_13.ds__quarter AS ds__quarter
+ , subq_13.ds__year AS ds__year
+ , subq_13.ds__extract_year AS ds__extract_year
+ , subq_13.ds__extract_quarter AS ds__extract_quarter
+ , subq_13.ds__extract_month AS ds__extract_month
+ , subq_13.ds__extract_day AS ds__extract_day
+ , subq_13.ds__extract_dow AS ds__extract_dow
+ , subq_13.ds__extract_doy AS ds__extract_doy
+ , subq_13.ds_partitioned__day AS ds_partitioned__day
+ , subq_13.ds_partitioned__week AS ds_partitioned__week
+ , subq_13.ds_partitioned__month AS ds_partitioned__month
+ , subq_13.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_13.ds_partitioned__year AS ds_partitioned__year
+ , subq_13.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_13.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_13.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_13.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_13.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_13.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_13.paid_at__day AS paid_at__day
+ , subq_13.paid_at__week AS paid_at__week
+ , subq_13.paid_at__month AS paid_at__month
+ , subq_13.paid_at__quarter AS paid_at__quarter
+ , subq_13.paid_at__year AS paid_at__year
+ , subq_13.paid_at__extract_year AS paid_at__extract_year
+ , subq_13.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_13.paid_at__extract_month AS paid_at__extract_month
+ , subq_13.paid_at__extract_day AS paid_at__extract_day
+ , subq_13.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_13.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_13.booking__ds__day AS booking__ds__day
+ , subq_13.booking__ds__week AS booking__ds__week
+ , subq_13.booking__ds__month AS booking__ds__month
+ , subq_13.booking__ds__quarter AS booking__ds__quarter
+ , subq_13.booking__ds__year AS booking__ds__year
+ , subq_13.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_13.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_13.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_13.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_13.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_13.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_13.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_13.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_13.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_13.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_13.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_13.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_13.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_13.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_13.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_13.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_13.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_13.booking__paid_at__day AS booking__paid_at__day
+ , subq_13.booking__paid_at__week AS booking__paid_at__week
+ , subq_13.booking__paid_at__month AS booking__paid_at__month
+ , subq_13.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_13.booking__paid_at__year AS booking__paid_at__year
+ , subq_13.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_13.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_13.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_13.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_13.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_13.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_13.listing AS listing
+ , subq_13.guest AS guest
+ , subq_13.host AS host
+ , subq_13.booking__listing AS booking__listing
+ , subq_13.booking__guest AS booking__guest
+ , subq_13.booking__host AS booking__host
+ , subq_13.is_instant AS is_instant
+ , subq_13.booking__is_instant AS booking__is_instant
+ , subq_13.bookings AS bookings
+ , subq_13.instant_bookings AS instant_bookings
+ , subq_13.booking_value AS booking_value
+ , subq_13.max_booking_value AS max_booking_value
+ , subq_13.min_booking_value AS min_booking_value
+ , subq_13.bookers AS bookers
+ , subq_13.average_booking_value AS average_booking_value
+ , subq_13.referred_bookings AS referred_bookings
+ , subq_13.median_booking_value AS median_booking_value
+ , subq_13.booking_value_p99 AS booking_value_p99
+ , subq_13.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_13.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_13.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_6.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_6
- WHERE subq_6.ds BETWEEN '2019-12-19' AND '2020-01-02'
- ) subq_5
+ subq_15.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_15
+ WHERE subq_15.ds BETWEEN '2019-12-19' AND '2020-01-02'
+ ) subq_14
INNER JOIN (
-- Join Self Over Time Range
SELECT
- subq_2.metric_time__day AS metric_time__day
- , subq_1.ds__day AS ds__day
- , subq_1.ds__week AS ds__week
- , subq_1.ds__month AS ds__month
- , subq_1.ds__quarter AS ds__quarter
- , subq_1.ds__year AS ds__year
- , subq_1.ds__extract_year AS ds__extract_year
- , subq_1.ds__extract_quarter AS ds__extract_quarter
- , subq_1.ds__extract_month AS ds__extract_month
- , subq_1.ds__extract_day AS ds__extract_day
- , subq_1.ds__extract_dow AS ds__extract_dow
- , subq_1.ds__extract_doy AS ds__extract_doy
- , subq_1.ds_partitioned__day AS ds_partitioned__day
- , subq_1.ds_partitioned__week AS ds_partitioned__week
- , subq_1.ds_partitioned__month AS ds_partitioned__month
- , subq_1.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_1.ds_partitioned__year AS ds_partitioned__year
- , subq_1.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_1.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_1.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_1.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_1.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_1.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_1.paid_at__day AS paid_at__day
- , subq_1.paid_at__week AS paid_at__week
- , subq_1.paid_at__month AS paid_at__month
- , subq_1.paid_at__quarter AS paid_at__quarter
- , subq_1.paid_at__year AS paid_at__year
- , subq_1.paid_at__extract_year AS paid_at__extract_year
- , subq_1.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_1.paid_at__extract_month AS paid_at__extract_month
- , subq_1.paid_at__extract_day AS paid_at__extract_day
- , subq_1.paid_at__extract_dow AS paid_at__extract_dow
- , subq_1.paid_at__extract_doy AS paid_at__extract_doy
- , subq_1.booking__ds__day AS booking__ds__day
- , subq_1.booking__ds__week AS booking__ds__week
- , subq_1.booking__ds__month AS booking__ds__month
- , subq_1.booking__ds__quarter AS booking__ds__quarter
- , subq_1.booking__ds__year AS booking__ds__year
- , subq_1.booking__ds__extract_year AS booking__ds__extract_year
- , subq_1.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_1.booking__ds__extract_month AS booking__ds__extract_month
- , subq_1.booking__ds__extract_day AS booking__ds__extract_day
- , subq_1.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_1.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_1.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_1.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_1.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_1.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_1.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_1.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_1.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_1.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_1.booking__paid_at__day AS booking__paid_at__day
- , subq_1.booking__paid_at__week AS booking__paid_at__week
- , subq_1.booking__paid_at__month AS booking__paid_at__month
- , subq_1.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_1.booking__paid_at__year AS booking__paid_at__year
- , subq_1.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_1.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_1.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_1.metric_time__week AS metric_time__week
- , subq_1.metric_time__month AS metric_time__month
- , subq_1.metric_time__quarter AS metric_time__quarter
- , subq_1.metric_time__year AS metric_time__year
- , subq_1.metric_time__extract_year AS metric_time__extract_year
- , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter
- , subq_1.metric_time__extract_month AS metric_time__extract_month
- , subq_1.metric_time__extract_day AS metric_time__extract_day
- , subq_1.metric_time__extract_dow AS metric_time__extract_dow
- , subq_1.metric_time__extract_doy AS metric_time__extract_doy
- , subq_1.listing AS listing
- , subq_1.guest AS guest
- , subq_1.host AS host
- , subq_1.booking__listing AS booking__listing
- , subq_1.booking__guest AS booking__guest
- , subq_1.booking__host AS booking__host
- , subq_1.is_instant AS is_instant
- , subq_1.booking__is_instant AS booking__is_instant
- , subq_1.bookings AS bookings
- , subq_1.instant_bookings AS instant_bookings
- , subq_1.booking_value AS booking_value
- , subq_1.max_booking_value AS max_booking_value
- , subq_1.min_booking_value AS min_booking_value
- , subq_1.bookers AS bookers
- , subq_1.average_booking_value AS average_booking_value
- , subq_1.referred_bookings AS referred_bookings
- , subq_1.median_booking_value AS median_booking_value
- , subq_1.booking_value_p99 AS booking_value_p99
- , subq_1.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_1.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_1.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ subq_11.metric_time__day AS metric_time__day
+ , subq_10.ds__day AS ds__day
+ , subq_10.ds__week AS ds__week
+ , subq_10.ds__month AS ds__month
+ , subq_10.ds__quarter AS ds__quarter
+ , subq_10.ds__year AS ds__year
+ , subq_10.ds__extract_year AS ds__extract_year
+ , subq_10.ds__extract_quarter AS ds__extract_quarter
+ , subq_10.ds__extract_month AS ds__extract_month
+ , subq_10.ds__extract_day AS ds__extract_day
+ , subq_10.ds__extract_dow AS ds__extract_dow
+ , subq_10.ds__extract_doy AS ds__extract_doy
+ , subq_10.ds_partitioned__day AS ds_partitioned__day
+ , subq_10.ds_partitioned__week AS ds_partitioned__week
+ , subq_10.ds_partitioned__month AS ds_partitioned__month
+ , subq_10.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_10.ds_partitioned__year AS ds_partitioned__year
+ , subq_10.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_10.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_10.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_10.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_10.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_10.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_10.paid_at__day AS paid_at__day
+ , subq_10.paid_at__week AS paid_at__week
+ , subq_10.paid_at__month AS paid_at__month
+ , subq_10.paid_at__quarter AS paid_at__quarter
+ , subq_10.paid_at__year AS paid_at__year
+ , subq_10.paid_at__extract_year AS paid_at__extract_year
+ , subq_10.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_10.paid_at__extract_month AS paid_at__extract_month
+ , subq_10.paid_at__extract_day AS paid_at__extract_day
+ , subq_10.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_10.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_10.booking__ds__day AS booking__ds__day
+ , subq_10.booking__ds__week AS booking__ds__week
+ , subq_10.booking__ds__month AS booking__ds__month
+ , subq_10.booking__ds__quarter AS booking__ds__quarter
+ , subq_10.booking__ds__year AS booking__ds__year
+ , subq_10.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_10.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_10.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_10.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_10.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_10.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_10.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_10.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_10.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_10.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_10.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_10.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_10.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_10.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_10.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_10.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_10.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_10.booking__paid_at__day AS booking__paid_at__day
+ , subq_10.booking__paid_at__week AS booking__paid_at__week
+ , subq_10.booking__paid_at__month AS booking__paid_at__month
+ , subq_10.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_10.booking__paid_at__year AS booking__paid_at__year
+ , subq_10.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_10.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_10.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_10.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_10.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_10.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_10.metric_time__week AS metric_time__week
+ , subq_10.metric_time__month AS metric_time__month
+ , subq_10.metric_time__quarter AS metric_time__quarter
+ , subq_10.metric_time__year AS metric_time__year
+ , subq_10.metric_time__extract_year AS metric_time__extract_year
+ , subq_10.metric_time__extract_quarter AS metric_time__extract_quarter
+ , subq_10.metric_time__extract_month AS metric_time__extract_month
+ , subq_10.metric_time__extract_day AS metric_time__extract_day
+ , subq_10.metric_time__extract_dow AS metric_time__extract_dow
+ , subq_10.metric_time__extract_doy AS metric_time__extract_doy
+ , subq_10.listing AS listing
+ , subq_10.guest AS guest
+ , subq_10.host AS host
+ , subq_10.booking__listing AS booking__listing
+ , subq_10.booking__guest AS booking__guest
+ , subq_10.booking__host AS booking__host
+ , subq_10.is_instant AS is_instant
+ , subq_10.booking__is_instant AS booking__is_instant
+ , subq_10.bookings AS bookings
+ , subq_10.instant_bookings AS instant_bookings
+ , subq_10.booking_value AS booking_value
+ , subq_10.max_booking_value AS max_booking_value
+ , subq_10.min_booking_value AS min_booking_value
+ , subq_10.bookers AS bookers
+ , subq_10.average_booking_value AS average_booking_value
+ , subq_10.referred_bookings AS referred_bookings
+ , subq_10.median_booking_value AS median_booking_value
+ , subq_10.booking_value_p99 AS booking_value_p99
+ , subq_10.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_10.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_10.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_3.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_3
- ) subq_2
+ subq_12.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_12
+ ) subq_11
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS booking__paid_at__extract_dow
+ , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
ON
(
- subq_1.metric_time__day <= subq_2.metric_time__day
+ subq_10.metric_time__day <= subq_11.metric_time__day
) AND (
- subq_1.metric_time__day > DATE_SUB(CAST(subq_2.metric_time__day AS DATETIME), INTERVAL 2 day)
+ subq_10.metric_time__day > DATE_SUB(CAST(subq_11.metric_time__day AS DATETIME), INTERVAL 2 day)
)
- ) subq_4
+ ) subq_13
ON
- DATE_SUB(CAST(subq_5.metric_time__day AS DATETIME), INTERVAL 2 day) = subq_4.metric_time__day
- ) subq_7
- ) subq_8
- WHERE subq_8.metric_time__day BETWEEN '2019-12-19' AND '2020-01-02'
- ) subq_9
+ DATE_SUB(CAST(subq_14.metric_time__day AS DATETIME), INTERVAL 2 day) = subq_13.metric_time__day
+ ) subq_16
+ ) subq_17
+ WHERE subq_17.metric_time__day BETWEEN '2019-12-19' AND '2020-01-02'
+ ) subq_18
GROUP BY
metric_time__day
- ) subq_10
-) subq_11
+ ) subq_19
+) subq_20
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_time_offset_metric_with_time_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_time_offset_metric_with_time_constraint__plan0_optimized.sql
index 8017ba04bd..5293e2c548 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_time_offset_metric_with_time_constraint__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_cumulative_time_offset_metric_with_time_constraint__plan0_optimized.sql
@@ -9,33 +9,33 @@ FROM (
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_17.metric_time__day AS metric_time__day
- , COUNT(DISTINCT subq_16.bookers) AS every_2_days_bookers_2_days_ago
+ subq_26.metric_time__day AS metric_time__day
+ , COUNT(DISTINCT subq_25.bookers) AS every_2_days_bookers_2_days_ago
FROM (
-- Time Spine
SELECT
ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_18
+ FROM ***************************.mf_time_spine subq_27
WHERE ds BETWEEN '2019-12-19' AND '2020-01-02'
- ) subq_17
+ ) subq_26
INNER JOIN (
-- Join Self Over Time Range
SELECT
- subq_15.ds AS metric_time__day
- , bookings_source_src_28001.guest_id AS bookers
- FROM ***************************.mf_time_spine subq_15
+ subq_24.ds AS metric_time__day
+ , bookings_source_src_28000.guest_id AS bookers
+ FROM ***************************.mf_time_spine subq_24
INNER JOIN
- ***************************.fct_bookings bookings_source_src_28001
+ ***************************.fct_bookings bookings_source_src_28000
ON
(
- DATE_TRUNC(bookings_source_src_28001.ds, day) <= subq_15.ds
+ DATE_TRUNC(bookings_source_src_28000.ds, day) <= subq_24.ds
) AND (
- DATE_TRUNC(bookings_source_src_28001.ds, day) > DATE_SUB(CAST(subq_15.ds AS DATETIME), INTERVAL 2 day)
+ DATE_TRUNC(bookings_source_src_28000.ds, day) > DATE_SUB(CAST(subq_24.ds AS DATETIME), INTERVAL 2 day)
)
- ) subq_16
+ ) subq_25
ON
- DATE_SUB(CAST(subq_17.metric_time__day AS DATETIME), INTERVAL 2 day) = subq_16.metric_time__day
- WHERE subq_17.metric_time__day BETWEEN '2019-12-19' AND '2020-01-02'
+ DATE_SUB(CAST(subq_26.metric_time__day AS DATETIME), INTERVAL 2 day) = subq_25.metric_time__day
+ WHERE subq_26.metric_time__day BETWEEN '2019-12-19' AND '2020-01-02'
GROUP BY
metric_time__day
-) subq_23
+) subq_32
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric__plan0.sql
index 13d7c71960..837ef0b791 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric__plan0.sql
@@ -1,445 +1,445 @@
-- Compute Metrics via Expressions
SELECT
- subq_10.metric_time__day
+ subq_19.metric_time__day
, (bookings - ref_bookings) * 1.0 / bookings AS non_referred_bookings_pct
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_4.metric_time__day, subq_9.metric_time__day) AS metric_time__day
- , MAX(subq_4.ref_bookings) AS ref_bookings
- , MAX(subq_9.bookings) AS bookings
+ COALESCE(subq_13.metric_time__day, subq_18.metric_time__day) AS metric_time__day
+ , MAX(subq_13.ref_bookings) AS ref_bookings
+ , MAX(subq_18.bookings) AS bookings
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_3.metric_time__day
- , subq_3.referred_bookings AS ref_bookings
+ subq_12.metric_time__day
+ , subq_12.referred_bookings AS ref_bookings
FROM (
-- Aggregate Measures
SELECT
- subq_2.metric_time__day
- , SUM(subq_2.referred_bookings) AS referred_bookings
+ subq_11.metric_time__day
+ , SUM(subq_11.referred_bookings) AS referred_bookings
FROM (
-- Pass Only Elements: ['referred_bookings', 'metric_time__day']
SELECT
- subq_1.metric_time__day
- , subq_1.referred_bookings
+ subq_10.metric_time__day
+ , subq_10.referred_bookings
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
- ) subq_2
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS booking__paid_at__extract_dow
+ , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
GROUP BY
metric_time__day
- ) subq_3
- ) subq_4
+ ) subq_12
+ ) subq_13
FULL OUTER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_8.metric_time__day
- , subq_8.bookings
+ subq_17.metric_time__day
+ , subq_17.bookings
FROM (
-- Aggregate Measures
SELECT
- subq_7.metric_time__day
- , SUM(subq_7.bookings) AS bookings
+ subq_16.metric_time__day
+ , SUM(subq_16.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__day']
SELECT
- subq_6.metric_time__day
- , subq_6.bookings
+ subq_15.metric_time__day
+ , subq_15.bookings
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_5.ds__day
- , subq_5.ds__week
- , subq_5.ds__month
- , subq_5.ds__quarter
- , subq_5.ds__year
- , subq_5.ds__extract_year
- , subq_5.ds__extract_quarter
- , subq_5.ds__extract_month
- , subq_5.ds__extract_day
- , subq_5.ds__extract_dow
- , subq_5.ds__extract_doy
- , subq_5.ds_partitioned__day
- , subq_5.ds_partitioned__week
- , subq_5.ds_partitioned__month
- , subq_5.ds_partitioned__quarter
- , subq_5.ds_partitioned__year
- , subq_5.ds_partitioned__extract_year
- , subq_5.ds_partitioned__extract_quarter
- , subq_5.ds_partitioned__extract_month
- , subq_5.ds_partitioned__extract_day
- , subq_5.ds_partitioned__extract_dow
- , subq_5.ds_partitioned__extract_doy
- , subq_5.paid_at__day
- , subq_5.paid_at__week
- , subq_5.paid_at__month
- , subq_5.paid_at__quarter
- , subq_5.paid_at__year
- , subq_5.paid_at__extract_year
- , subq_5.paid_at__extract_quarter
- , subq_5.paid_at__extract_month
- , subq_5.paid_at__extract_day
- , subq_5.paid_at__extract_dow
- , subq_5.paid_at__extract_doy
- , subq_5.booking__ds__day
- , subq_5.booking__ds__week
- , subq_5.booking__ds__month
- , subq_5.booking__ds__quarter
- , subq_5.booking__ds__year
- , subq_5.booking__ds__extract_year
- , subq_5.booking__ds__extract_quarter
- , subq_5.booking__ds__extract_month
- , subq_5.booking__ds__extract_day
- , subq_5.booking__ds__extract_dow
- , subq_5.booking__ds__extract_doy
- , subq_5.booking__ds_partitioned__day
- , subq_5.booking__ds_partitioned__week
- , subq_5.booking__ds_partitioned__month
- , subq_5.booking__ds_partitioned__quarter
- , subq_5.booking__ds_partitioned__year
- , subq_5.booking__ds_partitioned__extract_year
- , subq_5.booking__ds_partitioned__extract_quarter
- , subq_5.booking__ds_partitioned__extract_month
- , subq_5.booking__ds_partitioned__extract_day
- , subq_5.booking__ds_partitioned__extract_dow
- , subq_5.booking__ds_partitioned__extract_doy
- , subq_5.booking__paid_at__day
- , subq_5.booking__paid_at__week
- , subq_5.booking__paid_at__month
- , subq_5.booking__paid_at__quarter
- , subq_5.booking__paid_at__year
- , subq_5.booking__paid_at__extract_year
- , subq_5.booking__paid_at__extract_quarter
- , subq_5.booking__paid_at__extract_month
- , subq_5.booking__paid_at__extract_day
- , subq_5.booking__paid_at__extract_dow
- , subq_5.booking__paid_at__extract_doy
- , subq_5.ds__day AS metric_time__day
- , subq_5.ds__week AS metric_time__week
- , subq_5.ds__month AS metric_time__month
- , subq_5.ds__quarter AS metric_time__quarter
- , subq_5.ds__year AS metric_time__year
- , subq_5.ds__extract_year AS metric_time__extract_year
- , subq_5.ds__extract_quarter AS metric_time__extract_quarter
- , subq_5.ds__extract_month AS metric_time__extract_month
- , subq_5.ds__extract_day AS metric_time__extract_day
- , subq_5.ds__extract_dow AS metric_time__extract_dow
- , subq_5.ds__extract_doy AS metric_time__extract_doy
- , subq_5.listing
- , subq_5.guest
- , subq_5.host
- , subq_5.booking__listing
- , subq_5.booking__guest
- , subq_5.booking__host
- , subq_5.is_instant
- , subq_5.booking__is_instant
- , subq_5.bookings
- , subq_5.instant_bookings
- , subq_5.booking_value
- , subq_5.max_booking_value
- , subq_5.min_booking_value
- , subq_5.bookers
- , subq_5.average_booking_value
- , subq_5.referred_bookings
- , subq_5.median_booking_value
- , subq_5.booking_value_p99
- , subq_5.discrete_booking_value_p99
- , subq_5.approximate_continuous_booking_value_p99
- , subq_5.approximate_discrete_booking_value_p99
+ subq_14.ds__day
+ , subq_14.ds__week
+ , subq_14.ds__month
+ , subq_14.ds__quarter
+ , subq_14.ds__year
+ , subq_14.ds__extract_year
+ , subq_14.ds__extract_quarter
+ , subq_14.ds__extract_month
+ , subq_14.ds__extract_day
+ , subq_14.ds__extract_dow
+ , subq_14.ds__extract_doy
+ , subq_14.ds_partitioned__day
+ , subq_14.ds_partitioned__week
+ , subq_14.ds_partitioned__month
+ , subq_14.ds_partitioned__quarter
+ , subq_14.ds_partitioned__year
+ , subq_14.ds_partitioned__extract_year
+ , subq_14.ds_partitioned__extract_quarter
+ , subq_14.ds_partitioned__extract_month
+ , subq_14.ds_partitioned__extract_day
+ , subq_14.ds_partitioned__extract_dow
+ , subq_14.ds_partitioned__extract_doy
+ , subq_14.paid_at__day
+ , subq_14.paid_at__week
+ , subq_14.paid_at__month
+ , subq_14.paid_at__quarter
+ , subq_14.paid_at__year
+ , subq_14.paid_at__extract_year
+ , subq_14.paid_at__extract_quarter
+ , subq_14.paid_at__extract_month
+ , subq_14.paid_at__extract_day
+ , subq_14.paid_at__extract_dow
+ , subq_14.paid_at__extract_doy
+ , subq_14.booking__ds__day
+ , subq_14.booking__ds__week
+ , subq_14.booking__ds__month
+ , subq_14.booking__ds__quarter
+ , subq_14.booking__ds__year
+ , subq_14.booking__ds__extract_year
+ , subq_14.booking__ds__extract_quarter
+ , subq_14.booking__ds__extract_month
+ , subq_14.booking__ds__extract_day
+ , subq_14.booking__ds__extract_dow
+ , subq_14.booking__ds__extract_doy
+ , subq_14.booking__ds_partitioned__day
+ , subq_14.booking__ds_partitioned__week
+ , subq_14.booking__ds_partitioned__month
+ , subq_14.booking__ds_partitioned__quarter
+ , subq_14.booking__ds_partitioned__year
+ , subq_14.booking__ds_partitioned__extract_year
+ , subq_14.booking__ds_partitioned__extract_quarter
+ , subq_14.booking__ds_partitioned__extract_month
+ , subq_14.booking__ds_partitioned__extract_day
+ , subq_14.booking__ds_partitioned__extract_dow
+ , subq_14.booking__ds_partitioned__extract_doy
+ , subq_14.booking__paid_at__day
+ , subq_14.booking__paid_at__week
+ , subq_14.booking__paid_at__month
+ , subq_14.booking__paid_at__quarter
+ , subq_14.booking__paid_at__year
+ , subq_14.booking__paid_at__extract_year
+ , subq_14.booking__paid_at__extract_quarter
+ , subq_14.booking__paid_at__extract_month
+ , subq_14.booking__paid_at__extract_day
+ , subq_14.booking__paid_at__extract_dow
+ , subq_14.booking__paid_at__extract_doy
+ , subq_14.ds__day AS metric_time__day
+ , subq_14.ds__week AS metric_time__week
+ , subq_14.ds__month AS metric_time__month
+ , subq_14.ds__quarter AS metric_time__quarter
+ , subq_14.ds__year AS metric_time__year
+ , subq_14.ds__extract_year AS metric_time__extract_year
+ , subq_14.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_14.ds__extract_month AS metric_time__extract_month
+ , subq_14.ds__extract_day AS metric_time__extract_day
+ , subq_14.ds__extract_dow AS metric_time__extract_dow
+ , subq_14.ds__extract_doy AS metric_time__extract_doy
+ , subq_14.listing
+ , subq_14.guest
+ , subq_14.host
+ , subq_14.booking__listing
+ , subq_14.booking__guest
+ , subq_14.booking__host
+ , subq_14.is_instant
+ , subq_14.booking__is_instant
+ , subq_14.bookings
+ , subq_14.instant_bookings
+ , subq_14.booking_value
+ , subq_14.max_booking_value
+ , subq_14.min_booking_value
+ , subq_14.bookers
+ , subq_14.average_booking_value
+ , subq_14.referred_bookings
+ , subq_14.median_booking_value
+ , subq_14.booking_value_p99
+ , subq_14.discrete_booking_value_p99
+ , subq_14.approximate_continuous_booking_value_p99
+ , subq_14.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_5
- ) subq_6
- ) subq_7
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS booking__paid_at__extract_dow
+ , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_14
+ ) subq_15
+ ) subq_16
GROUP BY
metric_time__day
- ) subq_8
- ) subq_9
+ ) subq_17
+ ) subq_18
ON
- subq_4.metric_time__day = subq_9.metric_time__day
+ subq_13.metric_time__day = subq_18.metric_time__day
GROUP BY
metric_time__day
-) subq_10
+) subq_19
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric__plan0_optimized.sql
index 96c7f9893d..835463ceca 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric__plan0_optimized.sql
@@ -5,9 +5,9 @@ SELECT
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_15.metric_time__day, subq_20.metric_time__day) AS metric_time__day
- , MAX(subq_15.ref_bookings) AS ref_bookings
- , MAX(subq_20.bookings) AS bookings
+ COALESCE(subq_24.metric_time__day, subq_29.metric_time__day) AS metric_time__day
+ , MAX(subq_24.ref_bookings) AS ref_bookings
+ , MAX(subq_29.bookings) AS bookings
FROM (
-- Aggregate Measures
-- Compute Metrics via Expressions
@@ -21,11 +21,11 @@ FROM (
SELECT
DATE_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_28001
- ) subq_13
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_22
GROUP BY
metric_time__day
- ) subq_15
+ ) subq_24
FULL OUTER JOIN (
-- Aggregate Measures
-- Compute Metrics via Expressions
@@ -39,13 +39,13 @@ FROM (
SELECT
DATE_TRUNC(ds, day) AS metric_time__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_18
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_27
GROUP BY
metric_time__day
- ) subq_20
+ ) subq_29
ON
- subq_15.metric_time__day = subq_20.metric_time__day
+ subq_24.metric_time__day = subq_29.metric_time__day
GROUP BY
metric_time__day
-) subq_21
+) subq_30
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_month_dimension_and_offset_window__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_month_dimension_and_offset_window__plan0.sql
index 0de5b54144..aa452a5243 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_month_dimension_and_offset_window__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_month_dimension_and_offset_window__plan0.sql
@@ -1,73 +1,73 @@
-- Compute Metrics via Expressions
SELECT
- subq_7.metric_time__month
+ subq_9.metric_time__month
, bookings_last_month AS bookings_last_month
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_6.metric_time__month
- , subq_6.bookings_monthly AS bookings_last_month
+ subq_8.metric_time__month
+ , subq_8.bookings_monthly AS bookings_last_month
FROM (
-- Aggregate Measures
SELECT
- subq_5.metric_time__month
- , SUM(subq_5.bookings_monthly) AS bookings_monthly
+ subq_7.metric_time__month
+ , SUM(subq_7.bookings_monthly) AS bookings_monthly
FROM (
-- Pass Only Elements: ['bookings_monthly', 'metric_time__month']
SELECT
- subq_4.metric_time__month
- , subq_4.bookings_monthly
+ subq_6.metric_time__month
+ , subq_6.bookings_monthly
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_2.metric_time__month AS metric_time__month
- , subq_1.monthly_ds__month AS monthly_ds__month
- , subq_1.monthly_ds__quarter AS monthly_ds__quarter
- , subq_1.monthly_ds__year AS monthly_ds__year
- , subq_1.monthly_ds__extract_year AS monthly_ds__extract_year
- , subq_1.monthly_ds__extract_quarter AS monthly_ds__extract_quarter
- , subq_1.monthly_ds__extract_month AS monthly_ds__extract_month
- , subq_1.booking__monthly_ds__month AS booking__monthly_ds__month
- , subq_1.booking__monthly_ds__quarter AS booking__monthly_ds__quarter
- , subq_1.booking__monthly_ds__year AS booking__monthly_ds__year
- , subq_1.booking__monthly_ds__extract_year AS booking__monthly_ds__extract_year
- , subq_1.booking__monthly_ds__extract_quarter AS booking__monthly_ds__extract_quarter
- , subq_1.booking__monthly_ds__extract_month AS booking__monthly_ds__extract_month
- , subq_1.listing AS listing
- , subq_1.booking__listing AS booking__listing
- , subq_1.bookings_monthly AS bookings_monthly
+ subq_4.metric_time__month AS metric_time__month
+ , subq_3.monthly_ds__month AS monthly_ds__month
+ , subq_3.monthly_ds__quarter AS monthly_ds__quarter
+ , subq_3.monthly_ds__year AS monthly_ds__year
+ , subq_3.monthly_ds__extract_year AS monthly_ds__extract_year
+ , subq_3.monthly_ds__extract_quarter AS monthly_ds__extract_quarter
+ , subq_3.monthly_ds__extract_month AS monthly_ds__extract_month
+ , subq_3.booking__monthly_ds__month AS booking__monthly_ds__month
+ , subq_3.booking__monthly_ds__quarter AS booking__monthly_ds__quarter
+ , subq_3.booking__monthly_ds__year AS booking__monthly_ds__year
+ , subq_3.booking__monthly_ds__extract_year AS booking__monthly_ds__extract_year
+ , subq_3.booking__monthly_ds__extract_quarter AS booking__monthly_ds__extract_quarter
+ , subq_3.booking__monthly_ds__extract_month AS booking__monthly_ds__extract_month
+ , subq_3.listing AS listing
+ , subq_3.booking__listing AS booking__listing
+ , subq_3.bookings_monthly AS bookings_monthly
FROM (
-- Time Spine
SELECT
- DATE_TRUNC(subq_3.ds, month) AS metric_time__month
- FROM ***************************.mf_time_spine subq_3
+ DATE_TRUNC(subq_5.ds, month) AS metric_time__month
+ FROM ***************************.mf_time_spine subq_5
GROUP BY
metric_time__month
- ) subq_2
+ ) subq_4
INNER JOIN (
-- Metric Time Dimension 'monthly_ds'
SELECT
- subq_0.monthly_ds__month
- , subq_0.monthly_ds__quarter
- , subq_0.monthly_ds__year
- , subq_0.monthly_ds__extract_year
- , subq_0.monthly_ds__extract_quarter
- , subq_0.monthly_ds__extract_month
- , subq_0.booking__monthly_ds__month
- , subq_0.booking__monthly_ds__quarter
- , subq_0.booking__monthly_ds__year
- , subq_0.booking__monthly_ds__extract_year
- , subq_0.booking__monthly_ds__extract_quarter
- , subq_0.booking__monthly_ds__extract_month
- , subq_0.monthly_ds__month AS metric_time__month
- , subq_0.monthly_ds__quarter AS metric_time__quarter
- , subq_0.monthly_ds__year AS metric_time__year
- , subq_0.monthly_ds__extract_year AS metric_time__extract_year
- , subq_0.monthly_ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.monthly_ds__extract_month AS metric_time__extract_month
- , subq_0.listing
- , subq_0.booking__listing
- , subq_0.bookings_monthly
+ subq_2.monthly_ds__month
+ , subq_2.monthly_ds__quarter
+ , subq_2.monthly_ds__year
+ , subq_2.monthly_ds__extract_year
+ , subq_2.monthly_ds__extract_quarter
+ , subq_2.monthly_ds__extract_month
+ , subq_2.booking__monthly_ds__month
+ , subq_2.booking__monthly_ds__quarter
+ , subq_2.booking__monthly_ds__year
+ , subq_2.booking__monthly_ds__extract_year
+ , subq_2.booking__monthly_ds__extract_quarter
+ , subq_2.booking__monthly_ds__extract_month
+ , subq_2.monthly_ds__month AS metric_time__month
+ , subq_2.monthly_ds__quarter AS metric_time__quarter
+ , subq_2.monthly_ds__year AS metric_time__year
+ , subq_2.monthly_ds__extract_year AS metric_time__extract_year
+ , subq_2.monthly_ds__extract_quarter AS metric_time__extract_quarter
+ , subq_2.monthly_ds__extract_month AS metric_time__extract_month
+ , subq_2.listing
+ , subq_2.booking__listing
+ , subq_2.bookings_monthly
FROM (
-- Read Elements From Semantic Model 'bookings_monthly_source'
SELECT
@@ -87,13 +87,13 @@ FROM (
, bookings_monthly_source_src_16000.listing_id AS listing
, bookings_monthly_source_src_16000.listing_id AS booking__listing
FROM ***************************.fct_bookings_extended_monthly bookings_monthly_source_src_16000
- ) subq_0
- ) subq_1
+ ) subq_2
+ ) subq_3
ON
- DATE_SUB(CAST(subq_2.metric_time__month AS DATETIME), INTERVAL 1 month) = subq_1.metric_time__month
- ) subq_4
- ) subq_5
+ DATE_SUB(CAST(subq_4.metric_time__month AS DATETIME), INTERVAL 1 month) = subq_3.metric_time__month
+ ) subq_6
+ ) subq_7
GROUP BY
metric_time__month
- ) subq_6
-) subq_7
+ ) subq_8
+) subq_9
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_month_dimension_and_offset_window__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_month_dimension_and_offset_window__plan0_optimized.sql
index 5d3bd940a3..abaab21353 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_month_dimension_and_offset_window__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_month_dimension_and_offset_window__plan0_optimized.sql
@@ -8,20 +8,20 @@ FROM (
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_10.metric_time__month AS metric_time__month
+ subq_12.metric_time__month AS metric_time__month
, SUM(bookings_monthly_source_src_16000.bookings_monthly) AS bookings_last_month
FROM (
-- Time Spine
SELECT
DATE_TRUNC(ds, month) AS metric_time__month
- FROM ***************************.mf_time_spine subq_11
+ FROM ***************************.mf_time_spine subq_13
GROUP BY
metric_time__month
- ) subq_10
+ ) subq_12
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_12.metric_time__month AS DATETIME), INTERVAL 1 month) = DATE_TRUNC(bookings_monthly_source_src_16000.ds, month)
GROUP BY
metric_time__month
-) subq_15
+) subq_17
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_to_grain__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_to_grain__plan0.sql
index fea9961fc7..9d7e760a01 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_to_grain__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_to_grain__plan0.sql
@@ -1,545 +1,545 @@
-- Compute Metrics via Expressions
SELECT
- subq_13.metric_time__day
+ subq_22.metric_time__day
, bookings - bookings_at_start_of_month AS bookings_growth_since_start_of_month
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_4.metric_time__day, subq_12.metric_time__day) AS metric_time__day
- , MAX(subq_4.bookings) AS bookings
- , MAX(subq_12.bookings_at_start_of_month) AS bookings_at_start_of_month
+ COALESCE(subq_13.metric_time__day, subq_21.metric_time__day) AS metric_time__day
+ , MAX(subq_13.bookings) AS bookings
+ , MAX(subq_21.bookings_at_start_of_month) AS bookings_at_start_of_month
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_3.metric_time__day
- , subq_3.bookings
+ subq_12.metric_time__day
+ , subq_12.bookings
FROM (
-- Aggregate Measures
SELECT
- subq_2.metric_time__day
- , SUM(subq_2.bookings) AS bookings
+ subq_11.metric_time__day
+ , SUM(subq_11.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__day']
SELECT
- subq_1.metric_time__day
- , subq_1.bookings
+ subq_10.metric_time__day
+ , subq_10.bookings
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
- ) subq_2
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS booking__paid_at__extract_dow
+ , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
GROUP BY
metric_time__day
- ) subq_3
- ) subq_4
+ ) subq_12
+ ) subq_13
FULL OUTER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_11.metric_time__day
- , subq_11.bookings AS bookings_at_start_of_month
+ subq_20.metric_time__day
+ , subq_20.bookings AS bookings_at_start_of_month
FROM (
-- Aggregate Measures
SELECT
- subq_10.metric_time__day
- , SUM(subq_10.bookings) AS bookings
+ subq_19.metric_time__day
+ , SUM(subq_19.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__day']
SELECT
- subq_9.metric_time__day
- , subq_9.bookings
+ subq_18.metric_time__day
+ , subq_18.bookings
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_7.metric_time__day AS metric_time__day
- , subq_6.ds__day AS ds__day
- , subq_6.ds__week AS ds__week
- , subq_6.ds__month AS ds__month
- , subq_6.ds__quarter AS ds__quarter
- , subq_6.ds__year AS ds__year
- , subq_6.ds__extract_year AS ds__extract_year
- , subq_6.ds__extract_quarter AS ds__extract_quarter
- , subq_6.ds__extract_month AS ds__extract_month
- , subq_6.ds__extract_day AS ds__extract_day
- , subq_6.ds__extract_dow AS ds__extract_dow
- , subq_6.ds__extract_doy AS ds__extract_doy
- , subq_6.ds_partitioned__day AS ds_partitioned__day
- , subq_6.ds_partitioned__week AS ds_partitioned__week
- , subq_6.ds_partitioned__month AS ds_partitioned__month
- , subq_6.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_6.ds_partitioned__year AS ds_partitioned__year
- , subq_6.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_6.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_6.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_6.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_6.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_6.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_6.paid_at__day AS paid_at__day
- , subq_6.paid_at__week AS paid_at__week
- , subq_6.paid_at__month AS paid_at__month
- , subq_6.paid_at__quarter AS paid_at__quarter
- , subq_6.paid_at__year AS paid_at__year
- , subq_6.paid_at__extract_year AS paid_at__extract_year
- , subq_6.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_6.paid_at__extract_month AS paid_at__extract_month
- , subq_6.paid_at__extract_day AS paid_at__extract_day
- , subq_6.paid_at__extract_dow AS paid_at__extract_dow
- , subq_6.paid_at__extract_doy AS paid_at__extract_doy
- , subq_6.booking__ds__day AS booking__ds__day
- , subq_6.booking__ds__week AS booking__ds__week
- , subq_6.booking__ds__month AS booking__ds__month
- , subq_6.booking__ds__quarter AS booking__ds__quarter
- , subq_6.booking__ds__year AS booking__ds__year
- , subq_6.booking__ds__extract_year AS booking__ds__extract_year
- , subq_6.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_6.booking__ds__extract_month AS booking__ds__extract_month
- , subq_6.booking__ds__extract_day AS booking__ds__extract_day
- , subq_6.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_6.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_6.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_6.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_6.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_6.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_6.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_6.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_6.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_6.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_6.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_6.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_6.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_6.booking__paid_at__day AS booking__paid_at__day
- , subq_6.booking__paid_at__week AS booking__paid_at__week
- , subq_6.booking__paid_at__month AS booking__paid_at__month
- , subq_6.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_6.booking__paid_at__year AS booking__paid_at__year
- , subq_6.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_6.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_6.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_6.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_6.listing AS listing
- , subq_6.guest AS guest
- , subq_6.host AS host
- , subq_6.booking__listing AS booking__listing
- , subq_6.booking__guest AS booking__guest
- , subq_6.booking__host AS booking__host
- , subq_6.is_instant AS is_instant
- , subq_6.booking__is_instant AS booking__is_instant
- , subq_6.bookings AS bookings
- , subq_6.instant_bookings AS instant_bookings
- , subq_6.booking_value AS booking_value
- , subq_6.max_booking_value AS max_booking_value
- , subq_6.min_booking_value AS min_booking_value
- , subq_6.bookers AS bookers
- , subq_6.average_booking_value AS average_booking_value
- , subq_6.referred_bookings AS referred_bookings
- , subq_6.median_booking_value AS median_booking_value
- , subq_6.booking_value_p99 AS booking_value_p99
- , subq_6.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_6.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_6.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ subq_16.metric_time__day AS metric_time__day
+ , subq_15.ds__day AS ds__day
+ , subq_15.ds__week AS ds__week
+ , subq_15.ds__month AS ds__month
+ , subq_15.ds__quarter AS ds__quarter
+ , subq_15.ds__year AS ds__year
+ , subq_15.ds__extract_year AS ds__extract_year
+ , subq_15.ds__extract_quarter AS ds__extract_quarter
+ , subq_15.ds__extract_month AS ds__extract_month
+ , subq_15.ds__extract_day AS ds__extract_day
+ , subq_15.ds__extract_dow AS ds__extract_dow
+ , subq_15.ds__extract_doy AS ds__extract_doy
+ , subq_15.ds_partitioned__day AS ds_partitioned__day
+ , subq_15.ds_partitioned__week AS ds_partitioned__week
+ , subq_15.ds_partitioned__month AS ds_partitioned__month
+ , subq_15.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_15.ds_partitioned__year AS ds_partitioned__year
+ , subq_15.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_15.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_15.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_15.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_15.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_15.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_15.paid_at__day AS paid_at__day
+ , subq_15.paid_at__week AS paid_at__week
+ , subq_15.paid_at__month AS paid_at__month
+ , subq_15.paid_at__quarter AS paid_at__quarter
+ , subq_15.paid_at__year AS paid_at__year
+ , subq_15.paid_at__extract_year AS paid_at__extract_year
+ , subq_15.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_15.paid_at__extract_month AS paid_at__extract_month
+ , subq_15.paid_at__extract_day AS paid_at__extract_day
+ , subq_15.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_15.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_15.booking__ds__day AS booking__ds__day
+ , subq_15.booking__ds__week AS booking__ds__week
+ , subq_15.booking__ds__month AS booking__ds__month
+ , subq_15.booking__ds__quarter AS booking__ds__quarter
+ , subq_15.booking__ds__year AS booking__ds__year
+ , subq_15.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_15.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_15.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_15.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_15.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_15.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_15.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_15.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_15.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_15.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_15.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_15.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_15.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_15.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_15.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_15.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_15.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_15.booking__paid_at__day AS booking__paid_at__day
+ , subq_15.booking__paid_at__week AS booking__paid_at__week
+ , subq_15.booking__paid_at__month AS booking__paid_at__month
+ , subq_15.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_15.booking__paid_at__year AS booking__paid_at__year
+ , subq_15.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_15.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_15.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_15.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_15.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_15.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_15.listing AS listing
+ , subq_15.guest AS guest
+ , subq_15.host AS host
+ , subq_15.booking__listing AS booking__listing
+ , subq_15.booking__guest AS booking__guest
+ , subq_15.booking__host AS booking__host
+ , subq_15.is_instant AS is_instant
+ , subq_15.booking__is_instant AS booking__is_instant
+ , subq_15.bookings AS bookings
+ , subq_15.instant_bookings AS instant_bookings
+ , subq_15.booking_value AS booking_value
+ , subq_15.max_booking_value AS max_booking_value
+ , subq_15.min_booking_value AS min_booking_value
+ , subq_15.bookers AS bookers
+ , subq_15.average_booking_value AS average_booking_value
+ , subq_15.referred_bookings AS referred_bookings
+ , subq_15.median_booking_value AS median_booking_value
+ , subq_15.booking_value_p99 AS booking_value_p99
+ , subq_15.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_15.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_15.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_8.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_8
- ) subq_7
+ subq_17.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_17
+ ) subq_16
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_5.ds__day
- , subq_5.ds__week
- , subq_5.ds__month
- , subq_5.ds__quarter
- , subq_5.ds__year
- , subq_5.ds__extract_year
- , subq_5.ds__extract_quarter
- , subq_5.ds__extract_month
- , subq_5.ds__extract_day
- , subq_5.ds__extract_dow
- , subq_5.ds__extract_doy
- , subq_5.ds_partitioned__day
- , subq_5.ds_partitioned__week
- , subq_5.ds_partitioned__month
- , subq_5.ds_partitioned__quarter
- , subq_5.ds_partitioned__year
- , subq_5.ds_partitioned__extract_year
- , subq_5.ds_partitioned__extract_quarter
- , subq_5.ds_partitioned__extract_month
- , subq_5.ds_partitioned__extract_day
- , subq_5.ds_partitioned__extract_dow
- , subq_5.ds_partitioned__extract_doy
- , subq_5.paid_at__day
- , subq_5.paid_at__week
- , subq_5.paid_at__month
- , subq_5.paid_at__quarter
- , subq_5.paid_at__year
- , subq_5.paid_at__extract_year
- , subq_5.paid_at__extract_quarter
- , subq_5.paid_at__extract_month
- , subq_5.paid_at__extract_day
- , subq_5.paid_at__extract_dow
- , subq_5.paid_at__extract_doy
- , subq_5.booking__ds__day
- , subq_5.booking__ds__week
- , subq_5.booking__ds__month
- , subq_5.booking__ds__quarter
- , subq_5.booking__ds__year
- , subq_5.booking__ds__extract_year
- , subq_5.booking__ds__extract_quarter
- , subq_5.booking__ds__extract_month
- , subq_5.booking__ds__extract_day
- , subq_5.booking__ds__extract_dow
- , subq_5.booking__ds__extract_doy
- , subq_5.booking__ds_partitioned__day
- , subq_5.booking__ds_partitioned__week
- , subq_5.booking__ds_partitioned__month
- , subq_5.booking__ds_partitioned__quarter
- , subq_5.booking__ds_partitioned__year
- , subq_5.booking__ds_partitioned__extract_year
- , subq_5.booking__ds_partitioned__extract_quarter
- , subq_5.booking__ds_partitioned__extract_month
- , subq_5.booking__ds_partitioned__extract_day
- , subq_5.booking__ds_partitioned__extract_dow
- , subq_5.booking__ds_partitioned__extract_doy
- , subq_5.booking__paid_at__day
- , subq_5.booking__paid_at__week
- , subq_5.booking__paid_at__month
- , subq_5.booking__paid_at__quarter
- , subq_5.booking__paid_at__year
- , subq_5.booking__paid_at__extract_year
- , subq_5.booking__paid_at__extract_quarter
- , subq_5.booking__paid_at__extract_month
- , subq_5.booking__paid_at__extract_day
- , subq_5.booking__paid_at__extract_dow
- , subq_5.booking__paid_at__extract_doy
- , subq_5.ds__day AS metric_time__day
- , subq_5.ds__week AS metric_time__week
- , subq_5.ds__month AS metric_time__month
- , subq_5.ds__quarter AS metric_time__quarter
- , subq_5.ds__year AS metric_time__year
- , subq_5.ds__extract_year AS metric_time__extract_year
- , subq_5.ds__extract_quarter AS metric_time__extract_quarter
- , subq_5.ds__extract_month AS metric_time__extract_month
- , subq_5.ds__extract_day AS metric_time__extract_day
- , subq_5.ds__extract_dow AS metric_time__extract_dow
- , subq_5.ds__extract_doy AS metric_time__extract_doy
- , subq_5.listing
- , subq_5.guest
- , subq_5.host
- , subq_5.booking__listing
- , subq_5.booking__guest
- , subq_5.booking__host
- , subq_5.is_instant
- , subq_5.booking__is_instant
- , subq_5.bookings
- , subq_5.instant_bookings
- , subq_5.booking_value
- , subq_5.max_booking_value
- , subq_5.min_booking_value
- , subq_5.bookers
- , subq_5.average_booking_value
- , subq_5.referred_bookings
- , subq_5.median_booking_value
- , subq_5.booking_value_p99
- , subq_5.discrete_booking_value_p99
- , subq_5.approximate_continuous_booking_value_p99
- , subq_5.approximate_discrete_booking_value_p99
+ subq_14.ds__day
+ , subq_14.ds__week
+ , subq_14.ds__month
+ , subq_14.ds__quarter
+ , subq_14.ds__year
+ , subq_14.ds__extract_year
+ , subq_14.ds__extract_quarter
+ , subq_14.ds__extract_month
+ , subq_14.ds__extract_day
+ , subq_14.ds__extract_dow
+ , subq_14.ds__extract_doy
+ , subq_14.ds_partitioned__day
+ , subq_14.ds_partitioned__week
+ , subq_14.ds_partitioned__month
+ , subq_14.ds_partitioned__quarter
+ , subq_14.ds_partitioned__year
+ , subq_14.ds_partitioned__extract_year
+ , subq_14.ds_partitioned__extract_quarter
+ , subq_14.ds_partitioned__extract_month
+ , subq_14.ds_partitioned__extract_day
+ , subq_14.ds_partitioned__extract_dow
+ , subq_14.ds_partitioned__extract_doy
+ , subq_14.paid_at__day
+ , subq_14.paid_at__week
+ , subq_14.paid_at__month
+ , subq_14.paid_at__quarter
+ , subq_14.paid_at__year
+ , subq_14.paid_at__extract_year
+ , subq_14.paid_at__extract_quarter
+ , subq_14.paid_at__extract_month
+ , subq_14.paid_at__extract_day
+ , subq_14.paid_at__extract_dow
+ , subq_14.paid_at__extract_doy
+ , subq_14.booking__ds__day
+ , subq_14.booking__ds__week
+ , subq_14.booking__ds__month
+ , subq_14.booking__ds__quarter
+ , subq_14.booking__ds__year
+ , subq_14.booking__ds__extract_year
+ , subq_14.booking__ds__extract_quarter
+ , subq_14.booking__ds__extract_month
+ , subq_14.booking__ds__extract_day
+ , subq_14.booking__ds__extract_dow
+ , subq_14.booking__ds__extract_doy
+ , subq_14.booking__ds_partitioned__day
+ , subq_14.booking__ds_partitioned__week
+ , subq_14.booking__ds_partitioned__month
+ , subq_14.booking__ds_partitioned__quarter
+ , subq_14.booking__ds_partitioned__year
+ , subq_14.booking__ds_partitioned__extract_year
+ , subq_14.booking__ds_partitioned__extract_quarter
+ , subq_14.booking__ds_partitioned__extract_month
+ , subq_14.booking__ds_partitioned__extract_day
+ , subq_14.booking__ds_partitioned__extract_dow
+ , subq_14.booking__ds_partitioned__extract_doy
+ , subq_14.booking__paid_at__day
+ , subq_14.booking__paid_at__week
+ , subq_14.booking__paid_at__month
+ , subq_14.booking__paid_at__quarter
+ , subq_14.booking__paid_at__year
+ , subq_14.booking__paid_at__extract_year
+ , subq_14.booking__paid_at__extract_quarter
+ , subq_14.booking__paid_at__extract_month
+ , subq_14.booking__paid_at__extract_day
+ , subq_14.booking__paid_at__extract_dow
+ , subq_14.booking__paid_at__extract_doy
+ , subq_14.ds__day AS metric_time__day
+ , subq_14.ds__week AS metric_time__week
+ , subq_14.ds__month AS metric_time__month
+ , subq_14.ds__quarter AS metric_time__quarter
+ , subq_14.ds__year AS metric_time__year
+ , subq_14.ds__extract_year AS metric_time__extract_year
+ , subq_14.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_14.ds__extract_month AS metric_time__extract_month
+ , subq_14.ds__extract_day AS metric_time__extract_day
+ , subq_14.ds__extract_dow AS metric_time__extract_dow
+ , subq_14.ds__extract_doy AS metric_time__extract_doy
+ , subq_14.listing
+ , subq_14.guest
+ , subq_14.host
+ , subq_14.booking__listing
+ , subq_14.booking__guest
+ , subq_14.booking__host
+ , subq_14.is_instant
+ , subq_14.booking__is_instant
+ , subq_14.bookings
+ , subq_14.instant_bookings
+ , subq_14.booking_value
+ , subq_14.max_booking_value
+ , subq_14.min_booking_value
+ , subq_14.bookers
+ , subq_14.average_booking_value
+ , subq_14.referred_bookings
+ , subq_14.median_booking_value
+ , subq_14.booking_value_p99
+ , subq_14.discrete_booking_value_p99
+ , subq_14.approximate_continuous_booking_value_p99
+ , subq_14.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_5
- ) subq_6
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS booking__paid_at__extract_dow
+ , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_14
+ ) subq_15
ON
- DATE_TRUNC(subq_7.metric_time__day, month) = subq_6.metric_time__day
- ) subq_9
- ) subq_10
+ DATE_TRUNC(subq_16.metric_time__day, month) = subq_15.metric_time__day
+ ) subq_18
+ ) subq_19
GROUP BY
metric_time__day
- ) subq_11
- ) subq_12
+ ) subq_20
+ ) subq_21
ON
- subq_4.metric_time__day = subq_12.metric_time__day
+ subq_13.metric_time__day = subq_21.metric_time__day
GROUP BY
metric_time__day
-) subq_13
+) subq_22
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_to_grain__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_to_grain__plan0_optimized.sql
index d37df9cff5..4a45e241b2 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_to_grain__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_to_grain__plan0_optimized.sql
@@ -5,9 +5,9 @@ SELECT
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_18.metric_time__day, subq_26.metric_time__day) AS metric_time__day
- , MAX(subq_18.bookings) AS bookings
- , MAX(subq_26.bookings_at_start_of_month) AS bookings_at_start_of_month
+ COALESCE(subq_27.metric_time__day, subq_35.metric_time__day) AS metric_time__day
+ , MAX(subq_27.bookings) AS bookings
+ , MAX(subq_35.bookings_at_start_of_month) AS bookings_at_start_of_month
FROM (
-- Aggregate Measures
-- Compute Metrics via Expressions
@@ -21,35 +21,35 @@ FROM (
SELECT
DATE_TRUNC(ds, day) AS metric_time__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_16
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_25
GROUP BY
metric_time__day
- ) subq_18
+ ) subq_27
FULL OUTER JOIN (
-- Join to Time Spine Dataset
-- Pass Only Elements: ['bookings', 'metric_time__day']
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_22.ds AS metric_time__day
- , SUM(subq_20.bookings) AS bookings_at_start_of_month
- FROM ***************************.mf_time_spine subq_22
+ subq_31.ds AS metric_time__day
+ , SUM(subq_29.bookings) AS bookings_at_start_of_month
+ FROM ***************************.mf_time_spine subq_31
INNER JOIN (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
SELECT
DATE_TRUNC(ds, day) AS metric_time__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_20
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_29
ON
- DATE_TRUNC(subq_22.ds, month) = subq_20.metric_time__day
+ DATE_TRUNC(subq_31.ds, month) = subq_29.metric_time__day
GROUP BY
metric_time__day
- ) subq_26
+ ) subq_35
ON
- subq_18.metric_time__day = subq_26.metric_time__day
+ subq_27.metric_time__day = subq_35.metric_time__day
GROUP BY
metric_time__day
-) subq_27
+) subq_36
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql
index 06c13a54dd..25259dbe96 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql
@@ -1,546 +1,546 @@
-- Compute Metrics via Expressions
SELECT
- subq_13.metric_time__week
+ subq_22.metric_time__week
, bookings - bookings_at_start_of_month AS bookings_growth_since_start_of_month
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_4.metric_time__week, subq_12.metric_time__week) AS metric_time__week
- , MAX(subq_4.bookings) AS bookings
- , MAX(subq_12.bookings_at_start_of_month) AS bookings_at_start_of_month
+ COALESCE(subq_13.metric_time__week, subq_21.metric_time__week) AS metric_time__week
+ , MAX(subq_13.bookings) AS bookings
+ , MAX(subq_21.bookings_at_start_of_month) AS bookings_at_start_of_month
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_3.metric_time__week
- , subq_3.bookings
+ subq_12.metric_time__week
+ , subq_12.bookings
FROM (
-- Aggregate Measures
SELECT
- subq_2.metric_time__week
- , SUM(subq_2.bookings) AS bookings
+ subq_11.metric_time__week
+ , SUM(subq_11.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__week']
SELECT
- subq_1.metric_time__week
- , subq_1.bookings
+ subq_10.metric_time__week
+ , subq_10.bookings
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
- ) subq_2
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS booking__paid_at__extract_dow
+ , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
GROUP BY
metric_time__week
- ) subq_3
- ) subq_4
+ ) subq_12
+ ) subq_13
FULL OUTER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_11.metric_time__week
- , subq_11.bookings AS bookings_at_start_of_month
+ subq_20.metric_time__week
+ , subq_20.bookings AS bookings_at_start_of_month
FROM (
-- Aggregate Measures
SELECT
- subq_10.metric_time__week
- , SUM(subq_10.bookings) AS bookings
+ subq_19.metric_time__week
+ , SUM(subq_19.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__week']
SELECT
- subq_9.metric_time__week
- , subq_9.bookings
+ subq_18.metric_time__week
+ , subq_18.bookings
FROM (
-- Join to Time Spine Dataset
SELECT
- DATE_TRUNC(subq_7.metric_time__day, isoweek) AS metric_time__week
- , subq_6.ds__day AS ds__day
- , subq_6.ds__week AS ds__week
- , subq_6.ds__month AS ds__month
- , subq_6.ds__quarter AS ds__quarter
- , subq_6.ds__year AS ds__year
- , subq_6.ds__extract_year AS ds__extract_year
- , subq_6.ds__extract_quarter AS ds__extract_quarter
- , subq_6.ds__extract_month AS ds__extract_month
- , subq_6.ds__extract_day AS ds__extract_day
- , subq_6.ds__extract_dow AS ds__extract_dow
- , subq_6.ds__extract_doy AS ds__extract_doy
- , subq_6.ds_partitioned__day AS ds_partitioned__day
- , subq_6.ds_partitioned__week AS ds_partitioned__week
- , subq_6.ds_partitioned__month AS ds_partitioned__month
- , subq_6.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_6.ds_partitioned__year AS ds_partitioned__year
- , subq_6.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_6.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_6.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_6.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_6.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_6.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_6.paid_at__day AS paid_at__day
- , subq_6.paid_at__week AS paid_at__week
- , subq_6.paid_at__month AS paid_at__month
- , subq_6.paid_at__quarter AS paid_at__quarter
- , subq_6.paid_at__year AS paid_at__year
- , subq_6.paid_at__extract_year AS paid_at__extract_year
- , subq_6.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_6.paid_at__extract_month AS paid_at__extract_month
- , subq_6.paid_at__extract_day AS paid_at__extract_day
- , subq_6.paid_at__extract_dow AS paid_at__extract_dow
- , subq_6.paid_at__extract_doy AS paid_at__extract_doy
- , subq_6.booking__ds__day AS booking__ds__day
- , subq_6.booking__ds__week AS booking__ds__week
- , subq_6.booking__ds__month AS booking__ds__month
- , subq_6.booking__ds__quarter AS booking__ds__quarter
- , subq_6.booking__ds__year AS booking__ds__year
- , subq_6.booking__ds__extract_year AS booking__ds__extract_year
- , subq_6.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_6.booking__ds__extract_month AS booking__ds__extract_month
- , subq_6.booking__ds__extract_day AS booking__ds__extract_day
- , subq_6.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_6.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_6.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_6.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_6.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_6.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_6.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_6.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_6.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_6.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_6.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_6.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_6.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_6.booking__paid_at__day AS booking__paid_at__day
- , subq_6.booking__paid_at__week AS booking__paid_at__week
- , subq_6.booking__paid_at__month AS booking__paid_at__month
- , subq_6.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_6.booking__paid_at__year AS booking__paid_at__year
- , subq_6.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_6.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_6.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_6.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_6.listing AS listing
- , subq_6.guest AS guest
- , subq_6.host AS host
- , subq_6.booking__listing AS booking__listing
- , subq_6.booking__guest AS booking__guest
- , subq_6.booking__host AS booking__host
- , subq_6.is_instant AS is_instant
- , subq_6.booking__is_instant AS booking__is_instant
- , subq_6.bookings AS bookings
- , subq_6.instant_bookings AS instant_bookings
- , subq_6.booking_value AS booking_value
- , subq_6.max_booking_value AS max_booking_value
- , subq_6.min_booking_value AS min_booking_value
- , subq_6.bookers AS bookers
- , subq_6.average_booking_value AS average_booking_value
- , subq_6.referred_bookings AS referred_bookings
- , subq_6.median_booking_value AS median_booking_value
- , subq_6.booking_value_p99 AS booking_value_p99
- , subq_6.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_6.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_6.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ DATE_TRUNC(subq_16.metric_time__day, isoweek) AS metric_time__week
+ , subq_15.ds__day AS ds__day
+ , subq_15.ds__week AS ds__week
+ , subq_15.ds__month AS ds__month
+ , subq_15.ds__quarter AS ds__quarter
+ , subq_15.ds__year AS ds__year
+ , subq_15.ds__extract_year AS ds__extract_year
+ , subq_15.ds__extract_quarter AS ds__extract_quarter
+ , subq_15.ds__extract_month AS ds__extract_month
+ , subq_15.ds__extract_day AS ds__extract_day
+ , subq_15.ds__extract_dow AS ds__extract_dow
+ , subq_15.ds__extract_doy AS ds__extract_doy
+ , subq_15.ds_partitioned__day AS ds_partitioned__day
+ , subq_15.ds_partitioned__week AS ds_partitioned__week
+ , subq_15.ds_partitioned__month AS ds_partitioned__month
+ , subq_15.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_15.ds_partitioned__year AS ds_partitioned__year
+ , subq_15.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_15.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_15.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_15.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_15.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_15.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_15.paid_at__day AS paid_at__day
+ , subq_15.paid_at__week AS paid_at__week
+ , subq_15.paid_at__month AS paid_at__month
+ , subq_15.paid_at__quarter AS paid_at__quarter
+ , subq_15.paid_at__year AS paid_at__year
+ , subq_15.paid_at__extract_year AS paid_at__extract_year
+ , subq_15.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_15.paid_at__extract_month AS paid_at__extract_month
+ , subq_15.paid_at__extract_day AS paid_at__extract_day
+ , subq_15.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_15.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_15.booking__ds__day AS booking__ds__day
+ , subq_15.booking__ds__week AS booking__ds__week
+ , subq_15.booking__ds__month AS booking__ds__month
+ , subq_15.booking__ds__quarter AS booking__ds__quarter
+ , subq_15.booking__ds__year AS booking__ds__year
+ , subq_15.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_15.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_15.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_15.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_15.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_15.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_15.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_15.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_15.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_15.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_15.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_15.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_15.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_15.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_15.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_15.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_15.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_15.booking__paid_at__day AS booking__paid_at__day
+ , subq_15.booking__paid_at__week AS booking__paid_at__week
+ , subq_15.booking__paid_at__month AS booking__paid_at__month
+ , subq_15.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_15.booking__paid_at__year AS booking__paid_at__year
+ , subq_15.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_15.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_15.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_15.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_15.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_15.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_15.listing AS listing
+ , subq_15.guest AS guest
+ , subq_15.host AS host
+ , subq_15.booking__listing AS booking__listing
+ , subq_15.booking__guest AS booking__guest
+ , subq_15.booking__host AS booking__host
+ , subq_15.is_instant AS is_instant
+ , subq_15.booking__is_instant AS booking__is_instant
+ , subq_15.bookings AS bookings
+ , subq_15.instant_bookings AS instant_bookings
+ , subq_15.booking_value AS booking_value
+ , subq_15.max_booking_value AS max_booking_value
+ , subq_15.min_booking_value AS min_booking_value
+ , subq_15.bookers AS bookers
+ , subq_15.average_booking_value AS average_booking_value
+ , subq_15.referred_bookings AS referred_bookings
+ , subq_15.median_booking_value AS median_booking_value
+ , subq_15.booking_value_p99 AS booking_value_p99
+ , subq_15.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_15.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_15.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_8.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_8
- ) subq_7
+ subq_17.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_17
+ ) subq_16
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_5.ds__day
- , subq_5.ds__week
- , subq_5.ds__month
- , subq_5.ds__quarter
- , subq_5.ds__year
- , subq_5.ds__extract_year
- , subq_5.ds__extract_quarter
- , subq_5.ds__extract_month
- , subq_5.ds__extract_day
- , subq_5.ds__extract_dow
- , subq_5.ds__extract_doy
- , subq_5.ds_partitioned__day
- , subq_5.ds_partitioned__week
- , subq_5.ds_partitioned__month
- , subq_5.ds_partitioned__quarter
- , subq_5.ds_partitioned__year
- , subq_5.ds_partitioned__extract_year
- , subq_5.ds_partitioned__extract_quarter
- , subq_5.ds_partitioned__extract_month
- , subq_5.ds_partitioned__extract_day
- , subq_5.ds_partitioned__extract_dow
- , subq_5.ds_partitioned__extract_doy
- , subq_5.paid_at__day
- , subq_5.paid_at__week
- , subq_5.paid_at__month
- , subq_5.paid_at__quarter
- , subq_5.paid_at__year
- , subq_5.paid_at__extract_year
- , subq_5.paid_at__extract_quarter
- , subq_5.paid_at__extract_month
- , subq_5.paid_at__extract_day
- , subq_5.paid_at__extract_dow
- , subq_5.paid_at__extract_doy
- , subq_5.booking__ds__day
- , subq_5.booking__ds__week
- , subq_5.booking__ds__month
- , subq_5.booking__ds__quarter
- , subq_5.booking__ds__year
- , subq_5.booking__ds__extract_year
- , subq_5.booking__ds__extract_quarter
- , subq_5.booking__ds__extract_month
- , subq_5.booking__ds__extract_day
- , subq_5.booking__ds__extract_dow
- , subq_5.booking__ds__extract_doy
- , subq_5.booking__ds_partitioned__day
- , subq_5.booking__ds_partitioned__week
- , subq_5.booking__ds_partitioned__month
- , subq_5.booking__ds_partitioned__quarter
- , subq_5.booking__ds_partitioned__year
- , subq_5.booking__ds_partitioned__extract_year
- , subq_5.booking__ds_partitioned__extract_quarter
- , subq_5.booking__ds_partitioned__extract_month
- , subq_5.booking__ds_partitioned__extract_day
- , subq_5.booking__ds_partitioned__extract_dow
- , subq_5.booking__ds_partitioned__extract_doy
- , subq_5.booking__paid_at__day
- , subq_5.booking__paid_at__week
- , subq_5.booking__paid_at__month
- , subq_5.booking__paid_at__quarter
- , subq_5.booking__paid_at__year
- , subq_5.booking__paid_at__extract_year
- , subq_5.booking__paid_at__extract_quarter
- , subq_5.booking__paid_at__extract_month
- , subq_5.booking__paid_at__extract_day
- , subq_5.booking__paid_at__extract_dow
- , subq_5.booking__paid_at__extract_doy
- , subq_5.ds__day AS metric_time__day
- , subq_5.ds__week AS metric_time__week
- , subq_5.ds__month AS metric_time__month
- , subq_5.ds__quarter AS metric_time__quarter
- , subq_5.ds__year AS metric_time__year
- , subq_5.ds__extract_year AS metric_time__extract_year
- , subq_5.ds__extract_quarter AS metric_time__extract_quarter
- , subq_5.ds__extract_month AS metric_time__extract_month
- , subq_5.ds__extract_day AS metric_time__extract_day
- , subq_5.ds__extract_dow AS metric_time__extract_dow
- , subq_5.ds__extract_doy AS metric_time__extract_doy
- , subq_5.listing
- , subq_5.guest
- , subq_5.host
- , subq_5.booking__listing
- , subq_5.booking__guest
- , subq_5.booking__host
- , subq_5.is_instant
- , subq_5.booking__is_instant
- , subq_5.bookings
- , subq_5.instant_bookings
- , subq_5.booking_value
- , subq_5.max_booking_value
- , subq_5.min_booking_value
- , subq_5.bookers
- , subq_5.average_booking_value
- , subq_5.referred_bookings
- , subq_5.median_booking_value
- , subq_5.booking_value_p99
- , subq_5.discrete_booking_value_p99
- , subq_5.approximate_continuous_booking_value_p99
- , subq_5.approximate_discrete_booking_value_p99
+ subq_14.ds__day
+ , subq_14.ds__week
+ , subq_14.ds__month
+ , subq_14.ds__quarter
+ , subq_14.ds__year
+ , subq_14.ds__extract_year
+ , subq_14.ds__extract_quarter
+ , subq_14.ds__extract_month
+ , subq_14.ds__extract_day
+ , subq_14.ds__extract_dow
+ , subq_14.ds__extract_doy
+ , subq_14.ds_partitioned__day
+ , subq_14.ds_partitioned__week
+ , subq_14.ds_partitioned__month
+ , subq_14.ds_partitioned__quarter
+ , subq_14.ds_partitioned__year
+ , subq_14.ds_partitioned__extract_year
+ , subq_14.ds_partitioned__extract_quarter
+ , subq_14.ds_partitioned__extract_month
+ , subq_14.ds_partitioned__extract_day
+ , subq_14.ds_partitioned__extract_dow
+ , subq_14.ds_partitioned__extract_doy
+ , subq_14.paid_at__day
+ , subq_14.paid_at__week
+ , subq_14.paid_at__month
+ , subq_14.paid_at__quarter
+ , subq_14.paid_at__year
+ , subq_14.paid_at__extract_year
+ , subq_14.paid_at__extract_quarter
+ , subq_14.paid_at__extract_month
+ , subq_14.paid_at__extract_day
+ , subq_14.paid_at__extract_dow
+ , subq_14.paid_at__extract_doy
+ , subq_14.booking__ds__day
+ , subq_14.booking__ds__week
+ , subq_14.booking__ds__month
+ , subq_14.booking__ds__quarter
+ , subq_14.booking__ds__year
+ , subq_14.booking__ds__extract_year
+ , subq_14.booking__ds__extract_quarter
+ , subq_14.booking__ds__extract_month
+ , subq_14.booking__ds__extract_day
+ , subq_14.booking__ds__extract_dow
+ , subq_14.booking__ds__extract_doy
+ , subq_14.booking__ds_partitioned__day
+ , subq_14.booking__ds_partitioned__week
+ , subq_14.booking__ds_partitioned__month
+ , subq_14.booking__ds_partitioned__quarter
+ , subq_14.booking__ds_partitioned__year
+ , subq_14.booking__ds_partitioned__extract_year
+ , subq_14.booking__ds_partitioned__extract_quarter
+ , subq_14.booking__ds_partitioned__extract_month
+ , subq_14.booking__ds_partitioned__extract_day
+ , subq_14.booking__ds_partitioned__extract_dow
+ , subq_14.booking__ds_partitioned__extract_doy
+ , subq_14.booking__paid_at__day
+ , subq_14.booking__paid_at__week
+ , subq_14.booking__paid_at__month
+ , subq_14.booking__paid_at__quarter
+ , subq_14.booking__paid_at__year
+ , subq_14.booking__paid_at__extract_year
+ , subq_14.booking__paid_at__extract_quarter
+ , subq_14.booking__paid_at__extract_month
+ , subq_14.booking__paid_at__extract_day
+ , subq_14.booking__paid_at__extract_dow
+ , subq_14.booking__paid_at__extract_doy
+ , subq_14.ds__day AS metric_time__day
+ , subq_14.ds__week AS metric_time__week
+ , subq_14.ds__month AS metric_time__month
+ , subq_14.ds__quarter AS metric_time__quarter
+ , subq_14.ds__year AS metric_time__year
+ , subq_14.ds__extract_year AS metric_time__extract_year
+ , subq_14.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_14.ds__extract_month AS metric_time__extract_month
+ , subq_14.ds__extract_day AS metric_time__extract_day
+ , subq_14.ds__extract_dow AS metric_time__extract_dow
+ , subq_14.ds__extract_doy AS metric_time__extract_doy
+ , subq_14.listing
+ , subq_14.guest
+ , subq_14.host
+ , subq_14.booking__listing
+ , subq_14.booking__guest
+ , subq_14.booking__host
+ , subq_14.is_instant
+ , subq_14.booking__is_instant
+ , subq_14.bookings
+ , subq_14.instant_bookings
+ , subq_14.booking_value
+ , subq_14.max_booking_value
+ , subq_14.min_booking_value
+ , subq_14.bookers
+ , subq_14.average_booking_value
+ , subq_14.referred_bookings
+ , subq_14.median_booking_value
+ , subq_14.booking_value_p99
+ , subq_14.discrete_booking_value_p99
+ , subq_14.approximate_continuous_booking_value_p99
+ , subq_14.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_5
- ) subq_6
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS booking__paid_at__extract_dow
+ , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_14
+ ) subq_15
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
- ) subq_9
- ) subq_10
+ DATE_TRUNC(subq_16.metric_time__day, month) = subq_15.metric_time__day
+ WHERE DATE_TRUNC(subq_16.metric_time__day, isoweek) = subq_16.metric_time__day
+ ) subq_18
+ ) subq_19
GROUP BY
metric_time__week
- ) subq_11
- ) subq_12
+ ) subq_20
+ ) subq_21
ON
- subq_4.metric_time__week = subq_12.metric_time__week
+ subq_13.metric_time__week = subq_21.metric_time__week
GROUP BY
metric_time__week
-) subq_13
+) subq_22
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_to_grain_and_granularity__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_to_grain_and_granularity__plan0_optimized.sql
index 5deccf14fa..66fdf4eff2 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_to_grain_and_granularity__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_to_grain_and_granularity__plan0_optimized.sql
@@ -5,9 +5,9 @@ SELECT
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_18.metric_time__week, subq_26.metric_time__week) AS metric_time__week
- , MAX(subq_18.bookings) AS bookings
- , MAX(subq_26.bookings_at_start_of_month) AS bookings_at_start_of_month
+ COALESCE(subq_27.metric_time__week, subq_35.metric_time__week) AS metric_time__week
+ , MAX(subq_27.bookings) AS bookings
+ , MAX(subq_35.bookings_at_start_of_month) AS bookings_at_start_of_month
FROM (
-- Aggregate Measures
-- Compute Metrics via Expressions
@@ -21,36 +21,36 @@ FROM (
SELECT
DATE_TRUNC(ds, isoweek) AS metric_time__week
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_16
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_25
GROUP BY
metric_time__week
- ) subq_18
+ ) subq_27
FULL OUTER JOIN (
-- Join to Time Spine Dataset
-- Pass Only Elements: ['bookings', 'metric_time__week']
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- DATE_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
+ DATE_TRUNC(subq_31.ds, isoweek) AS metric_time__week
+ , SUM(subq_29.bookings) AS bookings_at_start_of_month
+ FROM ***************************.mf_time_spine subq_31
INNER JOIN (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
SELECT
DATE_TRUNC(ds, day) AS metric_time__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_20
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_29
ON
- DATE_TRUNC(subq_22.ds, month) = subq_20.metric_time__day
- WHERE DATE_TRUNC(subq_22.ds, isoweek) = subq_22.ds
+ DATE_TRUNC(subq_31.ds, month) = subq_29.metric_time__day
+ WHERE DATE_TRUNC(subq_31.ds, isoweek) = subq_31.ds
GROUP BY
metric_time__week
- ) subq_26
+ ) subq_35
ON
- subq_18.metric_time__week = subq_26.metric_time__week
+ subq_27.metric_time__week = subq_35.metric_time__week
GROUP BY
metric_time__week
-) subq_27
+) subq_36
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window__plan0.sql
index c16f9d3134..26044e5ad2 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window__plan0.sql
@@ -1,545 +1,545 @@
-- Compute Metrics via Expressions
SELECT
- subq_13.metric_time__day
+ subq_22.metric_time__day
, bookings - bookings_2_weeks_ago AS bookings_growth_2_weeks
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_4.metric_time__day, subq_12.metric_time__day) AS metric_time__day
- , MAX(subq_4.bookings) AS bookings
- , MAX(subq_12.bookings_2_weeks_ago) AS bookings_2_weeks_ago
+ COALESCE(subq_13.metric_time__day, subq_21.metric_time__day) AS metric_time__day
+ , MAX(subq_13.bookings) AS bookings
+ , MAX(subq_21.bookings_2_weeks_ago) AS bookings_2_weeks_ago
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_3.metric_time__day
- , subq_3.bookings
+ subq_12.metric_time__day
+ , subq_12.bookings
FROM (
-- Aggregate Measures
SELECT
- subq_2.metric_time__day
- , SUM(subq_2.bookings) AS bookings
+ subq_11.metric_time__day
+ , SUM(subq_11.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__day']
SELECT
- subq_1.metric_time__day
- , subq_1.bookings
+ subq_10.metric_time__day
+ , subq_10.bookings
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
- ) subq_2
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS booking__paid_at__extract_dow
+ , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
GROUP BY
metric_time__day
- ) subq_3
- ) subq_4
+ ) subq_12
+ ) subq_13
FULL OUTER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_11.metric_time__day
- , subq_11.bookings AS bookings_2_weeks_ago
+ subq_20.metric_time__day
+ , subq_20.bookings AS bookings_2_weeks_ago
FROM (
-- Aggregate Measures
SELECT
- subq_10.metric_time__day
- , SUM(subq_10.bookings) AS bookings
+ subq_19.metric_time__day
+ , SUM(subq_19.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__day']
SELECT
- subq_9.metric_time__day
- , subq_9.bookings
+ subq_18.metric_time__day
+ , subq_18.bookings
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_7.metric_time__day AS metric_time__day
- , subq_6.ds__day AS ds__day
- , subq_6.ds__week AS ds__week
- , subq_6.ds__month AS ds__month
- , subq_6.ds__quarter AS ds__quarter
- , subq_6.ds__year AS ds__year
- , subq_6.ds__extract_year AS ds__extract_year
- , subq_6.ds__extract_quarter AS ds__extract_quarter
- , subq_6.ds__extract_month AS ds__extract_month
- , subq_6.ds__extract_day AS ds__extract_day
- , subq_6.ds__extract_dow AS ds__extract_dow
- , subq_6.ds__extract_doy AS ds__extract_doy
- , subq_6.ds_partitioned__day AS ds_partitioned__day
- , subq_6.ds_partitioned__week AS ds_partitioned__week
- , subq_6.ds_partitioned__month AS ds_partitioned__month
- , subq_6.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_6.ds_partitioned__year AS ds_partitioned__year
- , subq_6.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_6.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_6.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_6.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_6.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_6.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_6.paid_at__day AS paid_at__day
- , subq_6.paid_at__week AS paid_at__week
- , subq_6.paid_at__month AS paid_at__month
- , subq_6.paid_at__quarter AS paid_at__quarter
- , subq_6.paid_at__year AS paid_at__year
- , subq_6.paid_at__extract_year AS paid_at__extract_year
- , subq_6.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_6.paid_at__extract_month AS paid_at__extract_month
- , subq_6.paid_at__extract_day AS paid_at__extract_day
- , subq_6.paid_at__extract_dow AS paid_at__extract_dow
- , subq_6.paid_at__extract_doy AS paid_at__extract_doy
- , subq_6.booking__ds__day AS booking__ds__day
- , subq_6.booking__ds__week AS booking__ds__week
- , subq_6.booking__ds__month AS booking__ds__month
- , subq_6.booking__ds__quarter AS booking__ds__quarter
- , subq_6.booking__ds__year AS booking__ds__year
- , subq_6.booking__ds__extract_year AS booking__ds__extract_year
- , subq_6.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_6.booking__ds__extract_month AS booking__ds__extract_month
- , subq_6.booking__ds__extract_day AS booking__ds__extract_day
- , subq_6.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_6.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_6.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_6.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_6.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_6.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_6.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_6.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_6.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_6.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_6.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_6.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_6.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_6.booking__paid_at__day AS booking__paid_at__day
- , subq_6.booking__paid_at__week AS booking__paid_at__week
- , subq_6.booking__paid_at__month AS booking__paid_at__month
- , subq_6.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_6.booking__paid_at__year AS booking__paid_at__year
- , subq_6.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_6.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_6.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_6.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_6.listing AS listing
- , subq_6.guest AS guest
- , subq_6.host AS host
- , subq_6.booking__listing AS booking__listing
- , subq_6.booking__guest AS booking__guest
- , subq_6.booking__host AS booking__host
- , subq_6.is_instant AS is_instant
- , subq_6.booking__is_instant AS booking__is_instant
- , subq_6.bookings AS bookings
- , subq_6.instant_bookings AS instant_bookings
- , subq_6.booking_value AS booking_value
- , subq_6.max_booking_value AS max_booking_value
- , subq_6.min_booking_value AS min_booking_value
- , subq_6.bookers AS bookers
- , subq_6.average_booking_value AS average_booking_value
- , subq_6.referred_bookings AS referred_bookings
- , subq_6.median_booking_value AS median_booking_value
- , subq_6.booking_value_p99 AS booking_value_p99
- , subq_6.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_6.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_6.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ subq_16.metric_time__day AS metric_time__day
+ , subq_15.ds__day AS ds__day
+ , subq_15.ds__week AS ds__week
+ , subq_15.ds__month AS ds__month
+ , subq_15.ds__quarter AS ds__quarter
+ , subq_15.ds__year AS ds__year
+ , subq_15.ds__extract_year AS ds__extract_year
+ , subq_15.ds__extract_quarter AS ds__extract_quarter
+ , subq_15.ds__extract_month AS ds__extract_month
+ , subq_15.ds__extract_day AS ds__extract_day
+ , subq_15.ds__extract_dow AS ds__extract_dow
+ , subq_15.ds__extract_doy AS ds__extract_doy
+ , subq_15.ds_partitioned__day AS ds_partitioned__day
+ , subq_15.ds_partitioned__week AS ds_partitioned__week
+ , subq_15.ds_partitioned__month AS ds_partitioned__month
+ , subq_15.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_15.ds_partitioned__year AS ds_partitioned__year
+ , subq_15.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_15.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_15.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_15.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_15.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_15.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_15.paid_at__day AS paid_at__day
+ , subq_15.paid_at__week AS paid_at__week
+ , subq_15.paid_at__month AS paid_at__month
+ , subq_15.paid_at__quarter AS paid_at__quarter
+ , subq_15.paid_at__year AS paid_at__year
+ , subq_15.paid_at__extract_year AS paid_at__extract_year
+ , subq_15.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_15.paid_at__extract_month AS paid_at__extract_month
+ , subq_15.paid_at__extract_day AS paid_at__extract_day
+ , subq_15.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_15.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_15.booking__ds__day AS booking__ds__day
+ , subq_15.booking__ds__week AS booking__ds__week
+ , subq_15.booking__ds__month AS booking__ds__month
+ , subq_15.booking__ds__quarter AS booking__ds__quarter
+ , subq_15.booking__ds__year AS booking__ds__year
+ , subq_15.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_15.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_15.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_15.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_15.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_15.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_15.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_15.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_15.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_15.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_15.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_15.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_15.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_15.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_15.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_15.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_15.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_15.booking__paid_at__day AS booking__paid_at__day
+ , subq_15.booking__paid_at__week AS booking__paid_at__week
+ , subq_15.booking__paid_at__month AS booking__paid_at__month
+ , subq_15.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_15.booking__paid_at__year AS booking__paid_at__year
+ , subq_15.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_15.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_15.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_15.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_15.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_15.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_15.listing AS listing
+ , subq_15.guest AS guest
+ , subq_15.host AS host
+ , subq_15.booking__listing AS booking__listing
+ , subq_15.booking__guest AS booking__guest
+ , subq_15.booking__host AS booking__host
+ , subq_15.is_instant AS is_instant
+ , subq_15.booking__is_instant AS booking__is_instant
+ , subq_15.bookings AS bookings
+ , subq_15.instant_bookings AS instant_bookings
+ , subq_15.booking_value AS booking_value
+ , subq_15.max_booking_value AS max_booking_value
+ , subq_15.min_booking_value AS min_booking_value
+ , subq_15.bookers AS bookers
+ , subq_15.average_booking_value AS average_booking_value
+ , subq_15.referred_bookings AS referred_bookings
+ , subq_15.median_booking_value AS median_booking_value
+ , subq_15.booking_value_p99 AS booking_value_p99
+ , subq_15.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_15.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_15.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_8.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_8
- ) subq_7
+ subq_17.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_17
+ ) subq_16
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_5.ds__day
- , subq_5.ds__week
- , subq_5.ds__month
- , subq_5.ds__quarter
- , subq_5.ds__year
- , subq_5.ds__extract_year
- , subq_5.ds__extract_quarter
- , subq_5.ds__extract_month
- , subq_5.ds__extract_day
- , subq_5.ds__extract_dow
- , subq_5.ds__extract_doy
- , subq_5.ds_partitioned__day
- , subq_5.ds_partitioned__week
- , subq_5.ds_partitioned__month
- , subq_5.ds_partitioned__quarter
- , subq_5.ds_partitioned__year
- , subq_5.ds_partitioned__extract_year
- , subq_5.ds_partitioned__extract_quarter
- , subq_5.ds_partitioned__extract_month
- , subq_5.ds_partitioned__extract_day
- , subq_5.ds_partitioned__extract_dow
- , subq_5.ds_partitioned__extract_doy
- , subq_5.paid_at__day
- , subq_5.paid_at__week
- , subq_5.paid_at__month
- , subq_5.paid_at__quarter
- , subq_5.paid_at__year
- , subq_5.paid_at__extract_year
- , subq_5.paid_at__extract_quarter
- , subq_5.paid_at__extract_month
- , subq_5.paid_at__extract_day
- , subq_5.paid_at__extract_dow
- , subq_5.paid_at__extract_doy
- , subq_5.booking__ds__day
- , subq_5.booking__ds__week
- , subq_5.booking__ds__month
- , subq_5.booking__ds__quarter
- , subq_5.booking__ds__year
- , subq_5.booking__ds__extract_year
- , subq_5.booking__ds__extract_quarter
- , subq_5.booking__ds__extract_month
- , subq_5.booking__ds__extract_day
- , subq_5.booking__ds__extract_dow
- , subq_5.booking__ds__extract_doy
- , subq_5.booking__ds_partitioned__day
- , subq_5.booking__ds_partitioned__week
- , subq_5.booking__ds_partitioned__month
- , subq_5.booking__ds_partitioned__quarter
- , subq_5.booking__ds_partitioned__year
- , subq_5.booking__ds_partitioned__extract_year
- , subq_5.booking__ds_partitioned__extract_quarter
- , subq_5.booking__ds_partitioned__extract_month
- , subq_5.booking__ds_partitioned__extract_day
- , subq_5.booking__ds_partitioned__extract_dow
- , subq_5.booking__ds_partitioned__extract_doy
- , subq_5.booking__paid_at__day
- , subq_5.booking__paid_at__week
- , subq_5.booking__paid_at__month
- , subq_5.booking__paid_at__quarter
- , subq_5.booking__paid_at__year
- , subq_5.booking__paid_at__extract_year
- , subq_5.booking__paid_at__extract_quarter
- , subq_5.booking__paid_at__extract_month
- , subq_5.booking__paid_at__extract_day
- , subq_5.booking__paid_at__extract_dow
- , subq_5.booking__paid_at__extract_doy
- , subq_5.ds__day AS metric_time__day
- , subq_5.ds__week AS metric_time__week
- , subq_5.ds__month AS metric_time__month
- , subq_5.ds__quarter AS metric_time__quarter
- , subq_5.ds__year AS metric_time__year
- , subq_5.ds__extract_year AS metric_time__extract_year
- , subq_5.ds__extract_quarter AS metric_time__extract_quarter
- , subq_5.ds__extract_month AS metric_time__extract_month
- , subq_5.ds__extract_day AS metric_time__extract_day
- , subq_5.ds__extract_dow AS metric_time__extract_dow
- , subq_5.ds__extract_doy AS metric_time__extract_doy
- , subq_5.listing
- , subq_5.guest
- , subq_5.host
- , subq_5.booking__listing
- , subq_5.booking__guest
- , subq_5.booking__host
- , subq_5.is_instant
- , subq_5.booking__is_instant
- , subq_5.bookings
- , subq_5.instant_bookings
- , subq_5.booking_value
- , subq_5.max_booking_value
- , subq_5.min_booking_value
- , subq_5.bookers
- , subq_5.average_booking_value
- , subq_5.referred_bookings
- , subq_5.median_booking_value
- , subq_5.booking_value_p99
- , subq_5.discrete_booking_value_p99
- , subq_5.approximate_continuous_booking_value_p99
- , subq_5.approximate_discrete_booking_value_p99
+ subq_14.ds__day
+ , subq_14.ds__week
+ , subq_14.ds__month
+ , subq_14.ds__quarter
+ , subq_14.ds__year
+ , subq_14.ds__extract_year
+ , subq_14.ds__extract_quarter
+ , subq_14.ds__extract_month
+ , subq_14.ds__extract_day
+ , subq_14.ds__extract_dow
+ , subq_14.ds__extract_doy
+ , subq_14.ds_partitioned__day
+ , subq_14.ds_partitioned__week
+ , subq_14.ds_partitioned__month
+ , subq_14.ds_partitioned__quarter
+ , subq_14.ds_partitioned__year
+ , subq_14.ds_partitioned__extract_year
+ , subq_14.ds_partitioned__extract_quarter
+ , subq_14.ds_partitioned__extract_month
+ , subq_14.ds_partitioned__extract_day
+ , subq_14.ds_partitioned__extract_dow
+ , subq_14.ds_partitioned__extract_doy
+ , subq_14.paid_at__day
+ , subq_14.paid_at__week
+ , subq_14.paid_at__month
+ , subq_14.paid_at__quarter
+ , subq_14.paid_at__year
+ , subq_14.paid_at__extract_year
+ , subq_14.paid_at__extract_quarter
+ , subq_14.paid_at__extract_month
+ , subq_14.paid_at__extract_day
+ , subq_14.paid_at__extract_dow
+ , subq_14.paid_at__extract_doy
+ , subq_14.booking__ds__day
+ , subq_14.booking__ds__week
+ , subq_14.booking__ds__month
+ , subq_14.booking__ds__quarter
+ , subq_14.booking__ds__year
+ , subq_14.booking__ds__extract_year
+ , subq_14.booking__ds__extract_quarter
+ , subq_14.booking__ds__extract_month
+ , subq_14.booking__ds__extract_day
+ , subq_14.booking__ds__extract_dow
+ , subq_14.booking__ds__extract_doy
+ , subq_14.booking__ds_partitioned__day
+ , subq_14.booking__ds_partitioned__week
+ , subq_14.booking__ds_partitioned__month
+ , subq_14.booking__ds_partitioned__quarter
+ , subq_14.booking__ds_partitioned__year
+ , subq_14.booking__ds_partitioned__extract_year
+ , subq_14.booking__ds_partitioned__extract_quarter
+ , subq_14.booking__ds_partitioned__extract_month
+ , subq_14.booking__ds_partitioned__extract_day
+ , subq_14.booking__ds_partitioned__extract_dow
+ , subq_14.booking__ds_partitioned__extract_doy
+ , subq_14.booking__paid_at__day
+ , subq_14.booking__paid_at__week
+ , subq_14.booking__paid_at__month
+ , subq_14.booking__paid_at__quarter
+ , subq_14.booking__paid_at__year
+ , subq_14.booking__paid_at__extract_year
+ , subq_14.booking__paid_at__extract_quarter
+ , subq_14.booking__paid_at__extract_month
+ , subq_14.booking__paid_at__extract_day
+ , subq_14.booking__paid_at__extract_dow
+ , subq_14.booking__paid_at__extract_doy
+ , subq_14.ds__day AS metric_time__day
+ , subq_14.ds__week AS metric_time__week
+ , subq_14.ds__month AS metric_time__month
+ , subq_14.ds__quarter AS metric_time__quarter
+ , subq_14.ds__year AS metric_time__year
+ , subq_14.ds__extract_year AS metric_time__extract_year
+ , subq_14.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_14.ds__extract_month AS metric_time__extract_month
+ , subq_14.ds__extract_day AS metric_time__extract_day
+ , subq_14.ds__extract_dow AS metric_time__extract_dow
+ , subq_14.ds__extract_doy AS metric_time__extract_doy
+ , subq_14.listing
+ , subq_14.guest
+ , subq_14.host
+ , subq_14.booking__listing
+ , subq_14.booking__guest
+ , subq_14.booking__host
+ , subq_14.is_instant
+ , subq_14.booking__is_instant
+ , subq_14.bookings
+ , subq_14.instant_bookings
+ , subq_14.booking_value
+ , subq_14.max_booking_value
+ , subq_14.min_booking_value
+ , subq_14.bookers
+ , subq_14.average_booking_value
+ , subq_14.referred_bookings
+ , subq_14.median_booking_value
+ , subq_14.booking_value_p99
+ , subq_14.discrete_booking_value_p99
+ , subq_14.approximate_continuous_booking_value_p99
+ , subq_14.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_5
- ) subq_6
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS booking__paid_at__extract_dow
+ , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_14
+ ) subq_15
ON
- DATE_SUB(CAST(subq_7.metric_time__day AS DATETIME), INTERVAL 14 day) = subq_6.metric_time__day
- ) subq_9
- ) subq_10
+ DATE_SUB(CAST(subq_16.metric_time__day AS DATETIME), INTERVAL 14 day) = subq_15.metric_time__day
+ ) subq_18
+ ) subq_19
GROUP BY
metric_time__day
- ) subq_11
- ) subq_12
+ ) subq_20
+ ) subq_21
ON
- subq_4.metric_time__day = subq_12.metric_time__day
+ subq_13.metric_time__day = subq_21.metric_time__day
GROUP BY
metric_time__day
-) subq_13
+) subq_22
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window__plan0_optimized.sql
index 8fa70fcf9d..2b2ce7a0e0 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window__plan0_optimized.sql
@@ -5,9 +5,9 @@ SELECT
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_18.metric_time__day, subq_26.metric_time__day) AS metric_time__day
- , MAX(subq_18.bookings) AS bookings
- , MAX(subq_26.bookings_2_weeks_ago) AS bookings_2_weeks_ago
+ COALESCE(subq_27.metric_time__day, subq_35.metric_time__day) AS metric_time__day
+ , MAX(subq_27.bookings) AS bookings
+ , MAX(subq_35.bookings_2_weeks_ago) AS bookings_2_weeks_ago
FROM (
-- Aggregate Measures
-- Compute Metrics via Expressions
@@ -21,35 +21,35 @@ FROM (
SELECT
DATE_TRUNC(ds, day) AS metric_time__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_16
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_25
GROUP BY
metric_time__day
- ) subq_18
+ ) subq_27
FULL OUTER JOIN (
-- Join to Time Spine Dataset
-- Pass Only Elements: ['bookings', 'metric_time__day']
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_22.ds AS metric_time__day
- , SUM(subq_20.bookings) AS bookings_2_weeks_ago
- FROM ***************************.mf_time_spine subq_22
+ subq_31.ds AS metric_time__day
+ , SUM(subq_29.bookings) AS bookings_2_weeks_ago
+ FROM ***************************.mf_time_spine subq_31
INNER JOIN (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
SELECT
DATE_TRUNC(ds, day) AS metric_time__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_20
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_29
ON
- DATE_SUB(CAST(subq_22.ds AS DATETIME), INTERVAL 14 day) = subq_20.metric_time__day
+ DATE_SUB(CAST(subq_31.ds AS DATETIME), INTERVAL 14 day) = subq_29.metric_time__day
GROUP BY
metric_time__day
- ) subq_26
+ ) subq_35
ON
- subq_18.metric_time__day = subq_26.metric_time__day
+ subq_27.metric_time__day = subq_35.metric_time__day
GROUP BY
metric_time__day
-) subq_27
+) subq_36
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_granularity__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_granularity__plan0.sql
index 0b17b0c775..a9a7d2730a 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_granularity__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_granularity__plan0.sql
@@ -1,545 +1,545 @@
-- Compute Metrics via Expressions
SELECT
- subq_13.metric_time__quarter
+ subq_22.metric_time__quarter
, bookings - bookings_2_weeks_ago AS bookings_growth_2_weeks
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_4.metric_time__quarter, subq_12.metric_time__quarter) AS metric_time__quarter
- , MAX(subq_4.bookings) AS bookings
- , MAX(subq_12.bookings_2_weeks_ago) AS bookings_2_weeks_ago
+ COALESCE(subq_13.metric_time__quarter, subq_21.metric_time__quarter) AS metric_time__quarter
+ , MAX(subq_13.bookings) AS bookings
+ , MAX(subq_21.bookings_2_weeks_ago) AS bookings_2_weeks_ago
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_3.metric_time__quarter
- , subq_3.bookings
+ subq_12.metric_time__quarter
+ , subq_12.bookings
FROM (
-- Aggregate Measures
SELECT
- subq_2.metric_time__quarter
- , SUM(subq_2.bookings) AS bookings
+ subq_11.metric_time__quarter
+ , SUM(subq_11.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__quarter']
SELECT
- subq_1.metric_time__quarter
- , subq_1.bookings
+ subq_10.metric_time__quarter
+ , subq_10.bookings
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
- ) subq_2
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS booking__paid_at__extract_dow
+ , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
GROUP BY
metric_time__quarter
- ) subq_3
- ) subq_4
+ ) subq_12
+ ) subq_13
FULL OUTER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_11.metric_time__quarter
- , subq_11.bookings AS bookings_2_weeks_ago
+ subq_20.metric_time__quarter
+ , subq_20.bookings AS bookings_2_weeks_ago
FROM (
-- Aggregate Measures
SELECT
- subq_10.metric_time__quarter
- , SUM(subq_10.bookings) AS bookings
+ subq_19.metric_time__quarter
+ , SUM(subq_19.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__quarter']
SELECT
- subq_9.metric_time__quarter
- , subq_9.bookings
+ subq_18.metric_time__quarter
+ , subq_18.bookings
FROM (
-- Join to Time Spine Dataset
SELECT
- DATE_TRUNC(subq_7.metric_time__day, quarter) AS metric_time__quarter
- , subq_6.ds__day AS ds__day
- , subq_6.ds__week AS ds__week
- , subq_6.ds__month AS ds__month
- , subq_6.ds__quarter AS ds__quarter
- , subq_6.ds__year AS ds__year
- , subq_6.ds__extract_year AS ds__extract_year
- , subq_6.ds__extract_quarter AS ds__extract_quarter
- , subq_6.ds__extract_month AS ds__extract_month
- , subq_6.ds__extract_day AS ds__extract_day
- , subq_6.ds__extract_dow AS ds__extract_dow
- , subq_6.ds__extract_doy AS ds__extract_doy
- , subq_6.ds_partitioned__day AS ds_partitioned__day
- , subq_6.ds_partitioned__week AS ds_partitioned__week
- , subq_6.ds_partitioned__month AS ds_partitioned__month
- , subq_6.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_6.ds_partitioned__year AS ds_partitioned__year
- , subq_6.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_6.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_6.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_6.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_6.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_6.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_6.paid_at__day AS paid_at__day
- , subq_6.paid_at__week AS paid_at__week
- , subq_6.paid_at__month AS paid_at__month
- , subq_6.paid_at__quarter AS paid_at__quarter
- , subq_6.paid_at__year AS paid_at__year
- , subq_6.paid_at__extract_year AS paid_at__extract_year
- , subq_6.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_6.paid_at__extract_month AS paid_at__extract_month
- , subq_6.paid_at__extract_day AS paid_at__extract_day
- , subq_6.paid_at__extract_dow AS paid_at__extract_dow
- , subq_6.paid_at__extract_doy AS paid_at__extract_doy
- , subq_6.booking__ds__day AS booking__ds__day
- , subq_6.booking__ds__week AS booking__ds__week
- , subq_6.booking__ds__month AS booking__ds__month
- , subq_6.booking__ds__quarter AS booking__ds__quarter
- , subq_6.booking__ds__year AS booking__ds__year
- , subq_6.booking__ds__extract_year AS booking__ds__extract_year
- , subq_6.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_6.booking__ds__extract_month AS booking__ds__extract_month
- , subq_6.booking__ds__extract_day AS booking__ds__extract_day
- , subq_6.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_6.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_6.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_6.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_6.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_6.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_6.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_6.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_6.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_6.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_6.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_6.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_6.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_6.booking__paid_at__day AS booking__paid_at__day
- , subq_6.booking__paid_at__week AS booking__paid_at__week
- , subq_6.booking__paid_at__month AS booking__paid_at__month
- , subq_6.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_6.booking__paid_at__year AS booking__paid_at__year
- , subq_6.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_6.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_6.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_6.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_6.listing AS listing
- , subq_6.guest AS guest
- , subq_6.host AS host
- , subq_6.booking__listing AS booking__listing
- , subq_6.booking__guest AS booking__guest
- , subq_6.booking__host AS booking__host
- , subq_6.is_instant AS is_instant
- , subq_6.booking__is_instant AS booking__is_instant
- , subq_6.bookings AS bookings
- , subq_6.instant_bookings AS instant_bookings
- , subq_6.booking_value AS booking_value
- , subq_6.max_booking_value AS max_booking_value
- , subq_6.min_booking_value AS min_booking_value
- , subq_6.bookers AS bookers
- , subq_6.average_booking_value AS average_booking_value
- , subq_6.referred_bookings AS referred_bookings
- , subq_6.median_booking_value AS median_booking_value
- , subq_6.booking_value_p99 AS booking_value_p99
- , subq_6.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_6.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_6.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ DATE_TRUNC(subq_16.metric_time__day, quarter) AS metric_time__quarter
+ , subq_15.ds__day AS ds__day
+ , subq_15.ds__week AS ds__week
+ , subq_15.ds__month AS ds__month
+ , subq_15.ds__quarter AS ds__quarter
+ , subq_15.ds__year AS ds__year
+ , subq_15.ds__extract_year AS ds__extract_year
+ , subq_15.ds__extract_quarter AS ds__extract_quarter
+ , subq_15.ds__extract_month AS ds__extract_month
+ , subq_15.ds__extract_day AS ds__extract_day
+ , subq_15.ds__extract_dow AS ds__extract_dow
+ , subq_15.ds__extract_doy AS ds__extract_doy
+ , subq_15.ds_partitioned__day AS ds_partitioned__day
+ , subq_15.ds_partitioned__week AS ds_partitioned__week
+ , subq_15.ds_partitioned__month AS ds_partitioned__month
+ , subq_15.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_15.ds_partitioned__year AS ds_partitioned__year
+ , subq_15.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_15.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_15.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_15.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_15.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_15.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_15.paid_at__day AS paid_at__day
+ , subq_15.paid_at__week AS paid_at__week
+ , subq_15.paid_at__month AS paid_at__month
+ , subq_15.paid_at__quarter AS paid_at__quarter
+ , subq_15.paid_at__year AS paid_at__year
+ , subq_15.paid_at__extract_year AS paid_at__extract_year
+ , subq_15.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_15.paid_at__extract_month AS paid_at__extract_month
+ , subq_15.paid_at__extract_day AS paid_at__extract_day
+ , subq_15.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_15.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_15.booking__ds__day AS booking__ds__day
+ , subq_15.booking__ds__week AS booking__ds__week
+ , subq_15.booking__ds__month AS booking__ds__month
+ , subq_15.booking__ds__quarter AS booking__ds__quarter
+ , subq_15.booking__ds__year AS booking__ds__year
+ , subq_15.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_15.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_15.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_15.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_15.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_15.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_15.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_15.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_15.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_15.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_15.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_15.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_15.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_15.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_15.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_15.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_15.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_15.booking__paid_at__day AS booking__paid_at__day
+ , subq_15.booking__paid_at__week AS booking__paid_at__week
+ , subq_15.booking__paid_at__month AS booking__paid_at__month
+ , subq_15.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_15.booking__paid_at__year AS booking__paid_at__year
+ , subq_15.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_15.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_15.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_15.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_15.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_15.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_15.listing AS listing
+ , subq_15.guest AS guest
+ , subq_15.host AS host
+ , subq_15.booking__listing AS booking__listing
+ , subq_15.booking__guest AS booking__guest
+ , subq_15.booking__host AS booking__host
+ , subq_15.is_instant AS is_instant
+ , subq_15.booking__is_instant AS booking__is_instant
+ , subq_15.bookings AS bookings
+ , subq_15.instant_bookings AS instant_bookings
+ , subq_15.booking_value AS booking_value
+ , subq_15.max_booking_value AS max_booking_value
+ , subq_15.min_booking_value AS min_booking_value
+ , subq_15.bookers AS bookers
+ , subq_15.average_booking_value AS average_booking_value
+ , subq_15.referred_bookings AS referred_bookings
+ , subq_15.median_booking_value AS median_booking_value
+ , subq_15.booking_value_p99 AS booking_value_p99
+ , subq_15.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_15.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_15.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_8.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_8
- ) subq_7
+ subq_17.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_17
+ ) subq_16
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_5.ds__day
- , subq_5.ds__week
- , subq_5.ds__month
- , subq_5.ds__quarter
- , subq_5.ds__year
- , subq_5.ds__extract_year
- , subq_5.ds__extract_quarter
- , subq_5.ds__extract_month
- , subq_5.ds__extract_day
- , subq_5.ds__extract_dow
- , subq_5.ds__extract_doy
- , subq_5.ds_partitioned__day
- , subq_5.ds_partitioned__week
- , subq_5.ds_partitioned__month
- , subq_5.ds_partitioned__quarter
- , subq_5.ds_partitioned__year
- , subq_5.ds_partitioned__extract_year
- , subq_5.ds_partitioned__extract_quarter
- , subq_5.ds_partitioned__extract_month
- , subq_5.ds_partitioned__extract_day
- , subq_5.ds_partitioned__extract_dow
- , subq_5.ds_partitioned__extract_doy
- , subq_5.paid_at__day
- , subq_5.paid_at__week
- , subq_5.paid_at__month
- , subq_5.paid_at__quarter
- , subq_5.paid_at__year
- , subq_5.paid_at__extract_year
- , subq_5.paid_at__extract_quarter
- , subq_5.paid_at__extract_month
- , subq_5.paid_at__extract_day
- , subq_5.paid_at__extract_dow
- , subq_5.paid_at__extract_doy
- , subq_5.booking__ds__day
- , subq_5.booking__ds__week
- , subq_5.booking__ds__month
- , subq_5.booking__ds__quarter
- , subq_5.booking__ds__year
- , subq_5.booking__ds__extract_year
- , subq_5.booking__ds__extract_quarter
- , subq_5.booking__ds__extract_month
- , subq_5.booking__ds__extract_day
- , subq_5.booking__ds__extract_dow
- , subq_5.booking__ds__extract_doy
- , subq_5.booking__ds_partitioned__day
- , subq_5.booking__ds_partitioned__week
- , subq_5.booking__ds_partitioned__month
- , subq_5.booking__ds_partitioned__quarter
- , subq_5.booking__ds_partitioned__year
- , subq_5.booking__ds_partitioned__extract_year
- , subq_5.booking__ds_partitioned__extract_quarter
- , subq_5.booking__ds_partitioned__extract_month
- , subq_5.booking__ds_partitioned__extract_day
- , subq_5.booking__ds_partitioned__extract_dow
- , subq_5.booking__ds_partitioned__extract_doy
- , subq_5.booking__paid_at__day
- , subq_5.booking__paid_at__week
- , subq_5.booking__paid_at__month
- , subq_5.booking__paid_at__quarter
- , subq_5.booking__paid_at__year
- , subq_5.booking__paid_at__extract_year
- , subq_5.booking__paid_at__extract_quarter
- , subq_5.booking__paid_at__extract_month
- , subq_5.booking__paid_at__extract_day
- , subq_5.booking__paid_at__extract_dow
- , subq_5.booking__paid_at__extract_doy
- , subq_5.ds__day AS metric_time__day
- , subq_5.ds__week AS metric_time__week
- , subq_5.ds__month AS metric_time__month
- , subq_5.ds__quarter AS metric_time__quarter
- , subq_5.ds__year AS metric_time__year
- , subq_5.ds__extract_year AS metric_time__extract_year
- , subq_5.ds__extract_quarter AS metric_time__extract_quarter
- , subq_5.ds__extract_month AS metric_time__extract_month
- , subq_5.ds__extract_day AS metric_time__extract_day
- , subq_5.ds__extract_dow AS metric_time__extract_dow
- , subq_5.ds__extract_doy AS metric_time__extract_doy
- , subq_5.listing
- , subq_5.guest
- , subq_5.host
- , subq_5.booking__listing
- , subq_5.booking__guest
- , subq_5.booking__host
- , subq_5.is_instant
- , subq_5.booking__is_instant
- , subq_5.bookings
- , subq_5.instant_bookings
- , subq_5.booking_value
- , subq_5.max_booking_value
- , subq_5.min_booking_value
- , subq_5.bookers
- , subq_5.average_booking_value
- , subq_5.referred_bookings
- , subq_5.median_booking_value
- , subq_5.booking_value_p99
- , subq_5.discrete_booking_value_p99
- , subq_5.approximate_continuous_booking_value_p99
- , subq_5.approximate_discrete_booking_value_p99
+ subq_14.ds__day
+ , subq_14.ds__week
+ , subq_14.ds__month
+ , subq_14.ds__quarter
+ , subq_14.ds__year
+ , subq_14.ds__extract_year
+ , subq_14.ds__extract_quarter
+ , subq_14.ds__extract_month
+ , subq_14.ds__extract_day
+ , subq_14.ds__extract_dow
+ , subq_14.ds__extract_doy
+ , subq_14.ds_partitioned__day
+ , subq_14.ds_partitioned__week
+ , subq_14.ds_partitioned__month
+ , subq_14.ds_partitioned__quarter
+ , subq_14.ds_partitioned__year
+ , subq_14.ds_partitioned__extract_year
+ , subq_14.ds_partitioned__extract_quarter
+ , subq_14.ds_partitioned__extract_month
+ , subq_14.ds_partitioned__extract_day
+ , subq_14.ds_partitioned__extract_dow
+ , subq_14.ds_partitioned__extract_doy
+ , subq_14.paid_at__day
+ , subq_14.paid_at__week
+ , subq_14.paid_at__month
+ , subq_14.paid_at__quarter
+ , subq_14.paid_at__year
+ , subq_14.paid_at__extract_year
+ , subq_14.paid_at__extract_quarter
+ , subq_14.paid_at__extract_month
+ , subq_14.paid_at__extract_day
+ , subq_14.paid_at__extract_dow
+ , subq_14.paid_at__extract_doy
+ , subq_14.booking__ds__day
+ , subq_14.booking__ds__week
+ , subq_14.booking__ds__month
+ , subq_14.booking__ds__quarter
+ , subq_14.booking__ds__year
+ , subq_14.booking__ds__extract_year
+ , subq_14.booking__ds__extract_quarter
+ , subq_14.booking__ds__extract_month
+ , subq_14.booking__ds__extract_day
+ , subq_14.booking__ds__extract_dow
+ , subq_14.booking__ds__extract_doy
+ , subq_14.booking__ds_partitioned__day
+ , subq_14.booking__ds_partitioned__week
+ , subq_14.booking__ds_partitioned__month
+ , subq_14.booking__ds_partitioned__quarter
+ , subq_14.booking__ds_partitioned__year
+ , subq_14.booking__ds_partitioned__extract_year
+ , subq_14.booking__ds_partitioned__extract_quarter
+ , subq_14.booking__ds_partitioned__extract_month
+ , subq_14.booking__ds_partitioned__extract_day
+ , subq_14.booking__ds_partitioned__extract_dow
+ , subq_14.booking__ds_partitioned__extract_doy
+ , subq_14.booking__paid_at__day
+ , subq_14.booking__paid_at__week
+ , subq_14.booking__paid_at__month
+ , subq_14.booking__paid_at__quarter
+ , subq_14.booking__paid_at__year
+ , subq_14.booking__paid_at__extract_year
+ , subq_14.booking__paid_at__extract_quarter
+ , subq_14.booking__paid_at__extract_month
+ , subq_14.booking__paid_at__extract_day
+ , subq_14.booking__paid_at__extract_dow
+ , subq_14.booking__paid_at__extract_doy
+ , subq_14.ds__day AS metric_time__day
+ , subq_14.ds__week AS metric_time__week
+ , subq_14.ds__month AS metric_time__month
+ , subq_14.ds__quarter AS metric_time__quarter
+ , subq_14.ds__year AS metric_time__year
+ , subq_14.ds__extract_year AS metric_time__extract_year
+ , subq_14.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_14.ds__extract_month AS metric_time__extract_month
+ , subq_14.ds__extract_day AS metric_time__extract_day
+ , subq_14.ds__extract_dow AS metric_time__extract_dow
+ , subq_14.ds__extract_doy AS metric_time__extract_doy
+ , subq_14.listing
+ , subq_14.guest
+ , subq_14.host
+ , subq_14.booking__listing
+ , subq_14.booking__guest
+ , subq_14.booking__host
+ , subq_14.is_instant
+ , subq_14.booking__is_instant
+ , subq_14.bookings
+ , subq_14.instant_bookings
+ , subq_14.booking_value
+ , subq_14.max_booking_value
+ , subq_14.min_booking_value
+ , subq_14.bookers
+ , subq_14.average_booking_value
+ , subq_14.referred_bookings
+ , subq_14.median_booking_value
+ , subq_14.booking_value_p99
+ , subq_14.discrete_booking_value_p99
+ , subq_14.approximate_continuous_booking_value_p99
+ , subq_14.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_5
- ) subq_6
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS booking__paid_at__extract_dow
+ , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_14
+ ) subq_15
ON
- DATE_SUB(CAST(subq_7.metric_time__day AS DATETIME), INTERVAL 14 day) = subq_6.metric_time__day
- ) subq_9
- ) subq_10
+ DATE_SUB(CAST(subq_16.metric_time__day AS DATETIME), INTERVAL 14 day) = subq_15.metric_time__day
+ ) subq_18
+ ) subq_19
GROUP BY
metric_time__quarter
- ) subq_11
- ) subq_12
+ ) subq_20
+ ) subq_21
ON
- subq_4.metric_time__quarter = subq_12.metric_time__quarter
+ subq_13.metric_time__quarter = subq_21.metric_time__quarter
GROUP BY
metric_time__quarter
-) subq_13
+) subq_22
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_granularity__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_granularity__plan0_optimized.sql
index d826bdbd46..3aa56a19b3 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_granularity__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_granularity__plan0_optimized.sql
@@ -5,9 +5,9 @@ SELECT
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_18.metric_time__quarter, subq_26.metric_time__quarter) AS metric_time__quarter
- , MAX(subq_18.bookings) AS bookings
- , MAX(subq_26.bookings_2_weeks_ago) AS bookings_2_weeks_ago
+ COALESCE(subq_27.metric_time__quarter, subq_35.metric_time__quarter) AS metric_time__quarter
+ , MAX(subq_27.bookings) AS bookings
+ , MAX(subq_35.bookings_2_weeks_ago) AS bookings_2_weeks_ago
FROM (
-- Aggregate Measures
-- Compute Metrics via Expressions
@@ -21,35 +21,35 @@ FROM (
SELECT
DATE_TRUNC(ds, quarter) AS metric_time__quarter
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_16
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_25
GROUP BY
metric_time__quarter
- ) subq_18
+ ) subq_27
FULL OUTER JOIN (
-- Join to Time Spine Dataset
-- Pass Only Elements: ['bookings', 'metric_time__quarter']
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- DATE_TRUNC(subq_22.ds, quarter) AS metric_time__quarter
- , SUM(subq_20.bookings) AS bookings_2_weeks_ago
- FROM ***************************.mf_time_spine subq_22
+ DATE_TRUNC(subq_31.ds, quarter) AS metric_time__quarter
+ , SUM(subq_29.bookings) AS bookings_2_weeks_ago
+ FROM ***************************.mf_time_spine subq_31
INNER JOIN (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
SELECT
DATE_TRUNC(ds, day) AS metric_time__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_20
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_29
ON
- DATE_SUB(CAST(subq_22.ds AS DATETIME), INTERVAL 14 day) = subq_20.metric_time__day
+ DATE_SUB(CAST(subq_31.ds AS DATETIME), INTERVAL 14 day) = subq_29.metric_time__day
GROUP BY
metric_time__quarter
- ) subq_26
+ ) subq_35
ON
- subq_18.metric_time__quarter = subq_26.metric_time__quarter
+ subq_27.metric_time__quarter = subq_35.metric_time__quarter
GROUP BY
metric_time__quarter
-) subq_27
+) subq_36
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql
index 9afd2673b1..06729b6831 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql
@@ -1,645 +1,645 @@
-- Compute Metrics via Expressions
SELECT
- subq_16.metric_time__day
+ subq_25.metric_time__day
, month_start_bookings - bookings_1_month_ago AS bookings_month_start_compared_to_1_month_prior
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_7.metric_time__day, subq_15.metric_time__day) AS metric_time__day
- , MAX(subq_7.month_start_bookings) AS month_start_bookings
- , MAX(subq_15.bookings_1_month_ago) AS bookings_1_month_ago
+ COALESCE(subq_16.metric_time__day, subq_24.metric_time__day) AS metric_time__day
+ , MAX(subq_16.month_start_bookings) AS month_start_bookings
+ , MAX(subq_24.bookings_1_month_ago) AS bookings_1_month_ago
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_6.metric_time__day
- , subq_6.bookings AS month_start_bookings
+ subq_15.metric_time__day
+ , subq_15.bookings AS month_start_bookings
FROM (
-- Aggregate Measures
SELECT
- subq_5.metric_time__day
- , SUM(subq_5.bookings) AS bookings
+ subq_14.metric_time__day
+ , SUM(subq_14.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__day']
SELECT
- subq_4.metric_time__day
- , subq_4.bookings
+ subq_13.metric_time__day
+ , subq_13.bookings
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_2.metric_time__day AS metric_time__day
- , subq_1.ds__day AS ds__day
- , subq_1.ds__week AS ds__week
- , subq_1.ds__month AS ds__month
- , subq_1.ds__quarter AS ds__quarter
- , subq_1.ds__year AS ds__year
- , subq_1.ds__extract_year AS ds__extract_year
- , subq_1.ds__extract_quarter AS ds__extract_quarter
- , subq_1.ds__extract_month AS ds__extract_month
- , subq_1.ds__extract_day AS ds__extract_day
- , subq_1.ds__extract_dow AS ds__extract_dow
- , subq_1.ds__extract_doy AS ds__extract_doy
- , subq_1.ds_partitioned__day AS ds_partitioned__day
- , subq_1.ds_partitioned__week AS ds_partitioned__week
- , subq_1.ds_partitioned__month AS ds_partitioned__month
- , subq_1.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_1.ds_partitioned__year AS ds_partitioned__year
- , subq_1.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_1.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_1.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_1.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_1.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_1.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_1.paid_at__day AS paid_at__day
- , subq_1.paid_at__week AS paid_at__week
- , subq_1.paid_at__month AS paid_at__month
- , subq_1.paid_at__quarter AS paid_at__quarter
- , subq_1.paid_at__year AS paid_at__year
- , subq_1.paid_at__extract_year AS paid_at__extract_year
- , subq_1.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_1.paid_at__extract_month AS paid_at__extract_month
- , subq_1.paid_at__extract_day AS paid_at__extract_day
- , subq_1.paid_at__extract_dow AS paid_at__extract_dow
- , subq_1.paid_at__extract_doy AS paid_at__extract_doy
- , subq_1.booking__ds__day AS booking__ds__day
- , subq_1.booking__ds__week AS booking__ds__week
- , subq_1.booking__ds__month AS booking__ds__month
- , subq_1.booking__ds__quarter AS booking__ds__quarter
- , subq_1.booking__ds__year AS booking__ds__year
- , subq_1.booking__ds__extract_year AS booking__ds__extract_year
- , subq_1.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_1.booking__ds__extract_month AS booking__ds__extract_month
- , subq_1.booking__ds__extract_day AS booking__ds__extract_day
- , subq_1.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_1.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_1.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_1.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_1.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_1.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_1.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_1.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_1.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_1.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_1.booking__paid_at__day AS booking__paid_at__day
- , subq_1.booking__paid_at__week AS booking__paid_at__week
- , subq_1.booking__paid_at__month AS booking__paid_at__month
- , subq_1.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_1.booking__paid_at__year AS booking__paid_at__year
- , subq_1.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_1.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_1.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_1.listing AS listing
- , subq_1.guest AS guest
- , subq_1.host AS host
- , subq_1.booking__listing AS booking__listing
- , subq_1.booking__guest AS booking__guest
- , subq_1.booking__host AS booking__host
- , subq_1.is_instant AS is_instant
- , subq_1.booking__is_instant AS booking__is_instant
- , subq_1.bookings AS bookings
- , subq_1.instant_bookings AS instant_bookings
- , subq_1.booking_value AS booking_value
- , subq_1.max_booking_value AS max_booking_value
- , subq_1.min_booking_value AS min_booking_value
- , subq_1.bookers AS bookers
- , subq_1.average_booking_value AS average_booking_value
- , subq_1.referred_bookings AS referred_bookings
- , subq_1.median_booking_value AS median_booking_value
- , subq_1.booking_value_p99 AS booking_value_p99
- , subq_1.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_1.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_1.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ subq_11.metric_time__day AS metric_time__day
+ , subq_10.ds__day AS ds__day
+ , subq_10.ds__week AS ds__week
+ , subq_10.ds__month AS ds__month
+ , subq_10.ds__quarter AS ds__quarter
+ , subq_10.ds__year AS ds__year
+ , subq_10.ds__extract_year AS ds__extract_year
+ , subq_10.ds__extract_quarter AS ds__extract_quarter
+ , subq_10.ds__extract_month AS ds__extract_month
+ , subq_10.ds__extract_day AS ds__extract_day
+ , subq_10.ds__extract_dow AS ds__extract_dow
+ , subq_10.ds__extract_doy AS ds__extract_doy
+ , subq_10.ds_partitioned__day AS ds_partitioned__day
+ , subq_10.ds_partitioned__week AS ds_partitioned__week
+ , subq_10.ds_partitioned__month AS ds_partitioned__month
+ , subq_10.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_10.ds_partitioned__year AS ds_partitioned__year
+ , subq_10.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_10.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_10.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_10.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_10.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_10.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_10.paid_at__day AS paid_at__day
+ , subq_10.paid_at__week AS paid_at__week
+ , subq_10.paid_at__month AS paid_at__month
+ , subq_10.paid_at__quarter AS paid_at__quarter
+ , subq_10.paid_at__year AS paid_at__year
+ , subq_10.paid_at__extract_year AS paid_at__extract_year
+ , subq_10.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_10.paid_at__extract_month AS paid_at__extract_month
+ , subq_10.paid_at__extract_day AS paid_at__extract_day
+ , subq_10.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_10.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_10.booking__ds__day AS booking__ds__day
+ , subq_10.booking__ds__week AS booking__ds__week
+ , subq_10.booking__ds__month AS booking__ds__month
+ , subq_10.booking__ds__quarter AS booking__ds__quarter
+ , subq_10.booking__ds__year AS booking__ds__year
+ , subq_10.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_10.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_10.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_10.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_10.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_10.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_10.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_10.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_10.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_10.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_10.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_10.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_10.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_10.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_10.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_10.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_10.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_10.booking__paid_at__day AS booking__paid_at__day
+ , subq_10.booking__paid_at__week AS booking__paid_at__week
+ , subq_10.booking__paid_at__month AS booking__paid_at__month
+ , subq_10.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_10.booking__paid_at__year AS booking__paid_at__year
+ , subq_10.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_10.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_10.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_10.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_10.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_10.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_10.listing AS listing
+ , subq_10.guest AS guest
+ , subq_10.host AS host
+ , subq_10.booking__listing AS booking__listing
+ , subq_10.booking__guest AS booking__guest
+ , subq_10.booking__host AS booking__host
+ , subq_10.is_instant AS is_instant
+ , subq_10.booking__is_instant AS booking__is_instant
+ , subq_10.bookings AS bookings
+ , subq_10.instant_bookings AS instant_bookings
+ , subq_10.booking_value AS booking_value
+ , subq_10.max_booking_value AS max_booking_value
+ , subq_10.min_booking_value AS min_booking_value
+ , subq_10.bookers AS bookers
+ , subq_10.average_booking_value AS average_booking_value
+ , subq_10.referred_bookings AS referred_bookings
+ , subq_10.median_booking_value AS median_booking_value
+ , subq_10.booking_value_p99 AS booking_value_p99
+ , subq_10.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_10.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_10.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_3.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_3
- ) subq_2
+ subq_12.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_12
+ ) subq_11
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS booking__paid_at__extract_dow
+ , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
ON
- DATE_TRUNC(subq_2.metric_time__day, month) = subq_1.metric_time__day
- ) subq_4
- ) subq_5
+ DATE_TRUNC(subq_11.metric_time__day, month) = subq_10.metric_time__day
+ ) subq_13
+ ) subq_14
GROUP BY
metric_time__day
- ) subq_6
- ) subq_7
+ ) subq_15
+ ) subq_16
FULL OUTER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_14.metric_time__day
- , subq_14.bookings AS bookings_1_month_ago
+ subq_23.metric_time__day
+ , subq_23.bookings AS bookings_1_month_ago
FROM (
-- Aggregate Measures
SELECT
- subq_13.metric_time__day
- , SUM(subq_13.bookings) AS bookings
+ subq_22.metric_time__day
+ , SUM(subq_22.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__day']
SELECT
- subq_12.metric_time__day
- , subq_12.bookings
+ subq_21.metric_time__day
+ , subq_21.bookings
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_10.metric_time__day AS metric_time__day
- , subq_9.ds__day AS ds__day
- , subq_9.ds__week AS ds__week
- , subq_9.ds__month AS ds__month
- , subq_9.ds__quarter AS ds__quarter
- , subq_9.ds__year AS ds__year
- , subq_9.ds__extract_year AS ds__extract_year
- , subq_9.ds__extract_quarter AS ds__extract_quarter
- , subq_9.ds__extract_month AS ds__extract_month
- , subq_9.ds__extract_day AS ds__extract_day
- , subq_9.ds__extract_dow AS ds__extract_dow
- , subq_9.ds__extract_doy AS ds__extract_doy
- , subq_9.ds_partitioned__day AS ds_partitioned__day
- , subq_9.ds_partitioned__week AS ds_partitioned__week
- , subq_9.ds_partitioned__month AS ds_partitioned__month
- , subq_9.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_9.ds_partitioned__year AS ds_partitioned__year
- , subq_9.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_9.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_9.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_9.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_9.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_9.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_9.paid_at__day AS paid_at__day
- , subq_9.paid_at__week AS paid_at__week
- , subq_9.paid_at__month AS paid_at__month
- , subq_9.paid_at__quarter AS paid_at__quarter
- , subq_9.paid_at__year AS paid_at__year
- , subq_9.paid_at__extract_year AS paid_at__extract_year
- , subq_9.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_9.paid_at__extract_month AS paid_at__extract_month
- , subq_9.paid_at__extract_day AS paid_at__extract_day
- , subq_9.paid_at__extract_dow AS paid_at__extract_dow
- , subq_9.paid_at__extract_doy AS paid_at__extract_doy
- , subq_9.booking__ds__day AS booking__ds__day
- , subq_9.booking__ds__week AS booking__ds__week
- , subq_9.booking__ds__month AS booking__ds__month
- , subq_9.booking__ds__quarter AS booking__ds__quarter
- , subq_9.booking__ds__year AS booking__ds__year
- , subq_9.booking__ds__extract_year AS booking__ds__extract_year
- , subq_9.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_9.booking__ds__extract_month AS booking__ds__extract_month
- , subq_9.booking__ds__extract_day AS booking__ds__extract_day
- , subq_9.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_9.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_9.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_9.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_9.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_9.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_9.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_9.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_9.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_9.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_9.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_9.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_9.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_9.booking__paid_at__day AS booking__paid_at__day
- , subq_9.booking__paid_at__week AS booking__paid_at__week
- , subq_9.booking__paid_at__month AS booking__paid_at__month
- , subq_9.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_9.booking__paid_at__year AS booking__paid_at__year
- , subq_9.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_9.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_9.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_9.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_9.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_9.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_9.listing AS listing
- , subq_9.guest AS guest
- , subq_9.host AS host
- , subq_9.booking__listing AS booking__listing
- , subq_9.booking__guest AS booking__guest
- , subq_9.booking__host AS booking__host
- , subq_9.is_instant AS is_instant
- , subq_9.booking__is_instant AS booking__is_instant
- , subq_9.bookings AS bookings
- , subq_9.instant_bookings AS instant_bookings
- , subq_9.booking_value AS booking_value
- , subq_9.max_booking_value AS max_booking_value
- , subq_9.min_booking_value AS min_booking_value
- , subq_9.bookers AS bookers
- , subq_9.average_booking_value AS average_booking_value
- , subq_9.referred_bookings AS referred_bookings
- , subq_9.median_booking_value AS median_booking_value
- , subq_9.booking_value_p99 AS booking_value_p99
- , subq_9.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_9.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_9.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ subq_19.metric_time__day AS metric_time__day
+ , subq_18.ds__day AS ds__day
+ , subq_18.ds__week AS ds__week
+ , subq_18.ds__month AS ds__month
+ , subq_18.ds__quarter AS ds__quarter
+ , subq_18.ds__year AS ds__year
+ , subq_18.ds__extract_year AS ds__extract_year
+ , subq_18.ds__extract_quarter AS ds__extract_quarter
+ , subq_18.ds__extract_month AS ds__extract_month
+ , subq_18.ds__extract_day AS ds__extract_day
+ , subq_18.ds__extract_dow AS ds__extract_dow
+ , subq_18.ds__extract_doy AS ds__extract_doy
+ , subq_18.ds_partitioned__day AS ds_partitioned__day
+ , subq_18.ds_partitioned__week AS ds_partitioned__week
+ , subq_18.ds_partitioned__month AS ds_partitioned__month
+ , subq_18.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_18.ds_partitioned__year AS ds_partitioned__year
+ , subq_18.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_18.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_18.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_18.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_18.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_18.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_18.paid_at__day AS paid_at__day
+ , subq_18.paid_at__week AS paid_at__week
+ , subq_18.paid_at__month AS paid_at__month
+ , subq_18.paid_at__quarter AS paid_at__quarter
+ , subq_18.paid_at__year AS paid_at__year
+ , subq_18.paid_at__extract_year AS paid_at__extract_year
+ , subq_18.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_18.paid_at__extract_month AS paid_at__extract_month
+ , subq_18.paid_at__extract_day AS paid_at__extract_day
+ , subq_18.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_18.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_18.booking__ds__day AS booking__ds__day
+ , subq_18.booking__ds__week AS booking__ds__week
+ , subq_18.booking__ds__month AS booking__ds__month
+ , subq_18.booking__ds__quarter AS booking__ds__quarter
+ , subq_18.booking__ds__year AS booking__ds__year
+ , subq_18.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_18.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_18.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_18.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_18.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_18.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_18.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_18.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_18.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_18.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_18.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_18.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_18.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_18.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_18.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_18.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_18.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_18.booking__paid_at__day AS booking__paid_at__day
+ , subq_18.booking__paid_at__week AS booking__paid_at__week
+ , subq_18.booking__paid_at__month AS booking__paid_at__month
+ , subq_18.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_18.booking__paid_at__year AS booking__paid_at__year
+ , subq_18.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_18.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_18.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_18.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_18.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_18.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_18.listing AS listing
+ , subq_18.guest AS guest
+ , subq_18.host AS host
+ , subq_18.booking__listing AS booking__listing
+ , subq_18.booking__guest AS booking__guest
+ , subq_18.booking__host AS booking__host
+ , subq_18.is_instant AS is_instant
+ , subq_18.booking__is_instant AS booking__is_instant
+ , subq_18.bookings AS bookings
+ , subq_18.instant_bookings AS instant_bookings
+ , subq_18.booking_value AS booking_value
+ , subq_18.max_booking_value AS max_booking_value
+ , subq_18.min_booking_value AS min_booking_value
+ , subq_18.bookers AS bookers
+ , subq_18.average_booking_value AS average_booking_value
+ , subq_18.referred_bookings AS referred_bookings
+ , subq_18.median_booking_value AS median_booking_value
+ , subq_18.booking_value_p99 AS booking_value_p99
+ , subq_18.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_18.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_18.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_11.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_11
- ) subq_10
+ subq_20.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_20
+ ) subq_19
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_8.ds__day
- , subq_8.ds__week
- , subq_8.ds__month
- , subq_8.ds__quarter
- , subq_8.ds__year
- , subq_8.ds__extract_year
- , subq_8.ds__extract_quarter
- , subq_8.ds__extract_month
- , subq_8.ds__extract_day
- , subq_8.ds__extract_dow
- , subq_8.ds__extract_doy
- , subq_8.ds_partitioned__day
- , subq_8.ds_partitioned__week
- , subq_8.ds_partitioned__month
- , subq_8.ds_partitioned__quarter
- , subq_8.ds_partitioned__year
- , subq_8.ds_partitioned__extract_year
- , subq_8.ds_partitioned__extract_quarter
- , subq_8.ds_partitioned__extract_month
- , subq_8.ds_partitioned__extract_day
- , subq_8.ds_partitioned__extract_dow
- , subq_8.ds_partitioned__extract_doy
- , subq_8.paid_at__day
- , subq_8.paid_at__week
- , subq_8.paid_at__month
- , subq_8.paid_at__quarter
- , subq_8.paid_at__year
- , subq_8.paid_at__extract_year
- , subq_8.paid_at__extract_quarter
- , subq_8.paid_at__extract_month
- , subq_8.paid_at__extract_day
- , subq_8.paid_at__extract_dow
- , subq_8.paid_at__extract_doy
- , subq_8.booking__ds__day
- , subq_8.booking__ds__week
- , subq_8.booking__ds__month
- , subq_8.booking__ds__quarter
- , subq_8.booking__ds__year
- , subq_8.booking__ds__extract_year
- , subq_8.booking__ds__extract_quarter
- , subq_8.booking__ds__extract_month
- , subq_8.booking__ds__extract_day
- , subq_8.booking__ds__extract_dow
- , subq_8.booking__ds__extract_doy
- , subq_8.booking__ds_partitioned__day
- , subq_8.booking__ds_partitioned__week
- , subq_8.booking__ds_partitioned__month
- , subq_8.booking__ds_partitioned__quarter
- , subq_8.booking__ds_partitioned__year
- , subq_8.booking__ds_partitioned__extract_year
- , subq_8.booking__ds_partitioned__extract_quarter
- , subq_8.booking__ds_partitioned__extract_month
- , subq_8.booking__ds_partitioned__extract_day
- , subq_8.booking__ds_partitioned__extract_dow
- , subq_8.booking__ds_partitioned__extract_doy
- , subq_8.booking__paid_at__day
- , subq_8.booking__paid_at__week
- , subq_8.booking__paid_at__month
- , subq_8.booking__paid_at__quarter
- , subq_8.booking__paid_at__year
- , subq_8.booking__paid_at__extract_year
- , subq_8.booking__paid_at__extract_quarter
- , subq_8.booking__paid_at__extract_month
- , subq_8.booking__paid_at__extract_day
- , subq_8.booking__paid_at__extract_dow
- , subq_8.booking__paid_at__extract_doy
- , subq_8.ds__day AS metric_time__day
- , subq_8.ds__week AS metric_time__week
- , subq_8.ds__month AS metric_time__month
- , subq_8.ds__quarter AS metric_time__quarter
- , subq_8.ds__year AS metric_time__year
- , subq_8.ds__extract_year AS metric_time__extract_year
- , subq_8.ds__extract_quarter AS metric_time__extract_quarter
- , subq_8.ds__extract_month AS metric_time__extract_month
- , subq_8.ds__extract_day AS metric_time__extract_day
- , subq_8.ds__extract_dow AS metric_time__extract_dow
- , subq_8.ds__extract_doy AS metric_time__extract_doy
- , subq_8.listing
- , subq_8.guest
- , subq_8.host
- , subq_8.booking__listing
- , subq_8.booking__guest
- , subq_8.booking__host
- , subq_8.is_instant
- , subq_8.booking__is_instant
- , subq_8.bookings
- , subq_8.instant_bookings
- , subq_8.booking_value
- , subq_8.max_booking_value
- , subq_8.min_booking_value
- , subq_8.bookers
- , subq_8.average_booking_value
- , subq_8.referred_bookings
- , subq_8.median_booking_value
- , subq_8.booking_value_p99
- , subq_8.discrete_booking_value_p99
- , subq_8.approximate_continuous_booking_value_p99
- , subq_8.approximate_discrete_booking_value_p99
+ subq_17.ds__day
+ , subq_17.ds__week
+ , subq_17.ds__month
+ , subq_17.ds__quarter
+ , subq_17.ds__year
+ , subq_17.ds__extract_year
+ , subq_17.ds__extract_quarter
+ , subq_17.ds__extract_month
+ , subq_17.ds__extract_day
+ , subq_17.ds__extract_dow
+ , subq_17.ds__extract_doy
+ , subq_17.ds_partitioned__day
+ , subq_17.ds_partitioned__week
+ , subq_17.ds_partitioned__month
+ , subq_17.ds_partitioned__quarter
+ , subq_17.ds_partitioned__year
+ , subq_17.ds_partitioned__extract_year
+ , subq_17.ds_partitioned__extract_quarter
+ , subq_17.ds_partitioned__extract_month
+ , subq_17.ds_partitioned__extract_day
+ , subq_17.ds_partitioned__extract_dow
+ , subq_17.ds_partitioned__extract_doy
+ , subq_17.paid_at__day
+ , subq_17.paid_at__week
+ , subq_17.paid_at__month
+ , subq_17.paid_at__quarter
+ , subq_17.paid_at__year
+ , subq_17.paid_at__extract_year
+ , subq_17.paid_at__extract_quarter
+ , subq_17.paid_at__extract_month
+ , subq_17.paid_at__extract_day
+ , subq_17.paid_at__extract_dow
+ , subq_17.paid_at__extract_doy
+ , subq_17.booking__ds__day
+ , subq_17.booking__ds__week
+ , subq_17.booking__ds__month
+ , subq_17.booking__ds__quarter
+ , subq_17.booking__ds__year
+ , subq_17.booking__ds__extract_year
+ , subq_17.booking__ds__extract_quarter
+ , subq_17.booking__ds__extract_month
+ , subq_17.booking__ds__extract_day
+ , subq_17.booking__ds__extract_dow
+ , subq_17.booking__ds__extract_doy
+ , subq_17.booking__ds_partitioned__day
+ , subq_17.booking__ds_partitioned__week
+ , subq_17.booking__ds_partitioned__month
+ , subq_17.booking__ds_partitioned__quarter
+ , subq_17.booking__ds_partitioned__year
+ , subq_17.booking__ds_partitioned__extract_year
+ , subq_17.booking__ds_partitioned__extract_quarter
+ , subq_17.booking__ds_partitioned__extract_month
+ , subq_17.booking__ds_partitioned__extract_day
+ , subq_17.booking__ds_partitioned__extract_dow
+ , subq_17.booking__ds_partitioned__extract_doy
+ , subq_17.booking__paid_at__day
+ , subq_17.booking__paid_at__week
+ , subq_17.booking__paid_at__month
+ , subq_17.booking__paid_at__quarter
+ , subq_17.booking__paid_at__year
+ , subq_17.booking__paid_at__extract_year
+ , subq_17.booking__paid_at__extract_quarter
+ , subq_17.booking__paid_at__extract_month
+ , subq_17.booking__paid_at__extract_day
+ , subq_17.booking__paid_at__extract_dow
+ , subq_17.booking__paid_at__extract_doy
+ , subq_17.ds__day AS metric_time__day
+ , subq_17.ds__week AS metric_time__week
+ , subq_17.ds__month AS metric_time__month
+ , subq_17.ds__quarter AS metric_time__quarter
+ , subq_17.ds__year AS metric_time__year
+ , subq_17.ds__extract_year AS metric_time__extract_year
+ , subq_17.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_17.ds__extract_month AS metric_time__extract_month
+ , subq_17.ds__extract_day AS metric_time__extract_day
+ , subq_17.ds__extract_dow AS metric_time__extract_dow
+ , subq_17.ds__extract_doy AS metric_time__extract_doy
+ , subq_17.listing
+ , subq_17.guest
+ , subq_17.host
+ , subq_17.booking__listing
+ , subq_17.booking__guest
+ , subq_17.booking__host
+ , subq_17.is_instant
+ , subq_17.booking__is_instant
+ , subq_17.bookings
+ , subq_17.instant_bookings
+ , subq_17.booking_value
+ , subq_17.max_booking_value
+ , subq_17.min_booking_value
+ , subq_17.bookers
+ , subq_17.average_booking_value
+ , subq_17.referred_bookings
+ , subq_17.median_booking_value
+ , subq_17.booking_value_p99
+ , subq_17.discrete_booking_value_p99
+ , subq_17.approximate_continuous_booking_value_p99
+ , subq_17.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_8
- ) subq_9
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS booking__paid_at__extract_dow
+ , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_17
+ ) subq_18
ON
- DATE_SUB(CAST(subq_10.metric_time__day AS DATETIME), INTERVAL 1 month) = subq_9.metric_time__day
- ) subq_12
- ) subq_13
+ DATE_SUB(CAST(subq_19.metric_time__day AS DATETIME), INTERVAL 1 month) = subq_18.metric_time__day
+ ) subq_21
+ ) subq_22
GROUP BY
metric_time__day
- ) subq_14
- ) subq_15
+ ) subq_23
+ ) subq_24
ON
- subq_7.metric_time__day = subq_15.metric_time__day
+ subq_16.metric_time__day = subq_24.metric_time__day
GROUP BY
metric_time__day
-) subq_16
+) subq_25
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_offset_to_grain__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_offset_to_grain__plan0_optimized.sql
index 1d68b2b651..4a04ab6bbb 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_offset_to_grain__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_offset_to_grain__plan0_optimized.sql
@@ -5,55 +5,55 @@ SELECT
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_24.metric_time__day, subq_32.metric_time__day) AS metric_time__day
- , MAX(subq_24.month_start_bookings) AS month_start_bookings
- , MAX(subq_32.bookings_1_month_ago) AS bookings_1_month_ago
+ COALESCE(subq_33.metric_time__day, subq_41.metric_time__day) AS metric_time__day
+ , MAX(subq_33.month_start_bookings) AS month_start_bookings
+ , MAX(subq_41.bookings_1_month_ago) AS bookings_1_month_ago
FROM (
-- Join to Time Spine Dataset
-- Pass Only Elements: ['bookings', 'metric_time__day']
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_20.ds AS metric_time__day
- , SUM(subq_18.bookings) AS month_start_bookings
- FROM ***************************.mf_time_spine subq_20
+ subq_29.ds AS metric_time__day
+ , SUM(subq_27.bookings) AS month_start_bookings
+ FROM ***************************.mf_time_spine subq_29
INNER JOIN (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
SELECT
DATE_TRUNC(ds, day) AS metric_time__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_18
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_27
ON
- DATE_TRUNC(subq_20.ds, month) = subq_18.metric_time__day
+ DATE_TRUNC(subq_29.ds, month) = subq_27.metric_time__day
GROUP BY
metric_time__day
- ) subq_24
+ ) subq_33
FULL OUTER JOIN (
-- Join to Time Spine Dataset
-- Pass Only Elements: ['bookings', 'metric_time__day']
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_28.ds AS metric_time__day
- , SUM(subq_26.bookings) AS bookings_1_month_ago
- FROM ***************************.mf_time_spine subq_28
+ subq_37.ds AS metric_time__day
+ , SUM(subq_35.bookings) AS bookings_1_month_ago
+ FROM ***************************.mf_time_spine subq_37
INNER JOIN (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
SELECT
DATE_TRUNC(ds, day) AS metric_time__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_26
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_35
ON
- DATE_SUB(CAST(subq_28.ds AS DATETIME), INTERVAL 1 month) = subq_26.metric_time__day
+ DATE_SUB(CAST(subq_37.ds AS DATETIME), INTERVAL 1 month) = subq_35.metric_time__day
GROUP BY
metric_time__day
- ) subq_32
+ ) subq_41
ON
- subq_24.metric_time__day = subq_32.metric_time__day
+ subq_33.metric_time__day = subq_41.metric_time__day
GROUP BY
metric_time__day
-) subq_33
+) subq_42
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql
index 8bd8d05233..ca230b4854 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql
@@ -1,646 +1,646 @@
-- Compute Metrics via Expressions
SELECT
- subq_16.metric_time__year
+ subq_25.metric_time__year
, month_start_bookings - bookings_1_month_ago AS bookings_month_start_compared_to_1_month_prior
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_7.metric_time__year, subq_15.metric_time__year) AS metric_time__year
- , MAX(subq_7.month_start_bookings) AS month_start_bookings
- , MAX(subq_15.bookings_1_month_ago) AS bookings_1_month_ago
+ COALESCE(subq_16.metric_time__year, subq_24.metric_time__year) AS metric_time__year
+ , MAX(subq_16.month_start_bookings) AS month_start_bookings
+ , MAX(subq_24.bookings_1_month_ago) AS bookings_1_month_ago
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_6.metric_time__year
- , subq_6.bookings AS month_start_bookings
+ subq_15.metric_time__year
+ , subq_15.bookings AS month_start_bookings
FROM (
-- Aggregate Measures
SELECT
- subq_5.metric_time__year
- , SUM(subq_5.bookings) AS bookings
+ subq_14.metric_time__year
+ , SUM(subq_14.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__year']
SELECT
- subq_4.metric_time__year
- , subq_4.bookings
+ subq_13.metric_time__year
+ , subq_13.bookings
FROM (
-- Join to Time Spine Dataset
SELECT
- DATE_TRUNC(subq_2.metric_time__day, year) AS metric_time__year
- , subq_1.ds__day AS ds__day
- , subq_1.ds__week AS ds__week
- , subq_1.ds__month AS ds__month
- , subq_1.ds__quarter AS ds__quarter
- , subq_1.ds__year AS ds__year
- , subq_1.ds__extract_year AS ds__extract_year
- , subq_1.ds__extract_quarter AS ds__extract_quarter
- , subq_1.ds__extract_month AS ds__extract_month
- , subq_1.ds__extract_day AS ds__extract_day
- , subq_1.ds__extract_dow AS ds__extract_dow
- , subq_1.ds__extract_doy AS ds__extract_doy
- , subq_1.ds_partitioned__day AS ds_partitioned__day
- , subq_1.ds_partitioned__week AS ds_partitioned__week
- , subq_1.ds_partitioned__month AS ds_partitioned__month
- , subq_1.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_1.ds_partitioned__year AS ds_partitioned__year
- , subq_1.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_1.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_1.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_1.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_1.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_1.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_1.paid_at__day AS paid_at__day
- , subq_1.paid_at__week AS paid_at__week
- , subq_1.paid_at__month AS paid_at__month
- , subq_1.paid_at__quarter AS paid_at__quarter
- , subq_1.paid_at__year AS paid_at__year
- , subq_1.paid_at__extract_year AS paid_at__extract_year
- , subq_1.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_1.paid_at__extract_month AS paid_at__extract_month
- , subq_1.paid_at__extract_day AS paid_at__extract_day
- , subq_1.paid_at__extract_dow AS paid_at__extract_dow
- , subq_1.paid_at__extract_doy AS paid_at__extract_doy
- , subq_1.booking__ds__day AS booking__ds__day
- , subq_1.booking__ds__week AS booking__ds__week
- , subq_1.booking__ds__month AS booking__ds__month
- , subq_1.booking__ds__quarter AS booking__ds__quarter
- , subq_1.booking__ds__year AS booking__ds__year
- , subq_1.booking__ds__extract_year AS booking__ds__extract_year
- , subq_1.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_1.booking__ds__extract_month AS booking__ds__extract_month
- , subq_1.booking__ds__extract_day AS booking__ds__extract_day
- , subq_1.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_1.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_1.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_1.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_1.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_1.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_1.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_1.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_1.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_1.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_1.booking__paid_at__day AS booking__paid_at__day
- , subq_1.booking__paid_at__week AS booking__paid_at__week
- , subq_1.booking__paid_at__month AS booking__paid_at__month
- , subq_1.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_1.booking__paid_at__year AS booking__paid_at__year
- , subq_1.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_1.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_1.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_1.listing AS listing
- , subq_1.guest AS guest
- , subq_1.host AS host
- , subq_1.booking__listing AS booking__listing
- , subq_1.booking__guest AS booking__guest
- , subq_1.booking__host AS booking__host
- , subq_1.is_instant AS is_instant
- , subq_1.booking__is_instant AS booking__is_instant
- , subq_1.bookings AS bookings
- , subq_1.instant_bookings AS instant_bookings
- , subq_1.booking_value AS booking_value
- , subq_1.max_booking_value AS max_booking_value
- , subq_1.min_booking_value AS min_booking_value
- , subq_1.bookers AS bookers
- , subq_1.average_booking_value AS average_booking_value
- , subq_1.referred_bookings AS referred_bookings
- , subq_1.median_booking_value AS median_booking_value
- , subq_1.booking_value_p99 AS booking_value_p99
- , subq_1.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_1.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_1.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ DATE_TRUNC(subq_11.metric_time__day, year) AS metric_time__year
+ , subq_10.ds__day AS ds__day
+ , subq_10.ds__week AS ds__week
+ , subq_10.ds__month AS ds__month
+ , subq_10.ds__quarter AS ds__quarter
+ , subq_10.ds__year AS ds__year
+ , subq_10.ds__extract_year AS ds__extract_year
+ , subq_10.ds__extract_quarter AS ds__extract_quarter
+ , subq_10.ds__extract_month AS ds__extract_month
+ , subq_10.ds__extract_day AS ds__extract_day
+ , subq_10.ds__extract_dow AS ds__extract_dow
+ , subq_10.ds__extract_doy AS ds__extract_doy
+ , subq_10.ds_partitioned__day AS ds_partitioned__day
+ , subq_10.ds_partitioned__week AS ds_partitioned__week
+ , subq_10.ds_partitioned__month AS ds_partitioned__month
+ , subq_10.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_10.ds_partitioned__year AS ds_partitioned__year
+ , subq_10.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_10.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_10.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_10.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_10.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_10.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_10.paid_at__day AS paid_at__day
+ , subq_10.paid_at__week AS paid_at__week
+ , subq_10.paid_at__month AS paid_at__month
+ , subq_10.paid_at__quarter AS paid_at__quarter
+ , subq_10.paid_at__year AS paid_at__year
+ , subq_10.paid_at__extract_year AS paid_at__extract_year
+ , subq_10.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_10.paid_at__extract_month AS paid_at__extract_month
+ , subq_10.paid_at__extract_day AS paid_at__extract_day
+ , subq_10.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_10.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_10.booking__ds__day AS booking__ds__day
+ , subq_10.booking__ds__week AS booking__ds__week
+ , subq_10.booking__ds__month AS booking__ds__month
+ , subq_10.booking__ds__quarter AS booking__ds__quarter
+ , subq_10.booking__ds__year AS booking__ds__year
+ , subq_10.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_10.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_10.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_10.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_10.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_10.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_10.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_10.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_10.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_10.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_10.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_10.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_10.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_10.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_10.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_10.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_10.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_10.booking__paid_at__day AS booking__paid_at__day
+ , subq_10.booking__paid_at__week AS booking__paid_at__week
+ , subq_10.booking__paid_at__month AS booking__paid_at__month
+ , subq_10.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_10.booking__paid_at__year AS booking__paid_at__year
+ , subq_10.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_10.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_10.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_10.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_10.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_10.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_10.listing AS listing
+ , subq_10.guest AS guest
+ , subq_10.host AS host
+ , subq_10.booking__listing AS booking__listing
+ , subq_10.booking__guest AS booking__guest
+ , subq_10.booking__host AS booking__host
+ , subq_10.is_instant AS is_instant
+ , subq_10.booking__is_instant AS booking__is_instant
+ , subq_10.bookings AS bookings
+ , subq_10.instant_bookings AS instant_bookings
+ , subq_10.booking_value AS booking_value
+ , subq_10.max_booking_value AS max_booking_value
+ , subq_10.min_booking_value AS min_booking_value
+ , subq_10.bookers AS bookers
+ , subq_10.average_booking_value AS average_booking_value
+ , subq_10.referred_bookings AS referred_bookings
+ , subq_10.median_booking_value AS median_booking_value
+ , subq_10.booking_value_p99 AS booking_value_p99
+ , subq_10.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_10.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_10.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_3.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_3
- ) subq_2
+ subq_12.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_12
+ ) subq_11
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS booking__paid_at__extract_dow
+ , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
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
- ) subq_4
- ) subq_5
+ DATE_TRUNC(subq_11.metric_time__day, month) = subq_10.metric_time__day
+ WHERE DATE_TRUNC(subq_11.metric_time__day, year) = subq_11.metric_time__day
+ ) subq_13
+ ) subq_14
GROUP BY
metric_time__year
- ) subq_6
- ) subq_7
+ ) subq_15
+ ) subq_16
FULL OUTER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_14.metric_time__year
- , subq_14.bookings AS bookings_1_month_ago
+ subq_23.metric_time__year
+ , subq_23.bookings AS bookings_1_month_ago
FROM (
-- Aggregate Measures
SELECT
- subq_13.metric_time__year
- , SUM(subq_13.bookings) AS bookings
+ subq_22.metric_time__year
+ , SUM(subq_22.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__year']
SELECT
- subq_12.metric_time__year
- , subq_12.bookings
+ subq_21.metric_time__year
+ , subq_21.bookings
FROM (
-- Join to Time Spine Dataset
SELECT
- DATE_TRUNC(subq_10.metric_time__day, year) AS metric_time__year
- , subq_9.ds__day AS ds__day
- , subq_9.ds__week AS ds__week
- , subq_9.ds__month AS ds__month
- , subq_9.ds__quarter AS ds__quarter
- , subq_9.ds__year AS ds__year
- , subq_9.ds__extract_year AS ds__extract_year
- , subq_9.ds__extract_quarter AS ds__extract_quarter
- , subq_9.ds__extract_month AS ds__extract_month
- , subq_9.ds__extract_day AS ds__extract_day
- , subq_9.ds__extract_dow AS ds__extract_dow
- , subq_9.ds__extract_doy AS ds__extract_doy
- , subq_9.ds_partitioned__day AS ds_partitioned__day
- , subq_9.ds_partitioned__week AS ds_partitioned__week
- , subq_9.ds_partitioned__month AS ds_partitioned__month
- , subq_9.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_9.ds_partitioned__year AS ds_partitioned__year
- , subq_9.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_9.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_9.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_9.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_9.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_9.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_9.paid_at__day AS paid_at__day
- , subq_9.paid_at__week AS paid_at__week
- , subq_9.paid_at__month AS paid_at__month
- , subq_9.paid_at__quarter AS paid_at__quarter
- , subq_9.paid_at__year AS paid_at__year
- , subq_9.paid_at__extract_year AS paid_at__extract_year
- , subq_9.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_9.paid_at__extract_month AS paid_at__extract_month
- , subq_9.paid_at__extract_day AS paid_at__extract_day
- , subq_9.paid_at__extract_dow AS paid_at__extract_dow
- , subq_9.paid_at__extract_doy AS paid_at__extract_doy
- , subq_9.booking__ds__day AS booking__ds__day
- , subq_9.booking__ds__week AS booking__ds__week
- , subq_9.booking__ds__month AS booking__ds__month
- , subq_9.booking__ds__quarter AS booking__ds__quarter
- , subq_9.booking__ds__year AS booking__ds__year
- , subq_9.booking__ds__extract_year AS booking__ds__extract_year
- , subq_9.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_9.booking__ds__extract_month AS booking__ds__extract_month
- , subq_9.booking__ds__extract_day AS booking__ds__extract_day
- , subq_9.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_9.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_9.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_9.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_9.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_9.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_9.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_9.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_9.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_9.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_9.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_9.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_9.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_9.booking__paid_at__day AS booking__paid_at__day
- , subq_9.booking__paid_at__week AS booking__paid_at__week
- , subq_9.booking__paid_at__month AS booking__paid_at__month
- , subq_9.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_9.booking__paid_at__year AS booking__paid_at__year
- , subq_9.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_9.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_9.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_9.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_9.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_9.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_9.listing AS listing
- , subq_9.guest AS guest
- , subq_9.host AS host
- , subq_9.booking__listing AS booking__listing
- , subq_9.booking__guest AS booking__guest
- , subq_9.booking__host AS booking__host
- , subq_9.is_instant AS is_instant
- , subq_9.booking__is_instant AS booking__is_instant
- , subq_9.bookings AS bookings
- , subq_9.instant_bookings AS instant_bookings
- , subq_9.booking_value AS booking_value
- , subq_9.max_booking_value AS max_booking_value
- , subq_9.min_booking_value AS min_booking_value
- , subq_9.bookers AS bookers
- , subq_9.average_booking_value AS average_booking_value
- , subq_9.referred_bookings AS referred_bookings
- , subq_9.median_booking_value AS median_booking_value
- , subq_9.booking_value_p99 AS booking_value_p99
- , subq_9.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_9.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_9.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ DATE_TRUNC(subq_19.metric_time__day, year) AS metric_time__year
+ , subq_18.ds__day AS ds__day
+ , subq_18.ds__week AS ds__week
+ , subq_18.ds__month AS ds__month
+ , subq_18.ds__quarter AS ds__quarter
+ , subq_18.ds__year AS ds__year
+ , subq_18.ds__extract_year AS ds__extract_year
+ , subq_18.ds__extract_quarter AS ds__extract_quarter
+ , subq_18.ds__extract_month AS ds__extract_month
+ , subq_18.ds__extract_day AS ds__extract_day
+ , subq_18.ds__extract_dow AS ds__extract_dow
+ , subq_18.ds__extract_doy AS ds__extract_doy
+ , subq_18.ds_partitioned__day AS ds_partitioned__day
+ , subq_18.ds_partitioned__week AS ds_partitioned__week
+ , subq_18.ds_partitioned__month AS ds_partitioned__month
+ , subq_18.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_18.ds_partitioned__year AS ds_partitioned__year
+ , subq_18.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_18.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_18.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_18.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_18.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_18.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_18.paid_at__day AS paid_at__day
+ , subq_18.paid_at__week AS paid_at__week
+ , subq_18.paid_at__month AS paid_at__month
+ , subq_18.paid_at__quarter AS paid_at__quarter
+ , subq_18.paid_at__year AS paid_at__year
+ , subq_18.paid_at__extract_year AS paid_at__extract_year
+ , subq_18.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_18.paid_at__extract_month AS paid_at__extract_month
+ , subq_18.paid_at__extract_day AS paid_at__extract_day
+ , subq_18.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_18.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_18.booking__ds__day AS booking__ds__day
+ , subq_18.booking__ds__week AS booking__ds__week
+ , subq_18.booking__ds__month AS booking__ds__month
+ , subq_18.booking__ds__quarter AS booking__ds__quarter
+ , subq_18.booking__ds__year AS booking__ds__year
+ , subq_18.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_18.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_18.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_18.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_18.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_18.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_18.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_18.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_18.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_18.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_18.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_18.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_18.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_18.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_18.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_18.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_18.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_18.booking__paid_at__day AS booking__paid_at__day
+ , subq_18.booking__paid_at__week AS booking__paid_at__week
+ , subq_18.booking__paid_at__month AS booking__paid_at__month
+ , subq_18.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_18.booking__paid_at__year AS booking__paid_at__year
+ , subq_18.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_18.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_18.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_18.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_18.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_18.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_18.listing AS listing
+ , subq_18.guest AS guest
+ , subq_18.host AS host
+ , subq_18.booking__listing AS booking__listing
+ , subq_18.booking__guest AS booking__guest
+ , subq_18.booking__host AS booking__host
+ , subq_18.is_instant AS is_instant
+ , subq_18.booking__is_instant AS booking__is_instant
+ , subq_18.bookings AS bookings
+ , subq_18.instant_bookings AS instant_bookings
+ , subq_18.booking_value AS booking_value
+ , subq_18.max_booking_value AS max_booking_value
+ , subq_18.min_booking_value AS min_booking_value
+ , subq_18.bookers AS bookers
+ , subq_18.average_booking_value AS average_booking_value
+ , subq_18.referred_bookings AS referred_bookings
+ , subq_18.median_booking_value AS median_booking_value
+ , subq_18.booking_value_p99 AS booking_value_p99
+ , subq_18.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_18.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_18.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_11.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_11
- ) subq_10
+ subq_20.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_20
+ ) subq_19
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_8.ds__day
- , subq_8.ds__week
- , subq_8.ds__month
- , subq_8.ds__quarter
- , subq_8.ds__year
- , subq_8.ds__extract_year
- , subq_8.ds__extract_quarter
- , subq_8.ds__extract_month
- , subq_8.ds__extract_day
- , subq_8.ds__extract_dow
- , subq_8.ds__extract_doy
- , subq_8.ds_partitioned__day
- , subq_8.ds_partitioned__week
- , subq_8.ds_partitioned__month
- , subq_8.ds_partitioned__quarter
- , subq_8.ds_partitioned__year
- , subq_8.ds_partitioned__extract_year
- , subq_8.ds_partitioned__extract_quarter
- , subq_8.ds_partitioned__extract_month
- , subq_8.ds_partitioned__extract_day
- , subq_8.ds_partitioned__extract_dow
- , subq_8.ds_partitioned__extract_doy
- , subq_8.paid_at__day
- , subq_8.paid_at__week
- , subq_8.paid_at__month
- , subq_8.paid_at__quarter
- , subq_8.paid_at__year
- , subq_8.paid_at__extract_year
- , subq_8.paid_at__extract_quarter
- , subq_8.paid_at__extract_month
- , subq_8.paid_at__extract_day
- , subq_8.paid_at__extract_dow
- , subq_8.paid_at__extract_doy
- , subq_8.booking__ds__day
- , subq_8.booking__ds__week
- , subq_8.booking__ds__month
- , subq_8.booking__ds__quarter
- , subq_8.booking__ds__year
- , subq_8.booking__ds__extract_year
- , subq_8.booking__ds__extract_quarter
- , subq_8.booking__ds__extract_month
- , subq_8.booking__ds__extract_day
- , subq_8.booking__ds__extract_dow
- , subq_8.booking__ds__extract_doy
- , subq_8.booking__ds_partitioned__day
- , subq_8.booking__ds_partitioned__week
- , subq_8.booking__ds_partitioned__month
- , subq_8.booking__ds_partitioned__quarter
- , subq_8.booking__ds_partitioned__year
- , subq_8.booking__ds_partitioned__extract_year
- , subq_8.booking__ds_partitioned__extract_quarter
- , subq_8.booking__ds_partitioned__extract_month
- , subq_8.booking__ds_partitioned__extract_day
- , subq_8.booking__ds_partitioned__extract_dow
- , subq_8.booking__ds_partitioned__extract_doy
- , subq_8.booking__paid_at__day
- , subq_8.booking__paid_at__week
- , subq_8.booking__paid_at__month
- , subq_8.booking__paid_at__quarter
- , subq_8.booking__paid_at__year
- , subq_8.booking__paid_at__extract_year
- , subq_8.booking__paid_at__extract_quarter
- , subq_8.booking__paid_at__extract_month
- , subq_8.booking__paid_at__extract_day
- , subq_8.booking__paid_at__extract_dow
- , subq_8.booking__paid_at__extract_doy
- , subq_8.ds__day AS metric_time__day
- , subq_8.ds__week AS metric_time__week
- , subq_8.ds__month AS metric_time__month
- , subq_8.ds__quarter AS metric_time__quarter
- , subq_8.ds__year AS metric_time__year
- , subq_8.ds__extract_year AS metric_time__extract_year
- , subq_8.ds__extract_quarter AS metric_time__extract_quarter
- , subq_8.ds__extract_month AS metric_time__extract_month
- , subq_8.ds__extract_day AS metric_time__extract_day
- , subq_8.ds__extract_dow AS metric_time__extract_dow
- , subq_8.ds__extract_doy AS metric_time__extract_doy
- , subq_8.listing
- , subq_8.guest
- , subq_8.host
- , subq_8.booking__listing
- , subq_8.booking__guest
- , subq_8.booking__host
- , subq_8.is_instant
- , subq_8.booking__is_instant
- , subq_8.bookings
- , subq_8.instant_bookings
- , subq_8.booking_value
- , subq_8.max_booking_value
- , subq_8.min_booking_value
- , subq_8.bookers
- , subq_8.average_booking_value
- , subq_8.referred_bookings
- , subq_8.median_booking_value
- , subq_8.booking_value_p99
- , subq_8.discrete_booking_value_p99
- , subq_8.approximate_continuous_booking_value_p99
- , subq_8.approximate_discrete_booking_value_p99
+ subq_17.ds__day
+ , subq_17.ds__week
+ , subq_17.ds__month
+ , subq_17.ds__quarter
+ , subq_17.ds__year
+ , subq_17.ds__extract_year
+ , subq_17.ds__extract_quarter
+ , subq_17.ds__extract_month
+ , subq_17.ds__extract_day
+ , subq_17.ds__extract_dow
+ , subq_17.ds__extract_doy
+ , subq_17.ds_partitioned__day
+ , subq_17.ds_partitioned__week
+ , subq_17.ds_partitioned__month
+ , subq_17.ds_partitioned__quarter
+ , subq_17.ds_partitioned__year
+ , subq_17.ds_partitioned__extract_year
+ , subq_17.ds_partitioned__extract_quarter
+ , subq_17.ds_partitioned__extract_month
+ , subq_17.ds_partitioned__extract_day
+ , subq_17.ds_partitioned__extract_dow
+ , subq_17.ds_partitioned__extract_doy
+ , subq_17.paid_at__day
+ , subq_17.paid_at__week
+ , subq_17.paid_at__month
+ , subq_17.paid_at__quarter
+ , subq_17.paid_at__year
+ , subq_17.paid_at__extract_year
+ , subq_17.paid_at__extract_quarter
+ , subq_17.paid_at__extract_month
+ , subq_17.paid_at__extract_day
+ , subq_17.paid_at__extract_dow
+ , subq_17.paid_at__extract_doy
+ , subq_17.booking__ds__day
+ , subq_17.booking__ds__week
+ , subq_17.booking__ds__month
+ , subq_17.booking__ds__quarter
+ , subq_17.booking__ds__year
+ , subq_17.booking__ds__extract_year
+ , subq_17.booking__ds__extract_quarter
+ , subq_17.booking__ds__extract_month
+ , subq_17.booking__ds__extract_day
+ , subq_17.booking__ds__extract_dow
+ , subq_17.booking__ds__extract_doy
+ , subq_17.booking__ds_partitioned__day
+ , subq_17.booking__ds_partitioned__week
+ , subq_17.booking__ds_partitioned__month
+ , subq_17.booking__ds_partitioned__quarter
+ , subq_17.booking__ds_partitioned__year
+ , subq_17.booking__ds_partitioned__extract_year
+ , subq_17.booking__ds_partitioned__extract_quarter
+ , subq_17.booking__ds_partitioned__extract_month
+ , subq_17.booking__ds_partitioned__extract_day
+ , subq_17.booking__ds_partitioned__extract_dow
+ , subq_17.booking__ds_partitioned__extract_doy
+ , subq_17.booking__paid_at__day
+ , subq_17.booking__paid_at__week
+ , subq_17.booking__paid_at__month
+ , subq_17.booking__paid_at__quarter
+ , subq_17.booking__paid_at__year
+ , subq_17.booking__paid_at__extract_year
+ , subq_17.booking__paid_at__extract_quarter
+ , subq_17.booking__paid_at__extract_month
+ , subq_17.booking__paid_at__extract_day
+ , subq_17.booking__paid_at__extract_dow
+ , subq_17.booking__paid_at__extract_doy
+ , subq_17.ds__day AS metric_time__day
+ , subq_17.ds__week AS metric_time__week
+ , subq_17.ds__month AS metric_time__month
+ , subq_17.ds__quarter AS metric_time__quarter
+ , subq_17.ds__year AS metric_time__year
+ , subq_17.ds__extract_year AS metric_time__extract_year
+ , subq_17.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_17.ds__extract_month AS metric_time__extract_month
+ , subq_17.ds__extract_day AS metric_time__extract_day
+ , subq_17.ds__extract_dow AS metric_time__extract_dow
+ , subq_17.ds__extract_doy AS metric_time__extract_doy
+ , subq_17.listing
+ , subq_17.guest
+ , subq_17.host
+ , subq_17.booking__listing
+ , subq_17.booking__guest
+ , subq_17.booking__host
+ , subq_17.is_instant
+ , subq_17.booking__is_instant
+ , subq_17.bookings
+ , subq_17.instant_bookings
+ , subq_17.booking_value
+ , subq_17.max_booking_value
+ , subq_17.min_booking_value
+ , subq_17.bookers
+ , subq_17.average_booking_value
+ , subq_17.referred_bookings
+ , subq_17.median_booking_value
+ , subq_17.booking_value_p99
+ , subq_17.discrete_booking_value_p99
+ , subq_17.approximate_continuous_booking_value_p99
+ , subq_17.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_8
- ) subq_9
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS booking__paid_at__extract_dow
+ , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_17
+ ) subq_18
ON
- DATE_SUB(CAST(subq_10.metric_time__day AS DATETIME), INTERVAL 1 month) = subq_9.metric_time__day
- ) subq_12
- ) subq_13
+ DATE_SUB(CAST(subq_19.metric_time__day AS DATETIME), INTERVAL 1 month) = subq_18.metric_time__day
+ ) subq_21
+ ) subq_22
GROUP BY
metric_time__year
- ) subq_14
- ) subq_15
+ ) subq_23
+ ) subq_24
ON
- subq_7.metric_time__year = subq_15.metric_time__year
+ subq_16.metric_time__year = subq_24.metric_time__year
GROUP BY
metric_time__year
-) subq_16
+) subq_25
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0_optimized.sql
index 48eb4e3434..ef8c58c1ce 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0_optimized.sql
@@ -5,56 +5,56 @@ SELECT
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_24.metric_time__year, subq_32.metric_time__year) AS metric_time__year
- , MAX(subq_24.month_start_bookings) AS month_start_bookings
- , MAX(subq_32.bookings_1_month_ago) AS bookings_1_month_ago
+ COALESCE(subq_33.metric_time__year, subq_41.metric_time__year) AS metric_time__year
+ , MAX(subq_33.month_start_bookings) AS month_start_bookings
+ , MAX(subq_41.bookings_1_month_ago) AS bookings_1_month_ago
FROM (
-- Join to Time Spine Dataset
-- Pass Only Elements: ['bookings', 'metric_time__year']
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- DATE_TRUNC(subq_20.ds, year) AS metric_time__year
- , SUM(subq_18.bookings) AS month_start_bookings
- FROM ***************************.mf_time_spine subq_20
+ DATE_TRUNC(subq_29.ds, year) AS metric_time__year
+ , SUM(subq_27.bookings) AS month_start_bookings
+ FROM ***************************.mf_time_spine subq_29
INNER JOIN (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
SELECT
DATE_TRUNC(ds, day) AS metric_time__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_18
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_27
ON
- DATE_TRUNC(subq_20.ds, month) = subq_18.metric_time__day
- WHERE DATE_TRUNC(subq_20.ds, year) = subq_20.ds
+ DATE_TRUNC(subq_29.ds, month) = subq_27.metric_time__day
+ WHERE DATE_TRUNC(subq_29.ds, year) = subq_29.ds
GROUP BY
metric_time__year
- ) subq_24
+ ) subq_33
FULL OUTER JOIN (
-- Join to Time Spine Dataset
-- Pass Only Elements: ['bookings', 'metric_time__year']
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- DATE_TRUNC(subq_28.ds, year) AS metric_time__year
- , SUM(subq_26.bookings) AS bookings_1_month_ago
- FROM ***************************.mf_time_spine subq_28
+ DATE_TRUNC(subq_37.ds, year) AS metric_time__year
+ , SUM(subq_35.bookings) AS bookings_1_month_ago
+ FROM ***************************.mf_time_spine subq_37
INNER JOIN (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
SELECT
DATE_TRUNC(ds, day) AS metric_time__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_26
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_35
ON
- DATE_SUB(CAST(subq_28.ds AS DATETIME), INTERVAL 1 month) = subq_26.metric_time__day
+ DATE_SUB(CAST(subq_37.ds AS DATETIME), INTERVAL 1 month) = subq_35.metric_time__day
GROUP BY
metric_time__year
- ) subq_32
+ ) subq_41
ON
- subq_24.metric_time__year = subq_32.metric_time__year
+ subq_33.metric_time__year = subq_41.metric_time__year
GROUP BY
metric_time__year
-) subq_33
+) subq_42
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_time_filter__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_time_filter__plan0.sql
index c6c85ac0bc..11f3e3920c 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_time_filter__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_time_filter__plan0.sql
@@ -1,559 +1,559 @@
-- Compute Metrics via Expressions
SELECT
- subq_15.metric_time__day
+ subq_24.metric_time__day
, bookings - bookings_2_weeks_ago AS bookings_growth_2_weeks
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_5.metric_time__day, subq_14.metric_time__day) AS metric_time__day
- , MAX(subq_5.bookings) AS bookings
- , MAX(subq_14.bookings_2_weeks_ago) AS bookings_2_weeks_ago
+ COALESCE(subq_14.metric_time__day, subq_23.metric_time__day) AS metric_time__day
+ , MAX(subq_14.bookings) AS bookings
+ , MAX(subq_23.bookings_2_weeks_ago) AS bookings_2_weeks_ago
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_4.metric_time__day
- , subq_4.bookings
+ subq_13.metric_time__day
+ , subq_13.bookings
FROM (
-- Aggregate Measures
SELECT
- subq_3.metric_time__day
- , SUM(subq_3.bookings) AS bookings
+ subq_12.metric_time__day
+ , SUM(subq_12.bookings) AS bookings
FROM (
-- Constrain Output with WHERE
SELECT
- subq_2.metric_time__day
- , subq_2.bookings
+ subq_11.metric_time__day
+ , subq_11.bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__day']
SELECT
- subq_1.metric_time__day
- , subq_1.bookings
+ subq_10.metric_time__day
+ , subq_10.bookings
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
- ) subq_2
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS booking__paid_at__extract_dow
+ , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
WHERE metric_time__day = '2020-01-01' or metric_time__day = '2020-01-14'
- ) subq_3
+ ) subq_12
GROUP BY
metric_time__day
- ) subq_4
- ) subq_5
+ ) subq_13
+ ) subq_14
FULL OUTER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_13.metric_time__day
- , subq_13.bookings AS bookings_2_weeks_ago
+ subq_22.metric_time__day
+ , subq_22.bookings AS bookings_2_weeks_ago
FROM (
-- Aggregate Measures
SELECT
- subq_12.metric_time__day
- , SUM(subq_12.bookings) AS bookings
+ subq_21.metric_time__day
+ , SUM(subq_21.bookings) AS bookings
FROM (
-- Constrain Output with WHERE
SELECT
- subq_11.metric_time__day
- , subq_11.bookings
+ subq_20.metric_time__day
+ , subq_20.bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__day']
SELECT
- subq_10.metric_time__day
- , subq_10.bookings
+ subq_19.metric_time__day
+ , subq_19.bookings
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_8.metric_time__day AS metric_time__day
- , subq_7.ds__day AS ds__day
- , subq_7.ds__week AS ds__week
- , subq_7.ds__month AS ds__month
- , subq_7.ds__quarter AS ds__quarter
- , subq_7.ds__year AS ds__year
- , subq_7.ds__extract_year AS ds__extract_year
- , subq_7.ds__extract_quarter AS ds__extract_quarter
- , subq_7.ds__extract_month AS ds__extract_month
- , subq_7.ds__extract_day AS ds__extract_day
- , subq_7.ds__extract_dow AS ds__extract_dow
- , subq_7.ds__extract_doy AS ds__extract_doy
- , subq_7.ds_partitioned__day AS ds_partitioned__day
- , subq_7.ds_partitioned__week AS ds_partitioned__week
- , subq_7.ds_partitioned__month AS ds_partitioned__month
- , subq_7.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_7.ds_partitioned__year AS ds_partitioned__year
- , subq_7.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_7.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_7.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_7.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_7.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_7.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_7.paid_at__day AS paid_at__day
- , subq_7.paid_at__week AS paid_at__week
- , subq_7.paid_at__month AS paid_at__month
- , subq_7.paid_at__quarter AS paid_at__quarter
- , subq_7.paid_at__year AS paid_at__year
- , subq_7.paid_at__extract_year AS paid_at__extract_year
- , subq_7.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_7.paid_at__extract_month AS paid_at__extract_month
- , subq_7.paid_at__extract_day AS paid_at__extract_day
- , subq_7.paid_at__extract_dow AS paid_at__extract_dow
- , subq_7.paid_at__extract_doy AS paid_at__extract_doy
- , subq_7.booking__ds__day AS booking__ds__day
- , subq_7.booking__ds__week AS booking__ds__week
- , subq_7.booking__ds__month AS booking__ds__month
- , subq_7.booking__ds__quarter AS booking__ds__quarter
- , subq_7.booking__ds__year AS booking__ds__year
- , subq_7.booking__ds__extract_year AS booking__ds__extract_year
- , subq_7.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_7.booking__ds__extract_month AS booking__ds__extract_month
- , subq_7.booking__ds__extract_day AS booking__ds__extract_day
- , subq_7.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_7.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_7.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_7.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_7.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_7.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_7.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_7.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_7.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_7.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_7.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_7.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_7.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_7.booking__paid_at__day AS booking__paid_at__day
- , subq_7.booking__paid_at__week AS booking__paid_at__week
- , subq_7.booking__paid_at__month AS booking__paid_at__month
- , subq_7.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_7.booking__paid_at__year AS booking__paid_at__year
- , subq_7.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_7.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_7.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_7.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_7.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_7.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_7.listing AS listing
- , subq_7.guest AS guest
- , subq_7.host AS host
- , subq_7.booking__listing AS booking__listing
- , subq_7.booking__guest AS booking__guest
- , subq_7.booking__host AS booking__host
- , subq_7.is_instant AS is_instant
- , subq_7.booking__is_instant AS booking__is_instant
- , subq_7.bookings AS bookings
- , subq_7.instant_bookings AS instant_bookings
- , subq_7.booking_value AS booking_value
- , subq_7.max_booking_value AS max_booking_value
- , subq_7.min_booking_value AS min_booking_value
- , subq_7.bookers AS bookers
- , subq_7.average_booking_value AS average_booking_value
- , subq_7.referred_bookings AS referred_bookings
- , subq_7.median_booking_value AS median_booking_value
- , subq_7.booking_value_p99 AS booking_value_p99
- , subq_7.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_7.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_7.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ subq_17.metric_time__day AS metric_time__day
+ , subq_16.ds__day AS ds__day
+ , subq_16.ds__week AS ds__week
+ , subq_16.ds__month AS ds__month
+ , subq_16.ds__quarter AS ds__quarter
+ , subq_16.ds__year AS ds__year
+ , subq_16.ds__extract_year AS ds__extract_year
+ , subq_16.ds__extract_quarter AS ds__extract_quarter
+ , subq_16.ds__extract_month AS ds__extract_month
+ , subq_16.ds__extract_day AS ds__extract_day
+ , subq_16.ds__extract_dow AS ds__extract_dow
+ , subq_16.ds__extract_doy AS ds__extract_doy
+ , subq_16.ds_partitioned__day AS ds_partitioned__day
+ , subq_16.ds_partitioned__week AS ds_partitioned__week
+ , subq_16.ds_partitioned__month AS ds_partitioned__month
+ , subq_16.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_16.ds_partitioned__year AS ds_partitioned__year
+ , subq_16.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_16.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_16.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_16.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_16.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_16.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_16.paid_at__day AS paid_at__day
+ , subq_16.paid_at__week AS paid_at__week
+ , subq_16.paid_at__month AS paid_at__month
+ , subq_16.paid_at__quarter AS paid_at__quarter
+ , subq_16.paid_at__year AS paid_at__year
+ , subq_16.paid_at__extract_year AS paid_at__extract_year
+ , subq_16.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_16.paid_at__extract_month AS paid_at__extract_month
+ , subq_16.paid_at__extract_day AS paid_at__extract_day
+ , subq_16.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_16.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_16.booking__ds__day AS booking__ds__day
+ , subq_16.booking__ds__week AS booking__ds__week
+ , subq_16.booking__ds__month AS booking__ds__month
+ , subq_16.booking__ds__quarter AS booking__ds__quarter
+ , subq_16.booking__ds__year AS booking__ds__year
+ , subq_16.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_16.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_16.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_16.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_16.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_16.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_16.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_16.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_16.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_16.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_16.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_16.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_16.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_16.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_16.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_16.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_16.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_16.booking__paid_at__day AS booking__paid_at__day
+ , subq_16.booking__paid_at__week AS booking__paid_at__week
+ , subq_16.booking__paid_at__month AS booking__paid_at__month
+ , subq_16.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_16.booking__paid_at__year AS booking__paid_at__year
+ , subq_16.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_16.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_16.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_16.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_16.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_16.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_16.listing AS listing
+ , subq_16.guest AS guest
+ , subq_16.host AS host
+ , subq_16.booking__listing AS booking__listing
+ , subq_16.booking__guest AS booking__guest
+ , subq_16.booking__host AS booking__host
+ , subq_16.is_instant AS is_instant
+ , subq_16.booking__is_instant AS booking__is_instant
+ , subq_16.bookings AS bookings
+ , subq_16.instant_bookings AS instant_bookings
+ , subq_16.booking_value AS booking_value
+ , subq_16.max_booking_value AS max_booking_value
+ , subq_16.min_booking_value AS min_booking_value
+ , subq_16.bookers AS bookers
+ , subq_16.average_booking_value AS average_booking_value
+ , subq_16.referred_bookings AS referred_bookings
+ , subq_16.median_booking_value AS median_booking_value
+ , subq_16.booking_value_p99 AS booking_value_p99
+ , subq_16.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_16.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_16.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_9.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_9
- ) subq_8
+ subq_18.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_18
+ ) subq_17
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_6.ds__day
- , subq_6.ds__week
- , subq_6.ds__month
- , subq_6.ds__quarter
- , subq_6.ds__year
- , subq_6.ds__extract_year
- , subq_6.ds__extract_quarter
- , subq_6.ds__extract_month
- , subq_6.ds__extract_day
- , subq_6.ds__extract_dow
- , subq_6.ds__extract_doy
- , subq_6.ds_partitioned__day
- , subq_6.ds_partitioned__week
- , subq_6.ds_partitioned__month
- , subq_6.ds_partitioned__quarter
- , subq_6.ds_partitioned__year
- , subq_6.ds_partitioned__extract_year
- , subq_6.ds_partitioned__extract_quarter
- , subq_6.ds_partitioned__extract_month
- , subq_6.ds_partitioned__extract_day
- , subq_6.ds_partitioned__extract_dow
- , subq_6.ds_partitioned__extract_doy
- , subq_6.paid_at__day
- , subq_6.paid_at__week
- , subq_6.paid_at__month
- , subq_6.paid_at__quarter
- , subq_6.paid_at__year
- , subq_6.paid_at__extract_year
- , subq_6.paid_at__extract_quarter
- , subq_6.paid_at__extract_month
- , subq_6.paid_at__extract_day
- , subq_6.paid_at__extract_dow
- , subq_6.paid_at__extract_doy
- , subq_6.booking__ds__day
- , subq_6.booking__ds__week
- , subq_6.booking__ds__month
- , subq_6.booking__ds__quarter
- , subq_6.booking__ds__year
- , subq_6.booking__ds__extract_year
- , subq_6.booking__ds__extract_quarter
- , subq_6.booking__ds__extract_month
- , subq_6.booking__ds__extract_day
- , subq_6.booking__ds__extract_dow
- , subq_6.booking__ds__extract_doy
- , subq_6.booking__ds_partitioned__day
- , subq_6.booking__ds_partitioned__week
- , subq_6.booking__ds_partitioned__month
- , subq_6.booking__ds_partitioned__quarter
- , subq_6.booking__ds_partitioned__year
- , subq_6.booking__ds_partitioned__extract_year
- , subq_6.booking__ds_partitioned__extract_quarter
- , subq_6.booking__ds_partitioned__extract_month
- , subq_6.booking__ds_partitioned__extract_day
- , subq_6.booking__ds_partitioned__extract_dow
- , subq_6.booking__ds_partitioned__extract_doy
- , subq_6.booking__paid_at__day
- , subq_6.booking__paid_at__week
- , subq_6.booking__paid_at__month
- , subq_6.booking__paid_at__quarter
- , subq_6.booking__paid_at__year
- , subq_6.booking__paid_at__extract_year
- , subq_6.booking__paid_at__extract_quarter
- , subq_6.booking__paid_at__extract_month
- , subq_6.booking__paid_at__extract_day
- , subq_6.booking__paid_at__extract_dow
- , subq_6.booking__paid_at__extract_doy
- , subq_6.ds__day AS metric_time__day
- , subq_6.ds__week AS metric_time__week
- , subq_6.ds__month AS metric_time__month
- , subq_6.ds__quarter AS metric_time__quarter
- , subq_6.ds__year AS metric_time__year
- , subq_6.ds__extract_year AS metric_time__extract_year
- , subq_6.ds__extract_quarter AS metric_time__extract_quarter
- , subq_6.ds__extract_month AS metric_time__extract_month
- , subq_6.ds__extract_day AS metric_time__extract_day
- , subq_6.ds__extract_dow AS metric_time__extract_dow
- , subq_6.ds__extract_doy AS metric_time__extract_doy
- , subq_6.listing
- , subq_6.guest
- , subq_6.host
- , subq_6.booking__listing
- , subq_6.booking__guest
- , subq_6.booking__host
- , subq_6.is_instant
- , subq_6.booking__is_instant
- , subq_6.bookings
- , subq_6.instant_bookings
- , subq_6.booking_value
- , subq_6.max_booking_value
- , subq_6.min_booking_value
- , subq_6.bookers
- , subq_6.average_booking_value
- , subq_6.referred_bookings
- , subq_6.median_booking_value
- , subq_6.booking_value_p99
- , subq_6.discrete_booking_value_p99
- , subq_6.approximate_continuous_booking_value_p99
- , subq_6.approximate_discrete_booking_value_p99
+ subq_15.ds__day
+ , subq_15.ds__week
+ , subq_15.ds__month
+ , subq_15.ds__quarter
+ , subq_15.ds__year
+ , subq_15.ds__extract_year
+ , subq_15.ds__extract_quarter
+ , subq_15.ds__extract_month
+ , subq_15.ds__extract_day
+ , subq_15.ds__extract_dow
+ , subq_15.ds__extract_doy
+ , subq_15.ds_partitioned__day
+ , subq_15.ds_partitioned__week
+ , subq_15.ds_partitioned__month
+ , subq_15.ds_partitioned__quarter
+ , subq_15.ds_partitioned__year
+ , subq_15.ds_partitioned__extract_year
+ , subq_15.ds_partitioned__extract_quarter
+ , subq_15.ds_partitioned__extract_month
+ , subq_15.ds_partitioned__extract_day
+ , subq_15.ds_partitioned__extract_dow
+ , subq_15.ds_partitioned__extract_doy
+ , subq_15.paid_at__day
+ , subq_15.paid_at__week
+ , subq_15.paid_at__month
+ , subq_15.paid_at__quarter
+ , subq_15.paid_at__year
+ , subq_15.paid_at__extract_year
+ , subq_15.paid_at__extract_quarter
+ , subq_15.paid_at__extract_month
+ , subq_15.paid_at__extract_day
+ , subq_15.paid_at__extract_dow
+ , subq_15.paid_at__extract_doy
+ , subq_15.booking__ds__day
+ , subq_15.booking__ds__week
+ , subq_15.booking__ds__month
+ , subq_15.booking__ds__quarter
+ , subq_15.booking__ds__year
+ , subq_15.booking__ds__extract_year
+ , subq_15.booking__ds__extract_quarter
+ , subq_15.booking__ds__extract_month
+ , subq_15.booking__ds__extract_day
+ , subq_15.booking__ds__extract_dow
+ , subq_15.booking__ds__extract_doy
+ , subq_15.booking__ds_partitioned__day
+ , subq_15.booking__ds_partitioned__week
+ , subq_15.booking__ds_partitioned__month
+ , subq_15.booking__ds_partitioned__quarter
+ , subq_15.booking__ds_partitioned__year
+ , subq_15.booking__ds_partitioned__extract_year
+ , subq_15.booking__ds_partitioned__extract_quarter
+ , subq_15.booking__ds_partitioned__extract_month
+ , subq_15.booking__ds_partitioned__extract_day
+ , subq_15.booking__ds_partitioned__extract_dow
+ , subq_15.booking__ds_partitioned__extract_doy
+ , subq_15.booking__paid_at__day
+ , subq_15.booking__paid_at__week
+ , subq_15.booking__paid_at__month
+ , subq_15.booking__paid_at__quarter
+ , subq_15.booking__paid_at__year
+ , subq_15.booking__paid_at__extract_year
+ , subq_15.booking__paid_at__extract_quarter
+ , subq_15.booking__paid_at__extract_month
+ , subq_15.booking__paid_at__extract_day
+ , subq_15.booking__paid_at__extract_dow
+ , subq_15.booking__paid_at__extract_doy
+ , subq_15.ds__day AS metric_time__day
+ , subq_15.ds__week AS metric_time__week
+ , subq_15.ds__month AS metric_time__month
+ , subq_15.ds__quarter AS metric_time__quarter
+ , subq_15.ds__year AS metric_time__year
+ , subq_15.ds__extract_year AS metric_time__extract_year
+ , subq_15.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_15.ds__extract_month AS metric_time__extract_month
+ , subq_15.ds__extract_day AS metric_time__extract_day
+ , subq_15.ds__extract_dow AS metric_time__extract_dow
+ , subq_15.ds__extract_doy AS metric_time__extract_doy
+ , subq_15.listing
+ , subq_15.guest
+ , subq_15.host
+ , subq_15.booking__listing
+ , subq_15.booking__guest
+ , subq_15.booking__host
+ , subq_15.is_instant
+ , subq_15.booking__is_instant
+ , subq_15.bookings
+ , subq_15.instant_bookings
+ , subq_15.booking_value
+ , subq_15.max_booking_value
+ , subq_15.min_booking_value
+ , subq_15.bookers
+ , subq_15.average_booking_value
+ , subq_15.referred_bookings
+ , subq_15.median_booking_value
+ , subq_15.booking_value_p99
+ , subq_15.discrete_booking_value_p99
+ , subq_15.approximate_continuous_booking_value_p99
+ , subq_15.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_6
- ) subq_7
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS booking__paid_at__extract_dow
+ , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_15
+ ) subq_16
ON
- DATE_SUB(CAST(subq_8.metric_time__day AS DATETIME), INTERVAL 14 day) = subq_7.metric_time__day
- ) subq_10
- ) subq_11
+ DATE_SUB(CAST(subq_17.metric_time__day AS DATETIME), INTERVAL 14 day) = subq_16.metric_time__day
+ ) subq_19
+ ) subq_20
WHERE metric_time__day = '2020-01-01' or metric_time__day = '2020-01-14'
- ) subq_12
+ ) subq_21
GROUP BY
metric_time__day
- ) subq_13
- ) subq_14
+ ) subq_22
+ ) subq_23
ON
- subq_5.metric_time__day = subq_14.metric_time__day
+ subq_14.metric_time__day = subq_23.metric_time__day
GROUP BY
metric_time__day
-) subq_15
+) subq_24
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_time_filter__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_time_filter__plan0_optimized.sql
index 7c07e7377c..8a2613d507 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_time_filter__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_metric_with_offset_window_and_time_filter__plan0_optimized.sql
@@ -5,9 +5,9 @@ SELECT
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_21.metric_time__day, subq_30.metric_time__day) AS metric_time__day
- , MAX(subq_21.bookings) AS bookings
- , MAX(subq_30.bookings_2_weeks_ago) AS bookings_2_weeks_ago
+ COALESCE(subq_30.metric_time__day, subq_39.metric_time__day) AS metric_time__day
+ , MAX(subq_30.bookings) AS bookings
+ , MAX(subq_39.bookings_2_weeks_ago) AS bookings_2_weeks_ago
FROM (
-- Constrain Output with WHERE
-- Aggregate Measures
@@ -22,12 +22,12 @@ FROM (
SELECT
DATE_TRUNC(ds, day) AS metric_time__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_18
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_27
WHERE metric_time__day = '2020-01-01' or metric_time__day = '2020-01-14'
GROUP BY
metric_time__day
- ) subq_21
+ ) subq_30
FULL OUTER JOIN (
-- Constrain Output with WHERE
-- Aggregate Measures
@@ -39,26 +39,26 @@ FROM (
-- Join to Time Spine Dataset
-- Pass Only Elements: ['bookings', 'metric_time__day']
SELECT
- subq_25.ds AS metric_time__day
- , subq_23.bookings AS bookings
- FROM ***************************.mf_time_spine subq_25
+ subq_34.ds AS metric_time__day
+ , subq_32.bookings AS bookings
+ FROM ***************************.mf_time_spine subq_34
INNER JOIN (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
SELECT
DATE_TRUNC(ds, day) AS metric_time__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_23
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_32
ON
- DATE_SUB(CAST(subq_25.ds AS DATETIME), INTERVAL 14 day) = subq_23.metric_time__day
- ) subq_27
+ DATE_SUB(CAST(subq_34.ds AS DATETIME), INTERVAL 14 day) = subq_32.metric_time__day
+ ) subq_36
WHERE metric_time__day = '2020-01-01' or metric_time__day = '2020-01-14'
GROUP BY
metric_time__day
- ) subq_30
+ ) subq_39
ON
- subq_21.metric_time__day = subq_30.metric_time__day
+ subq_30.metric_time__day = subq_39.metric_time__day
GROUP BY
metric_time__day
-) subq_31
+) subq_40
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_offset_cumulative_metric__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_offset_cumulative_metric__plan0.sql
index fa913a0870..9a924ca747 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_offset_cumulative_metric__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_offset_cumulative_metric__plan0.sql
@@ -1,433 +1,433 @@
-- Compute Metrics via Expressions
SELECT
- subq_10.metric_time__day
+ subq_19.metric_time__day
, every_2_days_bookers_2_days_ago AS every_2_days_bookers_2_days_ago
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_9.metric_time__day
- , subq_9.bookers AS every_2_days_bookers_2_days_ago
+ subq_18.metric_time__day
+ , subq_18.bookers AS every_2_days_bookers_2_days_ago
FROM (
-- Aggregate Measures
SELECT
- subq_8.metric_time__day
- , COUNT(DISTINCT subq_8.bookers) AS bookers
+ subq_17.metric_time__day
+ , COUNT(DISTINCT subq_17.bookers) AS bookers
FROM (
-- Pass Only Elements: ['bookers', 'metric_time__day']
SELECT
- subq_7.metric_time__day
- , subq_7.bookers
+ subq_16.metric_time__day
+ , subq_16.bookers
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_5.metric_time__day AS metric_time__day
- , subq_4.ds__day AS ds__day
- , subq_4.ds__week AS ds__week
- , subq_4.ds__month AS ds__month
- , subq_4.ds__quarter AS ds__quarter
- , subq_4.ds__year AS ds__year
- , subq_4.ds__extract_year AS ds__extract_year
- , subq_4.ds__extract_quarter AS ds__extract_quarter
- , subq_4.ds__extract_month AS ds__extract_month
- , subq_4.ds__extract_day AS ds__extract_day
- , subq_4.ds__extract_dow AS ds__extract_dow
- , subq_4.ds__extract_doy AS ds__extract_doy
- , subq_4.ds_partitioned__day AS ds_partitioned__day
- , subq_4.ds_partitioned__week AS ds_partitioned__week
- , subq_4.ds_partitioned__month AS ds_partitioned__month
- , subq_4.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_4.ds_partitioned__year AS ds_partitioned__year
- , subq_4.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_4.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_4.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_4.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_4.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_4.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_4.paid_at__day AS paid_at__day
- , subq_4.paid_at__week AS paid_at__week
- , subq_4.paid_at__month AS paid_at__month
- , subq_4.paid_at__quarter AS paid_at__quarter
- , subq_4.paid_at__year AS paid_at__year
- , subq_4.paid_at__extract_year AS paid_at__extract_year
- , subq_4.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_4.paid_at__extract_month AS paid_at__extract_month
- , subq_4.paid_at__extract_day AS paid_at__extract_day
- , subq_4.paid_at__extract_dow AS paid_at__extract_dow
- , subq_4.paid_at__extract_doy AS paid_at__extract_doy
- , subq_4.booking__ds__day AS booking__ds__day
- , subq_4.booking__ds__week AS booking__ds__week
- , subq_4.booking__ds__month AS booking__ds__month
- , subq_4.booking__ds__quarter AS booking__ds__quarter
- , subq_4.booking__ds__year AS booking__ds__year
- , subq_4.booking__ds__extract_year AS booking__ds__extract_year
- , subq_4.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_4.booking__ds__extract_month AS booking__ds__extract_month
- , subq_4.booking__ds__extract_day AS booking__ds__extract_day
- , subq_4.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_4.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_4.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_4.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_4.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_4.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_4.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_4.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_4.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_4.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_4.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_4.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_4.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_4.booking__paid_at__day AS booking__paid_at__day
- , subq_4.booking__paid_at__week AS booking__paid_at__week
- , subq_4.booking__paid_at__month AS booking__paid_at__month
- , subq_4.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_4.booking__paid_at__year AS booking__paid_at__year
- , subq_4.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_4.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_4.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_4.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_4.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_4.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_4.listing AS listing
- , subq_4.guest AS guest
- , subq_4.host AS host
- , subq_4.booking__listing AS booking__listing
- , subq_4.booking__guest AS booking__guest
- , subq_4.booking__host AS booking__host
- , subq_4.is_instant AS is_instant
- , subq_4.booking__is_instant AS booking__is_instant
- , subq_4.bookings AS bookings
- , subq_4.instant_bookings AS instant_bookings
- , subq_4.booking_value AS booking_value
- , subq_4.max_booking_value AS max_booking_value
- , subq_4.min_booking_value AS min_booking_value
- , subq_4.bookers AS bookers
- , subq_4.average_booking_value AS average_booking_value
- , subq_4.referred_bookings AS referred_bookings
- , subq_4.median_booking_value AS median_booking_value
- , subq_4.booking_value_p99 AS booking_value_p99
- , subq_4.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_4.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_4.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ subq_14.metric_time__day AS metric_time__day
+ , subq_13.ds__day AS ds__day
+ , subq_13.ds__week AS ds__week
+ , subq_13.ds__month AS ds__month
+ , subq_13.ds__quarter AS ds__quarter
+ , subq_13.ds__year AS ds__year
+ , subq_13.ds__extract_year AS ds__extract_year
+ , subq_13.ds__extract_quarter AS ds__extract_quarter
+ , subq_13.ds__extract_month AS ds__extract_month
+ , subq_13.ds__extract_day AS ds__extract_day
+ , subq_13.ds__extract_dow AS ds__extract_dow
+ , subq_13.ds__extract_doy AS ds__extract_doy
+ , subq_13.ds_partitioned__day AS ds_partitioned__day
+ , subq_13.ds_partitioned__week AS ds_partitioned__week
+ , subq_13.ds_partitioned__month AS ds_partitioned__month
+ , subq_13.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_13.ds_partitioned__year AS ds_partitioned__year
+ , subq_13.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_13.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_13.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_13.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_13.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_13.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_13.paid_at__day AS paid_at__day
+ , subq_13.paid_at__week AS paid_at__week
+ , subq_13.paid_at__month AS paid_at__month
+ , subq_13.paid_at__quarter AS paid_at__quarter
+ , subq_13.paid_at__year AS paid_at__year
+ , subq_13.paid_at__extract_year AS paid_at__extract_year
+ , subq_13.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_13.paid_at__extract_month AS paid_at__extract_month
+ , subq_13.paid_at__extract_day AS paid_at__extract_day
+ , subq_13.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_13.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_13.booking__ds__day AS booking__ds__day
+ , subq_13.booking__ds__week AS booking__ds__week
+ , subq_13.booking__ds__month AS booking__ds__month
+ , subq_13.booking__ds__quarter AS booking__ds__quarter
+ , subq_13.booking__ds__year AS booking__ds__year
+ , subq_13.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_13.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_13.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_13.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_13.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_13.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_13.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_13.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_13.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_13.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_13.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_13.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_13.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_13.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_13.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_13.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_13.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_13.booking__paid_at__day AS booking__paid_at__day
+ , subq_13.booking__paid_at__week AS booking__paid_at__week
+ , subq_13.booking__paid_at__month AS booking__paid_at__month
+ , subq_13.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_13.booking__paid_at__year AS booking__paid_at__year
+ , subq_13.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_13.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_13.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_13.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_13.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_13.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_13.listing AS listing
+ , subq_13.guest AS guest
+ , subq_13.host AS host
+ , subq_13.booking__listing AS booking__listing
+ , subq_13.booking__guest AS booking__guest
+ , subq_13.booking__host AS booking__host
+ , subq_13.is_instant AS is_instant
+ , subq_13.booking__is_instant AS booking__is_instant
+ , subq_13.bookings AS bookings
+ , subq_13.instant_bookings AS instant_bookings
+ , subq_13.booking_value AS booking_value
+ , subq_13.max_booking_value AS max_booking_value
+ , subq_13.min_booking_value AS min_booking_value
+ , subq_13.bookers AS bookers
+ , subq_13.average_booking_value AS average_booking_value
+ , subq_13.referred_bookings AS referred_bookings
+ , subq_13.median_booking_value AS median_booking_value
+ , subq_13.booking_value_p99 AS booking_value_p99
+ , subq_13.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_13.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_13.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_6.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_6
- ) subq_5
+ subq_15.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_15
+ ) subq_14
INNER JOIN (
-- Join Self Over Time Range
SELECT
- subq_2.metric_time__day AS metric_time__day
- , subq_1.ds__day AS ds__day
- , subq_1.ds__week AS ds__week
- , subq_1.ds__month AS ds__month
- , subq_1.ds__quarter AS ds__quarter
- , subq_1.ds__year AS ds__year
- , subq_1.ds__extract_year AS ds__extract_year
- , subq_1.ds__extract_quarter AS ds__extract_quarter
- , subq_1.ds__extract_month AS ds__extract_month
- , subq_1.ds__extract_day AS ds__extract_day
- , subq_1.ds__extract_dow AS ds__extract_dow
- , subq_1.ds__extract_doy AS ds__extract_doy
- , subq_1.ds_partitioned__day AS ds_partitioned__day
- , subq_1.ds_partitioned__week AS ds_partitioned__week
- , subq_1.ds_partitioned__month AS ds_partitioned__month
- , subq_1.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_1.ds_partitioned__year AS ds_partitioned__year
- , subq_1.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_1.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_1.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_1.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_1.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_1.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_1.paid_at__day AS paid_at__day
- , subq_1.paid_at__week AS paid_at__week
- , subq_1.paid_at__month AS paid_at__month
- , subq_1.paid_at__quarter AS paid_at__quarter
- , subq_1.paid_at__year AS paid_at__year
- , subq_1.paid_at__extract_year AS paid_at__extract_year
- , subq_1.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_1.paid_at__extract_month AS paid_at__extract_month
- , subq_1.paid_at__extract_day AS paid_at__extract_day
- , subq_1.paid_at__extract_dow AS paid_at__extract_dow
- , subq_1.paid_at__extract_doy AS paid_at__extract_doy
- , subq_1.booking__ds__day AS booking__ds__day
- , subq_1.booking__ds__week AS booking__ds__week
- , subq_1.booking__ds__month AS booking__ds__month
- , subq_1.booking__ds__quarter AS booking__ds__quarter
- , subq_1.booking__ds__year AS booking__ds__year
- , subq_1.booking__ds__extract_year AS booking__ds__extract_year
- , subq_1.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_1.booking__ds__extract_month AS booking__ds__extract_month
- , subq_1.booking__ds__extract_day AS booking__ds__extract_day
- , subq_1.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_1.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_1.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_1.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_1.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_1.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_1.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_1.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_1.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_1.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_1.booking__paid_at__day AS booking__paid_at__day
- , subq_1.booking__paid_at__week AS booking__paid_at__week
- , subq_1.booking__paid_at__month AS booking__paid_at__month
- , subq_1.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_1.booking__paid_at__year AS booking__paid_at__year
- , subq_1.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_1.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_1.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_1.metric_time__week AS metric_time__week
- , subq_1.metric_time__month AS metric_time__month
- , subq_1.metric_time__quarter AS metric_time__quarter
- , subq_1.metric_time__year AS metric_time__year
- , subq_1.metric_time__extract_year AS metric_time__extract_year
- , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter
- , subq_1.metric_time__extract_month AS metric_time__extract_month
- , subq_1.metric_time__extract_day AS metric_time__extract_day
- , subq_1.metric_time__extract_dow AS metric_time__extract_dow
- , subq_1.metric_time__extract_doy AS metric_time__extract_doy
- , subq_1.listing AS listing
- , subq_1.guest AS guest
- , subq_1.host AS host
- , subq_1.booking__listing AS booking__listing
- , subq_1.booking__guest AS booking__guest
- , subq_1.booking__host AS booking__host
- , subq_1.is_instant AS is_instant
- , subq_1.booking__is_instant AS booking__is_instant
- , subq_1.bookings AS bookings
- , subq_1.instant_bookings AS instant_bookings
- , subq_1.booking_value AS booking_value
- , subq_1.max_booking_value AS max_booking_value
- , subq_1.min_booking_value AS min_booking_value
- , subq_1.bookers AS bookers
- , subq_1.average_booking_value AS average_booking_value
- , subq_1.referred_bookings AS referred_bookings
- , subq_1.median_booking_value AS median_booking_value
- , subq_1.booking_value_p99 AS booking_value_p99
- , subq_1.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_1.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_1.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ subq_11.metric_time__day AS metric_time__day
+ , subq_10.ds__day AS ds__day
+ , subq_10.ds__week AS ds__week
+ , subq_10.ds__month AS ds__month
+ , subq_10.ds__quarter AS ds__quarter
+ , subq_10.ds__year AS ds__year
+ , subq_10.ds__extract_year AS ds__extract_year
+ , subq_10.ds__extract_quarter AS ds__extract_quarter
+ , subq_10.ds__extract_month AS ds__extract_month
+ , subq_10.ds__extract_day AS ds__extract_day
+ , subq_10.ds__extract_dow AS ds__extract_dow
+ , subq_10.ds__extract_doy AS ds__extract_doy
+ , subq_10.ds_partitioned__day AS ds_partitioned__day
+ , subq_10.ds_partitioned__week AS ds_partitioned__week
+ , subq_10.ds_partitioned__month AS ds_partitioned__month
+ , subq_10.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_10.ds_partitioned__year AS ds_partitioned__year
+ , subq_10.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_10.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_10.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_10.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_10.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_10.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_10.paid_at__day AS paid_at__day
+ , subq_10.paid_at__week AS paid_at__week
+ , subq_10.paid_at__month AS paid_at__month
+ , subq_10.paid_at__quarter AS paid_at__quarter
+ , subq_10.paid_at__year AS paid_at__year
+ , subq_10.paid_at__extract_year AS paid_at__extract_year
+ , subq_10.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_10.paid_at__extract_month AS paid_at__extract_month
+ , subq_10.paid_at__extract_day AS paid_at__extract_day
+ , subq_10.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_10.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_10.booking__ds__day AS booking__ds__day
+ , subq_10.booking__ds__week AS booking__ds__week
+ , subq_10.booking__ds__month AS booking__ds__month
+ , subq_10.booking__ds__quarter AS booking__ds__quarter
+ , subq_10.booking__ds__year AS booking__ds__year
+ , subq_10.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_10.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_10.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_10.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_10.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_10.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_10.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_10.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_10.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_10.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_10.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_10.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_10.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_10.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_10.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_10.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_10.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_10.booking__paid_at__day AS booking__paid_at__day
+ , subq_10.booking__paid_at__week AS booking__paid_at__week
+ , subq_10.booking__paid_at__month AS booking__paid_at__month
+ , subq_10.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_10.booking__paid_at__year AS booking__paid_at__year
+ , subq_10.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_10.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_10.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_10.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_10.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_10.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_10.metric_time__week AS metric_time__week
+ , subq_10.metric_time__month AS metric_time__month
+ , subq_10.metric_time__quarter AS metric_time__quarter
+ , subq_10.metric_time__year AS metric_time__year
+ , subq_10.metric_time__extract_year AS metric_time__extract_year
+ , subq_10.metric_time__extract_quarter AS metric_time__extract_quarter
+ , subq_10.metric_time__extract_month AS metric_time__extract_month
+ , subq_10.metric_time__extract_day AS metric_time__extract_day
+ , subq_10.metric_time__extract_dow AS metric_time__extract_dow
+ , subq_10.metric_time__extract_doy AS metric_time__extract_doy
+ , subq_10.listing AS listing
+ , subq_10.guest AS guest
+ , subq_10.host AS host
+ , subq_10.booking__listing AS booking__listing
+ , subq_10.booking__guest AS booking__guest
+ , subq_10.booking__host AS booking__host
+ , subq_10.is_instant AS is_instant
+ , subq_10.booking__is_instant AS booking__is_instant
+ , subq_10.bookings AS bookings
+ , subq_10.instant_bookings AS instant_bookings
+ , subq_10.booking_value AS booking_value
+ , subq_10.max_booking_value AS max_booking_value
+ , subq_10.min_booking_value AS min_booking_value
+ , subq_10.bookers AS bookers
+ , subq_10.average_booking_value AS average_booking_value
+ , subq_10.referred_bookings AS referred_bookings
+ , subq_10.median_booking_value AS median_booking_value
+ , subq_10.booking_value_p99 AS booking_value_p99
+ , subq_10.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_10.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_10.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_3.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_3
- ) subq_2
+ subq_12.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_12
+ ) subq_11
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS booking__paid_at__extract_dow
+ , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
ON
(
- subq_1.metric_time__day <= subq_2.metric_time__day
+ subq_10.metric_time__day <= subq_11.metric_time__day
) AND (
- subq_1.metric_time__day > DATE_SUB(CAST(subq_2.metric_time__day AS DATETIME), INTERVAL 2 day)
+ subq_10.metric_time__day > DATE_SUB(CAST(subq_11.metric_time__day AS DATETIME), INTERVAL 2 day)
)
- ) subq_4
+ ) subq_13
ON
- DATE_SUB(CAST(subq_5.metric_time__day AS DATETIME), INTERVAL 2 day) = subq_4.metric_time__day
- ) subq_7
- ) subq_8
+ DATE_SUB(CAST(subq_14.metric_time__day AS DATETIME), INTERVAL 2 day) = subq_13.metric_time__day
+ ) subq_16
+ ) subq_17
GROUP BY
metric_time__day
- ) subq_9
-) subq_10
+ ) subq_18
+) subq_19
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_offset_cumulative_metric__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_offset_cumulative_metric__plan0_optimized.sql
index e1b2edc391..219f573372 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_offset_cumulative_metric__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_offset_cumulative_metric__plan0_optimized.sql
@@ -8,26 +8,26 @@ FROM (
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_17.ds AS metric_time__day
- , COUNT(DISTINCT subq_15.bookers) AS every_2_days_bookers_2_days_ago
- FROM ***************************.mf_time_spine subq_17
+ subq_26.ds AS metric_time__day
+ , COUNT(DISTINCT subq_24.bookers) AS every_2_days_bookers_2_days_ago
+ FROM ***************************.mf_time_spine subq_26
INNER JOIN (
-- Join Self Over Time Range
SELECT
- subq_14.ds AS metric_time__day
- , bookings_source_src_28001.guest_id AS bookers
- FROM ***************************.mf_time_spine subq_14
+ subq_23.ds AS metric_time__day
+ , bookings_source_src_28000.guest_id AS bookers
+ FROM ***************************.mf_time_spine subq_23
INNER JOIN
- ***************************.fct_bookings bookings_source_src_28001
+ ***************************.fct_bookings bookings_source_src_28000
ON
(
- DATE_TRUNC(bookings_source_src_28001.ds, day) <= subq_14.ds
+ DATE_TRUNC(bookings_source_src_28000.ds, day) <= subq_23.ds
) AND (
- DATE_TRUNC(bookings_source_src_28001.ds, day) > DATE_SUB(CAST(subq_14.ds AS DATETIME), INTERVAL 2 day)
+ DATE_TRUNC(bookings_source_src_28000.ds, day) > DATE_SUB(CAST(subq_23.ds AS DATETIME), INTERVAL 2 day)
)
- ) subq_15
+ ) subq_24
ON
- DATE_SUB(CAST(subq_17.ds AS DATETIME), INTERVAL 2 day) = subq_15.metric_time__day
+ DATE_SUB(CAST(subq_26.ds AS DATETIME), INTERVAL 2 day) = subq_24.metric_time__day
GROUP BY
metric_time__day
-) subq_21
+) subq_30
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_offset_metric_with_agg_time_dim__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_offset_metric_with_agg_time_dim__plan0.sql
index 6a7e286712..0d997facd0 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_offset_metric_with_agg_time_dim__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_offset_metric_with_agg_time_dim__plan0.sql
@@ -1,545 +1,545 @@
-- Compute Metrics via Expressions
SELECT
- subq_13.booking__ds__day
+ subq_22.booking__ds__day
, booking_value * 0.05 / bookers AS booking_fees_last_week_per_booker_this_week
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_7.booking__ds__day, subq_12.booking__ds__day) AS booking__ds__day
- , MAX(subq_7.booking_value) AS booking_value
- , MAX(subq_12.bookers) AS bookers
+ COALESCE(subq_16.booking__ds__day, subq_21.booking__ds__day) AS booking__ds__day
+ , MAX(subq_16.booking_value) AS booking_value
+ , MAX(subq_21.bookers) AS bookers
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_6.booking__ds__day
- , subq_6.booking_value
+ subq_15.booking__ds__day
+ , subq_15.booking_value
FROM (
-- Aggregate Measures
SELECT
- subq_5.booking__ds__day
- , SUM(subq_5.booking_value) AS booking_value
+ subq_14.booking__ds__day
+ , SUM(subq_14.booking_value) AS booking_value
FROM (
-- Pass Only Elements: ['booking_value', 'booking__ds__day']
SELECT
- subq_4.booking__ds__day
- , subq_4.booking_value
+ subq_13.booking__ds__day
+ , subq_13.booking_value
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_2.booking__ds__day AS booking__ds__day
- , subq_1.ds__day AS ds__day
- , subq_1.ds__week AS ds__week
- , subq_1.ds__month AS ds__month
- , subq_1.ds__quarter AS ds__quarter
- , subq_1.ds__year AS ds__year
- , subq_1.ds__extract_year AS ds__extract_year
- , subq_1.ds__extract_quarter AS ds__extract_quarter
- , subq_1.ds__extract_month AS ds__extract_month
- , subq_1.ds__extract_day AS ds__extract_day
- , subq_1.ds__extract_dow AS ds__extract_dow
- , subq_1.ds__extract_doy AS ds__extract_doy
- , subq_1.ds_partitioned__day AS ds_partitioned__day
- , subq_1.ds_partitioned__week AS ds_partitioned__week
- , subq_1.ds_partitioned__month AS ds_partitioned__month
- , subq_1.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_1.ds_partitioned__year AS ds_partitioned__year
- , subq_1.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_1.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_1.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_1.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_1.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_1.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_1.paid_at__day AS paid_at__day
- , subq_1.paid_at__week AS paid_at__week
- , subq_1.paid_at__month AS paid_at__month
- , subq_1.paid_at__quarter AS paid_at__quarter
- , subq_1.paid_at__year AS paid_at__year
- , subq_1.paid_at__extract_year AS paid_at__extract_year
- , subq_1.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_1.paid_at__extract_month AS paid_at__extract_month
- , subq_1.paid_at__extract_day AS paid_at__extract_day
- , subq_1.paid_at__extract_dow AS paid_at__extract_dow
- , subq_1.paid_at__extract_doy AS paid_at__extract_doy
- , subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_1.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_1.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_1.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_1.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_1.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_1.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_1.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_1.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_1.booking__paid_at__day AS booking__paid_at__day
- , subq_1.booking__paid_at__week AS booking__paid_at__week
- , subq_1.booking__paid_at__month AS booking__paid_at__month
- , subq_1.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_1.booking__paid_at__year AS booking__paid_at__year
- , subq_1.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_1.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_1.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_1.metric_time__day AS metric_time__day
- , subq_1.metric_time__week AS metric_time__week
- , subq_1.metric_time__month AS metric_time__month
- , subq_1.metric_time__quarter AS metric_time__quarter
- , subq_1.metric_time__year AS metric_time__year
- , subq_1.metric_time__extract_year AS metric_time__extract_year
- , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter
- , subq_1.metric_time__extract_month AS metric_time__extract_month
- , subq_1.metric_time__extract_day AS metric_time__extract_day
- , subq_1.metric_time__extract_dow AS metric_time__extract_dow
- , subq_1.metric_time__extract_doy AS metric_time__extract_doy
- , subq_1.listing AS listing
- , subq_1.guest AS guest
- , subq_1.host AS host
- , subq_1.booking__listing AS booking__listing
- , subq_1.booking__guest AS booking__guest
- , subq_1.booking__host AS booking__host
- , subq_1.is_instant AS is_instant
- , subq_1.booking__is_instant AS booking__is_instant
- , subq_1.bookings AS bookings
- , subq_1.instant_bookings AS instant_bookings
- , subq_1.booking_value AS booking_value
- , subq_1.max_booking_value AS max_booking_value
- , subq_1.min_booking_value AS min_booking_value
- , subq_1.bookers AS bookers
- , subq_1.average_booking_value AS average_booking_value
- , subq_1.referred_bookings AS referred_bookings
- , subq_1.median_booking_value AS median_booking_value
- , subq_1.booking_value_p99 AS booking_value_p99
- , subq_1.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_1.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_1.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ subq_11.booking__ds__day AS booking__ds__day
+ , subq_10.ds__day AS ds__day
+ , subq_10.ds__week AS ds__week
+ , subq_10.ds__month AS ds__month
+ , subq_10.ds__quarter AS ds__quarter
+ , subq_10.ds__year AS ds__year
+ , subq_10.ds__extract_year AS ds__extract_year
+ , subq_10.ds__extract_quarter AS ds__extract_quarter
+ , subq_10.ds__extract_month AS ds__extract_month
+ , subq_10.ds__extract_day AS ds__extract_day
+ , subq_10.ds__extract_dow AS ds__extract_dow
+ , subq_10.ds__extract_doy AS ds__extract_doy
+ , subq_10.ds_partitioned__day AS ds_partitioned__day
+ , subq_10.ds_partitioned__week AS ds_partitioned__week
+ , subq_10.ds_partitioned__month AS ds_partitioned__month
+ , subq_10.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_10.ds_partitioned__year AS ds_partitioned__year
+ , subq_10.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_10.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_10.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_10.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_10.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_10.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_10.paid_at__day AS paid_at__day
+ , subq_10.paid_at__week AS paid_at__week
+ , subq_10.paid_at__month AS paid_at__month
+ , subq_10.paid_at__quarter AS paid_at__quarter
+ , subq_10.paid_at__year AS paid_at__year
+ , subq_10.paid_at__extract_year AS paid_at__extract_year
+ , subq_10.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_10.paid_at__extract_month AS paid_at__extract_month
+ , subq_10.paid_at__extract_day AS paid_at__extract_day
+ , subq_10.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_10.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_10.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_10.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_10.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_10.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_10.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_10.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_10.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_10.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_10.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_10.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_10.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_10.booking__paid_at__day AS booking__paid_at__day
+ , subq_10.booking__paid_at__week AS booking__paid_at__week
+ , subq_10.booking__paid_at__month AS booking__paid_at__month
+ , subq_10.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_10.booking__paid_at__year AS booking__paid_at__year
+ , subq_10.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_10.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_10.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_10.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_10.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_10.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_10.metric_time__day AS metric_time__day
+ , subq_10.metric_time__week AS metric_time__week
+ , subq_10.metric_time__month AS metric_time__month
+ , subq_10.metric_time__quarter AS metric_time__quarter
+ , subq_10.metric_time__year AS metric_time__year
+ , subq_10.metric_time__extract_year AS metric_time__extract_year
+ , subq_10.metric_time__extract_quarter AS metric_time__extract_quarter
+ , subq_10.metric_time__extract_month AS metric_time__extract_month
+ , subq_10.metric_time__extract_day AS metric_time__extract_day
+ , subq_10.metric_time__extract_dow AS metric_time__extract_dow
+ , subq_10.metric_time__extract_doy AS metric_time__extract_doy
+ , subq_10.listing AS listing
+ , subq_10.guest AS guest
+ , subq_10.host AS host
+ , subq_10.booking__listing AS booking__listing
+ , subq_10.booking__guest AS booking__guest
+ , subq_10.booking__host AS booking__host
+ , subq_10.is_instant AS is_instant
+ , subq_10.booking__is_instant AS booking__is_instant
+ , subq_10.bookings AS bookings
+ , subq_10.instant_bookings AS instant_bookings
+ , subq_10.booking_value AS booking_value
+ , subq_10.max_booking_value AS max_booking_value
+ , subq_10.min_booking_value AS min_booking_value
+ , subq_10.bookers AS bookers
+ , subq_10.average_booking_value AS average_booking_value
+ , subq_10.referred_bookings AS referred_bookings
+ , subq_10.median_booking_value AS median_booking_value
+ , subq_10.booking_value_p99 AS booking_value_p99
+ , subq_10.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_10.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_10.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_3.ds AS booking__ds__day
- FROM ***************************.mf_time_spine subq_3
- ) subq_2
+ subq_12.ds AS booking__ds__day
+ FROM ***************************.mf_time_spine subq_12
+ ) subq_11
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS booking__paid_at__extract_dow
+ , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
ON
- DATE_SUB(CAST(subq_2.booking__ds__day AS DATETIME), INTERVAL 1 week) = subq_1.booking__ds__day
- ) subq_4
- ) subq_5
+ DATE_SUB(CAST(subq_11.booking__ds__day AS DATETIME), INTERVAL 1 week) = subq_10.booking__ds__day
+ ) subq_13
+ ) subq_14
GROUP BY
booking__ds__day
- ) subq_6
- ) subq_7
+ ) subq_15
+ ) subq_16
FULL OUTER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_11.booking__ds__day
- , subq_11.bookers
+ subq_20.booking__ds__day
+ , subq_20.bookers
FROM (
-- Aggregate Measures
SELECT
- subq_10.booking__ds__day
- , COUNT(DISTINCT subq_10.bookers) AS bookers
+ subq_19.booking__ds__day
+ , COUNT(DISTINCT subq_19.bookers) AS bookers
FROM (
-- Pass Only Elements: ['bookers', 'booking__ds__day']
SELECT
- subq_9.booking__ds__day
- , subq_9.bookers
+ subq_18.booking__ds__day
+ , subq_18.bookers
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_8.ds__day
- , subq_8.ds__week
- , subq_8.ds__month
- , subq_8.ds__quarter
- , subq_8.ds__year
- , subq_8.ds__extract_year
- , subq_8.ds__extract_quarter
- , subq_8.ds__extract_month
- , subq_8.ds__extract_day
- , subq_8.ds__extract_dow
- , subq_8.ds__extract_doy
- , subq_8.ds_partitioned__day
- , subq_8.ds_partitioned__week
- , subq_8.ds_partitioned__month
- , subq_8.ds_partitioned__quarter
- , subq_8.ds_partitioned__year
- , subq_8.ds_partitioned__extract_year
- , subq_8.ds_partitioned__extract_quarter
- , subq_8.ds_partitioned__extract_month
- , subq_8.ds_partitioned__extract_day
- , subq_8.ds_partitioned__extract_dow
- , subq_8.ds_partitioned__extract_doy
- , subq_8.paid_at__day
- , subq_8.paid_at__week
- , subq_8.paid_at__month
- , subq_8.paid_at__quarter
- , subq_8.paid_at__year
- , subq_8.paid_at__extract_year
- , subq_8.paid_at__extract_quarter
- , subq_8.paid_at__extract_month
- , subq_8.paid_at__extract_day
- , subq_8.paid_at__extract_dow
- , subq_8.paid_at__extract_doy
- , subq_8.booking__ds__day
- , subq_8.booking__ds__week
- , subq_8.booking__ds__month
- , subq_8.booking__ds__quarter
- , subq_8.booking__ds__year
- , subq_8.booking__ds__extract_year
- , subq_8.booking__ds__extract_quarter
- , subq_8.booking__ds__extract_month
- , subq_8.booking__ds__extract_day
- , subq_8.booking__ds__extract_dow
- , subq_8.booking__ds__extract_doy
- , subq_8.booking__ds_partitioned__day
- , subq_8.booking__ds_partitioned__week
- , subq_8.booking__ds_partitioned__month
- , subq_8.booking__ds_partitioned__quarter
- , subq_8.booking__ds_partitioned__year
- , subq_8.booking__ds_partitioned__extract_year
- , subq_8.booking__ds_partitioned__extract_quarter
- , subq_8.booking__ds_partitioned__extract_month
- , subq_8.booking__ds_partitioned__extract_day
- , subq_8.booking__ds_partitioned__extract_dow
- , subq_8.booking__ds_partitioned__extract_doy
- , subq_8.booking__paid_at__day
- , subq_8.booking__paid_at__week
- , subq_8.booking__paid_at__month
- , subq_8.booking__paid_at__quarter
- , subq_8.booking__paid_at__year
- , subq_8.booking__paid_at__extract_year
- , subq_8.booking__paid_at__extract_quarter
- , subq_8.booking__paid_at__extract_month
- , subq_8.booking__paid_at__extract_day
- , subq_8.booking__paid_at__extract_dow
- , subq_8.booking__paid_at__extract_doy
- , subq_8.ds__day AS metric_time__day
- , subq_8.ds__week AS metric_time__week
- , subq_8.ds__month AS metric_time__month
- , subq_8.ds__quarter AS metric_time__quarter
- , subq_8.ds__year AS metric_time__year
- , subq_8.ds__extract_year AS metric_time__extract_year
- , subq_8.ds__extract_quarter AS metric_time__extract_quarter
- , subq_8.ds__extract_month AS metric_time__extract_month
- , subq_8.ds__extract_day AS metric_time__extract_day
- , subq_8.ds__extract_dow AS metric_time__extract_dow
- , subq_8.ds__extract_doy AS metric_time__extract_doy
- , subq_8.listing
- , subq_8.guest
- , subq_8.host
- , subq_8.booking__listing
- , subq_8.booking__guest
- , subq_8.booking__host
- , subq_8.is_instant
- , subq_8.booking__is_instant
- , subq_8.bookings
- , subq_8.instant_bookings
- , subq_8.booking_value
- , subq_8.max_booking_value
- , subq_8.min_booking_value
- , subq_8.bookers
- , subq_8.average_booking_value
- , subq_8.referred_bookings
- , subq_8.median_booking_value
- , subq_8.booking_value_p99
- , subq_8.discrete_booking_value_p99
- , subq_8.approximate_continuous_booking_value_p99
- , subq_8.approximate_discrete_booking_value_p99
+ subq_17.ds__day
+ , subq_17.ds__week
+ , subq_17.ds__month
+ , subq_17.ds__quarter
+ , subq_17.ds__year
+ , subq_17.ds__extract_year
+ , subq_17.ds__extract_quarter
+ , subq_17.ds__extract_month
+ , subq_17.ds__extract_day
+ , subq_17.ds__extract_dow
+ , subq_17.ds__extract_doy
+ , subq_17.ds_partitioned__day
+ , subq_17.ds_partitioned__week
+ , subq_17.ds_partitioned__month
+ , subq_17.ds_partitioned__quarter
+ , subq_17.ds_partitioned__year
+ , subq_17.ds_partitioned__extract_year
+ , subq_17.ds_partitioned__extract_quarter
+ , subq_17.ds_partitioned__extract_month
+ , subq_17.ds_partitioned__extract_day
+ , subq_17.ds_partitioned__extract_dow
+ , subq_17.ds_partitioned__extract_doy
+ , subq_17.paid_at__day
+ , subq_17.paid_at__week
+ , subq_17.paid_at__month
+ , subq_17.paid_at__quarter
+ , subq_17.paid_at__year
+ , subq_17.paid_at__extract_year
+ , subq_17.paid_at__extract_quarter
+ , subq_17.paid_at__extract_month
+ , subq_17.paid_at__extract_day
+ , subq_17.paid_at__extract_dow
+ , subq_17.paid_at__extract_doy
+ , subq_17.booking__ds__day
+ , subq_17.booking__ds__week
+ , subq_17.booking__ds__month
+ , subq_17.booking__ds__quarter
+ , subq_17.booking__ds__year
+ , subq_17.booking__ds__extract_year
+ , subq_17.booking__ds__extract_quarter
+ , subq_17.booking__ds__extract_month
+ , subq_17.booking__ds__extract_day
+ , subq_17.booking__ds__extract_dow
+ , subq_17.booking__ds__extract_doy
+ , subq_17.booking__ds_partitioned__day
+ , subq_17.booking__ds_partitioned__week
+ , subq_17.booking__ds_partitioned__month
+ , subq_17.booking__ds_partitioned__quarter
+ , subq_17.booking__ds_partitioned__year
+ , subq_17.booking__ds_partitioned__extract_year
+ , subq_17.booking__ds_partitioned__extract_quarter
+ , subq_17.booking__ds_partitioned__extract_month
+ , subq_17.booking__ds_partitioned__extract_day
+ , subq_17.booking__ds_partitioned__extract_dow
+ , subq_17.booking__ds_partitioned__extract_doy
+ , subq_17.booking__paid_at__day
+ , subq_17.booking__paid_at__week
+ , subq_17.booking__paid_at__month
+ , subq_17.booking__paid_at__quarter
+ , subq_17.booking__paid_at__year
+ , subq_17.booking__paid_at__extract_year
+ , subq_17.booking__paid_at__extract_quarter
+ , subq_17.booking__paid_at__extract_month
+ , subq_17.booking__paid_at__extract_day
+ , subq_17.booking__paid_at__extract_dow
+ , subq_17.booking__paid_at__extract_doy
+ , subq_17.ds__day AS metric_time__day
+ , subq_17.ds__week AS metric_time__week
+ , subq_17.ds__month AS metric_time__month
+ , subq_17.ds__quarter AS metric_time__quarter
+ , subq_17.ds__year AS metric_time__year
+ , subq_17.ds__extract_year AS metric_time__extract_year
+ , subq_17.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_17.ds__extract_month AS metric_time__extract_month
+ , subq_17.ds__extract_day AS metric_time__extract_day
+ , subq_17.ds__extract_dow AS metric_time__extract_dow
+ , subq_17.ds__extract_doy AS metric_time__extract_doy
+ , subq_17.listing
+ , subq_17.guest
+ , subq_17.host
+ , subq_17.booking__listing
+ , subq_17.booking__guest
+ , subq_17.booking__host
+ , subq_17.is_instant
+ , subq_17.booking__is_instant
+ , subq_17.bookings
+ , subq_17.instant_bookings
+ , subq_17.booking_value
+ , subq_17.max_booking_value
+ , subq_17.min_booking_value
+ , subq_17.bookers
+ , subq_17.average_booking_value
+ , subq_17.referred_bookings
+ , subq_17.median_booking_value
+ , subq_17.booking_value_p99
+ , subq_17.discrete_booking_value_p99
+ , subq_17.approximate_continuous_booking_value_p99
+ , subq_17.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_8
- ) subq_9
- ) subq_10
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS booking__paid_at__extract_dow
+ , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_17
+ ) subq_18
+ ) subq_19
GROUP BY
booking__ds__day
- ) subq_11
- ) subq_12
+ ) subq_20
+ ) subq_21
ON
- subq_7.booking__ds__day = subq_12.booking__ds__day
+ subq_16.booking__ds__day = subq_21.booking__ds__day
GROUP BY
booking__ds__day
-) subq_13
+) subq_22
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_offset_metric_with_agg_time_dim__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_offset_metric_with_agg_time_dim__plan0_optimized.sql
index 9ac31a60a2..e3c5b27c0a 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_offset_metric_with_agg_time_dim__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_offset_metric_with_agg_time_dim__plan0_optimized.sql
@@ -5,25 +5,25 @@ SELECT
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_21.booking__ds__day, subq_26.booking__ds__day) AS booking__ds__day
- , MAX(subq_21.booking_value) AS booking_value
- , MAX(subq_26.bookers) AS bookers
+ COALESCE(subq_30.booking__ds__day, subq_35.booking__ds__day) AS booking__ds__day
+ , MAX(subq_30.booking_value) AS booking_value
+ , MAX(subq_35.bookers) AS bookers
FROM (
-- Join to Time Spine Dataset
-- Pass Only Elements: ['booking_value', 'booking__ds__day']
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_17.ds AS booking__ds__day
- , SUM(bookings_source_src_28001.booking_value) AS booking_value
- FROM ***************************.mf_time_spine subq_17
+ subq_26.ds AS booking__ds__day
+ , SUM(bookings_source_src_28000.booking_value) AS booking_value
+ FROM ***************************.mf_time_spine subq_26
INNER JOIN
- ***************************.fct_bookings bookings_source_src_28001
+ ***************************.fct_bookings bookings_source_src_28000
ON
- DATE_SUB(CAST(subq_17.ds AS DATETIME), INTERVAL 1 week) = DATE_TRUNC(bookings_source_src_28001.ds, day)
+ DATE_SUB(CAST(subq_26.ds AS DATETIME), INTERVAL 1 week) = DATE_TRUNC(bookings_source_src_28000.ds, day)
GROUP BY
booking__ds__day
- ) subq_21
+ ) subq_30
FULL OUTER JOIN (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
@@ -33,12 +33,12 @@ FROM (
SELECT
DATE_TRUNC(ds, day) AS booking__ds__day
, COUNT(DISTINCT guest_id) AS bookers
- FROM ***************************.fct_bookings bookings_source_src_28001
+ FROM ***************************.fct_bookings bookings_source_src_28000
GROUP BY
booking__ds__day
- ) subq_26
+ ) subq_35
ON
- subq_21.booking__ds__day = subq_26.booking__ds__day
+ subq_30.booking__ds__day = subq_35.booking__ds__day
GROUP BY
booking__ds__day
-) subq_27
+) subq_36
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_offset_metric_with_one_input_metric__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_offset_metric_with_one_input_metric__plan0.sql
index 54f41d6072..4f44456c71 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_offset_metric_with_one_input_metric__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_offset_metric_with_one_input_metric__plan0.sql
@@ -1,319 +1,319 @@
-- Compute Metrics via Expressions
SELECT
- subq_7.metric_time__day
+ subq_16.metric_time__day
, bookings_5_days_ago AS bookings_5_day_lag
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_6.metric_time__day
- , subq_6.bookings AS bookings_5_days_ago
+ subq_15.metric_time__day
+ , subq_15.bookings AS bookings_5_days_ago
FROM (
-- Aggregate Measures
SELECT
- subq_5.metric_time__day
- , SUM(subq_5.bookings) AS bookings
+ subq_14.metric_time__day
+ , SUM(subq_14.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__day']
SELECT
- subq_4.metric_time__day
- , subq_4.bookings
+ subq_13.metric_time__day
+ , subq_13.bookings
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_2.metric_time__day AS metric_time__day
- , subq_1.ds__day AS ds__day
- , subq_1.ds__week AS ds__week
- , subq_1.ds__month AS ds__month
- , subq_1.ds__quarter AS ds__quarter
- , subq_1.ds__year AS ds__year
- , subq_1.ds__extract_year AS ds__extract_year
- , subq_1.ds__extract_quarter AS ds__extract_quarter
- , subq_1.ds__extract_month AS ds__extract_month
- , subq_1.ds__extract_day AS ds__extract_day
- , subq_1.ds__extract_dow AS ds__extract_dow
- , subq_1.ds__extract_doy AS ds__extract_doy
- , subq_1.ds_partitioned__day AS ds_partitioned__day
- , subq_1.ds_partitioned__week AS ds_partitioned__week
- , subq_1.ds_partitioned__month AS ds_partitioned__month
- , subq_1.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_1.ds_partitioned__year AS ds_partitioned__year
- , subq_1.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_1.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_1.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_1.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_1.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_1.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_1.paid_at__day AS paid_at__day
- , subq_1.paid_at__week AS paid_at__week
- , subq_1.paid_at__month AS paid_at__month
- , subq_1.paid_at__quarter AS paid_at__quarter
- , subq_1.paid_at__year AS paid_at__year
- , subq_1.paid_at__extract_year AS paid_at__extract_year
- , subq_1.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_1.paid_at__extract_month AS paid_at__extract_month
- , subq_1.paid_at__extract_day AS paid_at__extract_day
- , subq_1.paid_at__extract_dow AS paid_at__extract_dow
- , subq_1.paid_at__extract_doy AS paid_at__extract_doy
- , subq_1.booking__ds__day AS booking__ds__day
- , subq_1.booking__ds__week AS booking__ds__week
- , subq_1.booking__ds__month AS booking__ds__month
- , subq_1.booking__ds__quarter AS booking__ds__quarter
- , subq_1.booking__ds__year AS booking__ds__year
- , subq_1.booking__ds__extract_year AS booking__ds__extract_year
- , subq_1.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_1.booking__ds__extract_month AS booking__ds__extract_month
- , subq_1.booking__ds__extract_day AS booking__ds__extract_day
- , subq_1.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_1.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_1.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_1.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_1.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_1.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_1.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_1.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_1.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_1.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_1.booking__paid_at__day AS booking__paid_at__day
- , subq_1.booking__paid_at__week AS booking__paid_at__week
- , subq_1.booking__paid_at__month AS booking__paid_at__month
- , subq_1.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_1.booking__paid_at__year AS booking__paid_at__year
- , subq_1.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_1.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_1.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_1.listing AS listing
- , subq_1.guest AS guest
- , subq_1.host AS host
- , subq_1.booking__listing AS booking__listing
- , subq_1.booking__guest AS booking__guest
- , subq_1.booking__host AS booking__host
- , subq_1.is_instant AS is_instant
- , subq_1.booking__is_instant AS booking__is_instant
- , subq_1.bookings AS bookings
- , subq_1.instant_bookings AS instant_bookings
- , subq_1.booking_value AS booking_value
- , subq_1.max_booking_value AS max_booking_value
- , subq_1.min_booking_value AS min_booking_value
- , subq_1.bookers AS bookers
- , subq_1.average_booking_value AS average_booking_value
- , subq_1.referred_bookings AS referred_bookings
- , subq_1.median_booking_value AS median_booking_value
- , subq_1.booking_value_p99 AS booking_value_p99
- , subq_1.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_1.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_1.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ subq_11.metric_time__day AS metric_time__day
+ , subq_10.ds__day AS ds__day
+ , subq_10.ds__week AS ds__week
+ , subq_10.ds__month AS ds__month
+ , subq_10.ds__quarter AS ds__quarter
+ , subq_10.ds__year AS ds__year
+ , subq_10.ds__extract_year AS ds__extract_year
+ , subq_10.ds__extract_quarter AS ds__extract_quarter
+ , subq_10.ds__extract_month AS ds__extract_month
+ , subq_10.ds__extract_day AS ds__extract_day
+ , subq_10.ds__extract_dow AS ds__extract_dow
+ , subq_10.ds__extract_doy AS ds__extract_doy
+ , subq_10.ds_partitioned__day AS ds_partitioned__day
+ , subq_10.ds_partitioned__week AS ds_partitioned__week
+ , subq_10.ds_partitioned__month AS ds_partitioned__month
+ , subq_10.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_10.ds_partitioned__year AS ds_partitioned__year
+ , subq_10.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_10.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_10.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_10.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_10.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_10.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_10.paid_at__day AS paid_at__day
+ , subq_10.paid_at__week AS paid_at__week
+ , subq_10.paid_at__month AS paid_at__month
+ , subq_10.paid_at__quarter AS paid_at__quarter
+ , subq_10.paid_at__year AS paid_at__year
+ , subq_10.paid_at__extract_year AS paid_at__extract_year
+ , subq_10.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_10.paid_at__extract_month AS paid_at__extract_month
+ , subq_10.paid_at__extract_day AS paid_at__extract_day
+ , subq_10.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_10.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_10.booking__ds__day AS booking__ds__day
+ , subq_10.booking__ds__week AS booking__ds__week
+ , subq_10.booking__ds__month AS booking__ds__month
+ , subq_10.booking__ds__quarter AS booking__ds__quarter
+ , subq_10.booking__ds__year AS booking__ds__year
+ , subq_10.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_10.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_10.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_10.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_10.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_10.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_10.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_10.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_10.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_10.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_10.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_10.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_10.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_10.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_10.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_10.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_10.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_10.booking__paid_at__day AS booking__paid_at__day
+ , subq_10.booking__paid_at__week AS booking__paid_at__week
+ , subq_10.booking__paid_at__month AS booking__paid_at__month
+ , subq_10.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_10.booking__paid_at__year AS booking__paid_at__year
+ , subq_10.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_10.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_10.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_10.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_10.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_10.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_10.listing AS listing
+ , subq_10.guest AS guest
+ , subq_10.host AS host
+ , subq_10.booking__listing AS booking__listing
+ , subq_10.booking__guest AS booking__guest
+ , subq_10.booking__host AS booking__host
+ , subq_10.is_instant AS is_instant
+ , subq_10.booking__is_instant AS booking__is_instant
+ , subq_10.bookings AS bookings
+ , subq_10.instant_bookings AS instant_bookings
+ , subq_10.booking_value AS booking_value
+ , subq_10.max_booking_value AS max_booking_value
+ , subq_10.min_booking_value AS min_booking_value
+ , subq_10.bookers AS bookers
+ , subq_10.average_booking_value AS average_booking_value
+ , subq_10.referred_bookings AS referred_bookings
+ , subq_10.median_booking_value AS median_booking_value
+ , subq_10.booking_value_p99 AS booking_value_p99
+ , subq_10.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_10.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_10.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_3.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_3
- ) subq_2
+ subq_12.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_12
+ ) subq_11
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS booking__paid_at__extract_dow
+ , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
ON
- DATE_SUB(CAST(subq_2.metric_time__day AS DATETIME), INTERVAL 5 day) = subq_1.metric_time__day
- ) subq_4
- ) subq_5
+ DATE_SUB(CAST(subq_11.metric_time__day AS DATETIME), INTERVAL 5 day) = subq_10.metric_time__day
+ ) subq_13
+ ) subq_14
GROUP BY
metric_time__day
- ) subq_6
-) subq_7
+ ) subq_15
+) subq_16
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_offset_metric_with_one_input_metric__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_offset_metric_with_one_input_metric__plan0_optimized.sql
index 7d08909b4c..0cdc736d64 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_offset_metric_with_one_input_metric__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_derived_offset_metric_with_one_input_metric__plan0_optimized.sql
@@ -8,19 +8,19 @@ FROM (
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_11.ds AS metric_time__day
- , SUM(subq_9.bookings) AS bookings_5_days_ago
- FROM ***************************.mf_time_spine subq_11
+ subq_20.ds AS metric_time__day
+ , SUM(subq_18.bookings) AS bookings_5_days_ago
+ 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
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_9
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_18
ON
- DATE_SUB(CAST(subq_11.ds AS DATETIME), INTERVAL 5 day) = subq_9.metric_time__day
+ DATE_SUB(CAST(subq_20.ds AS DATETIME), INTERVAL 5 day) = subq_18.metric_time__day
GROUP BY
metric_time__day
-) subq_15
+) subq_24
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_derived_metric__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_derived_metric__plan0.sql
index 5b00e7ea4e..9bfa2415dd 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_derived_metric__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_derived_metric__plan0.sql
@@ -1,895 +1,895 @@
-- Compute Metrics via Expressions
SELECT
- subq_22.metric_time__day
+ subq_31.metric_time__day
, non_referred + (instant * 1.0 / bookings) AS instant_plus_non_referred_bookings_pct
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_11.metric_time__day, subq_16.metric_time__day, subq_21.metric_time__day) AS metric_time__day
- , MAX(subq_11.non_referred) AS non_referred
- , MAX(subq_16.instant) AS instant
- , MAX(subq_21.bookings) AS bookings
+ COALESCE(subq_20.metric_time__day, subq_25.metric_time__day, subq_30.metric_time__day) AS metric_time__day
+ , MAX(subq_20.non_referred) AS non_referred
+ , MAX(subq_25.instant) AS instant
+ , MAX(subq_30.bookings) AS bookings
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_10.metric_time__day
+ subq_19.metric_time__day
, (bookings - ref_bookings) * 1.0 / bookings AS non_referred
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_4.metric_time__day, subq_9.metric_time__day) AS metric_time__day
- , MAX(subq_4.ref_bookings) AS ref_bookings
- , MAX(subq_9.bookings) AS bookings
+ COALESCE(subq_13.metric_time__day, subq_18.metric_time__day) AS metric_time__day
+ , MAX(subq_13.ref_bookings) AS ref_bookings
+ , MAX(subq_18.bookings) AS bookings
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_3.metric_time__day
- , subq_3.referred_bookings AS ref_bookings
+ subq_12.metric_time__day
+ , subq_12.referred_bookings AS ref_bookings
FROM (
-- Aggregate Measures
SELECT
- subq_2.metric_time__day
- , SUM(subq_2.referred_bookings) AS referred_bookings
+ subq_11.metric_time__day
+ , SUM(subq_11.referred_bookings) AS referred_bookings
FROM (
-- Pass Only Elements: ['referred_bookings', 'metric_time__day']
SELECT
- subq_1.metric_time__day
- , subq_1.referred_bookings
+ subq_10.metric_time__day
+ , subq_10.referred_bookings
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
- ) subq_2
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS booking__paid_at__extract_dow
+ , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
GROUP BY
metric_time__day
- ) subq_3
- ) subq_4
+ ) subq_12
+ ) subq_13
FULL OUTER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_8.metric_time__day
- , subq_8.bookings
+ subq_17.metric_time__day
+ , subq_17.bookings
FROM (
-- Aggregate Measures
SELECT
- subq_7.metric_time__day
- , SUM(subq_7.bookings) AS bookings
+ subq_16.metric_time__day
+ , SUM(subq_16.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__day']
SELECT
- subq_6.metric_time__day
- , subq_6.bookings
+ subq_15.metric_time__day
+ , subq_15.bookings
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_5.ds__day
- , subq_5.ds__week
- , subq_5.ds__month
- , subq_5.ds__quarter
- , subq_5.ds__year
- , subq_5.ds__extract_year
- , subq_5.ds__extract_quarter
- , subq_5.ds__extract_month
- , subq_5.ds__extract_day
- , subq_5.ds__extract_dow
- , subq_5.ds__extract_doy
- , subq_5.ds_partitioned__day
- , subq_5.ds_partitioned__week
- , subq_5.ds_partitioned__month
- , subq_5.ds_partitioned__quarter
- , subq_5.ds_partitioned__year
- , subq_5.ds_partitioned__extract_year
- , subq_5.ds_partitioned__extract_quarter
- , subq_5.ds_partitioned__extract_month
- , subq_5.ds_partitioned__extract_day
- , subq_5.ds_partitioned__extract_dow
- , subq_5.ds_partitioned__extract_doy
- , subq_5.paid_at__day
- , subq_5.paid_at__week
- , subq_5.paid_at__month
- , subq_5.paid_at__quarter
- , subq_5.paid_at__year
- , subq_5.paid_at__extract_year
- , subq_5.paid_at__extract_quarter
- , subq_5.paid_at__extract_month
- , subq_5.paid_at__extract_day
- , subq_5.paid_at__extract_dow
- , subq_5.paid_at__extract_doy
- , subq_5.booking__ds__day
- , subq_5.booking__ds__week
- , subq_5.booking__ds__month
- , subq_5.booking__ds__quarter
- , subq_5.booking__ds__year
- , subq_5.booking__ds__extract_year
- , subq_5.booking__ds__extract_quarter
- , subq_5.booking__ds__extract_month
- , subq_5.booking__ds__extract_day
- , subq_5.booking__ds__extract_dow
- , subq_5.booking__ds__extract_doy
- , subq_5.booking__ds_partitioned__day
- , subq_5.booking__ds_partitioned__week
- , subq_5.booking__ds_partitioned__month
- , subq_5.booking__ds_partitioned__quarter
- , subq_5.booking__ds_partitioned__year
- , subq_5.booking__ds_partitioned__extract_year
- , subq_5.booking__ds_partitioned__extract_quarter
- , subq_5.booking__ds_partitioned__extract_month
- , subq_5.booking__ds_partitioned__extract_day
- , subq_5.booking__ds_partitioned__extract_dow
- , subq_5.booking__ds_partitioned__extract_doy
- , subq_5.booking__paid_at__day
- , subq_5.booking__paid_at__week
- , subq_5.booking__paid_at__month
- , subq_5.booking__paid_at__quarter
- , subq_5.booking__paid_at__year
- , subq_5.booking__paid_at__extract_year
- , subq_5.booking__paid_at__extract_quarter
- , subq_5.booking__paid_at__extract_month
- , subq_5.booking__paid_at__extract_day
- , subq_5.booking__paid_at__extract_dow
- , subq_5.booking__paid_at__extract_doy
- , subq_5.ds__day AS metric_time__day
- , subq_5.ds__week AS metric_time__week
- , subq_5.ds__month AS metric_time__month
- , subq_5.ds__quarter AS metric_time__quarter
- , subq_5.ds__year AS metric_time__year
- , subq_5.ds__extract_year AS metric_time__extract_year
- , subq_5.ds__extract_quarter AS metric_time__extract_quarter
- , subq_5.ds__extract_month AS metric_time__extract_month
- , subq_5.ds__extract_day AS metric_time__extract_day
- , subq_5.ds__extract_dow AS metric_time__extract_dow
- , subq_5.ds__extract_doy AS metric_time__extract_doy
- , subq_5.listing
- , subq_5.guest
- , subq_5.host
- , subq_5.booking__listing
- , subq_5.booking__guest
- , subq_5.booking__host
- , subq_5.is_instant
- , subq_5.booking__is_instant
- , subq_5.bookings
- , subq_5.instant_bookings
- , subq_5.booking_value
- , subq_5.max_booking_value
- , subq_5.min_booking_value
- , subq_5.bookers
- , subq_5.average_booking_value
- , subq_5.referred_bookings
- , subq_5.median_booking_value
- , subq_5.booking_value_p99
- , subq_5.discrete_booking_value_p99
- , subq_5.approximate_continuous_booking_value_p99
- , subq_5.approximate_discrete_booking_value_p99
+ subq_14.ds__day
+ , subq_14.ds__week
+ , subq_14.ds__month
+ , subq_14.ds__quarter
+ , subq_14.ds__year
+ , subq_14.ds__extract_year
+ , subq_14.ds__extract_quarter
+ , subq_14.ds__extract_month
+ , subq_14.ds__extract_day
+ , subq_14.ds__extract_dow
+ , subq_14.ds__extract_doy
+ , subq_14.ds_partitioned__day
+ , subq_14.ds_partitioned__week
+ , subq_14.ds_partitioned__month
+ , subq_14.ds_partitioned__quarter
+ , subq_14.ds_partitioned__year
+ , subq_14.ds_partitioned__extract_year
+ , subq_14.ds_partitioned__extract_quarter
+ , subq_14.ds_partitioned__extract_month
+ , subq_14.ds_partitioned__extract_day
+ , subq_14.ds_partitioned__extract_dow
+ , subq_14.ds_partitioned__extract_doy
+ , subq_14.paid_at__day
+ , subq_14.paid_at__week
+ , subq_14.paid_at__month
+ , subq_14.paid_at__quarter
+ , subq_14.paid_at__year
+ , subq_14.paid_at__extract_year
+ , subq_14.paid_at__extract_quarter
+ , subq_14.paid_at__extract_month
+ , subq_14.paid_at__extract_day
+ , subq_14.paid_at__extract_dow
+ , subq_14.paid_at__extract_doy
+ , subq_14.booking__ds__day
+ , subq_14.booking__ds__week
+ , subq_14.booking__ds__month
+ , subq_14.booking__ds__quarter
+ , subq_14.booking__ds__year
+ , subq_14.booking__ds__extract_year
+ , subq_14.booking__ds__extract_quarter
+ , subq_14.booking__ds__extract_month
+ , subq_14.booking__ds__extract_day
+ , subq_14.booking__ds__extract_dow
+ , subq_14.booking__ds__extract_doy
+ , subq_14.booking__ds_partitioned__day
+ , subq_14.booking__ds_partitioned__week
+ , subq_14.booking__ds_partitioned__month
+ , subq_14.booking__ds_partitioned__quarter
+ , subq_14.booking__ds_partitioned__year
+ , subq_14.booking__ds_partitioned__extract_year
+ , subq_14.booking__ds_partitioned__extract_quarter
+ , subq_14.booking__ds_partitioned__extract_month
+ , subq_14.booking__ds_partitioned__extract_day
+ , subq_14.booking__ds_partitioned__extract_dow
+ , subq_14.booking__ds_partitioned__extract_doy
+ , subq_14.booking__paid_at__day
+ , subq_14.booking__paid_at__week
+ , subq_14.booking__paid_at__month
+ , subq_14.booking__paid_at__quarter
+ , subq_14.booking__paid_at__year
+ , subq_14.booking__paid_at__extract_year
+ , subq_14.booking__paid_at__extract_quarter
+ , subq_14.booking__paid_at__extract_month
+ , subq_14.booking__paid_at__extract_day
+ , subq_14.booking__paid_at__extract_dow
+ , subq_14.booking__paid_at__extract_doy
+ , subq_14.ds__day AS metric_time__day
+ , subq_14.ds__week AS metric_time__week
+ , subq_14.ds__month AS metric_time__month
+ , subq_14.ds__quarter AS metric_time__quarter
+ , subq_14.ds__year AS metric_time__year
+ , subq_14.ds__extract_year AS metric_time__extract_year
+ , subq_14.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_14.ds__extract_month AS metric_time__extract_month
+ , subq_14.ds__extract_day AS metric_time__extract_day
+ , subq_14.ds__extract_dow AS metric_time__extract_dow
+ , subq_14.ds__extract_doy AS metric_time__extract_doy
+ , subq_14.listing
+ , subq_14.guest
+ , subq_14.host
+ , subq_14.booking__listing
+ , subq_14.booking__guest
+ , subq_14.booking__host
+ , subq_14.is_instant
+ , subq_14.booking__is_instant
+ , subq_14.bookings
+ , subq_14.instant_bookings
+ , subq_14.booking_value
+ , subq_14.max_booking_value
+ , subq_14.min_booking_value
+ , subq_14.bookers
+ , subq_14.average_booking_value
+ , subq_14.referred_bookings
+ , subq_14.median_booking_value
+ , subq_14.booking_value_p99
+ , subq_14.discrete_booking_value_p99
+ , subq_14.approximate_continuous_booking_value_p99
+ , subq_14.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_5
- ) subq_6
- ) subq_7
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS booking__paid_at__extract_dow
+ , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_14
+ ) subq_15
+ ) subq_16
GROUP BY
metric_time__day
- ) subq_8
- ) subq_9
+ ) subq_17
+ ) subq_18
ON
- subq_4.metric_time__day = subq_9.metric_time__day
+ subq_13.metric_time__day = subq_18.metric_time__day
GROUP BY
metric_time__day
- ) subq_10
- ) subq_11
+ ) subq_19
+ ) subq_20
FULL OUTER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_15.metric_time__day
- , subq_15.instant_bookings AS instant
+ subq_24.metric_time__day
+ , subq_24.instant_bookings AS instant
FROM (
-- Aggregate Measures
SELECT
- subq_14.metric_time__day
- , SUM(subq_14.instant_bookings) AS instant_bookings
+ subq_23.metric_time__day
+ , SUM(subq_23.instant_bookings) AS instant_bookings
FROM (
-- Pass Only Elements: ['instant_bookings', 'metric_time__day']
SELECT
- subq_13.metric_time__day
- , subq_13.instant_bookings
+ subq_22.metric_time__day
+ , subq_22.instant_bookings
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_12.ds__day
- , subq_12.ds__week
- , subq_12.ds__month
- , subq_12.ds__quarter
- , subq_12.ds__year
- , subq_12.ds__extract_year
- , subq_12.ds__extract_quarter
- , subq_12.ds__extract_month
- , subq_12.ds__extract_day
- , subq_12.ds__extract_dow
- , subq_12.ds__extract_doy
- , subq_12.ds_partitioned__day
- , subq_12.ds_partitioned__week
- , subq_12.ds_partitioned__month
- , subq_12.ds_partitioned__quarter
- , subq_12.ds_partitioned__year
- , subq_12.ds_partitioned__extract_year
- , subq_12.ds_partitioned__extract_quarter
- , subq_12.ds_partitioned__extract_month
- , subq_12.ds_partitioned__extract_day
- , subq_12.ds_partitioned__extract_dow
- , subq_12.ds_partitioned__extract_doy
- , subq_12.paid_at__day
- , subq_12.paid_at__week
- , subq_12.paid_at__month
- , subq_12.paid_at__quarter
- , subq_12.paid_at__year
- , subq_12.paid_at__extract_year
- , subq_12.paid_at__extract_quarter
- , subq_12.paid_at__extract_month
- , subq_12.paid_at__extract_day
- , subq_12.paid_at__extract_dow
- , subq_12.paid_at__extract_doy
- , subq_12.booking__ds__day
- , subq_12.booking__ds__week
- , subq_12.booking__ds__month
- , subq_12.booking__ds__quarter
- , subq_12.booking__ds__year
- , subq_12.booking__ds__extract_year
- , subq_12.booking__ds__extract_quarter
- , subq_12.booking__ds__extract_month
- , subq_12.booking__ds__extract_day
- , subq_12.booking__ds__extract_dow
- , subq_12.booking__ds__extract_doy
- , subq_12.booking__ds_partitioned__day
- , subq_12.booking__ds_partitioned__week
- , subq_12.booking__ds_partitioned__month
- , subq_12.booking__ds_partitioned__quarter
- , subq_12.booking__ds_partitioned__year
- , subq_12.booking__ds_partitioned__extract_year
- , subq_12.booking__ds_partitioned__extract_quarter
- , subq_12.booking__ds_partitioned__extract_month
- , subq_12.booking__ds_partitioned__extract_day
- , subq_12.booking__ds_partitioned__extract_dow
- , subq_12.booking__ds_partitioned__extract_doy
- , subq_12.booking__paid_at__day
- , subq_12.booking__paid_at__week
- , subq_12.booking__paid_at__month
- , subq_12.booking__paid_at__quarter
- , subq_12.booking__paid_at__year
- , subq_12.booking__paid_at__extract_year
- , subq_12.booking__paid_at__extract_quarter
- , subq_12.booking__paid_at__extract_month
- , subq_12.booking__paid_at__extract_day
- , subq_12.booking__paid_at__extract_dow
- , subq_12.booking__paid_at__extract_doy
- , subq_12.ds__day AS metric_time__day
- , subq_12.ds__week AS metric_time__week
- , subq_12.ds__month AS metric_time__month
- , subq_12.ds__quarter AS metric_time__quarter
- , subq_12.ds__year AS metric_time__year
- , subq_12.ds__extract_year AS metric_time__extract_year
- , subq_12.ds__extract_quarter AS metric_time__extract_quarter
- , subq_12.ds__extract_month AS metric_time__extract_month
- , subq_12.ds__extract_day AS metric_time__extract_day
- , subq_12.ds__extract_dow AS metric_time__extract_dow
- , subq_12.ds__extract_doy AS metric_time__extract_doy
- , subq_12.listing
- , subq_12.guest
- , subq_12.host
- , subq_12.booking__listing
- , subq_12.booking__guest
- , subq_12.booking__host
- , subq_12.is_instant
- , subq_12.booking__is_instant
- , subq_12.bookings
- , subq_12.instant_bookings
- , subq_12.booking_value
- , subq_12.max_booking_value
- , subq_12.min_booking_value
- , subq_12.bookers
- , subq_12.average_booking_value
- , subq_12.referred_bookings
- , subq_12.median_booking_value
- , subq_12.booking_value_p99
- , subq_12.discrete_booking_value_p99
- , subq_12.approximate_continuous_booking_value_p99
- , subq_12.approximate_discrete_booking_value_p99
+ subq_21.ds__day
+ , subq_21.ds__week
+ , subq_21.ds__month
+ , subq_21.ds__quarter
+ , subq_21.ds__year
+ , subq_21.ds__extract_year
+ , subq_21.ds__extract_quarter
+ , subq_21.ds__extract_month
+ , subq_21.ds__extract_day
+ , subq_21.ds__extract_dow
+ , subq_21.ds__extract_doy
+ , subq_21.ds_partitioned__day
+ , subq_21.ds_partitioned__week
+ , subq_21.ds_partitioned__month
+ , subq_21.ds_partitioned__quarter
+ , subq_21.ds_partitioned__year
+ , subq_21.ds_partitioned__extract_year
+ , subq_21.ds_partitioned__extract_quarter
+ , subq_21.ds_partitioned__extract_month
+ , subq_21.ds_partitioned__extract_day
+ , subq_21.ds_partitioned__extract_dow
+ , subq_21.ds_partitioned__extract_doy
+ , subq_21.paid_at__day
+ , subq_21.paid_at__week
+ , subq_21.paid_at__month
+ , subq_21.paid_at__quarter
+ , subq_21.paid_at__year
+ , subq_21.paid_at__extract_year
+ , subq_21.paid_at__extract_quarter
+ , subq_21.paid_at__extract_month
+ , subq_21.paid_at__extract_day
+ , subq_21.paid_at__extract_dow
+ , subq_21.paid_at__extract_doy
+ , subq_21.booking__ds__day
+ , subq_21.booking__ds__week
+ , subq_21.booking__ds__month
+ , subq_21.booking__ds__quarter
+ , subq_21.booking__ds__year
+ , subq_21.booking__ds__extract_year
+ , subq_21.booking__ds__extract_quarter
+ , subq_21.booking__ds__extract_month
+ , subq_21.booking__ds__extract_day
+ , subq_21.booking__ds__extract_dow
+ , subq_21.booking__ds__extract_doy
+ , subq_21.booking__ds_partitioned__day
+ , subq_21.booking__ds_partitioned__week
+ , subq_21.booking__ds_partitioned__month
+ , subq_21.booking__ds_partitioned__quarter
+ , subq_21.booking__ds_partitioned__year
+ , subq_21.booking__ds_partitioned__extract_year
+ , subq_21.booking__ds_partitioned__extract_quarter
+ , subq_21.booking__ds_partitioned__extract_month
+ , subq_21.booking__ds_partitioned__extract_day
+ , subq_21.booking__ds_partitioned__extract_dow
+ , subq_21.booking__ds_partitioned__extract_doy
+ , subq_21.booking__paid_at__day
+ , subq_21.booking__paid_at__week
+ , subq_21.booking__paid_at__month
+ , subq_21.booking__paid_at__quarter
+ , subq_21.booking__paid_at__year
+ , subq_21.booking__paid_at__extract_year
+ , subq_21.booking__paid_at__extract_quarter
+ , subq_21.booking__paid_at__extract_month
+ , subq_21.booking__paid_at__extract_day
+ , subq_21.booking__paid_at__extract_dow
+ , subq_21.booking__paid_at__extract_doy
+ , subq_21.ds__day AS metric_time__day
+ , subq_21.ds__week AS metric_time__week
+ , subq_21.ds__month AS metric_time__month
+ , subq_21.ds__quarter AS metric_time__quarter
+ , subq_21.ds__year AS metric_time__year
+ , subq_21.ds__extract_year AS metric_time__extract_year
+ , subq_21.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_21.ds__extract_month AS metric_time__extract_month
+ , subq_21.ds__extract_day AS metric_time__extract_day
+ , subq_21.ds__extract_dow AS metric_time__extract_dow
+ , subq_21.ds__extract_doy AS metric_time__extract_doy
+ , subq_21.listing
+ , subq_21.guest
+ , subq_21.host
+ , subq_21.booking__listing
+ , subq_21.booking__guest
+ , subq_21.booking__host
+ , subq_21.is_instant
+ , subq_21.booking__is_instant
+ , subq_21.bookings
+ , subq_21.instant_bookings
+ , subq_21.booking_value
+ , subq_21.max_booking_value
+ , subq_21.min_booking_value
+ , subq_21.bookers
+ , subq_21.average_booking_value
+ , subq_21.referred_bookings
+ , subq_21.median_booking_value
+ , subq_21.booking_value_p99
+ , subq_21.discrete_booking_value_p99
+ , subq_21.approximate_continuous_booking_value_p99
+ , subq_21.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_12
- ) subq_13
- ) subq_14
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS booking__paid_at__extract_dow
+ , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_21
+ ) subq_22
+ ) subq_23
GROUP BY
metric_time__day
- ) subq_15
- ) subq_16
+ ) subq_24
+ ) subq_25
ON
- subq_11.metric_time__day = subq_16.metric_time__day
+ subq_20.metric_time__day = subq_25.metric_time__day
FULL OUTER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_20.metric_time__day
- , subq_20.bookings
+ subq_29.metric_time__day
+ , subq_29.bookings
FROM (
-- Aggregate Measures
SELECT
- subq_19.metric_time__day
- , SUM(subq_19.bookings) AS bookings
+ subq_28.metric_time__day
+ , SUM(subq_28.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__day']
SELECT
- subq_18.metric_time__day
- , subq_18.bookings
+ subq_27.metric_time__day
+ , subq_27.bookings
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_17.ds__day
- , subq_17.ds__week
- , subq_17.ds__month
- , subq_17.ds__quarter
- , subq_17.ds__year
- , subq_17.ds__extract_year
- , subq_17.ds__extract_quarter
- , subq_17.ds__extract_month
- , subq_17.ds__extract_day
- , subq_17.ds__extract_dow
- , subq_17.ds__extract_doy
- , subq_17.ds_partitioned__day
- , subq_17.ds_partitioned__week
- , subq_17.ds_partitioned__month
- , subq_17.ds_partitioned__quarter
- , subq_17.ds_partitioned__year
- , subq_17.ds_partitioned__extract_year
- , subq_17.ds_partitioned__extract_quarter
- , subq_17.ds_partitioned__extract_month
- , subq_17.ds_partitioned__extract_day
- , subq_17.ds_partitioned__extract_dow
- , subq_17.ds_partitioned__extract_doy
- , subq_17.paid_at__day
- , subq_17.paid_at__week
- , subq_17.paid_at__month
- , subq_17.paid_at__quarter
- , subq_17.paid_at__year
- , subq_17.paid_at__extract_year
- , subq_17.paid_at__extract_quarter
- , subq_17.paid_at__extract_month
- , subq_17.paid_at__extract_day
- , subq_17.paid_at__extract_dow
- , subq_17.paid_at__extract_doy
- , subq_17.booking__ds__day
- , subq_17.booking__ds__week
- , subq_17.booking__ds__month
- , subq_17.booking__ds__quarter
- , subq_17.booking__ds__year
- , subq_17.booking__ds__extract_year
- , subq_17.booking__ds__extract_quarter
- , subq_17.booking__ds__extract_month
- , subq_17.booking__ds__extract_day
- , subq_17.booking__ds__extract_dow
- , subq_17.booking__ds__extract_doy
- , subq_17.booking__ds_partitioned__day
- , subq_17.booking__ds_partitioned__week
- , subq_17.booking__ds_partitioned__month
- , subq_17.booking__ds_partitioned__quarter
- , subq_17.booking__ds_partitioned__year
- , subq_17.booking__ds_partitioned__extract_year
- , subq_17.booking__ds_partitioned__extract_quarter
- , subq_17.booking__ds_partitioned__extract_month
- , subq_17.booking__ds_partitioned__extract_day
- , subq_17.booking__ds_partitioned__extract_dow
- , subq_17.booking__ds_partitioned__extract_doy
- , subq_17.booking__paid_at__day
- , subq_17.booking__paid_at__week
- , subq_17.booking__paid_at__month
- , subq_17.booking__paid_at__quarter
- , subq_17.booking__paid_at__year
- , subq_17.booking__paid_at__extract_year
- , subq_17.booking__paid_at__extract_quarter
- , subq_17.booking__paid_at__extract_month
- , subq_17.booking__paid_at__extract_day
- , subq_17.booking__paid_at__extract_dow
- , subq_17.booking__paid_at__extract_doy
- , subq_17.ds__day AS metric_time__day
- , subq_17.ds__week AS metric_time__week
- , subq_17.ds__month AS metric_time__month
- , subq_17.ds__quarter AS metric_time__quarter
- , subq_17.ds__year AS metric_time__year
- , subq_17.ds__extract_year AS metric_time__extract_year
- , subq_17.ds__extract_quarter AS metric_time__extract_quarter
- , subq_17.ds__extract_month AS metric_time__extract_month
- , subq_17.ds__extract_day AS metric_time__extract_day
- , subq_17.ds__extract_dow AS metric_time__extract_dow
- , subq_17.ds__extract_doy AS metric_time__extract_doy
- , subq_17.listing
- , subq_17.guest
- , subq_17.host
- , subq_17.booking__listing
- , subq_17.booking__guest
- , subq_17.booking__host
- , subq_17.is_instant
- , subq_17.booking__is_instant
- , subq_17.bookings
- , subq_17.instant_bookings
- , subq_17.booking_value
- , subq_17.max_booking_value
- , subq_17.min_booking_value
- , subq_17.bookers
- , subq_17.average_booking_value
- , subq_17.referred_bookings
- , subq_17.median_booking_value
- , subq_17.booking_value_p99
- , subq_17.discrete_booking_value_p99
- , subq_17.approximate_continuous_booking_value_p99
- , subq_17.approximate_discrete_booking_value_p99
+ subq_26.ds__day
+ , subq_26.ds__week
+ , subq_26.ds__month
+ , subq_26.ds__quarter
+ , subq_26.ds__year
+ , subq_26.ds__extract_year
+ , subq_26.ds__extract_quarter
+ , subq_26.ds__extract_month
+ , subq_26.ds__extract_day
+ , subq_26.ds__extract_dow
+ , subq_26.ds__extract_doy
+ , subq_26.ds_partitioned__day
+ , subq_26.ds_partitioned__week
+ , subq_26.ds_partitioned__month
+ , subq_26.ds_partitioned__quarter
+ , subq_26.ds_partitioned__year
+ , subq_26.ds_partitioned__extract_year
+ , subq_26.ds_partitioned__extract_quarter
+ , subq_26.ds_partitioned__extract_month
+ , subq_26.ds_partitioned__extract_day
+ , subq_26.ds_partitioned__extract_dow
+ , subq_26.ds_partitioned__extract_doy
+ , subq_26.paid_at__day
+ , subq_26.paid_at__week
+ , subq_26.paid_at__month
+ , subq_26.paid_at__quarter
+ , subq_26.paid_at__year
+ , subq_26.paid_at__extract_year
+ , subq_26.paid_at__extract_quarter
+ , subq_26.paid_at__extract_month
+ , subq_26.paid_at__extract_day
+ , subq_26.paid_at__extract_dow
+ , subq_26.paid_at__extract_doy
+ , subq_26.booking__ds__day
+ , subq_26.booking__ds__week
+ , subq_26.booking__ds__month
+ , subq_26.booking__ds__quarter
+ , subq_26.booking__ds__year
+ , subq_26.booking__ds__extract_year
+ , subq_26.booking__ds__extract_quarter
+ , subq_26.booking__ds__extract_month
+ , subq_26.booking__ds__extract_day
+ , subq_26.booking__ds__extract_dow
+ , subq_26.booking__ds__extract_doy
+ , subq_26.booking__ds_partitioned__day
+ , subq_26.booking__ds_partitioned__week
+ , subq_26.booking__ds_partitioned__month
+ , subq_26.booking__ds_partitioned__quarter
+ , subq_26.booking__ds_partitioned__year
+ , subq_26.booking__ds_partitioned__extract_year
+ , subq_26.booking__ds_partitioned__extract_quarter
+ , subq_26.booking__ds_partitioned__extract_month
+ , subq_26.booking__ds_partitioned__extract_day
+ , subq_26.booking__ds_partitioned__extract_dow
+ , subq_26.booking__ds_partitioned__extract_doy
+ , subq_26.booking__paid_at__day
+ , subq_26.booking__paid_at__week
+ , subq_26.booking__paid_at__month
+ , subq_26.booking__paid_at__quarter
+ , subq_26.booking__paid_at__year
+ , subq_26.booking__paid_at__extract_year
+ , subq_26.booking__paid_at__extract_quarter
+ , subq_26.booking__paid_at__extract_month
+ , subq_26.booking__paid_at__extract_day
+ , subq_26.booking__paid_at__extract_dow
+ , subq_26.booking__paid_at__extract_doy
+ , subq_26.ds__day AS metric_time__day
+ , subq_26.ds__week AS metric_time__week
+ , subq_26.ds__month AS metric_time__month
+ , subq_26.ds__quarter AS metric_time__quarter
+ , subq_26.ds__year AS metric_time__year
+ , subq_26.ds__extract_year AS metric_time__extract_year
+ , subq_26.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_26.ds__extract_month AS metric_time__extract_month
+ , subq_26.ds__extract_day AS metric_time__extract_day
+ , subq_26.ds__extract_dow AS metric_time__extract_dow
+ , subq_26.ds__extract_doy AS metric_time__extract_doy
+ , subq_26.listing
+ , subq_26.guest
+ , subq_26.host
+ , subq_26.booking__listing
+ , subq_26.booking__guest
+ , subq_26.booking__host
+ , subq_26.is_instant
+ , subq_26.booking__is_instant
+ , subq_26.bookings
+ , subq_26.instant_bookings
+ , subq_26.booking_value
+ , subq_26.max_booking_value
+ , subq_26.min_booking_value
+ , subq_26.bookers
+ , subq_26.average_booking_value
+ , subq_26.referred_bookings
+ , subq_26.median_booking_value
+ , subq_26.booking_value_p99
+ , subq_26.discrete_booking_value_p99
+ , subq_26.approximate_continuous_booking_value_p99
+ , subq_26.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_17
- ) subq_18
- ) subq_19
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS booking__paid_at__extract_dow
+ , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_26
+ ) subq_27
+ ) subq_28
GROUP BY
metric_time__day
- ) subq_20
- ) subq_21
+ ) subq_29
+ ) subq_30
ON
- COALESCE(subq_11.metric_time__day, subq_16.metric_time__day) = subq_21.metric_time__day
+ COALESCE(subq_20.metric_time__day, subq_25.metric_time__day) = subq_30.metric_time__day
GROUP BY
metric_time__day
-) subq_22
+) subq_31
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_derived_metric__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_derived_metric__plan0_optimized.sql
index 01e8970931..b8c118ace3 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_derived_metric__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_derived_metric__plan0_optimized.sql
@@ -5,10 +5,10 @@ SELECT
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_34.metric_time__day, subq_39.metric_time__day, subq_44.metric_time__day) AS metric_time__day
- , MAX(subq_34.non_referred) AS non_referred
- , MAX(subq_39.instant) AS instant
- , MAX(subq_44.bookings) AS bookings
+ COALESCE(subq_43.metric_time__day, subq_48.metric_time__day, subq_53.metric_time__day) AS metric_time__day
+ , MAX(subq_43.non_referred) AS non_referred
+ , MAX(subq_48.instant) AS instant
+ , MAX(subq_53.bookings) AS bookings
FROM (
-- Compute Metrics via Expressions
SELECT
@@ -17,9 +17,9 @@ FROM (
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_27.metric_time__day, subq_32.metric_time__day) AS metric_time__day
- , MAX(subq_27.ref_bookings) AS ref_bookings
- , MAX(subq_32.bookings) AS bookings
+ COALESCE(subq_36.metric_time__day, subq_41.metric_time__day) AS metric_time__day
+ , MAX(subq_36.ref_bookings) AS ref_bookings
+ , MAX(subq_41.bookings) AS bookings
FROM (
-- Aggregate Measures
-- Compute Metrics via Expressions
@@ -33,11 +33,11 @@ FROM (
SELECT
DATE_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_28001
- ) subq_25
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_34
GROUP BY
metric_time__day
- ) subq_27
+ ) subq_36
FULL OUTER JOIN (
-- Aggregate Measures
-- Compute Metrics via Expressions
@@ -51,17 +51,17 @@ FROM (
SELECT
DATE_TRUNC(ds, day) AS metric_time__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_30
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_39
GROUP BY
metric_time__day
- ) subq_32
+ ) subq_41
ON
- subq_27.metric_time__day = subq_32.metric_time__day
+ subq_36.metric_time__day = subq_41.metric_time__day
GROUP BY
metric_time__day
- ) subq_33
- ) subq_34
+ ) subq_42
+ ) subq_43
FULL OUTER JOIN (
-- Aggregate Measures
-- Compute Metrics via Expressions
@@ -75,13 +75,13 @@ FROM (
SELECT
DATE_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_28001
- ) subq_37
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_46
GROUP BY
metric_time__day
- ) subq_39
+ ) subq_48
ON
- subq_34.metric_time__day = subq_39.metric_time__day
+ subq_43.metric_time__day = subq_48.metric_time__day
FULL OUTER JOIN (
-- Aggregate Measures
-- Compute Metrics via Expressions
@@ -95,13 +95,13 @@ FROM (
SELECT
DATE_TRUNC(ds, day) AS metric_time__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_42
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_51
GROUP BY
metric_time__day
- ) subq_44
+ ) subq_53
ON
- COALESCE(subq_34.metric_time__day, subq_39.metric_time__day) = subq_44.metric_time__day
+ COALESCE(subq_43.metric_time__day, subq_48.metric_time__day) = subq_53.metric_time__day
GROUP BY
metric_time__day
-) subq_45
+) subq_54
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0.sql
index 679f1017aa..2e7af726e6 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0.sql
@@ -1,359 +1,359 @@
-- Compute Metrics via Expressions
SELECT
- subq_13.metric_time__day
+ subq_22.metric_time__day
, 2 * bookings_offset_once AS bookings_offset_twice
FROM (
-- Pass Only Elements: ['metric_time__day', 'bookings_offset_once']
SELECT
- subq_12.metric_time__day
- , subq_12.bookings_offset_once
+ subq_21.metric_time__day
+ , subq_21.bookings_offset_once
FROM (
-- Constrain Output with WHERE
SELECT
- subq_11.metric_time__day
- , subq_11.booking__is_instant
- , subq_11.bookings_offset_once
+ subq_20.metric_time__day
+ , subq_20.booking__is_instant
+ , subq_20.bookings_offset_once
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_9.metric_time__day AS metric_time__day
- , subq_8.booking__is_instant AS booking__is_instant
- , subq_8.bookings_offset_once AS bookings_offset_once
+ subq_18.metric_time__day AS metric_time__day
+ , subq_17.booking__is_instant AS booking__is_instant
+ , subq_17.bookings_offset_once AS bookings_offset_once
FROM (
-- Time Spine
SELECT
- subq_10.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_10
- ) subq_9
+ subq_19.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_19
+ ) subq_18
INNER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_7.metric_time__day
- , subq_7.booking__is_instant
+ subq_16.metric_time__day
+ , subq_16.booking__is_instant
, 2 * bookings AS bookings_offset_once
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_6.metric_time__day
- , subq_6.booking__is_instant
- , subq_6.bookings
+ subq_15.metric_time__day
+ , subq_15.booking__is_instant
+ , subq_15.bookings
FROM (
-- Aggregate Measures
SELECT
- subq_5.metric_time__day
- , subq_5.booking__is_instant
- , SUM(subq_5.bookings) AS bookings
+ subq_14.metric_time__day
+ , subq_14.booking__is_instant
+ , SUM(subq_14.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day']
SELECT
- subq_4.metric_time__day
- , subq_4.booking__is_instant
- , subq_4.bookings
+ subq_13.metric_time__day
+ , subq_13.booking__is_instant
+ , subq_13.bookings
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_2.metric_time__day AS metric_time__day
- , subq_1.ds__day AS ds__day
- , subq_1.ds__week AS ds__week
- , subq_1.ds__month AS ds__month
- , subq_1.ds__quarter AS ds__quarter
- , subq_1.ds__year AS ds__year
- , subq_1.ds__extract_year AS ds__extract_year
- , subq_1.ds__extract_quarter AS ds__extract_quarter
- , subq_1.ds__extract_month AS ds__extract_month
- , subq_1.ds__extract_day AS ds__extract_day
- , subq_1.ds__extract_dow AS ds__extract_dow
- , subq_1.ds__extract_doy AS ds__extract_doy
- , subq_1.ds_partitioned__day AS ds_partitioned__day
- , subq_1.ds_partitioned__week AS ds_partitioned__week
- , subq_1.ds_partitioned__month AS ds_partitioned__month
- , subq_1.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_1.ds_partitioned__year AS ds_partitioned__year
- , subq_1.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_1.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_1.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_1.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_1.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_1.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_1.paid_at__day AS paid_at__day
- , subq_1.paid_at__week AS paid_at__week
- , subq_1.paid_at__month AS paid_at__month
- , subq_1.paid_at__quarter AS paid_at__quarter
- , subq_1.paid_at__year AS paid_at__year
- , subq_1.paid_at__extract_year AS paid_at__extract_year
- , subq_1.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_1.paid_at__extract_month AS paid_at__extract_month
- , subq_1.paid_at__extract_day AS paid_at__extract_day
- , subq_1.paid_at__extract_dow AS paid_at__extract_dow
- , subq_1.paid_at__extract_doy AS paid_at__extract_doy
- , subq_1.booking__ds__day AS booking__ds__day
- , subq_1.booking__ds__week AS booking__ds__week
- , subq_1.booking__ds__month AS booking__ds__month
- , subq_1.booking__ds__quarter AS booking__ds__quarter
- , subq_1.booking__ds__year AS booking__ds__year
- , subq_1.booking__ds__extract_year AS booking__ds__extract_year
- , subq_1.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_1.booking__ds__extract_month AS booking__ds__extract_month
- , subq_1.booking__ds__extract_day AS booking__ds__extract_day
- , subq_1.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_1.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_1.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_1.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_1.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_1.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_1.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_1.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_1.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_1.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_1.booking__paid_at__day AS booking__paid_at__day
- , subq_1.booking__paid_at__week AS booking__paid_at__week
- , subq_1.booking__paid_at__month AS booking__paid_at__month
- , subq_1.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_1.booking__paid_at__year AS booking__paid_at__year
- , subq_1.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_1.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_1.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_1.listing AS listing
- , subq_1.guest AS guest
- , subq_1.host AS host
- , subq_1.booking__listing AS booking__listing
- , subq_1.booking__guest AS booking__guest
- , subq_1.booking__host AS booking__host
- , subq_1.is_instant AS is_instant
- , subq_1.booking__is_instant AS booking__is_instant
- , subq_1.bookings AS bookings
- , subq_1.instant_bookings AS instant_bookings
- , subq_1.booking_value AS booking_value
- , subq_1.max_booking_value AS max_booking_value
- , subq_1.min_booking_value AS min_booking_value
- , subq_1.bookers AS bookers
- , subq_1.average_booking_value AS average_booking_value
- , subq_1.referred_bookings AS referred_bookings
- , subq_1.median_booking_value AS median_booking_value
- , subq_1.booking_value_p99 AS booking_value_p99
- , subq_1.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_1.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_1.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ subq_11.metric_time__day AS metric_time__day
+ , subq_10.ds__day AS ds__day
+ , subq_10.ds__week AS ds__week
+ , subq_10.ds__month AS ds__month
+ , subq_10.ds__quarter AS ds__quarter
+ , subq_10.ds__year AS ds__year
+ , subq_10.ds__extract_year AS ds__extract_year
+ , subq_10.ds__extract_quarter AS ds__extract_quarter
+ , subq_10.ds__extract_month AS ds__extract_month
+ , subq_10.ds__extract_day AS ds__extract_day
+ , subq_10.ds__extract_dow AS ds__extract_dow
+ , subq_10.ds__extract_doy AS ds__extract_doy
+ , subq_10.ds_partitioned__day AS ds_partitioned__day
+ , subq_10.ds_partitioned__week AS ds_partitioned__week
+ , subq_10.ds_partitioned__month AS ds_partitioned__month
+ , subq_10.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_10.ds_partitioned__year AS ds_partitioned__year
+ , subq_10.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_10.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_10.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_10.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_10.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_10.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_10.paid_at__day AS paid_at__day
+ , subq_10.paid_at__week AS paid_at__week
+ , subq_10.paid_at__month AS paid_at__month
+ , subq_10.paid_at__quarter AS paid_at__quarter
+ , subq_10.paid_at__year AS paid_at__year
+ , subq_10.paid_at__extract_year AS paid_at__extract_year
+ , subq_10.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_10.paid_at__extract_month AS paid_at__extract_month
+ , subq_10.paid_at__extract_day AS paid_at__extract_day
+ , subq_10.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_10.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_10.booking__ds__day AS booking__ds__day
+ , subq_10.booking__ds__week AS booking__ds__week
+ , subq_10.booking__ds__month AS booking__ds__month
+ , subq_10.booking__ds__quarter AS booking__ds__quarter
+ , subq_10.booking__ds__year AS booking__ds__year
+ , subq_10.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_10.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_10.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_10.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_10.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_10.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_10.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_10.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_10.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_10.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_10.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_10.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_10.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_10.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_10.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_10.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_10.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_10.booking__paid_at__day AS booking__paid_at__day
+ , subq_10.booking__paid_at__week AS booking__paid_at__week
+ , subq_10.booking__paid_at__month AS booking__paid_at__month
+ , subq_10.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_10.booking__paid_at__year AS booking__paid_at__year
+ , subq_10.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_10.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_10.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_10.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_10.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_10.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_10.listing AS listing
+ , subq_10.guest AS guest
+ , subq_10.host AS host
+ , subq_10.booking__listing AS booking__listing
+ , subq_10.booking__guest AS booking__guest
+ , subq_10.booking__host AS booking__host
+ , subq_10.is_instant AS is_instant
+ , subq_10.booking__is_instant AS booking__is_instant
+ , subq_10.bookings AS bookings
+ , subq_10.instant_bookings AS instant_bookings
+ , subq_10.booking_value AS booking_value
+ , subq_10.max_booking_value AS max_booking_value
+ , subq_10.min_booking_value AS min_booking_value
+ , subq_10.bookers AS bookers
+ , subq_10.average_booking_value AS average_booking_value
+ , subq_10.referred_bookings AS referred_bookings
+ , subq_10.median_booking_value AS median_booking_value
+ , subq_10.booking_value_p99 AS booking_value_p99
+ , subq_10.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_10.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_10.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_3.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_3
- ) subq_2
+ subq_12.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_12
+ ) subq_11
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS booking__paid_at__extract_dow
+ , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
ON
- DATE_SUB(CAST(subq_2.metric_time__day AS DATETIME), INTERVAL 5 day) = subq_1.metric_time__day
- ) subq_4
- ) subq_5
+ DATE_SUB(CAST(subq_11.metric_time__day AS DATETIME), INTERVAL 5 day) = subq_10.metric_time__day
+ ) subq_13
+ ) subq_14
GROUP BY
metric_time__day
, booking__is_instant
- ) subq_6
- ) subq_7
- ) subq_8
+ ) subq_15
+ ) subq_16
+ ) subq_17
ON
- DATE_SUB(CAST(subq_9.metric_time__day AS DATETIME), INTERVAL 2 day) = subq_8.metric_time__day
- ) subq_11
+ DATE_SUB(CAST(subq_18.metric_time__day AS DATETIME), INTERVAL 2 day) = subq_17.metric_time__day
+ ) subq_20
WHERE booking__is_instant
- ) subq_12
-) subq_13
+ ) subq_21
+) subq_22
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0_optimized.sql
index c8d2c6d5e3..ce5f38f92c 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0_optimized.sql
@@ -11,10 +11,10 @@ FROM (
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_24.ds AS metric_time__day
- , subq_22.booking__is_instant AS booking__is_instant
- , subq_22.bookings_offset_once AS bookings_offset_once
- FROM ***************************.mf_time_spine subq_24
+ subq_33.ds AS metric_time__day
+ , subq_31.booking__is_instant AS booking__is_instant
+ , subq_31.bookings_offset_once AS bookings_offset_once
+ FROM ***************************.mf_time_spine subq_33
INNER JOIN (
-- Compute Metrics via Expressions
SELECT
@@ -27,10 +27,10 @@ FROM (
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_17.ds AS metric_time__day
- , subq_15.booking__is_instant AS booking__is_instant
- , SUM(subq_15.bookings) AS bookings
- FROM ***************************.mf_time_spine subq_17
+ subq_26.ds AS metric_time__day
+ , subq_24.booking__is_instant AS booking__is_instant
+ , SUM(subq_24.bookings) AS bookings
+ FROM ***************************.mf_time_spine subq_26
INNER JOIN (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
@@ -38,17 +38,17 @@ FROM (
DATE_TRUNC(ds, day) AS metric_time__day
, is_instant AS booking__is_instant
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_15
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_24
ON
- DATE_SUB(CAST(subq_17.ds AS DATETIME), INTERVAL 5 day) = subq_15.metric_time__day
+ DATE_SUB(CAST(subq_26.ds AS DATETIME), INTERVAL 5 day) = subq_24.metric_time__day
GROUP BY
metric_time__day
, booking__is_instant
- ) subq_21
- ) subq_22
+ ) subq_30
+ ) subq_31
ON
- DATE_SUB(CAST(subq_24.ds AS DATETIME), INTERVAL 2 day) = subq_22.metric_time__day
- ) subq_25
+ DATE_SUB(CAST(subq_33.ds AS DATETIME), INTERVAL 2 day) = subq_31.metric_time__day
+ ) subq_34
WHERE booking__is_instant
-) subq_27
+) subq_36
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0.sql
index d57a33a14b..338065a058 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0.sql
@@ -1,471 +1,471 @@
-- Compute Metrics via Expressions
SELECT
- subq_15.metric_time__day
+ subq_24.metric_time__day
, booking_fees - booking_fees_start_of_month AS booking_fees_since_start_of_month
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_8.metric_time__day, subq_14.metric_time__day) AS metric_time__day
- , MAX(subq_8.booking_fees_start_of_month) AS booking_fees_start_of_month
- , MAX(subq_14.booking_fees) AS booking_fees
+ COALESCE(subq_17.metric_time__day, subq_23.metric_time__day) AS metric_time__day
+ , MAX(subq_17.booking_fees_start_of_month) AS booking_fees_start_of_month
+ , MAX(subq_23.booking_fees) AS booking_fees
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_6.metric_time__day AS metric_time__day
- , subq_5.booking_fees_start_of_month AS booking_fees_start_of_month
+ subq_15.metric_time__day AS metric_time__day
+ , subq_14.booking_fees_start_of_month AS booking_fees_start_of_month
FROM (
-- Time Spine
SELECT
- subq_7.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_7
- ) subq_6
+ subq_16.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_16
+ ) subq_15
INNER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_4.metric_time__day
+ subq_13.metric_time__day
, booking_value * 0.05 AS booking_fees_start_of_month
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_3.metric_time__day
- , subq_3.booking_value
+ subq_12.metric_time__day
+ , subq_12.booking_value
FROM (
-- Aggregate Measures
SELECT
- subq_2.metric_time__day
- , SUM(subq_2.booking_value) AS booking_value
+ subq_11.metric_time__day
+ , SUM(subq_11.booking_value) AS booking_value
FROM (
-- Pass Only Elements: ['booking_value', 'metric_time__day']
SELECT
- subq_1.metric_time__day
- , subq_1.booking_value
+ subq_10.metric_time__day
+ , subq_10.booking_value
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
- ) subq_2
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS booking__paid_at__extract_dow
+ , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
GROUP BY
metric_time__day
- ) subq_3
- ) subq_4
- ) subq_5
+ ) subq_12
+ ) subq_13
+ ) subq_14
ON
- DATE_TRUNC(subq_6.metric_time__day, month) = subq_5.metric_time__day
- ) subq_8
+ DATE_TRUNC(subq_15.metric_time__day, month) = subq_14.metric_time__day
+ ) subq_17
FULL OUTER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_13.metric_time__day
+ subq_22.metric_time__day
, booking_value * 0.05 AS booking_fees
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_12.metric_time__day
- , subq_12.booking_value
+ subq_21.metric_time__day
+ , subq_21.booking_value
FROM (
-- Aggregate Measures
SELECT
- subq_11.metric_time__day
- , SUM(subq_11.booking_value) AS booking_value
+ subq_20.metric_time__day
+ , SUM(subq_20.booking_value) AS booking_value
FROM (
-- Pass Only Elements: ['booking_value', 'metric_time__day']
SELECT
- subq_10.metric_time__day
- , subq_10.booking_value
+ subq_19.metric_time__day
+ , subq_19.booking_value
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_9.ds__day
- , subq_9.ds__week
- , subq_9.ds__month
- , subq_9.ds__quarter
- , subq_9.ds__year
- , subq_9.ds__extract_year
- , subq_9.ds__extract_quarter
- , subq_9.ds__extract_month
- , subq_9.ds__extract_day
- , subq_9.ds__extract_dow
- , subq_9.ds__extract_doy
- , subq_9.ds_partitioned__day
- , subq_9.ds_partitioned__week
- , subq_9.ds_partitioned__month
- , subq_9.ds_partitioned__quarter
- , subq_9.ds_partitioned__year
- , subq_9.ds_partitioned__extract_year
- , subq_9.ds_partitioned__extract_quarter
- , subq_9.ds_partitioned__extract_month
- , subq_9.ds_partitioned__extract_day
- , subq_9.ds_partitioned__extract_dow
- , subq_9.ds_partitioned__extract_doy
- , subq_9.paid_at__day
- , subq_9.paid_at__week
- , subq_9.paid_at__month
- , subq_9.paid_at__quarter
- , subq_9.paid_at__year
- , subq_9.paid_at__extract_year
- , subq_9.paid_at__extract_quarter
- , subq_9.paid_at__extract_month
- , subq_9.paid_at__extract_day
- , subq_9.paid_at__extract_dow
- , subq_9.paid_at__extract_doy
- , subq_9.booking__ds__day
- , subq_9.booking__ds__week
- , subq_9.booking__ds__month
- , subq_9.booking__ds__quarter
- , subq_9.booking__ds__year
- , subq_9.booking__ds__extract_year
- , subq_9.booking__ds__extract_quarter
- , subq_9.booking__ds__extract_month
- , subq_9.booking__ds__extract_day
- , subq_9.booking__ds__extract_dow
- , subq_9.booking__ds__extract_doy
- , subq_9.booking__ds_partitioned__day
- , subq_9.booking__ds_partitioned__week
- , subq_9.booking__ds_partitioned__month
- , subq_9.booking__ds_partitioned__quarter
- , subq_9.booking__ds_partitioned__year
- , subq_9.booking__ds_partitioned__extract_year
- , subq_9.booking__ds_partitioned__extract_quarter
- , subq_9.booking__ds_partitioned__extract_month
- , subq_9.booking__ds_partitioned__extract_day
- , subq_9.booking__ds_partitioned__extract_dow
- , subq_9.booking__ds_partitioned__extract_doy
- , subq_9.booking__paid_at__day
- , subq_9.booking__paid_at__week
- , subq_9.booking__paid_at__month
- , subq_9.booking__paid_at__quarter
- , subq_9.booking__paid_at__year
- , subq_9.booking__paid_at__extract_year
- , subq_9.booking__paid_at__extract_quarter
- , subq_9.booking__paid_at__extract_month
- , subq_9.booking__paid_at__extract_day
- , subq_9.booking__paid_at__extract_dow
- , subq_9.booking__paid_at__extract_doy
- , subq_9.ds__day AS metric_time__day
- , subq_9.ds__week AS metric_time__week
- , subq_9.ds__month AS metric_time__month
- , subq_9.ds__quarter AS metric_time__quarter
- , subq_9.ds__year AS metric_time__year
- , subq_9.ds__extract_year AS metric_time__extract_year
- , subq_9.ds__extract_quarter AS metric_time__extract_quarter
- , subq_9.ds__extract_month AS metric_time__extract_month
- , subq_9.ds__extract_day AS metric_time__extract_day
- , subq_9.ds__extract_dow AS metric_time__extract_dow
- , subq_9.ds__extract_doy AS metric_time__extract_doy
- , subq_9.listing
- , subq_9.guest
- , subq_9.host
- , subq_9.booking__listing
- , subq_9.booking__guest
- , subq_9.booking__host
- , subq_9.is_instant
- , subq_9.booking__is_instant
- , subq_9.bookings
- , subq_9.instant_bookings
- , subq_9.booking_value
- , subq_9.max_booking_value
- , subq_9.min_booking_value
- , subq_9.bookers
- , subq_9.average_booking_value
- , subq_9.referred_bookings
- , subq_9.median_booking_value
- , subq_9.booking_value_p99
- , subq_9.discrete_booking_value_p99
- , subq_9.approximate_continuous_booking_value_p99
- , subq_9.approximate_discrete_booking_value_p99
+ subq_18.ds__day
+ , subq_18.ds__week
+ , subq_18.ds__month
+ , subq_18.ds__quarter
+ , subq_18.ds__year
+ , subq_18.ds__extract_year
+ , subq_18.ds__extract_quarter
+ , subq_18.ds__extract_month
+ , subq_18.ds__extract_day
+ , subq_18.ds__extract_dow
+ , subq_18.ds__extract_doy
+ , subq_18.ds_partitioned__day
+ , subq_18.ds_partitioned__week
+ , subq_18.ds_partitioned__month
+ , subq_18.ds_partitioned__quarter
+ , subq_18.ds_partitioned__year
+ , subq_18.ds_partitioned__extract_year
+ , subq_18.ds_partitioned__extract_quarter
+ , subq_18.ds_partitioned__extract_month
+ , subq_18.ds_partitioned__extract_day
+ , subq_18.ds_partitioned__extract_dow
+ , subq_18.ds_partitioned__extract_doy
+ , subq_18.paid_at__day
+ , subq_18.paid_at__week
+ , subq_18.paid_at__month
+ , subq_18.paid_at__quarter
+ , subq_18.paid_at__year
+ , subq_18.paid_at__extract_year
+ , subq_18.paid_at__extract_quarter
+ , subq_18.paid_at__extract_month
+ , subq_18.paid_at__extract_day
+ , subq_18.paid_at__extract_dow
+ , subq_18.paid_at__extract_doy
+ , subq_18.booking__ds__day
+ , subq_18.booking__ds__week
+ , subq_18.booking__ds__month
+ , subq_18.booking__ds__quarter
+ , subq_18.booking__ds__year
+ , subq_18.booking__ds__extract_year
+ , subq_18.booking__ds__extract_quarter
+ , subq_18.booking__ds__extract_month
+ , subq_18.booking__ds__extract_day
+ , subq_18.booking__ds__extract_dow
+ , subq_18.booking__ds__extract_doy
+ , subq_18.booking__ds_partitioned__day
+ , subq_18.booking__ds_partitioned__week
+ , subq_18.booking__ds_partitioned__month
+ , subq_18.booking__ds_partitioned__quarter
+ , subq_18.booking__ds_partitioned__year
+ , subq_18.booking__ds_partitioned__extract_year
+ , subq_18.booking__ds_partitioned__extract_quarter
+ , subq_18.booking__ds_partitioned__extract_month
+ , subq_18.booking__ds_partitioned__extract_day
+ , subq_18.booking__ds_partitioned__extract_dow
+ , subq_18.booking__ds_partitioned__extract_doy
+ , subq_18.booking__paid_at__day
+ , subq_18.booking__paid_at__week
+ , subq_18.booking__paid_at__month
+ , subq_18.booking__paid_at__quarter
+ , subq_18.booking__paid_at__year
+ , subq_18.booking__paid_at__extract_year
+ , subq_18.booking__paid_at__extract_quarter
+ , subq_18.booking__paid_at__extract_month
+ , subq_18.booking__paid_at__extract_day
+ , subq_18.booking__paid_at__extract_dow
+ , subq_18.booking__paid_at__extract_doy
+ , subq_18.ds__day AS metric_time__day
+ , subq_18.ds__week AS metric_time__week
+ , subq_18.ds__month AS metric_time__month
+ , subq_18.ds__quarter AS metric_time__quarter
+ , subq_18.ds__year AS metric_time__year
+ , subq_18.ds__extract_year AS metric_time__extract_year
+ , subq_18.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_18.ds__extract_month AS metric_time__extract_month
+ , subq_18.ds__extract_day AS metric_time__extract_day
+ , subq_18.ds__extract_dow AS metric_time__extract_dow
+ , subq_18.ds__extract_doy AS metric_time__extract_doy
+ , subq_18.listing
+ , subq_18.guest
+ , subq_18.host
+ , subq_18.booking__listing
+ , subq_18.booking__guest
+ , subq_18.booking__host
+ , subq_18.is_instant
+ , subq_18.booking__is_instant
+ , subq_18.bookings
+ , subq_18.instant_bookings
+ , subq_18.booking_value
+ , subq_18.max_booking_value
+ , subq_18.min_booking_value
+ , subq_18.bookers
+ , subq_18.average_booking_value
+ , subq_18.referred_bookings
+ , subq_18.median_booking_value
+ , subq_18.booking_value_p99
+ , subq_18.discrete_booking_value_p99
+ , subq_18.approximate_continuous_booking_value_p99
+ , subq_18.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_9
- ) subq_10
- ) subq_11
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS booking__paid_at__extract_dow
+ , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_18
+ ) subq_19
+ ) subq_20
GROUP BY
metric_time__day
- ) subq_12
- ) subq_13
- ) subq_14
+ ) subq_21
+ ) subq_22
+ ) subq_23
ON
- subq_8.metric_time__day = subq_14.metric_time__day
+ subq_17.metric_time__day = subq_23.metric_time__day
GROUP BY
metric_time__day
-) subq_15
+) subq_24
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0_optimized.sql
index ffc76505df..8b3b69ee18 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0_optimized.sql
@@ -5,15 +5,15 @@ SELECT
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_24.metric_time__day, subq_30.metric_time__day) AS metric_time__day
- , MAX(subq_24.booking_fees_start_of_month) AS booking_fees_start_of_month
- , MAX(subq_30.booking_fees) AS booking_fees
+ COALESCE(subq_33.metric_time__day, subq_39.metric_time__day) AS metric_time__day
+ , MAX(subq_33.booking_fees_start_of_month) AS booking_fees_start_of_month
+ , MAX(subq_39.booking_fees) AS booking_fees
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_23.ds AS metric_time__day
- , subq_21.booking_fees_start_of_month AS booking_fees_start_of_month
- FROM ***************************.mf_time_spine subq_23
+ subq_32.ds AS metric_time__day
+ , subq_30.booking_fees_start_of_month AS booking_fees_start_of_month
+ FROM ***************************.mf_time_spine subq_32
INNER JOIN (
-- Compute Metrics via Expressions
SELECT
@@ -28,14 +28,14 @@ FROM (
SELECT
DATE_TRUNC(ds, day) AS metric_time__day
, SUM(booking_value) AS booking_value
- FROM ***************************.fct_bookings bookings_source_src_28001
+ FROM ***************************.fct_bookings bookings_source_src_28000
GROUP BY
metric_time__day
- ) subq_20
- ) subq_21
+ ) subq_29
+ ) subq_30
ON
- DATE_TRUNC(subq_23.ds, month) = subq_21.metric_time__day
- ) subq_24
+ DATE_TRUNC(subq_32.ds, month) = subq_30.metric_time__day
+ ) subq_33
FULL OUTER JOIN (
-- Compute Metrics via Expressions
SELECT
@@ -50,13 +50,13 @@ FROM (
SELECT
DATE_TRUNC(ds, day) AS metric_time__day
, SUM(booking_value) AS booking_value
- FROM ***************************.fct_bookings bookings_source_src_28001
+ FROM ***************************.fct_bookings bookings_source_src_28000
GROUP BY
metric_time__day
- ) subq_29
- ) subq_30
+ ) subq_38
+ ) subq_39
ON
- subq_24.metric_time__day = subq_30.metric_time__day
+ subq_33.metric_time__day = subq_39.metric_time__day
GROUP BY
metric_time__day
-) subq_31
+) subq_40
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_filters__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_filters__plan0.sql
index c3ec7a2819..8da244d87d 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_filters__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_filters__plan0.sql
@@ -8,991 +8,991 @@ FROM (
FROM (
-- Combine Aggregated Outputs
SELECT
- MAX(subq_11.average_booking_value) AS average_booking_value
- , MAX(subq_23.bookings) AS bookings
- , MAX(subq_30.booking_value) AS booking_value
+ MAX(subq_20.average_booking_value) AS average_booking_value
+ , MAX(subq_32.bookings) AS bookings
+ , MAX(subq_39.booking_value) AS booking_value
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_10.average_booking_value
+ subq_19.average_booking_value
FROM (
-- Aggregate Measures
SELECT
- AVG(subq_9.average_booking_value) AS average_booking_value
+ AVG(subq_18.average_booking_value) AS average_booking_value
FROM (
-- Pass Only Elements: ['average_booking_value',]
SELECT
- subq_8.average_booking_value
+ subq_17.average_booking_value
FROM (
-- Constrain Output with WHERE
SELECT
- subq_7.booking__is_instant
- , subq_7.listing__is_lux_latest
- , subq_7.average_booking_value
+ subq_16.booking__is_instant
+ , subq_16.listing__is_lux_latest
+ , subq_16.average_booking_value
FROM (
-- Pass Only Elements: ['average_booking_value', 'listing__is_lux_latest', 'booking__is_instant']
SELECT
- subq_6.booking__is_instant
- , subq_6.listing__is_lux_latest
- , subq_6.average_booking_value
+ subq_15.booking__is_instant
+ , subq_15.listing__is_lux_latest
+ , subq_15.average_booking_value
FROM (
-- Join Standard Outputs
SELECT
- subq_2.listing AS listing
- , subq_2.booking__is_instant AS booking__is_instant
- , subq_5.is_lux_latest AS listing__is_lux_latest
- , subq_2.average_booking_value AS average_booking_value
+ subq_11.listing AS listing
+ , subq_11.booking__is_instant AS booking__is_instant
+ , subq_14.is_lux_latest AS listing__is_lux_latest
+ , subq_11.average_booking_value AS average_booking_value
FROM (
-- Pass Only Elements: ['average_booking_value', 'booking__is_instant', 'listing']
SELECT
- subq_1.listing
- , subq_1.booking__is_instant
- , subq_1.average_booking_value
+ subq_10.listing
+ , subq_10.booking__is_instant
+ , subq_10.average_booking_value
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
- ) subq_2
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS booking__paid_at__extract_dow
+ , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
LEFT OUTER JOIN (
-- Pass Only Elements: ['is_lux_latest', 'listing']
SELECT
- subq_4.listing
- , subq_4.is_lux_latest
+ subq_13.listing
+ , subq_13.is_lux_latest
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_3.ds__day
- , subq_3.ds__week
- , subq_3.ds__month
- , subq_3.ds__quarter
- , subq_3.ds__year
- , subq_3.ds__extract_year
- , subq_3.ds__extract_quarter
- , subq_3.ds__extract_month
- , subq_3.ds__extract_day
- , subq_3.ds__extract_dow
- , subq_3.ds__extract_doy
- , subq_3.created_at__day
- , subq_3.created_at__week
- , subq_3.created_at__month
- , subq_3.created_at__quarter
- , subq_3.created_at__year
- , subq_3.created_at__extract_year
- , subq_3.created_at__extract_quarter
- , subq_3.created_at__extract_month
- , subq_3.created_at__extract_day
- , subq_3.created_at__extract_dow
- , subq_3.created_at__extract_doy
- , subq_3.listing__ds__day
- , subq_3.listing__ds__week
- , subq_3.listing__ds__month
- , subq_3.listing__ds__quarter
- , subq_3.listing__ds__year
- , subq_3.listing__ds__extract_year
- , subq_3.listing__ds__extract_quarter
- , subq_3.listing__ds__extract_month
- , subq_3.listing__ds__extract_day
- , subq_3.listing__ds__extract_dow
- , subq_3.listing__ds__extract_doy
- , subq_3.listing__created_at__day
- , subq_3.listing__created_at__week
- , subq_3.listing__created_at__month
- , subq_3.listing__created_at__quarter
- , subq_3.listing__created_at__year
- , subq_3.listing__created_at__extract_year
- , subq_3.listing__created_at__extract_quarter
- , subq_3.listing__created_at__extract_month
- , subq_3.listing__created_at__extract_day
- , subq_3.listing__created_at__extract_dow
- , subq_3.listing__created_at__extract_doy
- , subq_3.ds__day AS metric_time__day
- , subq_3.ds__week AS metric_time__week
- , subq_3.ds__month AS metric_time__month
- , subq_3.ds__quarter AS metric_time__quarter
- , subq_3.ds__year AS metric_time__year
- , subq_3.ds__extract_year AS metric_time__extract_year
- , subq_3.ds__extract_quarter AS metric_time__extract_quarter
- , subq_3.ds__extract_month AS metric_time__extract_month
- , subq_3.ds__extract_day AS metric_time__extract_day
- , subq_3.ds__extract_dow AS metric_time__extract_dow
- , subq_3.ds__extract_doy AS metric_time__extract_doy
- , subq_3.listing
- , subq_3.user
- , subq_3.listing__user
- , subq_3.country_latest
- , subq_3.is_lux_latest
- , subq_3.capacity_latest
- , subq_3.listing__country_latest
- , subq_3.listing__is_lux_latest
- , subq_3.listing__capacity_latest
- , subq_3.listings
- , subq_3.largest_listing
- , subq_3.smallest_listing
+ subq_12.ds__day
+ , subq_12.ds__week
+ , subq_12.ds__month
+ , subq_12.ds__quarter
+ , subq_12.ds__year
+ , subq_12.ds__extract_year
+ , subq_12.ds__extract_quarter
+ , subq_12.ds__extract_month
+ , subq_12.ds__extract_day
+ , subq_12.ds__extract_dow
+ , subq_12.ds__extract_doy
+ , subq_12.created_at__day
+ , subq_12.created_at__week
+ , subq_12.created_at__month
+ , subq_12.created_at__quarter
+ , subq_12.created_at__year
+ , subq_12.created_at__extract_year
+ , subq_12.created_at__extract_quarter
+ , subq_12.created_at__extract_month
+ , subq_12.created_at__extract_day
+ , subq_12.created_at__extract_dow
+ , subq_12.created_at__extract_doy
+ , subq_12.listing__ds__day
+ , subq_12.listing__ds__week
+ , subq_12.listing__ds__month
+ , subq_12.listing__ds__quarter
+ , subq_12.listing__ds__year
+ , subq_12.listing__ds__extract_year
+ , subq_12.listing__ds__extract_quarter
+ , subq_12.listing__ds__extract_month
+ , subq_12.listing__ds__extract_day
+ , subq_12.listing__ds__extract_dow
+ , subq_12.listing__ds__extract_doy
+ , subq_12.listing__created_at__day
+ , subq_12.listing__created_at__week
+ , subq_12.listing__created_at__month
+ , subq_12.listing__created_at__quarter
+ , subq_12.listing__created_at__year
+ , subq_12.listing__created_at__extract_year
+ , subq_12.listing__created_at__extract_quarter
+ , subq_12.listing__created_at__extract_month
+ , subq_12.listing__created_at__extract_day
+ , subq_12.listing__created_at__extract_dow
+ , subq_12.listing__created_at__extract_doy
+ , subq_12.ds__day AS metric_time__day
+ , subq_12.ds__week AS metric_time__week
+ , subq_12.ds__month AS metric_time__month
+ , subq_12.ds__quarter AS metric_time__quarter
+ , subq_12.ds__year AS metric_time__year
+ , subq_12.ds__extract_year AS metric_time__extract_year
+ , subq_12.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_12.ds__extract_month AS metric_time__extract_month
+ , subq_12.ds__extract_day AS metric_time__extract_day
+ , subq_12.ds__extract_dow AS metric_time__extract_dow
+ , subq_12.ds__extract_doy AS metric_time__extract_doy
+ , subq_12.listing
+ , subq_12.user
+ , subq_12.listing__user
+ , subq_12.country_latest
+ , subq_12.is_lux_latest
+ , subq_12.capacity_latest
+ , subq_12.listing__country_latest
+ , subq_12.listing__is_lux_latest
+ , subq_12.listing__capacity_latest
+ , subq_12.listings
+ , subq_12.largest_listing
+ , subq_12.smallest_listing
FROM (
-- Read Elements From Semantic Model 'listings_latest'
SELECT
1 AS listings
- , listings_latest_src_28005.capacity AS largest_listing
- , listings_latest_src_28005.capacity AS smallest_listing
- , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS ds__day
- , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS ds__week
- , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS ds__month
- , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS ds__quarter
- , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS ds__extract_doy
- , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS created_at__day
- , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS created_at__week
- , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS created_at__month
- , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS created_at__quarter
- , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day
- , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS created_at__extract_dow
- , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS created_at__extract_doy
- , listings_latest_src_28005.country AS country_latest
- , listings_latest_src_28005.is_lux AS is_lux_latest
- , listings_latest_src_28005.capacity AS capacity_latest
- , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS listing__ds__day
- , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS listing__ds__week
- , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS listing__ds__month
- , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS listing__ds__quarter
- , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS listing__ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day
- , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS listing__ds__extract_dow
- , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy
- , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS listing__created_at__day
- , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS listing__created_at__week
- , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS listing__created_at__month
- , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS listing__created_at__quarter
- , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS listing__created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day
- , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS listing__created_at__extract_dow
- , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy
- , listings_latest_src_28005.country AS listing__country_latest
- , listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , listings_latest_src_28005.capacity AS listing__capacity_latest
- , listings_latest_src_28005.listing_id AS listing
- , listings_latest_src_28005.user_id AS user
- , listings_latest_src_28005.user_id AS listing__user
- FROM ***************************.dim_listings_latest listings_latest_src_28005
- ) subq_3
- ) subq_4
- ) subq_5
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS created_at__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 created_at__extract_dow
+ , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS created_at__extract_doy
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__created_at__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__created_at__extract_dow
+ , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_doy
+ , listings_latest_src_28000.country AS listing__country_latest
+ , listings_latest_src_28000.is_lux AS listing__is_lux_latest
+ , listings_latest_src_28000.capacity AS listing__capacity_latest
+ , listings_latest_src_28000.listing_id AS listing
+ , listings_latest_src_28000.user_id AS user
+ , listings_latest_src_28000.user_id AS listing__user
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
+ ) subq_12
+ ) subq_13
+ ) subq_14
ON
- subq_2.listing = subq_5.listing
- ) subq_6
- ) subq_7
+ subq_11.listing = subq_14.listing
+ ) subq_15
+ ) subq_16
WHERE (listing__is_lux_latest) AND (booking__is_instant)
- ) subq_8
- ) subq_9
- ) subq_10
- ) subq_11
+ ) subq_17
+ ) subq_18
+ ) subq_19
+ ) subq_20
CROSS JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_22.bookings
+ subq_31.bookings
FROM (
-- Aggregate Measures
SELECT
- SUM(subq_21.bookings) AS bookings
+ SUM(subq_30.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings',]
SELECT
- subq_20.bookings
+ subq_29.bookings
FROM (
-- Constrain Output with WHERE
SELECT
- subq_19.booking__is_instant
- , subq_19.listing__is_lux_latest
- , subq_19.bookings
+ subq_28.booking__is_instant
+ , subq_28.listing__is_lux_latest
+ , subq_28.bookings
FROM (
-- Pass Only Elements: ['bookings', 'listing__is_lux_latest', 'booking__is_instant']
SELECT
- subq_18.booking__is_instant
- , subq_18.listing__is_lux_latest
- , subq_18.bookings
+ subq_27.booking__is_instant
+ , subq_27.listing__is_lux_latest
+ , subq_27.bookings
FROM (
-- Join Standard Outputs
SELECT
- subq_14.listing AS listing
- , subq_14.booking__is_instant AS booking__is_instant
- , subq_17.is_lux_latest AS listing__is_lux_latest
- , subq_14.bookings AS bookings
+ subq_23.listing AS listing
+ , subq_23.booking__is_instant AS booking__is_instant
+ , subq_26.is_lux_latest AS listing__is_lux_latest
+ , subq_23.bookings AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'booking__is_instant', 'listing']
SELECT
- subq_13.listing
- , subq_13.booking__is_instant
- , subq_13.bookings
+ subq_22.listing
+ , subq_22.booking__is_instant
+ , subq_22.bookings
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_12.ds__day
- , subq_12.ds__week
- , subq_12.ds__month
- , subq_12.ds__quarter
- , subq_12.ds__year
- , subq_12.ds__extract_year
- , subq_12.ds__extract_quarter
- , subq_12.ds__extract_month
- , subq_12.ds__extract_day
- , subq_12.ds__extract_dow
- , subq_12.ds__extract_doy
- , subq_12.ds_partitioned__day
- , subq_12.ds_partitioned__week
- , subq_12.ds_partitioned__month
- , subq_12.ds_partitioned__quarter
- , subq_12.ds_partitioned__year
- , subq_12.ds_partitioned__extract_year
- , subq_12.ds_partitioned__extract_quarter
- , subq_12.ds_partitioned__extract_month
- , subq_12.ds_partitioned__extract_day
- , subq_12.ds_partitioned__extract_dow
- , subq_12.ds_partitioned__extract_doy
- , subq_12.paid_at__day
- , subq_12.paid_at__week
- , subq_12.paid_at__month
- , subq_12.paid_at__quarter
- , subq_12.paid_at__year
- , subq_12.paid_at__extract_year
- , subq_12.paid_at__extract_quarter
- , subq_12.paid_at__extract_month
- , subq_12.paid_at__extract_day
- , subq_12.paid_at__extract_dow
- , subq_12.paid_at__extract_doy
- , subq_12.booking__ds__day
- , subq_12.booking__ds__week
- , subq_12.booking__ds__month
- , subq_12.booking__ds__quarter
- , subq_12.booking__ds__year
- , subq_12.booking__ds__extract_year
- , subq_12.booking__ds__extract_quarter
- , subq_12.booking__ds__extract_month
- , subq_12.booking__ds__extract_day
- , subq_12.booking__ds__extract_dow
- , subq_12.booking__ds__extract_doy
- , subq_12.booking__ds_partitioned__day
- , subq_12.booking__ds_partitioned__week
- , subq_12.booking__ds_partitioned__month
- , subq_12.booking__ds_partitioned__quarter
- , subq_12.booking__ds_partitioned__year
- , subq_12.booking__ds_partitioned__extract_year
- , subq_12.booking__ds_partitioned__extract_quarter
- , subq_12.booking__ds_partitioned__extract_month
- , subq_12.booking__ds_partitioned__extract_day
- , subq_12.booking__ds_partitioned__extract_dow
- , subq_12.booking__ds_partitioned__extract_doy
- , subq_12.booking__paid_at__day
- , subq_12.booking__paid_at__week
- , subq_12.booking__paid_at__month
- , subq_12.booking__paid_at__quarter
- , subq_12.booking__paid_at__year
- , subq_12.booking__paid_at__extract_year
- , subq_12.booking__paid_at__extract_quarter
- , subq_12.booking__paid_at__extract_month
- , subq_12.booking__paid_at__extract_day
- , subq_12.booking__paid_at__extract_dow
- , subq_12.booking__paid_at__extract_doy
- , subq_12.ds__day AS metric_time__day
- , subq_12.ds__week AS metric_time__week
- , subq_12.ds__month AS metric_time__month
- , subq_12.ds__quarter AS metric_time__quarter
- , subq_12.ds__year AS metric_time__year
- , subq_12.ds__extract_year AS metric_time__extract_year
- , subq_12.ds__extract_quarter AS metric_time__extract_quarter
- , subq_12.ds__extract_month AS metric_time__extract_month
- , subq_12.ds__extract_day AS metric_time__extract_day
- , subq_12.ds__extract_dow AS metric_time__extract_dow
- , subq_12.ds__extract_doy AS metric_time__extract_doy
- , subq_12.listing
- , subq_12.guest
- , subq_12.host
- , subq_12.booking__listing
- , subq_12.booking__guest
- , subq_12.booking__host
- , subq_12.is_instant
- , subq_12.booking__is_instant
- , subq_12.bookings
- , subq_12.instant_bookings
- , subq_12.booking_value
- , subq_12.max_booking_value
- , subq_12.min_booking_value
- , subq_12.bookers
- , subq_12.average_booking_value
- , subq_12.referred_bookings
- , subq_12.median_booking_value
- , subq_12.booking_value_p99
- , subq_12.discrete_booking_value_p99
- , subq_12.approximate_continuous_booking_value_p99
- , subq_12.approximate_discrete_booking_value_p99
+ subq_21.ds__day
+ , subq_21.ds__week
+ , subq_21.ds__month
+ , subq_21.ds__quarter
+ , subq_21.ds__year
+ , subq_21.ds__extract_year
+ , subq_21.ds__extract_quarter
+ , subq_21.ds__extract_month
+ , subq_21.ds__extract_day
+ , subq_21.ds__extract_dow
+ , subq_21.ds__extract_doy
+ , subq_21.ds_partitioned__day
+ , subq_21.ds_partitioned__week
+ , subq_21.ds_partitioned__month
+ , subq_21.ds_partitioned__quarter
+ , subq_21.ds_partitioned__year
+ , subq_21.ds_partitioned__extract_year
+ , subq_21.ds_partitioned__extract_quarter
+ , subq_21.ds_partitioned__extract_month
+ , subq_21.ds_partitioned__extract_day
+ , subq_21.ds_partitioned__extract_dow
+ , subq_21.ds_partitioned__extract_doy
+ , subq_21.paid_at__day
+ , subq_21.paid_at__week
+ , subq_21.paid_at__month
+ , subq_21.paid_at__quarter
+ , subq_21.paid_at__year
+ , subq_21.paid_at__extract_year
+ , subq_21.paid_at__extract_quarter
+ , subq_21.paid_at__extract_month
+ , subq_21.paid_at__extract_day
+ , subq_21.paid_at__extract_dow
+ , subq_21.paid_at__extract_doy
+ , subq_21.booking__ds__day
+ , subq_21.booking__ds__week
+ , subq_21.booking__ds__month
+ , subq_21.booking__ds__quarter
+ , subq_21.booking__ds__year
+ , subq_21.booking__ds__extract_year
+ , subq_21.booking__ds__extract_quarter
+ , subq_21.booking__ds__extract_month
+ , subq_21.booking__ds__extract_day
+ , subq_21.booking__ds__extract_dow
+ , subq_21.booking__ds__extract_doy
+ , subq_21.booking__ds_partitioned__day
+ , subq_21.booking__ds_partitioned__week
+ , subq_21.booking__ds_partitioned__month
+ , subq_21.booking__ds_partitioned__quarter
+ , subq_21.booking__ds_partitioned__year
+ , subq_21.booking__ds_partitioned__extract_year
+ , subq_21.booking__ds_partitioned__extract_quarter
+ , subq_21.booking__ds_partitioned__extract_month
+ , subq_21.booking__ds_partitioned__extract_day
+ , subq_21.booking__ds_partitioned__extract_dow
+ , subq_21.booking__ds_partitioned__extract_doy
+ , subq_21.booking__paid_at__day
+ , subq_21.booking__paid_at__week
+ , subq_21.booking__paid_at__month
+ , subq_21.booking__paid_at__quarter
+ , subq_21.booking__paid_at__year
+ , subq_21.booking__paid_at__extract_year
+ , subq_21.booking__paid_at__extract_quarter
+ , subq_21.booking__paid_at__extract_month
+ , subq_21.booking__paid_at__extract_day
+ , subq_21.booking__paid_at__extract_dow
+ , subq_21.booking__paid_at__extract_doy
+ , subq_21.ds__day AS metric_time__day
+ , subq_21.ds__week AS metric_time__week
+ , subq_21.ds__month AS metric_time__month
+ , subq_21.ds__quarter AS metric_time__quarter
+ , subq_21.ds__year AS metric_time__year
+ , subq_21.ds__extract_year AS metric_time__extract_year
+ , subq_21.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_21.ds__extract_month AS metric_time__extract_month
+ , subq_21.ds__extract_day AS metric_time__extract_day
+ , subq_21.ds__extract_dow AS metric_time__extract_dow
+ , subq_21.ds__extract_doy AS metric_time__extract_doy
+ , subq_21.listing
+ , subq_21.guest
+ , subq_21.host
+ , subq_21.booking__listing
+ , subq_21.booking__guest
+ , subq_21.booking__host
+ , subq_21.is_instant
+ , subq_21.booking__is_instant
+ , subq_21.bookings
+ , subq_21.instant_bookings
+ , subq_21.booking_value
+ , subq_21.max_booking_value
+ , subq_21.min_booking_value
+ , subq_21.bookers
+ , subq_21.average_booking_value
+ , subq_21.referred_bookings
+ , subq_21.median_booking_value
+ , subq_21.booking_value_p99
+ , subq_21.discrete_booking_value_p99
+ , subq_21.approximate_continuous_booking_value_p99
+ , subq_21.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_12
- ) subq_13
- ) subq_14
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS booking__paid_at__extract_dow
+ , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_21
+ ) subq_22
+ ) subq_23
LEFT OUTER JOIN (
-- Pass Only Elements: ['is_lux_latest', 'listing']
SELECT
- subq_16.listing
- , subq_16.is_lux_latest
+ subq_25.listing
+ , subq_25.is_lux_latest
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_15.ds__day
- , subq_15.ds__week
- , subq_15.ds__month
- , subq_15.ds__quarter
- , subq_15.ds__year
- , subq_15.ds__extract_year
- , subq_15.ds__extract_quarter
- , subq_15.ds__extract_month
- , subq_15.ds__extract_day
- , subq_15.ds__extract_dow
- , subq_15.ds__extract_doy
- , subq_15.created_at__day
- , subq_15.created_at__week
- , subq_15.created_at__month
- , subq_15.created_at__quarter
- , subq_15.created_at__year
- , subq_15.created_at__extract_year
- , subq_15.created_at__extract_quarter
- , subq_15.created_at__extract_month
- , subq_15.created_at__extract_day
- , subq_15.created_at__extract_dow
- , subq_15.created_at__extract_doy
- , subq_15.listing__ds__day
- , subq_15.listing__ds__week
- , subq_15.listing__ds__month
- , subq_15.listing__ds__quarter
- , subq_15.listing__ds__year
- , subq_15.listing__ds__extract_year
- , subq_15.listing__ds__extract_quarter
- , subq_15.listing__ds__extract_month
- , subq_15.listing__ds__extract_day
- , subq_15.listing__ds__extract_dow
- , subq_15.listing__ds__extract_doy
- , subq_15.listing__created_at__day
- , subq_15.listing__created_at__week
- , subq_15.listing__created_at__month
- , subq_15.listing__created_at__quarter
- , subq_15.listing__created_at__year
- , subq_15.listing__created_at__extract_year
- , subq_15.listing__created_at__extract_quarter
- , subq_15.listing__created_at__extract_month
- , subq_15.listing__created_at__extract_day
- , subq_15.listing__created_at__extract_dow
- , subq_15.listing__created_at__extract_doy
- , subq_15.ds__day AS metric_time__day
- , subq_15.ds__week AS metric_time__week
- , subq_15.ds__month AS metric_time__month
- , subq_15.ds__quarter AS metric_time__quarter
- , subq_15.ds__year AS metric_time__year
- , subq_15.ds__extract_year AS metric_time__extract_year
- , subq_15.ds__extract_quarter AS metric_time__extract_quarter
- , subq_15.ds__extract_month AS metric_time__extract_month
- , subq_15.ds__extract_day AS metric_time__extract_day
- , subq_15.ds__extract_dow AS metric_time__extract_dow
- , subq_15.ds__extract_doy AS metric_time__extract_doy
- , subq_15.listing
- , subq_15.user
- , subq_15.listing__user
- , subq_15.country_latest
- , subq_15.is_lux_latest
- , subq_15.capacity_latest
- , subq_15.listing__country_latest
- , subq_15.listing__is_lux_latest
- , subq_15.listing__capacity_latest
- , subq_15.listings
- , subq_15.largest_listing
- , subq_15.smallest_listing
+ subq_24.ds__day
+ , subq_24.ds__week
+ , subq_24.ds__month
+ , subq_24.ds__quarter
+ , subq_24.ds__year
+ , subq_24.ds__extract_year
+ , subq_24.ds__extract_quarter
+ , subq_24.ds__extract_month
+ , subq_24.ds__extract_day
+ , subq_24.ds__extract_dow
+ , subq_24.ds__extract_doy
+ , subq_24.created_at__day
+ , subq_24.created_at__week
+ , subq_24.created_at__month
+ , subq_24.created_at__quarter
+ , subq_24.created_at__year
+ , subq_24.created_at__extract_year
+ , subq_24.created_at__extract_quarter
+ , subq_24.created_at__extract_month
+ , subq_24.created_at__extract_day
+ , subq_24.created_at__extract_dow
+ , subq_24.created_at__extract_doy
+ , subq_24.listing__ds__day
+ , subq_24.listing__ds__week
+ , subq_24.listing__ds__month
+ , subq_24.listing__ds__quarter
+ , subq_24.listing__ds__year
+ , subq_24.listing__ds__extract_year
+ , subq_24.listing__ds__extract_quarter
+ , subq_24.listing__ds__extract_month
+ , subq_24.listing__ds__extract_day
+ , subq_24.listing__ds__extract_dow
+ , subq_24.listing__ds__extract_doy
+ , subq_24.listing__created_at__day
+ , subq_24.listing__created_at__week
+ , subq_24.listing__created_at__month
+ , subq_24.listing__created_at__quarter
+ , subq_24.listing__created_at__year
+ , subq_24.listing__created_at__extract_year
+ , subq_24.listing__created_at__extract_quarter
+ , subq_24.listing__created_at__extract_month
+ , subq_24.listing__created_at__extract_day
+ , subq_24.listing__created_at__extract_dow
+ , subq_24.listing__created_at__extract_doy
+ , subq_24.ds__day AS metric_time__day
+ , subq_24.ds__week AS metric_time__week
+ , subq_24.ds__month AS metric_time__month
+ , subq_24.ds__quarter AS metric_time__quarter
+ , subq_24.ds__year AS metric_time__year
+ , subq_24.ds__extract_year AS metric_time__extract_year
+ , subq_24.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_24.ds__extract_month AS metric_time__extract_month
+ , subq_24.ds__extract_day AS metric_time__extract_day
+ , subq_24.ds__extract_dow AS metric_time__extract_dow
+ , subq_24.ds__extract_doy AS metric_time__extract_doy
+ , subq_24.listing
+ , subq_24.user
+ , subq_24.listing__user
+ , subq_24.country_latest
+ , subq_24.is_lux_latest
+ , subq_24.capacity_latest
+ , subq_24.listing__country_latest
+ , subq_24.listing__is_lux_latest
+ , subq_24.listing__capacity_latest
+ , subq_24.listings
+ , subq_24.largest_listing
+ , subq_24.smallest_listing
FROM (
-- Read Elements From Semantic Model 'listings_latest'
SELECT
1 AS listings
- , listings_latest_src_28005.capacity AS largest_listing
- , listings_latest_src_28005.capacity AS smallest_listing
- , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS ds__day
- , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS ds__week
- , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS ds__month
- , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS ds__quarter
- , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS ds__extract_doy
- , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS created_at__day
- , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS created_at__week
- , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS created_at__month
- , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS created_at__quarter
- , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day
- , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS created_at__extract_dow
- , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS created_at__extract_doy
- , listings_latest_src_28005.country AS country_latest
- , listings_latest_src_28005.is_lux AS is_lux_latest
- , listings_latest_src_28005.capacity AS capacity_latest
- , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS listing__ds__day
- , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS listing__ds__week
- , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS listing__ds__month
- , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS listing__ds__quarter
- , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS listing__ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day
- , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS listing__ds__extract_dow
- , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy
- , DATE_TRUNC(listings_latest_src_28005.created_at, day) AS listing__created_at__day
- , DATE_TRUNC(listings_latest_src_28005.created_at, isoweek) AS listing__created_at__week
- , DATE_TRUNC(listings_latest_src_28005.created_at, month) AS listing__created_at__month
- , DATE_TRUNC(listings_latest_src_28005.created_at, quarter) AS listing__created_at__quarter
- , DATE_TRUNC(listings_latest_src_28005.created_at, year) AS listing__created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day
- , IF(EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) = 1, 7, EXTRACT(dayofweek FROM listings_latest_src_28005.created_at) - 1) AS listing__created_at__extract_dow
- , EXTRACT(dayofyear FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy
- , listings_latest_src_28005.country AS listing__country_latest
- , listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , listings_latest_src_28005.capacity AS listing__capacity_latest
- , listings_latest_src_28005.listing_id AS listing
- , listings_latest_src_28005.user_id AS user
- , listings_latest_src_28005.user_id AS listing__user
- FROM ***************************.dim_listings_latest listings_latest_src_28005
- ) subq_15
- ) subq_16
- ) subq_17
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS created_at__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 created_at__extract_dow
+ , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS created_at__extract_doy
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__created_at__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__created_at__extract_dow
+ , EXTRACT(dayofyear FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_doy
+ , listings_latest_src_28000.country AS listing__country_latest
+ , listings_latest_src_28000.is_lux AS listing__is_lux_latest
+ , listings_latest_src_28000.capacity AS listing__capacity_latest
+ , listings_latest_src_28000.listing_id AS listing
+ , listings_latest_src_28000.user_id AS user
+ , listings_latest_src_28000.user_id AS listing__user
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
+ ) subq_24
+ ) subq_25
+ ) subq_26
ON
- subq_14.listing = subq_17.listing
- ) subq_18
- ) subq_19
+ subq_23.listing = subq_26.listing
+ ) subq_27
+ ) subq_28
WHERE (listing__is_lux_latest) AND (booking__is_instant)
- ) subq_20
- ) subq_21
- ) subq_22
- ) subq_23
+ ) subq_29
+ ) subq_30
+ ) subq_31
+ ) subq_32
CROSS JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_29.booking_value
+ subq_38.booking_value
FROM (
-- Aggregate Measures
SELECT
- SUM(subq_28.booking_value) AS booking_value
+ SUM(subq_37.booking_value) AS booking_value
FROM (
-- Pass Only Elements: ['booking_value',]
SELECT
- subq_27.booking_value
+ subq_36.booking_value
FROM (
-- Constrain Output with WHERE
SELECT
- subq_26.booking__is_instant
- , subq_26.booking_value
+ subq_35.booking__is_instant
+ , subq_35.booking_value
FROM (
-- Pass Only Elements: ['booking_value', 'booking__is_instant']
SELECT
- subq_25.booking__is_instant
- , subq_25.booking_value
+ subq_34.booking__is_instant
+ , subq_34.booking_value
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_24.ds__day
- , subq_24.ds__week
- , subq_24.ds__month
- , subq_24.ds__quarter
- , subq_24.ds__year
- , subq_24.ds__extract_year
- , subq_24.ds__extract_quarter
- , subq_24.ds__extract_month
- , subq_24.ds__extract_day
- , subq_24.ds__extract_dow
- , subq_24.ds__extract_doy
- , subq_24.ds_partitioned__day
- , subq_24.ds_partitioned__week
- , subq_24.ds_partitioned__month
- , subq_24.ds_partitioned__quarter
- , subq_24.ds_partitioned__year
- , subq_24.ds_partitioned__extract_year
- , subq_24.ds_partitioned__extract_quarter
- , subq_24.ds_partitioned__extract_month
- , subq_24.ds_partitioned__extract_day
- , subq_24.ds_partitioned__extract_dow
- , subq_24.ds_partitioned__extract_doy
- , subq_24.paid_at__day
- , subq_24.paid_at__week
- , subq_24.paid_at__month
- , subq_24.paid_at__quarter
- , subq_24.paid_at__year
- , subq_24.paid_at__extract_year
- , subq_24.paid_at__extract_quarter
- , subq_24.paid_at__extract_month
- , subq_24.paid_at__extract_day
- , subq_24.paid_at__extract_dow
- , subq_24.paid_at__extract_doy
- , subq_24.booking__ds__day
- , subq_24.booking__ds__week
- , subq_24.booking__ds__month
- , subq_24.booking__ds__quarter
- , subq_24.booking__ds__year
- , subq_24.booking__ds__extract_year
- , subq_24.booking__ds__extract_quarter
- , subq_24.booking__ds__extract_month
- , subq_24.booking__ds__extract_day
- , subq_24.booking__ds__extract_dow
- , subq_24.booking__ds__extract_doy
- , subq_24.booking__ds_partitioned__day
- , subq_24.booking__ds_partitioned__week
- , subq_24.booking__ds_partitioned__month
- , subq_24.booking__ds_partitioned__quarter
- , subq_24.booking__ds_partitioned__year
- , subq_24.booking__ds_partitioned__extract_year
- , subq_24.booking__ds_partitioned__extract_quarter
- , subq_24.booking__ds_partitioned__extract_month
- , subq_24.booking__ds_partitioned__extract_day
- , subq_24.booking__ds_partitioned__extract_dow
- , subq_24.booking__ds_partitioned__extract_doy
- , subq_24.booking__paid_at__day
- , subq_24.booking__paid_at__week
- , subq_24.booking__paid_at__month
- , subq_24.booking__paid_at__quarter
- , subq_24.booking__paid_at__year
- , subq_24.booking__paid_at__extract_year
- , subq_24.booking__paid_at__extract_quarter
- , subq_24.booking__paid_at__extract_month
- , subq_24.booking__paid_at__extract_day
- , subq_24.booking__paid_at__extract_dow
- , subq_24.booking__paid_at__extract_doy
- , subq_24.ds__day AS metric_time__day
- , subq_24.ds__week AS metric_time__week
- , subq_24.ds__month AS metric_time__month
- , subq_24.ds__quarter AS metric_time__quarter
- , subq_24.ds__year AS metric_time__year
- , subq_24.ds__extract_year AS metric_time__extract_year
- , subq_24.ds__extract_quarter AS metric_time__extract_quarter
- , subq_24.ds__extract_month AS metric_time__extract_month
- , subq_24.ds__extract_day AS metric_time__extract_day
- , subq_24.ds__extract_dow AS metric_time__extract_dow
- , subq_24.ds__extract_doy AS metric_time__extract_doy
- , subq_24.listing
- , subq_24.guest
- , subq_24.host
- , subq_24.booking__listing
- , subq_24.booking__guest
- , subq_24.booking__host
- , subq_24.is_instant
- , subq_24.booking__is_instant
- , subq_24.bookings
- , subq_24.instant_bookings
- , subq_24.booking_value
- , subq_24.max_booking_value
- , subq_24.min_booking_value
- , subq_24.bookers
- , subq_24.average_booking_value
- , subq_24.referred_bookings
- , subq_24.median_booking_value
- , subq_24.booking_value_p99
- , subq_24.discrete_booking_value_p99
- , subq_24.approximate_continuous_booking_value_p99
- , subq_24.approximate_discrete_booking_value_p99
+ subq_33.ds__day
+ , subq_33.ds__week
+ , subq_33.ds__month
+ , subq_33.ds__quarter
+ , subq_33.ds__year
+ , subq_33.ds__extract_year
+ , subq_33.ds__extract_quarter
+ , subq_33.ds__extract_month
+ , subq_33.ds__extract_day
+ , subq_33.ds__extract_dow
+ , subq_33.ds__extract_doy
+ , subq_33.ds_partitioned__day
+ , subq_33.ds_partitioned__week
+ , subq_33.ds_partitioned__month
+ , subq_33.ds_partitioned__quarter
+ , subq_33.ds_partitioned__year
+ , subq_33.ds_partitioned__extract_year
+ , subq_33.ds_partitioned__extract_quarter
+ , subq_33.ds_partitioned__extract_month
+ , subq_33.ds_partitioned__extract_day
+ , subq_33.ds_partitioned__extract_dow
+ , subq_33.ds_partitioned__extract_doy
+ , subq_33.paid_at__day
+ , subq_33.paid_at__week
+ , subq_33.paid_at__month
+ , subq_33.paid_at__quarter
+ , subq_33.paid_at__year
+ , subq_33.paid_at__extract_year
+ , subq_33.paid_at__extract_quarter
+ , subq_33.paid_at__extract_month
+ , subq_33.paid_at__extract_day
+ , subq_33.paid_at__extract_dow
+ , subq_33.paid_at__extract_doy
+ , subq_33.booking__ds__day
+ , subq_33.booking__ds__week
+ , subq_33.booking__ds__month
+ , subq_33.booking__ds__quarter
+ , subq_33.booking__ds__year
+ , subq_33.booking__ds__extract_year
+ , subq_33.booking__ds__extract_quarter
+ , subq_33.booking__ds__extract_month
+ , subq_33.booking__ds__extract_day
+ , subq_33.booking__ds__extract_dow
+ , subq_33.booking__ds__extract_doy
+ , subq_33.booking__ds_partitioned__day
+ , subq_33.booking__ds_partitioned__week
+ , subq_33.booking__ds_partitioned__month
+ , subq_33.booking__ds_partitioned__quarter
+ , subq_33.booking__ds_partitioned__year
+ , subq_33.booking__ds_partitioned__extract_year
+ , subq_33.booking__ds_partitioned__extract_quarter
+ , subq_33.booking__ds_partitioned__extract_month
+ , subq_33.booking__ds_partitioned__extract_day
+ , subq_33.booking__ds_partitioned__extract_dow
+ , subq_33.booking__ds_partitioned__extract_doy
+ , subq_33.booking__paid_at__day
+ , subq_33.booking__paid_at__week
+ , subq_33.booking__paid_at__month
+ , subq_33.booking__paid_at__quarter
+ , subq_33.booking__paid_at__year
+ , subq_33.booking__paid_at__extract_year
+ , subq_33.booking__paid_at__extract_quarter
+ , subq_33.booking__paid_at__extract_month
+ , subq_33.booking__paid_at__extract_day
+ , subq_33.booking__paid_at__extract_dow
+ , subq_33.booking__paid_at__extract_doy
+ , subq_33.ds__day AS metric_time__day
+ , subq_33.ds__week AS metric_time__week
+ , subq_33.ds__month AS metric_time__month
+ , subq_33.ds__quarter AS metric_time__quarter
+ , subq_33.ds__year AS metric_time__year
+ , subq_33.ds__extract_year AS metric_time__extract_year
+ , subq_33.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_33.ds__extract_month AS metric_time__extract_month
+ , subq_33.ds__extract_day AS metric_time__extract_day
+ , subq_33.ds__extract_dow AS metric_time__extract_dow
+ , subq_33.ds__extract_doy AS metric_time__extract_doy
+ , subq_33.listing
+ , subq_33.guest
+ , subq_33.host
+ , subq_33.booking__listing
+ , subq_33.booking__guest
+ , subq_33.booking__host
+ , subq_33.is_instant
+ , subq_33.booking__is_instant
+ , subq_33.bookings
+ , subq_33.instant_bookings
+ , subq_33.booking_value
+ , subq_33.max_booking_value
+ , subq_33.min_booking_value
+ , subq_33.bookers
+ , subq_33.average_booking_value
+ , subq_33.referred_bookings
+ , subq_33.median_booking_value
+ , subq_33.booking_value_p99
+ , subq_33.discrete_booking_value_p99
+ , subq_33.approximate_continuous_booking_value_p99
+ , subq_33.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_24
- ) subq_25
- ) subq_26
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS booking__paid_at__extract_dow
+ , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_33
+ ) subq_34
+ ) subq_35
WHERE booking__is_instant
- ) subq_27
- ) subq_28
- ) subq_29
- ) subq_30
- ) subq_31
-) subq_32
+ ) subq_36
+ ) subq_37
+ ) subq_38
+ ) subq_39
+ ) subq_40
+) subq_41
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_filters__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_filters__plan0_optimized.sql
index 14649c62dd..35859d3713 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_filters__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_filters__plan0_optimized.sql
@@ -8,9 +8,9 @@ FROM (
FROM (
-- Combine Aggregated Outputs
SELECT
- MAX(subq_44.average_booking_value) AS average_booking_value
- , MAX(subq_56.bookings) AS bookings
- , MAX(subq_63.booking_value) AS booking_value
+ MAX(subq_53.average_booking_value) AS average_booking_value
+ , MAX(subq_65.bookings) AS bookings
+ , MAX(subq_72.booking_value) AS booking_value
FROM (
-- Constrain Output with WHERE
-- Pass Only Elements: ['average_booking_value',]
@@ -22,17 +22,17 @@ FROM (
-- Join Standard Outputs
-- Pass Only Elements: ['average_booking_value', 'listing__is_lux_latest', 'booking__is_instant']
SELECT
- bookings_source_src_28001.is_instant AS booking__is_instant
- , listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , bookings_source_src_28001.booking_value AS average_booking_value
- FROM ***************************.fct_bookings bookings_source_src_28001
+ bookings_source_src_28000.is_instant AS booking__is_instant
+ , 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
LEFT OUTER JOIN
- ***************************.dim_listings_latest listings_latest_src_28005
+ ***************************.dim_listings_latest listings_latest_src_28000
ON
- bookings_source_src_28001.listing_id = listings_latest_src_28005.listing_id
- ) subq_40
+ bookings_source_src_28000.listing_id = listings_latest_src_28000.listing_id
+ ) subq_49
WHERE (listing__is_lux_latest) AND (booking__is_instant)
- ) subq_44
+ ) subq_53
CROSS JOIN (
-- Constrain Output with WHERE
-- Pass Only Elements: ['bookings',]
@@ -44,9 +44,9 @@ FROM (
-- Join Standard Outputs
-- Pass Only Elements: ['bookings', 'listing__is_lux_latest', 'booking__is_instant']
SELECT
- subq_47.booking__is_instant AS booking__is_instant
- , listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , subq_47.bookings AS bookings
+ subq_56.booking__is_instant AS booking__is_instant
+ , listings_latest_src_28000.is_lux AS listing__is_lux_latest
+ , subq_56.bookings AS bookings
FROM (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
@@ -55,15 +55,15 @@ FROM (
listing_id AS listing
, is_instant AS booking__is_instant
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_47
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_56
LEFT OUTER JOIN
- ***************************.dim_listings_latest listings_latest_src_28005
+ ***************************.dim_listings_latest listings_latest_src_28000
ON
- subq_47.listing = listings_latest_src_28005.listing_id
- ) subq_52
+ subq_56.listing = listings_latest_src_28000.listing_id
+ ) subq_61
WHERE (listing__is_lux_latest) AND (booking__is_instant)
- ) subq_56
+ ) subq_65
CROSS JOIN (
-- Constrain Output with WHERE
-- Pass Only Elements: ['booking_value',]
@@ -78,9 +78,9 @@ FROM (
SELECT
is_instant AS booking__is_instant
, booking_value
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_59
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_68
WHERE booking__is_instant
- ) subq_63
- ) subq_64
-) subq_65
+ ) subq_72
+ ) subq_73
+) subq_74
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_offsets__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_offsets__plan0.sql
index 0e363a5bea..45ae5e73c3 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_offsets__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_offsets__plan0.sql
@@ -1,339 +1,339 @@
-- Compute Metrics via Expressions
SELECT
- subq_11.metric_time__day
+ subq_20.metric_time__day
, 2 * bookings_offset_once AS bookings_offset_twice
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_9.metric_time__day AS metric_time__day
- , subq_8.bookings_offset_once AS bookings_offset_once
+ subq_18.metric_time__day AS metric_time__day
+ , subq_17.bookings_offset_once AS bookings_offset_once
FROM (
-- Time Spine
SELECT
- subq_10.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_10
- ) subq_9
+ subq_19.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_19
+ ) subq_18
INNER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_7.metric_time__day
+ subq_16.metric_time__day
, 2 * bookings AS bookings_offset_once
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_6.metric_time__day
- , subq_6.bookings
+ subq_15.metric_time__day
+ , subq_15.bookings
FROM (
-- Aggregate Measures
SELECT
- subq_5.metric_time__day
- , SUM(subq_5.bookings) AS bookings
+ subq_14.metric_time__day
+ , SUM(subq_14.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__day']
SELECT
- subq_4.metric_time__day
- , subq_4.bookings
+ subq_13.metric_time__day
+ , subq_13.bookings
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_2.metric_time__day AS metric_time__day
- , subq_1.ds__day AS ds__day
- , subq_1.ds__week AS ds__week
- , subq_1.ds__month AS ds__month
- , subq_1.ds__quarter AS ds__quarter
- , subq_1.ds__year AS ds__year
- , subq_1.ds__extract_year AS ds__extract_year
- , subq_1.ds__extract_quarter AS ds__extract_quarter
- , subq_1.ds__extract_month AS ds__extract_month
- , subq_1.ds__extract_day AS ds__extract_day
- , subq_1.ds__extract_dow AS ds__extract_dow
- , subq_1.ds__extract_doy AS ds__extract_doy
- , subq_1.ds_partitioned__day AS ds_partitioned__day
- , subq_1.ds_partitioned__week AS ds_partitioned__week
- , subq_1.ds_partitioned__month AS ds_partitioned__month
- , subq_1.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_1.ds_partitioned__year AS ds_partitioned__year
- , subq_1.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_1.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_1.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_1.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_1.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_1.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_1.paid_at__day AS paid_at__day
- , subq_1.paid_at__week AS paid_at__week
- , subq_1.paid_at__month AS paid_at__month
- , subq_1.paid_at__quarter AS paid_at__quarter
- , subq_1.paid_at__year AS paid_at__year
- , subq_1.paid_at__extract_year AS paid_at__extract_year
- , subq_1.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_1.paid_at__extract_month AS paid_at__extract_month
- , subq_1.paid_at__extract_day AS paid_at__extract_day
- , subq_1.paid_at__extract_dow AS paid_at__extract_dow
- , subq_1.paid_at__extract_doy AS paid_at__extract_doy
- , subq_1.booking__ds__day AS booking__ds__day
- , subq_1.booking__ds__week AS booking__ds__week
- , subq_1.booking__ds__month AS booking__ds__month
- , subq_1.booking__ds__quarter AS booking__ds__quarter
- , subq_1.booking__ds__year AS booking__ds__year
- , subq_1.booking__ds__extract_year AS booking__ds__extract_year
- , subq_1.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_1.booking__ds__extract_month AS booking__ds__extract_month
- , subq_1.booking__ds__extract_day AS booking__ds__extract_day
- , subq_1.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_1.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_1.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_1.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_1.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_1.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_1.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_1.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_1.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_1.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_1.booking__paid_at__day AS booking__paid_at__day
- , subq_1.booking__paid_at__week AS booking__paid_at__week
- , subq_1.booking__paid_at__month AS booking__paid_at__month
- , subq_1.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_1.booking__paid_at__year AS booking__paid_at__year
- , subq_1.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_1.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_1.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_1.listing AS listing
- , subq_1.guest AS guest
- , subq_1.host AS host
- , subq_1.booking__listing AS booking__listing
- , subq_1.booking__guest AS booking__guest
- , subq_1.booking__host AS booking__host
- , subq_1.is_instant AS is_instant
- , subq_1.booking__is_instant AS booking__is_instant
- , subq_1.bookings AS bookings
- , subq_1.instant_bookings AS instant_bookings
- , subq_1.booking_value AS booking_value
- , subq_1.max_booking_value AS max_booking_value
- , subq_1.min_booking_value AS min_booking_value
- , subq_1.bookers AS bookers
- , subq_1.average_booking_value AS average_booking_value
- , subq_1.referred_bookings AS referred_bookings
- , subq_1.median_booking_value AS median_booking_value
- , subq_1.booking_value_p99 AS booking_value_p99
- , subq_1.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_1.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_1.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ subq_11.metric_time__day AS metric_time__day
+ , subq_10.ds__day AS ds__day
+ , subq_10.ds__week AS ds__week
+ , subq_10.ds__month AS ds__month
+ , subq_10.ds__quarter AS ds__quarter
+ , subq_10.ds__year AS ds__year
+ , subq_10.ds__extract_year AS ds__extract_year
+ , subq_10.ds__extract_quarter AS ds__extract_quarter
+ , subq_10.ds__extract_month AS ds__extract_month
+ , subq_10.ds__extract_day AS ds__extract_day
+ , subq_10.ds__extract_dow AS ds__extract_dow
+ , subq_10.ds__extract_doy AS ds__extract_doy
+ , subq_10.ds_partitioned__day AS ds_partitioned__day
+ , subq_10.ds_partitioned__week AS ds_partitioned__week
+ , subq_10.ds_partitioned__month AS ds_partitioned__month
+ , subq_10.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_10.ds_partitioned__year AS ds_partitioned__year
+ , subq_10.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_10.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_10.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_10.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_10.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_10.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_10.paid_at__day AS paid_at__day
+ , subq_10.paid_at__week AS paid_at__week
+ , subq_10.paid_at__month AS paid_at__month
+ , subq_10.paid_at__quarter AS paid_at__quarter
+ , subq_10.paid_at__year AS paid_at__year
+ , subq_10.paid_at__extract_year AS paid_at__extract_year
+ , subq_10.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_10.paid_at__extract_month AS paid_at__extract_month
+ , subq_10.paid_at__extract_day AS paid_at__extract_day
+ , subq_10.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_10.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_10.booking__ds__day AS booking__ds__day
+ , subq_10.booking__ds__week AS booking__ds__week
+ , subq_10.booking__ds__month AS booking__ds__month
+ , subq_10.booking__ds__quarter AS booking__ds__quarter
+ , subq_10.booking__ds__year AS booking__ds__year
+ , subq_10.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_10.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_10.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_10.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_10.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_10.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_10.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_10.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_10.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_10.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_10.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_10.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_10.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_10.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_10.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_10.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_10.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_10.booking__paid_at__day AS booking__paid_at__day
+ , subq_10.booking__paid_at__week AS booking__paid_at__week
+ , subq_10.booking__paid_at__month AS booking__paid_at__month
+ , subq_10.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_10.booking__paid_at__year AS booking__paid_at__year
+ , subq_10.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_10.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_10.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_10.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_10.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_10.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_10.listing AS listing
+ , subq_10.guest AS guest
+ , subq_10.host AS host
+ , subq_10.booking__listing AS booking__listing
+ , subq_10.booking__guest AS booking__guest
+ , subq_10.booking__host AS booking__host
+ , subq_10.is_instant AS is_instant
+ , subq_10.booking__is_instant AS booking__is_instant
+ , subq_10.bookings AS bookings
+ , subq_10.instant_bookings AS instant_bookings
+ , subq_10.booking_value AS booking_value
+ , subq_10.max_booking_value AS max_booking_value
+ , subq_10.min_booking_value AS min_booking_value
+ , subq_10.bookers AS bookers
+ , subq_10.average_booking_value AS average_booking_value
+ , subq_10.referred_bookings AS referred_bookings
+ , subq_10.median_booking_value AS median_booking_value
+ , subq_10.booking_value_p99 AS booking_value_p99
+ , subq_10.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_10.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_10.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_3.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_3
- ) subq_2
+ subq_12.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_12
+ ) subq_11
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS booking__paid_at__extract_dow
+ , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
ON
- DATE_SUB(CAST(subq_2.metric_time__day AS DATETIME), INTERVAL 5 day) = subq_1.metric_time__day
- ) subq_4
- ) subq_5
+ DATE_SUB(CAST(subq_11.metric_time__day AS DATETIME), INTERVAL 5 day) = subq_10.metric_time__day
+ ) subq_13
+ ) subq_14
GROUP BY
metric_time__day
- ) subq_6
- ) subq_7
- ) subq_8
+ ) subq_15
+ ) subq_16
+ ) subq_17
ON
- DATE_SUB(CAST(subq_9.metric_time__day AS DATETIME), INTERVAL 2 day) = subq_8.metric_time__day
-) subq_11
+ DATE_SUB(CAST(subq_18.metric_time__day AS DATETIME), INTERVAL 2 day) = subq_17.metric_time__day
+) subq_20
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_offsets__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_offsets__plan0_optimized.sql
index 6ccdca5949..aec04b98d6 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_offsets__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_offsets__plan0_optimized.sql
@@ -5,9 +5,9 @@ SELECT
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_22.ds AS metric_time__day
- , subq_20.bookings_offset_once AS bookings_offset_once
- FROM ***************************.mf_time_spine subq_22
+ subq_31.ds AS metric_time__day
+ , subq_29.bookings_offset_once AS bookings_offset_once
+ FROM ***************************.mf_time_spine subq_31
INNER JOIN (
-- Compute Metrics via Expressions
SELECT
@@ -19,23 +19,23 @@ FROM (
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_15.ds AS metric_time__day
- , SUM(subq_13.bookings) AS bookings
- FROM ***************************.mf_time_spine subq_15
+ subq_24.ds AS metric_time__day
+ , SUM(subq_22.bookings) AS bookings
+ FROM ***************************.mf_time_spine subq_24
INNER JOIN (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
SELECT
DATE_TRUNC(ds, day) AS metric_time__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_13
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_22
ON
- DATE_SUB(CAST(subq_15.ds AS DATETIME), INTERVAL 5 day) = subq_13.metric_time__day
+ DATE_SUB(CAST(subq_24.ds AS DATETIME), INTERVAL 5 day) = subq_22.metric_time__day
GROUP BY
metric_time__day
- ) subq_19
- ) subq_20
+ ) subq_28
+ ) subq_29
ON
- DATE_SUB(CAST(subq_22.ds AS DATETIME), INTERVAL 2 day) = subq_20.metric_time__day
-) subq_23
+ DATE_SUB(CAST(subq_31.ds AS DATETIME), INTERVAL 2 day) = subq_29.metric_time__day
+) subq_32
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_offsets_with_time_constraint__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_offsets_with_time_constraint__plan0.sql
index 6d2d03942f..4a49e9f729 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_offsets_with_time_constraint__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_offsets_with_time_constraint__plan0.sql
@@ -1,340 +1,340 @@
-- Compute Metrics via Expressions
SELECT
- subq_11.metric_time__day
+ subq_20.metric_time__day
, 2 * bookings_offset_once AS bookings_offset_twice
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_9.metric_time__day AS metric_time__day
- , subq_8.bookings_offset_once AS bookings_offset_once
+ subq_18.metric_time__day AS metric_time__day
+ , subq_17.bookings_offset_once AS bookings_offset_once
FROM (
-- Time Spine
SELECT
- subq_10.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_10
- WHERE subq_10.ds BETWEEN '2020-01-12' AND '2020-01-13'
- ) subq_9
+ subq_19.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_19
+ WHERE subq_19.ds BETWEEN '2020-01-12' AND '2020-01-13'
+ ) subq_18
INNER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_7.metric_time__day
+ subq_16.metric_time__day
, 2 * bookings AS bookings_offset_once
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_6.metric_time__day
- , subq_6.bookings
+ subq_15.metric_time__day
+ , subq_15.bookings
FROM (
-- Aggregate Measures
SELECT
- subq_5.metric_time__day
- , SUM(subq_5.bookings) AS bookings
+ subq_14.metric_time__day
+ , SUM(subq_14.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__day']
SELECT
- subq_4.metric_time__day
- , subq_4.bookings
+ subq_13.metric_time__day
+ , subq_13.bookings
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_2.metric_time__day AS metric_time__day
- , subq_1.ds__day AS ds__day
- , subq_1.ds__week AS ds__week
- , subq_1.ds__month AS ds__month
- , subq_1.ds__quarter AS ds__quarter
- , subq_1.ds__year AS ds__year
- , subq_1.ds__extract_year AS ds__extract_year
- , subq_1.ds__extract_quarter AS ds__extract_quarter
- , subq_1.ds__extract_month AS ds__extract_month
- , subq_1.ds__extract_day AS ds__extract_day
- , subq_1.ds__extract_dow AS ds__extract_dow
- , subq_1.ds__extract_doy AS ds__extract_doy
- , subq_1.ds_partitioned__day AS ds_partitioned__day
- , subq_1.ds_partitioned__week AS ds_partitioned__week
- , subq_1.ds_partitioned__month AS ds_partitioned__month
- , subq_1.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_1.ds_partitioned__year AS ds_partitioned__year
- , subq_1.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_1.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_1.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_1.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_1.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_1.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_1.paid_at__day AS paid_at__day
- , subq_1.paid_at__week AS paid_at__week
- , subq_1.paid_at__month AS paid_at__month
- , subq_1.paid_at__quarter AS paid_at__quarter
- , subq_1.paid_at__year AS paid_at__year
- , subq_1.paid_at__extract_year AS paid_at__extract_year
- , subq_1.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_1.paid_at__extract_month AS paid_at__extract_month
- , subq_1.paid_at__extract_day AS paid_at__extract_day
- , subq_1.paid_at__extract_dow AS paid_at__extract_dow
- , subq_1.paid_at__extract_doy AS paid_at__extract_doy
- , subq_1.booking__ds__day AS booking__ds__day
- , subq_1.booking__ds__week AS booking__ds__week
- , subq_1.booking__ds__month AS booking__ds__month
- , subq_1.booking__ds__quarter AS booking__ds__quarter
- , subq_1.booking__ds__year AS booking__ds__year
- , subq_1.booking__ds__extract_year AS booking__ds__extract_year
- , subq_1.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_1.booking__ds__extract_month AS booking__ds__extract_month
- , subq_1.booking__ds__extract_day AS booking__ds__extract_day
- , subq_1.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_1.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_1.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_1.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_1.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_1.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_1.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_1.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_1.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_1.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_1.booking__paid_at__day AS booking__paid_at__day
- , subq_1.booking__paid_at__week AS booking__paid_at__week
- , subq_1.booking__paid_at__month AS booking__paid_at__month
- , subq_1.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_1.booking__paid_at__year AS booking__paid_at__year
- , subq_1.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_1.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_1.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_1.listing AS listing
- , subq_1.guest AS guest
- , subq_1.host AS host
- , subq_1.booking__listing AS booking__listing
- , subq_1.booking__guest AS booking__guest
- , subq_1.booking__host AS booking__host
- , subq_1.is_instant AS is_instant
- , subq_1.booking__is_instant AS booking__is_instant
- , subq_1.bookings AS bookings
- , subq_1.instant_bookings AS instant_bookings
- , subq_1.booking_value AS booking_value
- , subq_1.max_booking_value AS max_booking_value
- , subq_1.min_booking_value AS min_booking_value
- , subq_1.bookers AS bookers
- , subq_1.average_booking_value AS average_booking_value
- , subq_1.referred_bookings AS referred_bookings
- , subq_1.median_booking_value AS median_booking_value
- , subq_1.booking_value_p99 AS booking_value_p99
- , subq_1.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_1.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_1.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ subq_11.metric_time__day AS metric_time__day
+ , subq_10.ds__day AS ds__day
+ , subq_10.ds__week AS ds__week
+ , subq_10.ds__month AS ds__month
+ , subq_10.ds__quarter AS ds__quarter
+ , subq_10.ds__year AS ds__year
+ , subq_10.ds__extract_year AS ds__extract_year
+ , subq_10.ds__extract_quarter AS ds__extract_quarter
+ , subq_10.ds__extract_month AS ds__extract_month
+ , subq_10.ds__extract_day AS ds__extract_day
+ , subq_10.ds__extract_dow AS ds__extract_dow
+ , subq_10.ds__extract_doy AS ds__extract_doy
+ , subq_10.ds_partitioned__day AS ds_partitioned__day
+ , subq_10.ds_partitioned__week AS ds_partitioned__week
+ , subq_10.ds_partitioned__month AS ds_partitioned__month
+ , subq_10.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_10.ds_partitioned__year AS ds_partitioned__year
+ , subq_10.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_10.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_10.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_10.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_10.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_10.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_10.paid_at__day AS paid_at__day
+ , subq_10.paid_at__week AS paid_at__week
+ , subq_10.paid_at__month AS paid_at__month
+ , subq_10.paid_at__quarter AS paid_at__quarter
+ , subq_10.paid_at__year AS paid_at__year
+ , subq_10.paid_at__extract_year AS paid_at__extract_year
+ , subq_10.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_10.paid_at__extract_month AS paid_at__extract_month
+ , subq_10.paid_at__extract_day AS paid_at__extract_day
+ , subq_10.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_10.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_10.booking__ds__day AS booking__ds__day
+ , subq_10.booking__ds__week AS booking__ds__week
+ , subq_10.booking__ds__month AS booking__ds__month
+ , subq_10.booking__ds__quarter AS booking__ds__quarter
+ , subq_10.booking__ds__year AS booking__ds__year
+ , subq_10.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_10.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_10.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_10.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_10.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_10.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_10.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_10.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_10.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_10.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_10.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_10.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_10.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_10.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_10.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_10.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_10.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_10.booking__paid_at__day AS booking__paid_at__day
+ , subq_10.booking__paid_at__week AS booking__paid_at__week
+ , subq_10.booking__paid_at__month AS booking__paid_at__month
+ , subq_10.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_10.booking__paid_at__year AS booking__paid_at__year
+ , subq_10.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_10.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_10.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_10.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_10.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_10.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_10.listing AS listing
+ , subq_10.guest AS guest
+ , subq_10.host AS host
+ , subq_10.booking__listing AS booking__listing
+ , subq_10.booking__guest AS booking__guest
+ , subq_10.booking__host AS booking__host
+ , subq_10.is_instant AS is_instant
+ , subq_10.booking__is_instant AS booking__is_instant
+ , subq_10.bookings AS bookings
+ , subq_10.instant_bookings AS instant_bookings
+ , subq_10.booking_value AS booking_value
+ , subq_10.max_booking_value AS max_booking_value
+ , subq_10.min_booking_value AS min_booking_value
+ , subq_10.bookers AS bookers
+ , subq_10.average_booking_value AS average_booking_value
+ , subq_10.referred_bookings AS referred_bookings
+ , subq_10.median_booking_value AS median_booking_value
+ , subq_10.booking_value_p99 AS booking_value_p99
+ , subq_10.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_10.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_10.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_3.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_3
- ) subq_2
+ subq_12.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_12
+ ) subq_11
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS booking__paid_at__extract_dow
+ , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
ON
- DATE_SUB(CAST(subq_2.metric_time__day AS DATETIME), INTERVAL 5 day) = subq_1.metric_time__day
- ) subq_4
- ) subq_5
+ DATE_SUB(CAST(subq_11.metric_time__day AS DATETIME), INTERVAL 5 day) = subq_10.metric_time__day
+ ) subq_13
+ ) subq_14
GROUP BY
metric_time__day
- ) subq_6
- ) subq_7
- ) subq_8
+ ) subq_15
+ ) subq_16
+ ) subq_17
ON
- DATE_SUB(CAST(subq_9.metric_time__day AS DATETIME), INTERVAL 2 day) = subq_8.metric_time__day
-) subq_11
+ DATE_SUB(CAST(subq_18.metric_time__day AS DATETIME), INTERVAL 2 day) = subq_17.metric_time__day
+) subq_20
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_offsets_with_time_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_offsets_with_time_constraint__plan0_optimized.sql
index 6a5e37b13e..a1c5d1a4a5 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_offsets_with_time_constraint__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_offsets_with_time_constraint__plan0_optimized.sql
@@ -5,15 +5,15 @@ SELECT
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_21.metric_time__day AS metric_time__day
- , subq_20.bookings_offset_once AS bookings_offset_once
+ subq_30.metric_time__day AS metric_time__day
+ , subq_29.bookings_offset_once AS bookings_offset_once
FROM (
-- Time Spine
SELECT
ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_22
+ FROM ***************************.mf_time_spine subq_31
WHERE ds BETWEEN '2020-01-12' AND '2020-01-13'
- ) subq_21
+ ) subq_30
INNER JOIN (
-- Compute Metrics via Expressions
SELECT
@@ -25,23 +25,23 @@ FROM (
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_15.ds AS metric_time__day
- , SUM(subq_13.bookings) AS bookings
- FROM ***************************.mf_time_spine subq_15
+ subq_24.ds AS metric_time__day
+ , SUM(subq_22.bookings) AS bookings
+ FROM ***************************.mf_time_spine subq_24
INNER JOIN (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
SELECT
DATE_TRUNC(ds, day) AS metric_time__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_13
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_22
ON
- DATE_SUB(CAST(subq_15.ds AS DATETIME), INTERVAL 5 day) = subq_13.metric_time__day
+ DATE_SUB(CAST(subq_24.ds AS DATETIME), INTERVAL 5 day) = subq_22.metric_time__day
GROUP BY
metric_time__day
- ) subq_19
- ) subq_20
+ ) subq_28
+ ) subq_29
ON
- DATE_SUB(CAST(subq_21.metric_time__day AS DATETIME), INTERVAL 2 day) = subq_20.metric_time__day
-) subq_23
+ DATE_SUB(CAST(subq_30.metric_time__day AS DATETIME), INTERVAL 2 day) = subq_29.metric_time__day
+) subq_32
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_offsets_with_where_constraint__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_offsets_with_where_constraint__plan0.sql
index 4775f4046c..b86725807c 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_offsets_with_where_constraint__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_offsets_with_where_constraint__plan0.sql
@@ -1,346 +1,346 @@
-- Compute Metrics via Expressions
SELECT
- subq_12.metric_time__day
+ subq_21.metric_time__day
, 2 * bookings_offset_once AS bookings_offset_twice
FROM (
-- Constrain Output with WHERE
SELECT
- subq_11.metric_time__day
- , subq_11.bookings_offset_once
+ subq_20.metric_time__day
+ , subq_20.bookings_offset_once
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_9.metric_time__day AS metric_time__day
- , subq_8.bookings_offset_once AS bookings_offset_once
+ subq_18.metric_time__day AS metric_time__day
+ , subq_17.bookings_offset_once AS bookings_offset_once
FROM (
-- Time Spine
SELECT
- subq_10.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_10
- ) subq_9
+ subq_19.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_19
+ ) subq_18
INNER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_7.metric_time__day
+ subq_16.metric_time__day
, 2 * bookings AS bookings_offset_once
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_6.metric_time__day
- , subq_6.bookings
+ subq_15.metric_time__day
+ , subq_15.bookings
FROM (
-- Aggregate Measures
SELECT
- subq_5.metric_time__day
- , SUM(subq_5.bookings) AS bookings
+ subq_14.metric_time__day
+ , SUM(subq_14.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__day']
SELECT
- subq_4.metric_time__day
- , subq_4.bookings
+ subq_13.metric_time__day
+ , subq_13.bookings
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_2.metric_time__day AS metric_time__day
- , subq_1.ds__day AS ds__day
- , subq_1.ds__week AS ds__week
- , subq_1.ds__month AS ds__month
- , subq_1.ds__quarter AS ds__quarter
- , subq_1.ds__year AS ds__year
- , subq_1.ds__extract_year AS ds__extract_year
- , subq_1.ds__extract_quarter AS ds__extract_quarter
- , subq_1.ds__extract_month AS ds__extract_month
- , subq_1.ds__extract_day AS ds__extract_day
- , subq_1.ds__extract_dow AS ds__extract_dow
- , subq_1.ds__extract_doy AS ds__extract_doy
- , subq_1.ds_partitioned__day AS ds_partitioned__day
- , subq_1.ds_partitioned__week AS ds_partitioned__week
- , subq_1.ds_partitioned__month AS ds_partitioned__month
- , subq_1.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_1.ds_partitioned__year AS ds_partitioned__year
- , subq_1.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_1.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_1.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_1.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_1.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_1.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_1.paid_at__day AS paid_at__day
- , subq_1.paid_at__week AS paid_at__week
- , subq_1.paid_at__month AS paid_at__month
- , subq_1.paid_at__quarter AS paid_at__quarter
- , subq_1.paid_at__year AS paid_at__year
- , subq_1.paid_at__extract_year AS paid_at__extract_year
- , subq_1.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_1.paid_at__extract_month AS paid_at__extract_month
- , subq_1.paid_at__extract_day AS paid_at__extract_day
- , subq_1.paid_at__extract_dow AS paid_at__extract_dow
- , subq_1.paid_at__extract_doy AS paid_at__extract_doy
- , subq_1.booking__ds__day AS booking__ds__day
- , subq_1.booking__ds__week AS booking__ds__week
- , subq_1.booking__ds__month AS booking__ds__month
- , subq_1.booking__ds__quarter AS booking__ds__quarter
- , subq_1.booking__ds__year AS booking__ds__year
- , subq_1.booking__ds__extract_year AS booking__ds__extract_year
- , subq_1.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_1.booking__ds__extract_month AS booking__ds__extract_month
- , subq_1.booking__ds__extract_day AS booking__ds__extract_day
- , subq_1.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_1.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_1.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_1.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_1.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_1.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_1.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_1.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_1.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_1.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_1.booking__paid_at__day AS booking__paid_at__day
- , subq_1.booking__paid_at__week AS booking__paid_at__week
- , subq_1.booking__paid_at__month AS booking__paid_at__month
- , subq_1.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_1.booking__paid_at__year AS booking__paid_at__year
- , subq_1.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_1.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_1.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_1.listing AS listing
- , subq_1.guest AS guest
- , subq_1.host AS host
- , subq_1.booking__listing AS booking__listing
- , subq_1.booking__guest AS booking__guest
- , subq_1.booking__host AS booking__host
- , subq_1.is_instant AS is_instant
- , subq_1.booking__is_instant AS booking__is_instant
- , subq_1.bookings AS bookings
- , subq_1.instant_bookings AS instant_bookings
- , subq_1.booking_value AS booking_value
- , subq_1.max_booking_value AS max_booking_value
- , subq_1.min_booking_value AS min_booking_value
- , subq_1.bookers AS bookers
- , subq_1.average_booking_value AS average_booking_value
- , subq_1.referred_bookings AS referred_bookings
- , subq_1.median_booking_value AS median_booking_value
- , subq_1.booking_value_p99 AS booking_value_p99
- , subq_1.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_1.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_1.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ subq_11.metric_time__day AS metric_time__day
+ , subq_10.ds__day AS ds__day
+ , subq_10.ds__week AS ds__week
+ , subq_10.ds__month AS ds__month
+ , subq_10.ds__quarter AS ds__quarter
+ , subq_10.ds__year AS ds__year
+ , subq_10.ds__extract_year AS ds__extract_year
+ , subq_10.ds__extract_quarter AS ds__extract_quarter
+ , subq_10.ds__extract_month AS ds__extract_month
+ , subq_10.ds__extract_day AS ds__extract_day
+ , subq_10.ds__extract_dow AS ds__extract_dow
+ , subq_10.ds__extract_doy AS ds__extract_doy
+ , subq_10.ds_partitioned__day AS ds_partitioned__day
+ , subq_10.ds_partitioned__week AS ds_partitioned__week
+ , subq_10.ds_partitioned__month AS ds_partitioned__month
+ , subq_10.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_10.ds_partitioned__year AS ds_partitioned__year
+ , subq_10.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_10.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_10.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_10.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_10.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_10.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_10.paid_at__day AS paid_at__day
+ , subq_10.paid_at__week AS paid_at__week
+ , subq_10.paid_at__month AS paid_at__month
+ , subq_10.paid_at__quarter AS paid_at__quarter
+ , subq_10.paid_at__year AS paid_at__year
+ , subq_10.paid_at__extract_year AS paid_at__extract_year
+ , subq_10.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_10.paid_at__extract_month AS paid_at__extract_month
+ , subq_10.paid_at__extract_day AS paid_at__extract_day
+ , subq_10.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_10.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_10.booking__ds__day AS booking__ds__day
+ , subq_10.booking__ds__week AS booking__ds__week
+ , subq_10.booking__ds__month AS booking__ds__month
+ , subq_10.booking__ds__quarter AS booking__ds__quarter
+ , subq_10.booking__ds__year AS booking__ds__year
+ , subq_10.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_10.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_10.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_10.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_10.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_10.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_10.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_10.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_10.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_10.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_10.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_10.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_10.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_10.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_10.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_10.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_10.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_10.booking__paid_at__day AS booking__paid_at__day
+ , subq_10.booking__paid_at__week AS booking__paid_at__week
+ , subq_10.booking__paid_at__month AS booking__paid_at__month
+ , subq_10.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_10.booking__paid_at__year AS booking__paid_at__year
+ , subq_10.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_10.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_10.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_10.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_10.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_10.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_10.listing AS listing
+ , subq_10.guest AS guest
+ , subq_10.host AS host
+ , subq_10.booking__listing AS booking__listing
+ , subq_10.booking__guest AS booking__guest
+ , subq_10.booking__host AS booking__host
+ , subq_10.is_instant AS is_instant
+ , subq_10.booking__is_instant AS booking__is_instant
+ , subq_10.bookings AS bookings
+ , subq_10.instant_bookings AS instant_bookings
+ , subq_10.booking_value AS booking_value
+ , subq_10.max_booking_value AS max_booking_value
+ , subq_10.min_booking_value AS min_booking_value
+ , subq_10.bookers AS bookers
+ , subq_10.average_booking_value AS average_booking_value
+ , subq_10.referred_bookings AS referred_bookings
+ , subq_10.median_booking_value AS median_booking_value
+ , subq_10.booking_value_p99 AS booking_value_p99
+ , subq_10.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_10.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_10.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_3.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_3
- ) subq_2
+ subq_12.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_12
+ ) subq_11
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS booking__paid_at__extract_dow
+ , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
ON
- DATE_SUB(CAST(subq_2.metric_time__day AS DATETIME), INTERVAL 5 day) = subq_1.metric_time__day
- ) subq_4
- ) subq_5
+ DATE_SUB(CAST(subq_11.metric_time__day AS DATETIME), INTERVAL 5 day) = subq_10.metric_time__day
+ ) subq_13
+ ) subq_14
GROUP BY
metric_time__day
- ) subq_6
- ) subq_7
- ) subq_8
+ ) subq_15
+ ) subq_16
+ ) subq_17
ON
- DATE_SUB(CAST(subq_9.metric_time__day AS DATETIME), INTERVAL 2 day) = subq_8.metric_time__day
- ) subq_11
+ DATE_SUB(CAST(subq_18.metric_time__day AS DATETIME), INTERVAL 2 day) = subq_17.metric_time__day
+ ) subq_20
WHERE metric_time__day = '2020-01-12' or metric_time__day = '2020-01-13'
-) subq_12
+) subq_21
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_offsets_with_where_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_offsets_with_where_constraint__plan0_optimized.sql
index a19f6253a1..0537f77e49 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_offsets_with_where_constraint__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_nested_offsets_with_where_constraint__plan0_optimized.sql
@@ -10,9 +10,9 @@ FROM (
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_23.ds AS metric_time__day
- , subq_21.bookings_offset_once AS bookings_offset_once
- FROM ***************************.mf_time_spine subq_23
+ subq_32.ds AS metric_time__day
+ , subq_30.bookings_offset_once AS bookings_offset_once
+ FROM ***************************.mf_time_spine subq_32
INNER JOIN (
-- Compute Metrics via Expressions
SELECT
@@ -24,25 +24,25 @@ FROM (
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_16.ds AS metric_time__day
- , SUM(subq_14.bookings) AS bookings
- FROM ***************************.mf_time_spine subq_16
+ subq_25.ds AS metric_time__day
+ , SUM(subq_23.bookings) AS bookings
+ FROM ***************************.mf_time_spine subq_25
INNER JOIN (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
SELECT
DATE_TRUNC(ds, day) AS metric_time__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_14
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_23
ON
- DATE_SUB(CAST(subq_16.ds AS DATETIME), INTERVAL 5 day) = subq_14.metric_time__day
+ DATE_SUB(CAST(subq_25.ds AS DATETIME), INTERVAL 5 day) = subq_23.metric_time__day
GROUP BY
metric_time__day
- ) subq_20
- ) subq_21
+ ) subq_29
+ ) subq_30
ON
- DATE_SUB(CAST(subq_23.ds AS DATETIME), INTERVAL 2 day) = subq_21.metric_time__day
- ) subq_24
+ DATE_SUB(CAST(subq_32.ds AS DATETIME), INTERVAL 2 day) = subq_30.metric_time__day
+ ) subq_33
WHERE metric_time__day = '2020-01-12' or metric_time__day = '2020-01-13'
-) subq_25
+) subq_34
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_to_grain_with_agg_time_dim__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_to_grain_with_agg_time_dim__plan0.sql
index 45846b3999..683f460fe5 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_to_grain_with_agg_time_dim__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_to_grain_with_agg_time_dim__plan0.sql
@@ -1,545 +1,545 @@
-- Compute Metrics via Expressions
SELECT
- subq_13.booking__ds__day
+ subq_22.booking__ds__day
, bookings - bookings_at_start_of_month AS bookings_growth_since_start_of_month
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_4.booking__ds__day, subq_12.booking__ds__day) AS booking__ds__day
- , MAX(subq_4.bookings) AS bookings
- , MAX(subq_12.bookings_at_start_of_month) AS bookings_at_start_of_month
+ COALESCE(subq_13.booking__ds__day, subq_21.booking__ds__day) AS booking__ds__day
+ , MAX(subq_13.bookings) AS bookings
+ , MAX(subq_21.bookings_at_start_of_month) AS bookings_at_start_of_month
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_3.booking__ds__day
- , subq_3.bookings
+ subq_12.booking__ds__day
+ , subq_12.bookings
FROM (
-- Aggregate Measures
SELECT
- subq_2.booking__ds__day
- , SUM(subq_2.bookings) AS bookings
+ subq_11.booking__ds__day
+ , SUM(subq_11.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'booking__ds__day']
SELECT
- subq_1.booking__ds__day
- , subq_1.bookings
+ subq_10.booking__ds__day
+ , subq_10.bookings
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
- ) subq_2
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS booking__paid_at__extract_dow
+ , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
GROUP BY
booking__ds__day
- ) subq_3
- ) subq_4
+ ) subq_12
+ ) subq_13
FULL OUTER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_11.booking__ds__day
- , subq_11.bookings AS bookings_at_start_of_month
+ subq_20.booking__ds__day
+ , subq_20.bookings AS bookings_at_start_of_month
FROM (
-- Aggregate Measures
SELECT
- subq_10.booking__ds__day
- , SUM(subq_10.bookings) AS bookings
+ subq_19.booking__ds__day
+ , SUM(subq_19.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'booking__ds__day']
SELECT
- subq_9.booking__ds__day
- , subq_9.bookings
+ subq_18.booking__ds__day
+ , subq_18.bookings
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_7.booking__ds__day AS booking__ds__day
- , subq_6.ds__day AS ds__day
- , subq_6.ds__week AS ds__week
- , subq_6.ds__month AS ds__month
- , subq_6.ds__quarter AS ds__quarter
- , subq_6.ds__year AS ds__year
- , subq_6.ds__extract_year AS ds__extract_year
- , subq_6.ds__extract_quarter AS ds__extract_quarter
- , subq_6.ds__extract_month AS ds__extract_month
- , subq_6.ds__extract_day AS ds__extract_day
- , subq_6.ds__extract_dow AS ds__extract_dow
- , subq_6.ds__extract_doy AS ds__extract_doy
- , subq_6.ds_partitioned__day AS ds_partitioned__day
- , subq_6.ds_partitioned__week AS ds_partitioned__week
- , subq_6.ds_partitioned__month AS ds_partitioned__month
- , subq_6.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_6.ds_partitioned__year AS ds_partitioned__year
- , subq_6.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_6.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_6.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_6.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_6.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_6.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_6.paid_at__day AS paid_at__day
- , subq_6.paid_at__week AS paid_at__week
- , subq_6.paid_at__month AS paid_at__month
- , subq_6.paid_at__quarter AS paid_at__quarter
- , subq_6.paid_at__year AS paid_at__year
- , subq_6.paid_at__extract_year AS paid_at__extract_year
- , subq_6.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_6.paid_at__extract_month AS paid_at__extract_month
- , subq_6.paid_at__extract_day AS paid_at__extract_day
- , subq_6.paid_at__extract_dow AS paid_at__extract_dow
- , subq_6.paid_at__extract_doy AS paid_at__extract_doy
- , subq_6.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_6.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_6.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_6.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_6.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_6.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_6.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_6.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_6.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_6.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_6.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_6.booking__paid_at__day AS booking__paid_at__day
- , subq_6.booking__paid_at__week AS booking__paid_at__week
- , subq_6.booking__paid_at__month AS booking__paid_at__month
- , subq_6.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_6.booking__paid_at__year AS booking__paid_at__year
- , subq_6.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_6.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_6.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_6.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_6.metric_time__day AS metric_time__day
- , subq_6.metric_time__week AS metric_time__week
- , subq_6.metric_time__month AS metric_time__month
- , subq_6.metric_time__quarter AS metric_time__quarter
- , subq_6.metric_time__year AS metric_time__year
- , subq_6.metric_time__extract_year AS metric_time__extract_year
- , subq_6.metric_time__extract_quarter AS metric_time__extract_quarter
- , subq_6.metric_time__extract_month AS metric_time__extract_month
- , subq_6.metric_time__extract_day AS metric_time__extract_day
- , subq_6.metric_time__extract_dow AS metric_time__extract_dow
- , subq_6.metric_time__extract_doy AS metric_time__extract_doy
- , subq_6.listing AS listing
- , subq_6.guest AS guest
- , subq_6.host AS host
- , subq_6.booking__listing AS booking__listing
- , subq_6.booking__guest AS booking__guest
- , subq_6.booking__host AS booking__host
- , subq_6.is_instant AS is_instant
- , subq_6.booking__is_instant AS booking__is_instant
- , subq_6.bookings AS bookings
- , subq_6.instant_bookings AS instant_bookings
- , subq_6.booking_value AS booking_value
- , subq_6.max_booking_value AS max_booking_value
- , subq_6.min_booking_value AS min_booking_value
- , subq_6.bookers AS bookers
- , subq_6.average_booking_value AS average_booking_value
- , subq_6.referred_bookings AS referred_bookings
- , subq_6.median_booking_value AS median_booking_value
- , subq_6.booking_value_p99 AS booking_value_p99
- , subq_6.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_6.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_6.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ subq_16.booking__ds__day AS booking__ds__day
+ , subq_15.ds__day AS ds__day
+ , subq_15.ds__week AS ds__week
+ , subq_15.ds__month AS ds__month
+ , subq_15.ds__quarter AS ds__quarter
+ , subq_15.ds__year AS ds__year
+ , subq_15.ds__extract_year AS ds__extract_year
+ , subq_15.ds__extract_quarter AS ds__extract_quarter
+ , subq_15.ds__extract_month AS ds__extract_month
+ , subq_15.ds__extract_day AS ds__extract_day
+ , subq_15.ds__extract_dow AS ds__extract_dow
+ , subq_15.ds__extract_doy AS ds__extract_doy
+ , subq_15.ds_partitioned__day AS ds_partitioned__day
+ , subq_15.ds_partitioned__week AS ds_partitioned__week
+ , subq_15.ds_partitioned__month AS ds_partitioned__month
+ , subq_15.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_15.ds_partitioned__year AS ds_partitioned__year
+ , subq_15.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_15.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_15.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_15.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_15.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_15.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_15.paid_at__day AS paid_at__day
+ , subq_15.paid_at__week AS paid_at__week
+ , subq_15.paid_at__month AS paid_at__month
+ , subq_15.paid_at__quarter AS paid_at__quarter
+ , subq_15.paid_at__year AS paid_at__year
+ , subq_15.paid_at__extract_year AS paid_at__extract_year
+ , subq_15.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_15.paid_at__extract_month AS paid_at__extract_month
+ , subq_15.paid_at__extract_day AS paid_at__extract_day
+ , subq_15.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_15.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_15.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_15.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_15.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_15.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_15.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_15.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_15.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_15.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_15.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_15.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_15.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_15.booking__paid_at__day AS booking__paid_at__day
+ , subq_15.booking__paid_at__week AS booking__paid_at__week
+ , subq_15.booking__paid_at__month AS booking__paid_at__month
+ , subq_15.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_15.booking__paid_at__year AS booking__paid_at__year
+ , subq_15.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_15.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_15.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_15.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_15.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_15.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_15.metric_time__day AS metric_time__day
+ , subq_15.metric_time__week AS metric_time__week
+ , subq_15.metric_time__month AS metric_time__month
+ , subq_15.metric_time__quarter AS metric_time__quarter
+ , subq_15.metric_time__year AS metric_time__year
+ , subq_15.metric_time__extract_year AS metric_time__extract_year
+ , subq_15.metric_time__extract_quarter AS metric_time__extract_quarter
+ , subq_15.metric_time__extract_month AS metric_time__extract_month
+ , subq_15.metric_time__extract_day AS metric_time__extract_day
+ , subq_15.metric_time__extract_dow AS metric_time__extract_dow
+ , subq_15.metric_time__extract_doy AS metric_time__extract_doy
+ , subq_15.listing AS listing
+ , subq_15.guest AS guest
+ , subq_15.host AS host
+ , subq_15.booking__listing AS booking__listing
+ , subq_15.booking__guest AS booking__guest
+ , subq_15.booking__host AS booking__host
+ , subq_15.is_instant AS is_instant
+ , subq_15.booking__is_instant AS booking__is_instant
+ , subq_15.bookings AS bookings
+ , subq_15.instant_bookings AS instant_bookings
+ , subq_15.booking_value AS booking_value
+ , subq_15.max_booking_value AS max_booking_value
+ , subq_15.min_booking_value AS min_booking_value
+ , subq_15.bookers AS bookers
+ , subq_15.average_booking_value AS average_booking_value
+ , subq_15.referred_bookings AS referred_bookings
+ , subq_15.median_booking_value AS median_booking_value
+ , subq_15.booking_value_p99 AS booking_value_p99
+ , subq_15.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_15.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_15.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_8.ds AS booking__ds__day
- FROM ***************************.mf_time_spine subq_8
- ) subq_7
+ subq_17.ds AS booking__ds__day
+ FROM ***************************.mf_time_spine subq_17
+ ) subq_16
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_5.ds__day
- , subq_5.ds__week
- , subq_5.ds__month
- , subq_5.ds__quarter
- , subq_5.ds__year
- , subq_5.ds__extract_year
- , subq_5.ds__extract_quarter
- , subq_5.ds__extract_month
- , subq_5.ds__extract_day
- , subq_5.ds__extract_dow
- , subq_5.ds__extract_doy
- , subq_5.ds_partitioned__day
- , subq_5.ds_partitioned__week
- , subq_5.ds_partitioned__month
- , subq_5.ds_partitioned__quarter
- , subq_5.ds_partitioned__year
- , subq_5.ds_partitioned__extract_year
- , subq_5.ds_partitioned__extract_quarter
- , subq_5.ds_partitioned__extract_month
- , subq_5.ds_partitioned__extract_day
- , subq_5.ds_partitioned__extract_dow
- , subq_5.ds_partitioned__extract_doy
- , subq_5.paid_at__day
- , subq_5.paid_at__week
- , subq_5.paid_at__month
- , subq_5.paid_at__quarter
- , subq_5.paid_at__year
- , subq_5.paid_at__extract_year
- , subq_5.paid_at__extract_quarter
- , subq_5.paid_at__extract_month
- , subq_5.paid_at__extract_day
- , subq_5.paid_at__extract_dow
- , subq_5.paid_at__extract_doy
- , subq_5.booking__ds__day
- , subq_5.booking__ds__week
- , subq_5.booking__ds__month
- , subq_5.booking__ds__quarter
- , subq_5.booking__ds__year
- , subq_5.booking__ds__extract_year
- , subq_5.booking__ds__extract_quarter
- , subq_5.booking__ds__extract_month
- , subq_5.booking__ds__extract_day
- , subq_5.booking__ds__extract_dow
- , subq_5.booking__ds__extract_doy
- , subq_5.booking__ds_partitioned__day
- , subq_5.booking__ds_partitioned__week
- , subq_5.booking__ds_partitioned__month
- , subq_5.booking__ds_partitioned__quarter
- , subq_5.booking__ds_partitioned__year
- , subq_5.booking__ds_partitioned__extract_year
- , subq_5.booking__ds_partitioned__extract_quarter
- , subq_5.booking__ds_partitioned__extract_month
- , subq_5.booking__ds_partitioned__extract_day
- , subq_5.booking__ds_partitioned__extract_dow
- , subq_5.booking__ds_partitioned__extract_doy
- , subq_5.booking__paid_at__day
- , subq_5.booking__paid_at__week
- , subq_5.booking__paid_at__month
- , subq_5.booking__paid_at__quarter
- , subq_5.booking__paid_at__year
- , subq_5.booking__paid_at__extract_year
- , subq_5.booking__paid_at__extract_quarter
- , subq_5.booking__paid_at__extract_month
- , subq_5.booking__paid_at__extract_day
- , subq_5.booking__paid_at__extract_dow
- , subq_5.booking__paid_at__extract_doy
- , subq_5.ds__day AS metric_time__day
- , subq_5.ds__week AS metric_time__week
- , subq_5.ds__month AS metric_time__month
- , subq_5.ds__quarter AS metric_time__quarter
- , subq_5.ds__year AS metric_time__year
- , subq_5.ds__extract_year AS metric_time__extract_year
- , subq_5.ds__extract_quarter AS metric_time__extract_quarter
- , subq_5.ds__extract_month AS metric_time__extract_month
- , subq_5.ds__extract_day AS metric_time__extract_day
- , subq_5.ds__extract_dow AS metric_time__extract_dow
- , subq_5.ds__extract_doy AS metric_time__extract_doy
- , subq_5.listing
- , subq_5.guest
- , subq_5.host
- , subq_5.booking__listing
- , subq_5.booking__guest
- , subq_5.booking__host
- , subq_5.is_instant
- , subq_5.booking__is_instant
- , subq_5.bookings
- , subq_5.instant_bookings
- , subq_5.booking_value
- , subq_5.max_booking_value
- , subq_5.min_booking_value
- , subq_5.bookers
- , subq_5.average_booking_value
- , subq_5.referred_bookings
- , subq_5.median_booking_value
- , subq_5.booking_value_p99
- , subq_5.discrete_booking_value_p99
- , subq_5.approximate_continuous_booking_value_p99
- , subq_5.approximate_discrete_booking_value_p99
+ subq_14.ds__day
+ , subq_14.ds__week
+ , subq_14.ds__month
+ , subq_14.ds__quarter
+ , subq_14.ds__year
+ , subq_14.ds__extract_year
+ , subq_14.ds__extract_quarter
+ , subq_14.ds__extract_month
+ , subq_14.ds__extract_day
+ , subq_14.ds__extract_dow
+ , subq_14.ds__extract_doy
+ , subq_14.ds_partitioned__day
+ , subq_14.ds_partitioned__week
+ , subq_14.ds_partitioned__month
+ , subq_14.ds_partitioned__quarter
+ , subq_14.ds_partitioned__year
+ , subq_14.ds_partitioned__extract_year
+ , subq_14.ds_partitioned__extract_quarter
+ , subq_14.ds_partitioned__extract_month
+ , subq_14.ds_partitioned__extract_day
+ , subq_14.ds_partitioned__extract_dow
+ , subq_14.ds_partitioned__extract_doy
+ , subq_14.paid_at__day
+ , subq_14.paid_at__week
+ , subq_14.paid_at__month
+ , subq_14.paid_at__quarter
+ , subq_14.paid_at__year
+ , subq_14.paid_at__extract_year
+ , subq_14.paid_at__extract_quarter
+ , subq_14.paid_at__extract_month
+ , subq_14.paid_at__extract_day
+ , subq_14.paid_at__extract_dow
+ , subq_14.paid_at__extract_doy
+ , subq_14.booking__ds__day
+ , subq_14.booking__ds__week
+ , subq_14.booking__ds__month
+ , subq_14.booking__ds__quarter
+ , subq_14.booking__ds__year
+ , subq_14.booking__ds__extract_year
+ , subq_14.booking__ds__extract_quarter
+ , subq_14.booking__ds__extract_month
+ , subq_14.booking__ds__extract_day
+ , subq_14.booking__ds__extract_dow
+ , subq_14.booking__ds__extract_doy
+ , subq_14.booking__ds_partitioned__day
+ , subq_14.booking__ds_partitioned__week
+ , subq_14.booking__ds_partitioned__month
+ , subq_14.booking__ds_partitioned__quarter
+ , subq_14.booking__ds_partitioned__year
+ , subq_14.booking__ds_partitioned__extract_year
+ , subq_14.booking__ds_partitioned__extract_quarter
+ , subq_14.booking__ds_partitioned__extract_month
+ , subq_14.booking__ds_partitioned__extract_day
+ , subq_14.booking__ds_partitioned__extract_dow
+ , subq_14.booking__ds_partitioned__extract_doy
+ , subq_14.booking__paid_at__day
+ , subq_14.booking__paid_at__week
+ , subq_14.booking__paid_at__month
+ , subq_14.booking__paid_at__quarter
+ , subq_14.booking__paid_at__year
+ , subq_14.booking__paid_at__extract_year
+ , subq_14.booking__paid_at__extract_quarter
+ , subq_14.booking__paid_at__extract_month
+ , subq_14.booking__paid_at__extract_day
+ , subq_14.booking__paid_at__extract_dow
+ , subq_14.booking__paid_at__extract_doy
+ , subq_14.ds__day AS metric_time__day
+ , subq_14.ds__week AS metric_time__week
+ , subq_14.ds__month AS metric_time__month
+ , subq_14.ds__quarter AS metric_time__quarter
+ , subq_14.ds__year AS metric_time__year
+ , subq_14.ds__extract_year AS metric_time__extract_year
+ , subq_14.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_14.ds__extract_month AS metric_time__extract_month
+ , subq_14.ds__extract_day AS metric_time__extract_day
+ , subq_14.ds__extract_dow AS metric_time__extract_dow
+ , subq_14.ds__extract_doy AS metric_time__extract_doy
+ , subq_14.listing
+ , subq_14.guest
+ , subq_14.host
+ , subq_14.booking__listing
+ , subq_14.booking__guest
+ , subq_14.booking__host
+ , subq_14.is_instant
+ , subq_14.booking__is_instant
+ , subq_14.bookings
+ , subq_14.instant_bookings
+ , subq_14.booking_value
+ , subq_14.max_booking_value
+ , subq_14.min_booking_value
+ , subq_14.bookers
+ , subq_14.average_booking_value
+ , subq_14.referred_bookings
+ , subq_14.median_booking_value
+ , subq_14.booking_value_p99
+ , subq_14.discrete_booking_value_p99
+ , subq_14.approximate_continuous_booking_value_p99
+ , subq_14.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_5
- ) subq_6
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS booking__paid_at__extract_dow
+ , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_14
+ ) subq_15
ON
- DATE_TRUNC(subq_7.booking__ds__day, month) = subq_6.booking__ds__day
- ) subq_9
- ) subq_10
+ DATE_TRUNC(subq_16.booking__ds__day, month) = subq_15.booking__ds__day
+ ) subq_18
+ ) subq_19
GROUP BY
booking__ds__day
- ) subq_11
- ) subq_12
+ ) subq_20
+ ) subq_21
ON
- subq_4.booking__ds__day = subq_12.booking__ds__day
+ subq_13.booking__ds__day = subq_21.booking__ds__day
GROUP BY
booking__ds__day
-) subq_13
+) subq_22
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_to_grain_with_agg_time_dim__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_to_grain_with_agg_time_dim__plan0_optimized.sql
index 6a4f47cc54..80492a487e 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_to_grain_with_agg_time_dim__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_to_grain_with_agg_time_dim__plan0_optimized.sql
@@ -5,9 +5,9 @@ SELECT
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_18.booking__ds__day, subq_26.booking__ds__day) AS booking__ds__day
- , MAX(subq_18.bookings) AS bookings
- , MAX(subq_26.bookings_at_start_of_month) AS bookings_at_start_of_month
+ COALESCE(subq_27.booking__ds__day, subq_35.booking__ds__day) AS booking__ds__day
+ , MAX(subq_27.bookings) AS bookings
+ , MAX(subq_35.bookings_at_start_of_month) AS bookings_at_start_of_month
FROM (
-- Aggregate Measures
-- Compute Metrics via Expressions
@@ -21,35 +21,35 @@ FROM (
SELECT
DATE_TRUNC(ds, day) AS booking__ds__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_16
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_25
GROUP BY
booking__ds__day
- ) subq_18
+ ) subq_27
FULL OUTER JOIN (
-- Join to Time Spine Dataset
-- Pass Only Elements: ['bookings', 'booking__ds__day']
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_22.ds AS booking__ds__day
- , SUM(subq_20.bookings) AS bookings_at_start_of_month
- FROM ***************************.mf_time_spine subq_22
+ subq_31.ds AS booking__ds__day
+ , SUM(subq_29.bookings) AS bookings_at_start_of_month
+ FROM ***************************.mf_time_spine subq_31
INNER JOIN (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
SELECT
DATE_TRUNC(ds, day) AS booking__ds__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_20
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_29
ON
- DATE_TRUNC(subq_22.ds, month) = subq_20.booking__ds__day
+ DATE_TRUNC(subq_31.ds, month) = subq_29.booking__ds__day
GROUP BY
booking__ds__day
- ) subq_26
+ ) subq_35
ON
- subq_18.booking__ds__day = subq_26.booking__ds__day
+ subq_27.booking__ds__day = subq_35.booking__ds__day
GROUP BY
booking__ds__day
-) subq_27
+) subq_36
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_window_with_agg_time_dim__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_window_with_agg_time_dim__plan0.sql
index c855ed38d8..0c43e3eb97 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_window_with_agg_time_dim__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_window_with_agg_time_dim__plan0.sql
@@ -1,545 +1,545 @@
-- Compute Metrics via Expressions
SELECT
- subq_13.booking__ds__day
+ subq_22.booking__ds__day
, bookings - bookings_2_weeks_ago AS bookings_growth_2_weeks
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_4.booking__ds__day, subq_12.booking__ds__day) AS booking__ds__day
- , MAX(subq_4.bookings) AS bookings
- , MAX(subq_12.bookings_2_weeks_ago) AS bookings_2_weeks_ago
+ COALESCE(subq_13.booking__ds__day, subq_21.booking__ds__day) AS booking__ds__day
+ , MAX(subq_13.bookings) AS bookings
+ , MAX(subq_21.bookings_2_weeks_ago) AS bookings_2_weeks_ago
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_3.booking__ds__day
- , subq_3.bookings
+ subq_12.booking__ds__day
+ , subq_12.bookings
FROM (
-- Aggregate Measures
SELECT
- subq_2.booking__ds__day
- , SUM(subq_2.bookings) AS bookings
+ subq_11.booking__ds__day
+ , SUM(subq_11.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'booking__ds__day']
SELECT
- subq_1.booking__ds__day
- , subq_1.bookings
+ subq_10.booking__ds__day
+ , subq_10.bookings
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
- ) subq_2
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS booking__paid_at__extract_dow
+ , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
GROUP BY
booking__ds__day
- ) subq_3
- ) subq_4
+ ) subq_12
+ ) subq_13
FULL OUTER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_11.booking__ds__day
- , subq_11.bookings AS bookings_2_weeks_ago
+ subq_20.booking__ds__day
+ , subq_20.bookings AS bookings_2_weeks_ago
FROM (
-- Aggregate Measures
SELECT
- subq_10.booking__ds__day
- , SUM(subq_10.bookings) AS bookings
+ subq_19.booking__ds__day
+ , SUM(subq_19.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'booking__ds__day']
SELECT
- subq_9.booking__ds__day
- , subq_9.bookings
+ subq_18.booking__ds__day
+ , subq_18.bookings
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_7.booking__ds__day AS booking__ds__day
- , subq_6.ds__day AS ds__day
- , subq_6.ds__week AS ds__week
- , subq_6.ds__month AS ds__month
- , subq_6.ds__quarter AS ds__quarter
- , subq_6.ds__year AS ds__year
- , subq_6.ds__extract_year AS ds__extract_year
- , subq_6.ds__extract_quarter AS ds__extract_quarter
- , subq_6.ds__extract_month AS ds__extract_month
- , subq_6.ds__extract_day AS ds__extract_day
- , subq_6.ds__extract_dow AS ds__extract_dow
- , subq_6.ds__extract_doy AS ds__extract_doy
- , subq_6.ds_partitioned__day AS ds_partitioned__day
- , subq_6.ds_partitioned__week AS ds_partitioned__week
- , subq_6.ds_partitioned__month AS ds_partitioned__month
- , subq_6.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_6.ds_partitioned__year AS ds_partitioned__year
- , subq_6.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_6.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_6.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_6.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_6.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_6.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_6.paid_at__day AS paid_at__day
- , subq_6.paid_at__week AS paid_at__week
- , subq_6.paid_at__month AS paid_at__month
- , subq_6.paid_at__quarter AS paid_at__quarter
- , subq_6.paid_at__year AS paid_at__year
- , subq_6.paid_at__extract_year AS paid_at__extract_year
- , subq_6.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_6.paid_at__extract_month AS paid_at__extract_month
- , subq_6.paid_at__extract_day AS paid_at__extract_day
- , subq_6.paid_at__extract_dow AS paid_at__extract_dow
- , subq_6.paid_at__extract_doy AS paid_at__extract_doy
- , subq_6.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_6.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_6.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_6.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_6.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_6.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_6.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_6.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_6.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_6.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_6.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_6.booking__paid_at__day AS booking__paid_at__day
- , subq_6.booking__paid_at__week AS booking__paid_at__week
- , subq_6.booking__paid_at__month AS booking__paid_at__month
- , subq_6.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_6.booking__paid_at__year AS booking__paid_at__year
- , subq_6.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_6.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_6.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_6.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_6.metric_time__day AS metric_time__day
- , subq_6.metric_time__week AS metric_time__week
- , subq_6.metric_time__month AS metric_time__month
- , subq_6.metric_time__quarter AS metric_time__quarter
- , subq_6.metric_time__year AS metric_time__year
- , subq_6.metric_time__extract_year AS metric_time__extract_year
- , subq_6.metric_time__extract_quarter AS metric_time__extract_quarter
- , subq_6.metric_time__extract_month AS metric_time__extract_month
- , subq_6.metric_time__extract_day AS metric_time__extract_day
- , subq_6.metric_time__extract_dow AS metric_time__extract_dow
- , subq_6.metric_time__extract_doy AS metric_time__extract_doy
- , subq_6.listing AS listing
- , subq_6.guest AS guest
- , subq_6.host AS host
- , subq_6.booking__listing AS booking__listing
- , subq_6.booking__guest AS booking__guest
- , subq_6.booking__host AS booking__host
- , subq_6.is_instant AS is_instant
- , subq_6.booking__is_instant AS booking__is_instant
- , subq_6.bookings AS bookings
- , subq_6.instant_bookings AS instant_bookings
- , subq_6.booking_value AS booking_value
- , subq_6.max_booking_value AS max_booking_value
- , subq_6.min_booking_value AS min_booking_value
- , subq_6.bookers AS bookers
- , subq_6.average_booking_value AS average_booking_value
- , subq_6.referred_bookings AS referred_bookings
- , subq_6.median_booking_value AS median_booking_value
- , subq_6.booking_value_p99 AS booking_value_p99
- , subq_6.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_6.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_6.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ subq_16.booking__ds__day AS booking__ds__day
+ , subq_15.ds__day AS ds__day
+ , subq_15.ds__week AS ds__week
+ , subq_15.ds__month AS ds__month
+ , subq_15.ds__quarter AS ds__quarter
+ , subq_15.ds__year AS ds__year
+ , subq_15.ds__extract_year AS ds__extract_year
+ , subq_15.ds__extract_quarter AS ds__extract_quarter
+ , subq_15.ds__extract_month AS ds__extract_month
+ , subq_15.ds__extract_day AS ds__extract_day
+ , subq_15.ds__extract_dow AS ds__extract_dow
+ , subq_15.ds__extract_doy AS ds__extract_doy
+ , subq_15.ds_partitioned__day AS ds_partitioned__day
+ , subq_15.ds_partitioned__week AS ds_partitioned__week
+ , subq_15.ds_partitioned__month AS ds_partitioned__month
+ , subq_15.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_15.ds_partitioned__year AS ds_partitioned__year
+ , subq_15.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_15.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_15.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_15.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_15.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_15.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_15.paid_at__day AS paid_at__day
+ , subq_15.paid_at__week AS paid_at__week
+ , subq_15.paid_at__month AS paid_at__month
+ , subq_15.paid_at__quarter AS paid_at__quarter
+ , subq_15.paid_at__year AS paid_at__year
+ , subq_15.paid_at__extract_year AS paid_at__extract_year
+ , subq_15.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_15.paid_at__extract_month AS paid_at__extract_month
+ , subq_15.paid_at__extract_day AS paid_at__extract_day
+ , subq_15.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_15.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_15.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_15.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_15.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_15.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_15.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_15.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_15.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_15.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_15.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_15.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_15.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_15.booking__paid_at__day AS booking__paid_at__day
+ , subq_15.booking__paid_at__week AS booking__paid_at__week
+ , subq_15.booking__paid_at__month AS booking__paid_at__month
+ , subq_15.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_15.booking__paid_at__year AS booking__paid_at__year
+ , subq_15.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_15.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_15.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_15.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_15.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_15.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_15.metric_time__day AS metric_time__day
+ , subq_15.metric_time__week AS metric_time__week
+ , subq_15.metric_time__month AS metric_time__month
+ , subq_15.metric_time__quarter AS metric_time__quarter
+ , subq_15.metric_time__year AS metric_time__year
+ , subq_15.metric_time__extract_year AS metric_time__extract_year
+ , subq_15.metric_time__extract_quarter AS metric_time__extract_quarter
+ , subq_15.metric_time__extract_month AS metric_time__extract_month
+ , subq_15.metric_time__extract_day AS metric_time__extract_day
+ , subq_15.metric_time__extract_dow AS metric_time__extract_dow
+ , subq_15.metric_time__extract_doy AS metric_time__extract_doy
+ , subq_15.listing AS listing
+ , subq_15.guest AS guest
+ , subq_15.host AS host
+ , subq_15.booking__listing AS booking__listing
+ , subq_15.booking__guest AS booking__guest
+ , subq_15.booking__host AS booking__host
+ , subq_15.is_instant AS is_instant
+ , subq_15.booking__is_instant AS booking__is_instant
+ , subq_15.bookings AS bookings
+ , subq_15.instant_bookings AS instant_bookings
+ , subq_15.booking_value AS booking_value
+ , subq_15.max_booking_value AS max_booking_value
+ , subq_15.min_booking_value AS min_booking_value
+ , subq_15.bookers AS bookers
+ , subq_15.average_booking_value AS average_booking_value
+ , subq_15.referred_bookings AS referred_bookings
+ , subq_15.median_booking_value AS median_booking_value
+ , subq_15.booking_value_p99 AS booking_value_p99
+ , subq_15.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_15.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_15.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_8.ds AS booking__ds__day
- FROM ***************************.mf_time_spine subq_8
- ) subq_7
+ subq_17.ds AS booking__ds__day
+ FROM ***************************.mf_time_spine subq_17
+ ) subq_16
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_5.ds__day
- , subq_5.ds__week
- , subq_5.ds__month
- , subq_5.ds__quarter
- , subq_5.ds__year
- , subq_5.ds__extract_year
- , subq_5.ds__extract_quarter
- , subq_5.ds__extract_month
- , subq_5.ds__extract_day
- , subq_5.ds__extract_dow
- , subq_5.ds__extract_doy
- , subq_5.ds_partitioned__day
- , subq_5.ds_partitioned__week
- , subq_5.ds_partitioned__month
- , subq_5.ds_partitioned__quarter
- , subq_5.ds_partitioned__year
- , subq_5.ds_partitioned__extract_year
- , subq_5.ds_partitioned__extract_quarter
- , subq_5.ds_partitioned__extract_month
- , subq_5.ds_partitioned__extract_day
- , subq_5.ds_partitioned__extract_dow
- , subq_5.ds_partitioned__extract_doy
- , subq_5.paid_at__day
- , subq_5.paid_at__week
- , subq_5.paid_at__month
- , subq_5.paid_at__quarter
- , subq_5.paid_at__year
- , subq_5.paid_at__extract_year
- , subq_5.paid_at__extract_quarter
- , subq_5.paid_at__extract_month
- , subq_5.paid_at__extract_day
- , subq_5.paid_at__extract_dow
- , subq_5.paid_at__extract_doy
- , subq_5.booking__ds__day
- , subq_5.booking__ds__week
- , subq_5.booking__ds__month
- , subq_5.booking__ds__quarter
- , subq_5.booking__ds__year
- , subq_5.booking__ds__extract_year
- , subq_5.booking__ds__extract_quarter
- , subq_5.booking__ds__extract_month
- , subq_5.booking__ds__extract_day
- , subq_5.booking__ds__extract_dow
- , subq_5.booking__ds__extract_doy
- , subq_5.booking__ds_partitioned__day
- , subq_5.booking__ds_partitioned__week
- , subq_5.booking__ds_partitioned__month
- , subq_5.booking__ds_partitioned__quarter
- , subq_5.booking__ds_partitioned__year
- , subq_5.booking__ds_partitioned__extract_year
- , subq_5.booking__ds_partitioned__extract_quarter
- , subq_5.booking__ds_partitioned__extract_month
- , subq_5.booking__ds_partitioned__extract_day
- , subq_5.booking__ds_partitioned__extract_dow
- , subq_5.booking__ds_partitioned__extract_doy
- , subq_5.booking__paid_at__day
- , subq_5.booking__paid_at__week
- , subq_5.booking__paid_at__month
- , subq_5.booking__paid_at__quarter
- , subq_5.booking__paid_at__year
- , subq_5.booking__paid_at__extract_year
- , subq_5.booking__paid_at__extract_quarter
- , subq_5.booking__paid_at__extract_month
- , subq_5.booking__paid_at__extract_day
- , subq_5.booking__paid_at__extract_dow
- , subq_5.booking__paid_at__extract_doy
- , subq_5.ds__day AS metric_time__day
- , subq_5.ds__week AS metric_time__week
- , subq_5.ds__month AS metric_time__month
- , subq_5.ds__quarter AS metric_time__quarter
- , subq_5.ds__year AS metric_time__year
- , subq_5.ds__extract_year AS metric_time__extract_year
- , subq_5.ds__extract_quarter AS metric_time__extract_quarter
- , subq_5.ds__extract_month AS metric_time__extract_month
- , subq_5.ds__extract_day AS metric_time__extract_day
- , subq_5.ds__extract_dow AS metric_time__extract_dow
- , subq_5.ds__extract_doy AS metric_time__extract_doy
- , subq_5.listing
- , subq_5.guest
- , subq_5.host
- , subq_5.booking__listing
- , subq_5.booking__guest
- , subq_5.booking__host
- , subq_5.is_instant
- , subq_5.booking__is_instant
- , subq_5.bookings
- , subq_5.instant_bookings
- , subq_5.booking_value
- , subq_5.max_booking_value
- , subq_5.min_booking_value
- , subq_5.bookers
- , subq_5.average_booking_value
- , subq_5.referred_bookings
- , subq_5.median_booking_value
- , subq_5.booking_value_p99
- , subq_5.discrete_booking_value_p99
- , subq_5.approximate_continuous_booking_value_p99
- , subq_5.approximate_discrete_booking_value_p99
+ subq_14.ds__day
+ , subq_14.ds__week
+ , subq_14.ds__month
+ , subq_14.ds__quarter
+ , subq_14.ds__year
+ , subq_14.ds__extract_year
+ , subq_14.ds__extract_quarter
+ , subq_14.ds__extract_month
+ , subq_14.ds__extract_day
+ , subq_14.ds__extract_dow
+ , subq_14.ds__extract_doy
+ , subq_14.ds_partitioned__day
+ , subq_14.ds_partitioned__week
+ , subq_14.ds_partitioned__month
+ , subq_14.ds_partitioned__quarter
+ , subq_14.ds_partitioned__year
+ , subq_14.ds_partitioned__extract_year
+ , subq_14.ds_partitioned__extract_quarter
+ , subq_14.ds_partitioned__extract_month
+ , subq_14.ds_partitioned__extract_day
+ , subq_14.ds_partitioned__extract_dow
+ , subq_14.ds_partitioned__extract_doy
+ , subq_14.paid_at__day
+ , subq_14.paid_at__week
+ , subq_14.paid_at__month
+ , subq_14.paid_at__quarter
+ , subq_14.paid_at__year
+ , subq_14.paid_at__extract_year
+ , subq_14.paid_at__extract_quarter
+ , subq_14.paid_at__extract_month
+ , subq_14.paid_at__extract_day
+ , subq_14.paid_at__extract_dow
+ , subq_14.paid_at__extract_doy
+ , subq_14.booking__ds__day
+ , subq_14.booking__ds__week
+ , subq_14.booking__ds__month
+ , subq_14.booking__ds__quarter
+ , subq_14.booking__ds__year
+ , subq_14.booking__ds__extract_year
+ , subq_14.booking__ds__extract_quarter
+ , subq_14.booking__ds__extract_month
+ , subq_14.booking__ds__extract_day
+ , subq_14.booking__ds__extract_dow
+ , subq_14.booking__ds__extract_doy
+ , subq_14.booking__ds_partitioned__day
+ , subq_14.booking__ds_partitioned__week
+ , subq_14.booking__ds_partitioned__month
+ , subq_14.booking__ds_partitioned__quarter
+ , subq_14.booking__ds_partitioned__year
+ , subq_14.booking__ds_partitioned__extract_year
+ , subq_14.booking__ds_partitioned__extract_quarter
+ , subq_14.booking__ds_partitioned__extract_month
+ , subq_14.booking__ds_partitioned__extract_day
+ , subq_14.booking__ds_partitioned__extract_dow
+ , subq_14.booking__ds_partitioned__extract_doy
+ , subq_14.booking__paid_at__day
+ , subq_14.booking__paid_at__week
+ , subq_14.booking__paid_at__month
+ , subq_14.booking__paid_at__quarter
+ , subq_14.booking__paid_at__year
+ , subq_14.booking__paid_at__extract_year
+ , subq_14.booking__paid_at__extract_quarter
+ , subq_14.booking__paid_at__extract_month
+ , subq_14.booking__paid_at__extract_day
+ , subq_14.booking__paid_at__extract_dow
+ , subq_14.booking__paid_at__extract_doy
+ , subq_14.ds__day AS metric_time__day
+ , subq_14.ds__week AS metric_time__week
+ , subq_14.ds__month AS metric_time__month
+ , subq_14.ds__quarter AS metric_time__quarter
+ , subq_14.ds__year AS metric_time__year
+ , subq_14.ds__extract_year AS metric_time__extract_year
+ , subq_14.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_14.ds__extract_month AS metric_time__extract_month
+ , subq_14.ds__extract_day AS metric_time__extract_day
+ , subq_14.ds__extract_dow AS metric_time__extract_dow
+ , subq_14.ds__extract_doy AS metric_time__extract_doy
+ , subq_14.listing
+ , subq_14.guest
+ , subq_14.host
+ , subq_14.booking__listing
+ , subq_14.booking__guest
+ , subq_14.booking__host
+ , subq_14.is_instant
+ , subq_14.booking__is_instant
+ , subq_14.bookings
+ , subq_14.instant_bookings
+ , subq_14.booking_value
+ , subq_14.max_booking_value
+ , subq_14.min_booking_value
+ , subq_14.bookers
+ , subq_14.average_booking_value
+ , subq_14.referred_bookings
+ , subq_14.median_booking_value
+ , subq_14.booking_value_p99
+ , subq_14.discrete_booking_value_p99
+ , subq_14.approximate_continuous_booking_value_p99
+ , subq_14.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_5
- ) subq_6
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS booking__paid_at__extract_dow
+ , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_14
+ ) subq_15
ON
- DATE_SUB(CAST(subq_7.booking__ds__day AS DATETIME), INTERVAL 14 day) = subq_6.booking__ds__day
- ) subq_9
- ) subq_10
+ DATE_SUB(CAST(subq_16.booking__ds__day AS DATETIME), INTERVAL 14 day) = subq_15.booking__ds__day
+ ) subq_18
+ ) subq_19
GROUP BY
booking__ds__day
- ) subq_11
- ) subq_12
+ ) subq_20
+ ) subq_21
ON
- subq_4.booking__ds__day = subq_12.booking__ds__day
+ subq_13.booking__ds__day = subq_21.booking__ds__day
GROUP BY
booking__ds__day
-) subq_13
+) subq_22
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_window_with_agg_time_dim__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_window_with_agg_time_dim__plan0_optimized.sql
index 7fd58814bc..852a256564 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_window_with_agg_time_dim__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_offset_window_with_agg_time_dim__plan0_optimized.sql
@@ -5,9 +5,9 @@ SELECT
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_18.booking__ds__day, subq_26.booking__ds__day) AS booking__ds__day
- , MAX(subq_18.bookings) AS bookings
- , MAX(subq_26.bookings_2_weeks_ago) AS bookings_2_weeks_ago
+ COALESCE(subq_27.booking__ds__day, subq_35.booking__ds__day) AS booking__ds__day
+ , MAX(subq_27.bookings) AS bookings
+ , MAX(subq_35.bookings_2_weeks_ago) AS bookings_2_weeks_ago
FROM (
-- Aggregate Measures
-- Compute Metrics via Expressions
@@ -21,35 +21,35 @@ FROM (
SELECT
DATE_TRUNC(ds, day) AS booking__ds__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_16
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_25
GROUP BY
booking__ds__day
- ) subq_18
+ ) subq_27
FULL OUTER JOIN (
-- Join to Time Spine Dataset
-- Pass Only Elements: ['bookings', 'booking__ds__day']
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_22.ds AS booking__ds__day
- , SUM(subq_20.bookings) AS bookings_2_weeks_ago
- FROM ***************************.mf_time_spine subq_22
+ subq_31.ds AS booking__ds__day
+ , SUM(subq_29.bookings) AS bookings_2_weeks_ago
+ FROM ***************************.mf_time_spine subq_31
INNER JOIN (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
SELECT
DATE_TRUNC(ds, day) AS booking__ds__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_20
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_29
ON
- DATE_SUB(CAST(subq_22.ds AS DATETIME), INTERVAL 14 day) = subq_20.booking__ds__day
+ DATE_SUB(CAST(subq_31.ds AS DATETIME), INTERVAL 14 day) = subq_29.booking__ds__day
GROUP BY
booking__ds__day
- ) subq_26
+ ) subq_35
ON
- subq_18.booking__ds__day = subq_26.booking__ds__day
+ subq_27.booking__ds__day = subq_35.booking__ds__day
GROUP BY
booking__ds__day
-) subq_27
+) subq_36
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_time_offset_metric_with_time_constraint__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_time_offset_metric_with_time_constraint__plan0.sql
index 4e204fef06..2398c4f3b5 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_time_offset_metric_with_time_constraint__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_time_offset_metric_with_time_constraint__plan0.sql
@@ -1,320 +1,320 @@
-- Compute Metrics via Expressions
SELECT
- subq_7.metric_time__day
+ subq_16.metric_time__day
, bookings_5_days_ago AS bookings_5_day_lag
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_6.metric_time__day
- , subq_6.bookings AS bookings_5_days_ago
+ subq_15.metric_time__day
+ , subq_15.bookings AS bookings_5_days_ago
FROM (
-- Aggregate Measures
SELECT
- subq_5.metric_time__day
- , SUM(subq_5.bookings) AS bookings
+ subq_14.metric_time__day
+ , SUM(subq_14.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__day']
SELECT
- subq_4.metric_time__day
- , subq_4.bookings
+ subq_13.metric_time__day
+ , subq_13.bookings
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_2.metric_time__day AS metric_time__day
- , subq_1.ds__day AS ds__day
- , subq_1.ds__week AS ds__week
- , subq_1.ds__month AS ds__month
- , subq_1.ds__quarter AS ds__quarter
- , subq_1.ds__year AS ds__year
- , subq_1.ds__extract_year AS ds__extract_year
- , subq_1.ds__extract_quarter AS ds__extract_quarter
- , subq_1.ds__extract_month AS ds__extract_month
- , subq_1.ds__extract_day AS ds__extract_day
- , subq_1.ds__extract_dow AS ds__extract_dow
- , subq_1.ds__extract_doy AS ds__extract_doy
- , subq_1.ds_partitioned__day AS ds_partitioned__day
- , subq_1.ds_partitioned__week AS ds_partitioned__week
- , subq_1.ds_partitioned__month AS ds_partitioned__month
- , subq_1.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_1.ds_partitioned__year AS ds_partitioned__year
- , subq_1.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_1.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_1.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_1.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_1.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_1.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_1.paid_at__day AS paid_at__day
- , subq_1.paid_at__week AS paid_at__week
- , subq_1.paid_at__month AS paid_at__month
- , subq_1.paid_at__quarter AS paid_at__quarter
- , subq_1.paid_at__year AS paid_at__year
- , subq_1.paid_at__extract_year AS paid_at__extract_year
- , subq_1.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_1.paid_at__extract_month AS paid_at__extract_month
- , subq_1.paid_at__extract_day AS paid_at__extract_day
- , subq_1.paid_at__extract_dow AS paid_at__extract_dow
- , subq_1.paid_at__extract_doy AS paid_at__extract_doy
- , subq_1.booking__ds__day AS booking__ds__day
- , subq_1.booking__ds__week AS booking__ds__week
- , subq_1.booking__ds__month AS booking__ds__month
- , subq_1.booking__ds__quarter AS booking__ds__quarter
- , subq_1.booking__ds__year AS booking__ds__year
- , subq_1.booking__ds__extract_year AS booking__ds__extract_year
- , subq_1.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_1.booking__ds__extract_month AS booking__ds__extract_month
- , subq_1.booking__ds__extract_day AS booking__ds__extract_day
- , subq_1.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_1.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_1.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_1.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_1.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_1.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_1.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_1.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_1.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_1.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_1.booking__paid_at__day AS booking__paid_at__day
- , subq_1.booking__paid_at__week AS booking__paid_at__week
- , subq_1.booking__paid_at__month AS booking__paid_at__month
- , subq_1.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_1.booking__paid_at__year AS booking__paid_at__year
- , subq_1.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_1.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_1.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_1.listing AS listing
- , subq_1.guest AS guest
- , subq_1.host AS host
- , subq_1.booking__listing AS booking__listing
- , subq_1.booking__guest AS booking__guest
- , subq_1.booking__host AS booking__host
- , subq_1.is_instant AS is_instant
- , subq_1.booking__is_instant AS booking__is_instant
- , subq_1.bookings AS bookings
- , subq_1.instant_bookings AS instant_bookings
- , subq_1.booking_value AS booking_value
- , subq_1.max_booking_value AS max_booking_value
- , subq_1.min_booking_value AS min_booking_value
- , subq_1.bookers AS bookers
- , subq_1.average_booking_value AS average_booking_value
- , subq_1.referred_bookings AS referred_bookings
- , subq_1.median_booking_value AS median_booking_value
- , subq_1.booking_value_p99 AS booking_value_p99
- , subq_1.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_1.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_1.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ subq_11.metric_time__day AS metric_time__day
+ , subq_10.ds__day AS ds__day
+ , subq_10.ds__week AS ds__week
+ , subq_10.ds__month AS ds__month
+ , subq_10.ds__quarter AS ds__quarter
+ , subq_10.ds__year AS ds__year
+ , subq_10.ds__extract_year AS ds__extract_year
+ , subq_10.ds__extract_quarter AS ds__extract_quarter
+ , subq_10.ds__extract_month AS ds__extract_month
+ , subq_10.ds__extract_day AS ds__extract_day
+ , subq_10.ds__extract_dow AS ds__extract_dow
+ , subq_10.ds__extract_doy AS ds__extract_doy
+ , subq_10.ds_partitioned__day AS ds_partitioned__day
+ , subq_10.ds_partitioned__week AS ds_partitioned__week
+ , subq_10.ds_partitioned__month AS ds_partitioned__month
+ , subq_10.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_10.ds_partitioned__year AS ds_partitioned__year
+ , subq_10.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_10.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_10.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_10.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_10.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_10.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_10.paid_at__day AS paid_at__day
+ , subq_10.paid_at__week AS paid_at__week
+ , subq_10.paid_at__month AS paid_at__month
+ , subq_10.paid_at__quarter AS paid_at__quarter
+ , subq_10.paid_at__year AS paid_at__year
+ , subq_10.paid_at__extract_year AS paid_at__extract_year
+ , subq_10.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_10.paid_at__extract_month AS paid_at__extract_month
+ , subq_10.paid_at__extract_day AS paid_at__extract_day
+ , subq_10.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_10.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_10.booking__ds__day AS booking__ds__day
+ , subq_10.booking__ds__week AS booking__ds__week
+ , subq_10.booking__ds__month AS booking__ds__month
+ , subq_10.booking__ds__quarter AS booking__ds__quarter
+ , subq_10.booking__ds__year AS booking__ds__year
+ , subq_10.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_10.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_10.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_10.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_10.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_10.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_10.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_10.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_10.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_10.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_10.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_10.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_10.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_10.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_10.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_10.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_10.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_10.booking__paid_at__day AS booking__paid_at__day
+ , subq_10.booking__paid_at__week AS booking__paid_at__week
+ , subq_10.booking__paid_at__month AS booking__paid_at__month
+ , subq_10.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_10.booking__paid_at__year AS booking__paid_at__year
+ , subq_10.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_10.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_10.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_10.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_10.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_10.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_10.listing AS listing
+ , subq_10.guest AS guest
+ , subq_10.host AS host
+ , subq_10.booking__listing AS booking__listing
+ , subq_10.booking__guest AS booking__guest
+ , subq_10.booking__host AS booking__host
+ , subq_10.is_instant AS is_instant
+ , subq_10.booking__is_instant AS booking__is_instant
+ , subq_10.bookings AS bookings
+ , subq_10.instant_bookings AS instant_bookings
+ , subq_10.booking_value AS booking_value
+ , subq_10.max_booking_value AS max_booking_value
+ , subq_10.min_booking_value AS min_booking_value
+ , subq_10.bookers AS bookers
+ , subq_10.average_booking_value AS average_booking_value
+ , subq_10.referred_bookings AS referred_bookings
+ , subq_10.median_booking_value AS median_booking_value
+ , subq_10.booking_value_p99 AS booking_value_p99
+ , subq_10.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_10.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_10.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_3.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_3
- WHERE subq_3.ds BETWEEN '2019-12-19' AND '2020-01-02'
- ) subq_2
+ subq_12.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_12
+ WHERE subq_12.ds BETWEEN '2019-12-19' AND '2020-01-02'
+ ) subq_11
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC(bookings_source_src_28001.ds, day) AS booking__ds__day
- , DATE_TRUNC(bookings_source_src_28001.ds, isoweek) AS booking__ds__week
- , DATE_TRUNC(bookings_source_src_28001.ds, month) AS booking__ds__month
- , DATE_TRUNC(bookings_source_src_28001.ds, quarter) AS booking__ds__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds, year) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds) - 1) AS booking__ds__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, day) AS booking__ds_partitioned__day
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, isoweek) AS booking__ds_partitioned__week
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, month) AS booking__ds_partitioned__month
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, quarter) AS booking__ds_partitioned__quarter
- , DATE_TRUNC(bookings_source_src_28001.ds_partitioned, year) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.ds_partitioned) - 1) AS booking__ds_partitioned__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC(bookings_source_src_28001.paid_at, day) AS booking__paid_at__day
- , DATE_TRUNC(bookings_source_src_28001.paid_at, isoweek) AS booking__paid_at__week
- , DATE_TRUNC(bookings_source_src_28001.paid_at, month) AS booking__paid_at__month
- , DATE_TRUNC(bookings_source_src_28001.paid_at, quarter) AS booking__paid_at__quarter
- , DATE_TRUNC(bookings_source_src_28001.paid_at, year) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , IF(EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28001.paid_at) - 1) AS booking__paid_at__extract_dow
- , EXTRACT(dayofyear FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , 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
+ , 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
+ , 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
+ , 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , IF(EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) = 1, 7, EXTRACT(dayofweek FROM bookings_source_src_28000.paid_at) - 1) AS booking__paid_at__extract_dow
+ , EXTRACT(dayofyear FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
ON
- DATE_SUB(CAST(subq_2.metric_time__day AS DATETIME), INTERVAL 5 day) = subq_1.metric_time__day
- ) subq_4
- ) subq_5
+ DATE_SUB(CAST(subq_11.metric_time__day AS DATETIME), INTERVAL 5 day) = subq_10.metric_time__day
+ ) subq_13
+ ) subq_14
GROUP BY
metric_time__day
- ) subq_6
-) subq_7
+ ) subq_15
+) subq_16
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_time_offset_metric_with_time_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_time_offset_metric_with_time_constraint__plan0_optimized.sql
index 4e0b8eddb8..8a38a0a36f 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_time_offset_metric_with_time_constraint__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/BigQuery/test_time_offset_metric_with_time_constraint__plan0_optimized.sql
@@ -8,25 +8,25 @@ FROM (
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_10.metric_time__day AS metric_time__day
- , SUM(subq_9.bookings) AS bookings_5_days_ago
+ subq_19.metric_time__day AS metric_time__day
+ , SUM(subq_18.bookings) AS bookings_5_days_ago
FROM (
-- Time Spine
SELECT
ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_11
+ FROM ***************************.mf_time_spine subq_20
WHERE ds BETWEEN '2019-12-19' AND '2020-01-02'
- ) subq_10
+ ) subq_19
INNER JOIN (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
SELECT
DATE_TRUNC(ds, day) AS metric_time__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_9
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_18
ON
- DATE_SUB(CAST(subq_10.metric_time__day AS DATETIME), INTERVAL 5 day) = subq_9.metric_time__day
+ DATE_SUB(CAST(subq_19.metric_time__day AS DATETIME), INTERVAL 5 day) = subq_18.metric_time__day
GROUP BY
metric_time__day
-) subq_15
+) subq_24
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_time_offset_metric_with_time_constraint__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_time_offset_metric_with_time_constraint__plan0.sql
index d975878710..6c8fa6b9ae 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_time_offset_metric_with_time_constraint__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_time_offset_metric_with_time_constraint__plan0.sql
@@ -1,441 +1,441 @@
-- Compute Metrics via Expressions
SELECT
- subq_11.metric_time__day
+ subq_20.metric_time__day
, every_2_days_bookers_2_days_ago AS every_2_days_bookers_2_days_ago
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_10.metric_time__day
- , subq_10.bookers AS every_2_days_bookers_2_days_ago
+ subq_19.metric_time__day
+ , subq_19.bookers AS every_2_days_bookers_2_days_ago
FROM (
-- Aggregate Measures
SELECT
- subq_9.metric_time__day
- , COUNT(DISTINCT subq_9.bookers) AS bookers
+ subq_18.metric_time__day
+ , COUNT(DISTINCT subq_18.bookers) AS bookers
FROM (
-- Constrain Time Range to [2019-12-19T00:00:00, 2020-01-02T00:00:00]
SELECT
- subq_8.metric_time__day
- , subq_8.bookers
+ subq_17.metric_time__day
+ , subq_17.bookers
FROM (
-- Pass Only Elements: ['bookers', 'metric_time__day']
SELECT
- subq_7.metric_time__day
- , subq_7.bookers
+ subq_16.metric_time__day
+ , subq_16.bookers
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_5.metric_time__day AS metric_time__day
- , subq_4.ds__day AS ds__day
- , subq_4.ds__week AS ds__week
- , subq_4.ds__month AS ds__month
- , subq_4.ds__quarter AS ds__quarter
- , subq_4.ds__year AS ds__year
- , subq_4.ds__extract_year AS ds__extract_year
- , subq_4.ds__extract_quarter AS ds__extract_quarter
- , subq_4.ds__extract_month AS ds__extract_month
- , subq_4.ds__extract_day AS ds__extract_day
- , subq_4.ds__extract_dow AS ds__extract_dow
- , subq_4.ds__extract_doy AS ds__extract_doy
- , subq_4.ds_partitioned__day AS ds_partitioned__day
- , subq_4.ds_partitioned__week AS ds_partitioned__week
- , subq_4.ds_partitioned__month AS ds_partitioned__month
- , subq_4.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_4.ds_partitioned__year AS ds_partitioned__year
- , subq_4.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_4.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_4.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_4.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_4.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_4.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_4.paid_at__day AS paid_at__day
- , subq_4.paid_at__week AS paid_at__week
- , subq_4.paid_at__month AS paid_at__month
- , subq_4.paid_at__quarter AS paid_at__quarter
- , subq_4.paid_at__year AS paid_at__year
- , subq_4.paid_at__extract_year AS paid_at__extract_year
- , subq_4.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_4.paid_at__extract_month AS paid_at__extract_month
- , subq_4.paid_at__extract_day AS paid_at__extract_day
- , subq_4.paid_at__extract_dow AS paid_at__extract_dow
- , subq_4.paid_at__extract_doy AS paid_at__extract_doy
- , subq_4.booking__ds__day AS booking__ds__day
- , subq_4.booking__ds__week AS booking__ds__week
- , subq_4.booking__ds__month AS booking__ds__month
- , subq_4.booking__ds__quarter AS booking__ds__quarter
- , subq_4.booking__ds__year AS booking__ds__year
- , subq_4.booking__ds__extract_year AS booking__ds__extract_year
- , subq_4.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_4.booking__ds__extract_month AS booking__ds__extract_month
- , subq_4.booking__ds__extract_day AS booking__ds__extract_day
- , subq_4.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_4.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_4.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_4.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_4.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_4.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_4.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_4.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_4.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_4.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_4.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_4.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_4.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_4.booking__paid_at__day AS booking__paid_at__day
- , subq_4.booking__paid_at__week AS booking__paid_at__week
- , subq_4.booking__paid_at__month AS booking__paid_at__month
- , subq_4.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_4.booking__paid_at__year AS booking__paid_at__year
- , subq_4.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_4.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_4.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_4.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_4.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_4.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_4.listing AS listing
- , subq_4.guest AS guest
- , subq_4.host AS host
- , subq_4.booking__listing AS booking__listing
- , subq_4.booking__guest AS booking__guest
- , subq_4.booking__host AS booking__host
- , subq_4.is_instant AS is_instant
- , subq_4.booking__is_instant AS booking__is_instant
- , subq_4.bookings AS bookings
- , subq_4.instant_bookings AS instant_bookings
- , subq_4.booking_value AS booking_value
- , subq_4.max_booking_value AS max_booking_value
- , subq_4.min_booking_value AS min_booking_value
- , subq_4.bookers AS bookers
- , subq_4.average_booking_value AS average_booking_value
- , subq_4.referred_bookings AS referred_bookings
- , subq_4.median_booking_value AS median_booking_value
- , subq_4.booking_value_p99 AS booking_value_p99
- , subq_4.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_4.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_4.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ subq_14.metric_time__day AS metric_time__day
+ , subq_13.ds__day AS ds__day
+ , subq_13.ds__week AS ds__week
+ , subq_13.ds__month AS ds__month
+ , subq_13.ds__quarter AS ds__quarter
+ , subq_13.ds__year AS ds__year
+ , subq_13.ds__extract_year AS ds__extract_year
+ , subq_13.ds__extract_quarter AS ds__extract_quarter
+ , subq_13.ds__extract_month AS ds__extract_month
+ , subq_13.ds__extract_day AS ds__extract_day
+ , subq_13.ds__extract_dow AS ds__extract_dow
+ , subq_13.ds__extract_doy AS ds__extract_doy
+ , subq_13.ds_partitioned__day AS ds_partitioned__day
+ , subq_13.ds_partitioned__week AS ds_partitioned__week
+ , subq_13.ds_partitioned__month AS ds_partitioned__month
+ , subq_13.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_13.ds_partitioned__year AS ds_partitioned__year
+ , subq_13.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_13.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_13.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_13.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_13.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_13.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_13.paid_at__day AS paid_at__day
+ , subq_13.paid_at__week AS paid_at__week
+ , subq_13.paid_at__month AS paid_at__month
+ , subq_13.paid_at__quarter AS paid_at__quarter
+ , subq_13.paid_at__year AS paid_at__year
+ , subq_13.paid_at__extract_year AS paid_at__extract_year
+ , subq_13.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_13.paid_at__extract_month AS paid_at__extract_month
+ , subq_13.paid_at__extract_day AS paid_at__extract_day
+ , subq_13.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_13.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_13.booking__ds__day AS booking__ds__day
+ , subq_13.booking__ds__week AS booking__ds__week
+ , subq_13.booking__ds__month AS booking__ds__month
+ , subq_13.booking__ds__quarter AS booking__ds__quarter
+ , subq_13.booking__ds__year AS booking__ds__year
+ , subq_13.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_13.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_13.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_13.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_13.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_13.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_13.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_13.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_13.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_13.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_13.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_13.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_13.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_13.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_13.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_13.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_13.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_13.booking__paid_at__day AS booking__paid_at__day
+ , subq_13.booking__paid_at__week AS booking__paid_at__week
+ , subq_13.booking__paid_at__month AS booking__paid_at__month
+ , subq_13.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_13.booking__paid_at__year AS booking__paid_at__year
+ , subq_13.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_13.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_13.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_13.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_13.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_13.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_13.listing AS listing
+ , subq_13.guest AS guest
+ , subq_13.host AS host
+ , subq_13.booking__listing AS booking__listing
+ , subq_13.booking__guest AS booking__guest
+ , subq_13.booking__host AS booking__host
+ , subq_13.is_instant AS is_instant
+ , subq_13.booking__is_instant AS booking__is_instant
+ , subq_13.bookings AS bookings
+ , subq_13.instant_bookings AS instant_bookings
+ , subq_13.booking_value AS booking_value
+ , subq_13.max_booking_value AS max_booking_value
+ , subq_13.min_booking_value AS min_booking_value
+ , subq_13.bookers AS bookers
+ , subq_13.average_booking_value AS average_booking_value
+ , subq_13.referred_bookings AS referred_bookings
+ , subq_13.median_booking_value AS median_booking_value
+ , subq_13.booking_value_p99 AS booking_value_p99
+ , subq_13.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_13.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_13.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_6.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_6
- WHERE subq_6.ds BETWEEN '2019-12-19' AND '2020-01-02'
- ) subq_5
+ subq_15.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_15
+ WHERE subq_15.ds BETWEEN '2019-12-19' AND '2020-01-02'
+ ) subq_14
INNER JOIN (
-- Join Self Over Time Range
SELECT
- subq_2.metric_time__day AS metric_time__day
- , subq_1.ds__day AS ds__day
- , subq_1.ds__week AS ds__week
- , subq_1.ds__month AS ds__month
- , subq_1.ds__quarter AS ds__quarter
- , subq_1.ds__year AS ds__year
- , subq_1.ds__extract_year AS ds__extract_year
- , subq_1.ds__extract_quarter AS ds__extract_quarter
- , subq_1.ds__extract_month AS ds__extract_month
- , subq_1.ds__extract_day AS ds__extract_day
- , subq_1.ds__extract_dow AS ds__extract_dow
- , subq_1.ds__extract_doy AS ds__extract_doy
- , subq_1.ds_partitioned__day AS ds_partitioned__day
- , subq_1.ds_partitioned__week AS ds_partitioned__week
- , subq_1.ds_partitioned__month AS ds_partitioned__month
- , subq_1.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_1.ds_partitioned__year AS ds_partitioned__year
- , subq_1.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_1.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_1.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_1.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_1.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_1.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_1.paid_at__day AS paid_at__day
- , subq_1.paid_at__week AS paid_at__week
- , subq_1.paid_at__month AS paid_at__month
- , subq_1.paid_at__quarter AS paid_at__quarter
- , subq_1.paid_at__year AS paid_at__year
- , subq_1.paid_at__extract_year AS paid_at__extract_year
- , subq_1.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_1.paid_at__extract_month AS paid_at__extract_month
- , subq_1.paid_at__extract_day AS paid_at__extract_day
- , subq_1.paid_at__extract_dow AS paid_at__extract_dow
- , subq_1.paid_at__extract_doy AS paid_at__extract_doy
- , subq_1.booking__ds__day AS booking__ds__day
- , subq_1.booking__ds__week AS booking__ds__week
- , subq_1.booking__ds__month AS booking__ds__month
- , subq_1.booking__ds__quarter AS booking__ds__quarter
- , subq_1.booking__ds__year AS booking__ds__year
- , subq_1.booking__ds__extract_year AS booking__ds__extract_year
- , subq_1.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_1.booking__ds__extract_month AS booking__ds__extract_month
- , subq_1.booking__ds__extract_day AS booking__ds__extract_day
- , subq_1.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_1.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_1.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_1.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_1.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_1.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_1.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_1.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_1.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_1.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_1.booking__paid_at__day AS booking__paid_at__day
- , subq_1.booking__paid_at__week AS booking__paid_at__week
- , subq_1.booking__paid_at__month AS booking__paid_at__month
- , subq_1.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_1.booking__paid_at__year AS booking__paid_at__year
- , subq_1.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_1.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_1.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_1.metric_time__week AS metric_time__week
- , subq_1.metric_time__month AS metric_time__month
- , subq_1.metric_time__quarter AS metric_time__quarter
- , subq_1.metric_time__year AS metric_time__year
- , subq_1.metric_time__extract_year AS metric_time__extract_year
- , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter
- , subq_1.metric_time__extract_month AS metric_time__extract_month
- , subq_1.metric_time__extract_day AS metric_time__extract_day
- , subq_1.metric_time__extract_dow AS metric_time__extract_dow
- , subq_1.metric_time__extract_doy AS metric_time__extract_doy
- , subq_1.listing AS listing
- , subq_1.guest AS guest
- , subq_1.host AS host
- , subq_1.booking__listing AS booking__listing
- , subq_1.booking__guest AS booking__guest
- , subq_1.booking__host AS booking__host
- , subq_1.is_instant AS is_instant
- , subq_1.booking__is_instant AS booking__is_instant
- , subq_1.bookings AS bookings
- , subq_1.instant_bookings AS instant_bookings
- , subq_1.booking_value AS booking_value
- , subq_1.max_booking_value AS max_booking_value
- , subq_1.min_booking_value AS min_booking_value
- , subq_1.bookers AS bookers
- , subq_1.average_booking_value AS average_booking_value
- , subq_1.referred_bookings AS referred_bookings
- , subq_1.median_booking_value AS median_booking_value
- , subq_1.booking_value_p99 AS booking_value_p99
- , subq_1.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_1.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_1.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ subq_11.metric_time__day AS metric_time__day
+ , subq_10.ds__day AS ds__day
+ , subq_10.ds__week AS ds__week
+ , subq_10.ds__month AS ds__month
+ , subq_10.ds__quarter AS ds__quarter
+ , subq_10.ds__year AS ds__year
+ , subq_10.ds__extract_year AS ds__extract_year
+ , subq_10.ds__extract_quarter AS ds__extract_quarter
+ , subq_10.ds__extract_month AS ds__extract_month
+ , subq_10.ds__extract_day AS ds__extract_day
+ , subq_10.ds__extract_dow AS ds__extract_dow
+ , subq_10.ds__extract_doy AS ds__extract_doy
+ , subq_10.ds_partitioned__day AS ds_partitioned__day
+ , subq_10.ds_partitioned__week AS ds_partitioned__week
+ , subq_10.ds_partitioned__month AS ds_partitioned__month
+ , subq_10.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_10.ds_partitioned__year AS ds_partitioned__year
+ , subq_10.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_10.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_10.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_10.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_10.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_10.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_10.paid_at__day AS paid_at__day
+ , subq_10.paid_at__week AS paid_at__week
+ , subq_10.paid_at__month AS paid_at__month
+ , subq_10.paid_at__quarter AS paid_at__quarter
+ , subq_10.paid_at__year AS paid_at__year
+ , subq_10.paid_at__extract_year AS paid_at__extract_year
+ , subq_10.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_10.paid_at__extract_month AS paid_at__extract_month
+ , subq_10.paid_at__extract_day AS paid_at__extract_day
+ , subq_10.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_10.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_10.booking__ds__day AS booking__ds__day
+ , subq_10.booking__ds__week AS booking__ds__week
+ , subq_10.booking__ds__month AS booking__ds__month
+ , subq_10.booking__ds__quarter AS booking__ds__quarter
+ , subq_10.booking__ds__year AS booking__ds__year
+ , subq_10.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_10.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_10.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_10.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_10.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_10.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_10.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_10.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_10.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_10.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_10.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_10.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_10.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_10.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_10.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_10.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_10.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_10.booking__paid_at__day AS booking__paid_at__day
+ , subq_10.booking__paid_at__week AS booking__paid_at__week
+ , subq_10.booking__paid_at__month AS booking__paid_at__month
+ , subq_10.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_10.booking__paid_at__year AS booking__paid_at__year
+ , subq_10.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_10.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_10.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_10.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_10.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_10.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_10.metric_time__week AS metric_time__week
+ , subq_10.metric_time__month AS metric_time__month
+ , subq_10.metric_time__quarter AS metric_time__quarter
+ , subq_10.metric_time__year AS metric_time__year
+ , subq_10.metric_time__extract_year AS metric_time__extract_year
+ , subq_10.metric_time__extract_quarter AS metric_time__extract_quarter
+ , subq_10.metric_time__extract_month AS metric_time__extract_month
+ , subq_10.metric_time__extract_day AS metric_time__extract_day
+ , subq_10.metric_time__extract_dow AS metric_time__extract_dow
+ , subq_10.metric_time__extract_doy AS metric_time__extract_doy
+ , subq_10.listing AS listing
+ , subq_10.guest AS guest
+ , subq_10.host AS host
+ , subq_10.booking__listing AS booking__listing
+ , subq_10.booking__guest AS booking__guest
+ , subq_10.booking__host AS booking__host
+ , subq_10.is_instant AS is_instant
+ , subq_10.booking__is_instant AS booking__is_instant
+ , subq_10.bookings AS bookings
+ , subq_10.instant_bookings AS instant_bookings
+ , subq_10.booking_value AS booking_value
+ , subq_10.max_booking_value AS max_booking_value
+ , subq_10.min_booking_value AS min_booking_value
+ , subq_10.bookers AS bookers
+ , subq_10.average_booking_value AS average_booking_value
+ , subq_10.referred_bookings AS referred_bookings
+ , subq_10.median_booking_value AS median_booking_value
+ , subq_10.booking_value_p99 AS booking_value_p99
+ , subq_10.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_10.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_10.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_3.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_3
- ) subq_2
+ subq_12.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_12
+ ) subq_11
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
ON
(
- subq_1.metric_time__day <= subq_2.metric_time__day
+ subq_10.metric_time__day <= subq_11.metric_time__day
) AND (
- subq_1.metric_time__day > DATEADD(day, -2, subq_2.metric_time__day)
+ subq_10.metric_time__day > DATEADD(day, -2, subq_11.metric_time__day)
)
- ) subq_4
+ ) subq_13
ON
- DATEADD(day, -2, subq_5.metric_time__day) = subq_4.metric_time__day
- ) subq_7
- ) subq_8
- WHERE subq_8.metric_time__day BETWEEN '2019-12-19' AND '2020-01-02'
- ) subq_9
+ DATEADD(day, -2, subq_14.metric_time__day) = subq_13.metric_time__day
+ ) subq_16
+ ) subq_17
+ WHERE subq_17.metric_time__day BETWEEN '2019-12-19' AND '2020-01-02'
+ ) subq_18
GROUP BY
- subq_9.metric_time__day
- ) subq_10
-) subq_11
+ subq_18.metric_time__day
+ ) subq_19
+) subq_20
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_time_offset_metric_with_time_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_time_offset_metric_with_time_constraint__plan0_optimized.sql
index d998382fb8..0f2d801995 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_time_offset_metric_with_time_constraint__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_cumulative_time_offset_metric_with_time_constraint__plan0_optimized.sql
@@ -9,33 +9,33 @@ FROM (
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_17.metric_time__day AS metric_time__day
- , COUNT(DISTINCT subq_16.bookers) AS every_2_days_bookers_2_days_ago
+ subq_26.metric_time__day AS metric_time__day
+ , COUNT(DISTINCT subq_25.bookers) AS every_2_days_bookers_2_days_ago
FROM (
-- Time Spine
SELECT
ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_18
+ FROM ***************************.mf_time_spine subq_27
WHERE ds BETWEEN '2019-12-19' AND '2020-01-02'
- ) subq_17
+ ) subq_26
INNER JOIN (
-- Join Self Over Time Range
SELECT
- subq_15.ds AS metric_time__day
- , bookings_source_src_28001.guest_id AS bookers
- FROM ***************************.mf_time_spine subq_15
+ subq_24.ds AS metric_time__day
+ , bookings_source_src_28000.guest_id AS bookers
+ FROM ***************************.mf_time_spine subq_24
INNER JOIN
- ***************************.fct_bookings bookings_source_src_28001
+ ***************************.fct_bookings bookings_source_src_28000
ON
(
- DATE_TRUNC('day', bookings_source_src_28001.ds) <= subq_15.ds
+ DATE_TRUNC('day', bookings_source_src_28000.ds) <= subq_24.ds
) AND (
- DATE_TRUNC('day', bookings_source_src_28001.ds) > DATEADD(day, -2, subq_15.ds)
+ DATE_TRUNC('day', bookings_source_src_28000.ds) > DATEADD(day, -2, subq_24.ds)
)
- ) subq_16
+ ) subq_25
ON
- DATEADD(day, -2, subq_17.metric_time__day) = subq_16.metric_time__day
- WHERE subq_17.metric_time__day BETWEEN '2019-12-19' AND '2020-01-02'
+ DATEADD(day, -2, subq_26.metric_time__day) = subq_25.metric_time__day
+ WHERE subq_26.metric_time__day BETWEEN '2019-12-19' AND '2020-01-02'
GROUP BY
- subq_17.metric_time__day
-) subq_23
+ subq_26.metric_time__day
+) subq_32
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric__plan0.sql
index 08cb56bfde..04cc877c0b 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric__plan0.sql
@@ -1,445 +1,445 @@
-- Compute Metrics via Expressions
SELECT
- subq_10.metric_time__day
+ subq_19.metric_time__day
, (bookings - ref_bookings) * 1.0 / bookings AS non_referred_bookings_pct
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_4.metric_time__day, subq_9.metric_time__day) AS metric_time__day
- , MAX(subq_4.ref_bookings) AS ref_bookings
- , MAX(subq_9.bookings) AS bookings
+ COALESCE(subq_13.metric_time__day, subq_18.metric_time__day) AS metric_time__day
+ , MAX(subq_13.ref_bookings) AS ref_bookings
+ , MAX(subq_18.bookings) AS bookings
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_3.metric_time__day
- , subq_3.referred_bookings AS ref_bookings
+ subq_12.metric_time__day
+ , subq_12.referred_bookings AS ref_bookings
FROM (
-- Aggregate Measures
SELECT
- subq_2.metric_time__day
- , SUM(subq_2.referred_bookings) AS referred_bookings
+ subq_11.metric_time__day
+ , SUM(subq_11.referred_bookings) AS referred_bookings
FROM (
-- Pass Only Elements: ['referred_bookings', 'metric_time__day']
SELECT
- subq_1.metric_time__day
- , subq_1.referred_bookings
+ subq_10.metric_time__day
+ , subq_10.referred_bookings
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
- ) subq_2
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
GROUP BY
- subq_2.metric_time__day
- ) subq_3
- ) subq_4
+ subq_11.metric_time__day
+ ) subq_12
+ ) subq_13
FULL OUTER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_8.metric_time__day
- , subq_8.bookings
+ subq_17.metric_time__day
+ , subq_17.bookings
FROM (
-- Aggregate Measures
SELECT
- subq_7.metric_time__day
- , SUM(subq_7.bookings) AS bookings
+ subq_16.metric_time__day
+ , SUM(subq_16.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__day']
SELECT
- subq_6.metric_time__day
- , subq_6.bookings
+ subq_15.metric_time__day
+ , subq_15.bookings
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_5.ds__day
- , subq_5.ds__week
- , subq_5.ds__month
- , subq_5.ds__quarter
- , subq_5.ds__year
- , subq_5.ds__extract_year
- , subq_5.ds__extract_quarter
- , subq_5.ds__extract_month
- , subq_5.ds__extract_day
- , subq_5.ds__extract_dow
- , subq_5.ds__extract_doy
- , subq_5.ds_partitioned__day
- , subq_5.ds_partitioned__week
- , subq_5.ds_partitioned__month
- , subq_5.ds_partitioned__quarter
- , subq_5.ds_partitioned__year
- , subq_5.ds_partitioned__extract_year
- , subq_5.ds_partitioned__extract_quarter
- , subq_5.ds_partitioned__extract_month
- , subq_5.ds_partitioned__extract_day
- , subq_5.ds_partitioned__extract_dow
- , subq_5.ds_partitioned__extract_doy
- , subq_5.paid_at__day
- , subq_5.paid_at__week
- , subq_5.paid_at__month
- , subq_5.paid_at__quarter
- , subq_5.paid_at__year
- , subq_5.paid_at__extract_year
- , subq_5.paid_at__extract_quarter
- , subq_5.paid_at__extract_month
- , subq_5.paid_at__extract_day
- , subq_5.paid_at__extract_dow
- , subq_5.paid_at__extract_doy
- , subq_5.booking__ds__day
- , subq_5.booking__ds__week
- , subq_5.booking__ds__month
- , subq_5.booking__ds__quarter
- , subq_5.booking__ds__year
- , subq_5.booking__ds__extract_year
- , subq_5.booking__ds__extract_quarter
- , subq_5.booking__ds__extract_month
- , subq_5.booking__ds__extract_day
- , subq_5.booking__ds__extract_dow
- , subq_5.booking__ds__extract_doy
- , subq_5.booking__ds_partitioned__day
- , subq_5.booking__ds_partitioned__week
- , subq_5.booking__ds_partitioned__month
- , subq_5.booking__ds_partitioned__quarter
- , subq_5.booking__ds_partitioned__year
- , subq_5.booking__ds_partitioned__extract_year
- , subq_5.booking__ds_partitioned__extract_quarter
- , subq_5.booking__ds_partitioned__extract_month
- , subq_5.booking__ds_partitioned__extract_day
- , subq_5.booking__ds_partitioned__extract_dow
- , subq_5.booking__ds_partitioned__extract_doy
- , subq_5.booking__paid_at__day
- , subq_5.booking__paid_at__week
- , subq_5.booking__paid_at__month
- , subq_5.booking__paid_at__quarter
- , subq_5.booking__paid_at__year
- , subq_5.booking__paid_at__extract_year
- , subq_5.booking__paid_at__extract_quarter
- , subq_5.booking__paid_at__extract_month
- , subq_5.booking__paid_at__extract_day
- , subq_5.booking__paid_at__extract_dow
- , subq_5.booking__paid_at__extract_doy
- , subq_5.ds__day AS metric_time__day
- , subq_5.ds__week AS metric_time__week
- , subq_5.ds__month AS metric_time__month
- , subq_5.ds__quarter AS metric_time__quarter
- , subq_5.ds__year AS metric_time__year
- , subq_5.ds__extract_year AS metric_time__extract_year
- , subq_5.ds__extract_quarter AS metric_time__extract_quarter
- , subq_5.ds__extract_month AS metric_time__extract_month
- , subq_5.ds__extract_day AS metric_time__extract_day
- , subq_5.ds__extract_dow AS metric_time__extract_dow
- , subq_5.ds__extract_doy AS metric_time__extract_doy
- , subq_5.listing
- , subq_5.guest
- , subq_5.host
- , subq_5.booking__listing
- , subq_5.booking__guest
- , subq_5.booking__host
- , subq_5.is_instant
- , subq_5.booking__is_instant
- , subq_5.bookings
- , subq_5.instant_bookings
- , subq_5.booking_value
- , subq_5.max_booking_value
- , subq_5.min_booking_value
- , subq_5.bookers
- , subq_5.average_booking_value
- , subq_5.referred_bookings
- , subq_5.median_booking_value
- , subq_5.booking_value_p99
- , subq_5.discrete_booking_value_p99
- , subq_5.approximate_continuous_booking_value_p99
- , subq_5.approximate_discrete_booking_value_p99
+ subq_14.ds__day
+ , subq_14.ds__week
+ , subq_14.ds__month
+ , subq_14.ds__quarter
+ , subq_14.ds__year
+ , subq_14.ds__extract_year
+ , subq_14.ds__extract_quarter
+ , subq_14.ds__extract_month
+ , subq_14.ds__extract_day
+ , subq_14.ds__extract_dow
+ , subq_14.ds__extract_doy
+ , subq_14.ds_partitioned__day
+ , subq_14.ds_partitioned__week
+ , subq_14.ds_partitioned__month
+ , subq_14.ds_partitioned__quarter
+ , subq_14.ds_partitioned__year
+ , subq_14.ds_partitioned__extract_year
+ , subq_14.ds_partitioned__extract_quarter
+ , subq_14.ds_partitioned__extract_month
+ , subq_14.ds_partitioned__extract_day
+ , subq_14.ds_partitioned__extract_dow
+ , subq_14.ds_partitioned__extract_doy
+ , subq_14.paid_at__day
+ , subq_14.paid_at__week
+ , subq_14.paid_at__month
+ , subq_14.paid_at__quarter
+ , subq_14.paid_at__year
+ , subq_14.paid_at__extract_year
+ , subq_14.paid_at__extract_quarter
+ , subq_14.paid_at__extract_month
+ , subq_14.paid_at__extract_day
+ , subq_14.paid_at__extract_dow
+ , subq_14.paid_at__extract_doy
+ , subq_14.booking__ds__day
+ , subq_14.booking__ds__week
+ , subq_14.booking__ds__month
+ , subq_14.booking__ds__quarter
+ , subq_14.booking__ds__year
+ , subq_14.booking__ds__extract_year
+ , subq_14.booking__ds__extract_quarter
+ , subq_14.booking__ds__extract_month
+ , subq_14.booking__ds__extract_day
+ , subq_14.booking__ds__extract_dow
+ , subq_14.booking__ds__extract_doy
+ , subq_14.booking__ds_partitioned__day
+ , subq_14.booking__ds_partitioned__week
+ , subq_14.booking__ds_partitioned__month
+ , subq_14.booking__ds_partitioned__quarter
+ , subq_14.booking__ds_partitioned__year
+ , subq_14.booking__ds_partitioned__extract_year
+ , subq_14.booking__ds_partitioned__extract_quarter
+ , subq_14.booking__ds_partitioned__extract_month
+ , subq_14.booking__ds_partitioned__extract_day
+ , subq_14.booking__ds_partitioned__extract_dow
+ , subq_14.booking__ds_partitioned__extract_doy
+ , subq_14.booking__paid_at__day
+ , subq_14.booking__paid_at__week
+ , subq_14.booking__paid_at__month
+ , subq_14.booking__paid_at__quarter
+ , subq_14.booking__paid_at__year
+ , subq_14.booking__paid_at__extract_year
+ , subq_14.booking__paid_at__extract_quarter
+ , subq_14.booking__paid_at__extract_month
+ , subq_14.booking__paid_at__extract_day
+ , subq_14.booking__paid_at__extract_dow
+ , subq_14.booking__paid_at__extract_doy
+ , subq_14.ds__day AS metric_time__day
+ , subq_14.ds__week AS metric_time__week
+ , subq_14.ds__month AS metric_time__month
+ , subq_14.ds__quarter AS metric_time__quarter
+ , subq_14.ds__year AS metric_time__year
+ , subq_14.ds__extract_year AS metric_time__extract_year
+ , subq_14.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_14.ds__extract_month AS metric_time__extract_month
+ , subq_14.ds__extract_day AS metric_time__extract_day
+ , subq_14.ds__extract_dow AS metric_time__extract_dow
+ , subq_14.ds__extract_doy AS metric_time__extract_doy
+ , subq_14.listing
+ , subq_14.guest
+ , subq_14.host
+ , subq_14.booking__listing
+ , subq_14.booking__guest
+ , subq_14.booking__host
+ , subq_14.is_instant
+ , subq_14.booking__is_instant
+ , subq_14.bookings
+ , subq_14.instant_bookings
+ , subq_14.booking_value
+ , subq_14.max_booking_value
+ , subq_14.min_booking_value
+ , subq_14.bookers
+ , subq_14.average_booking_value
+ , subq_14.referred_bookings
+ , subq_14.median_booking_value
+ , subq_14.booking_value_p99
+ , subq_14.discrete_booking_value_p99
+ , subq_14.approximate_continuous_booking_value_p99
+ , subq_14.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_5
- ) subq_6
- ) subq_7
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_14
+ ) subq_15
+ ) subq_16
GROUP BY
- subq_7.metric_time__day
- ) subq_8
- ) subq_9
+ subq_16.metric_time__day
+ ) subq_17
+ ) subq_18
ON
- subq_4.metric_time__day = subq_9.metric_time__day
+ subq_13.metric_time__day = subq_18.metric_time__day
GROUP BY
- COALESCE(subq_4.metric_time__day, subq_9.metric_time__day)
-) subq_10
+ COALESCE(subq_13.metric_time__day, subq_18.metric_time__day)
+) subq_19
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric__plan0_optimized.sql
index 23f7234c6e..1638560b4d 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric__plan0_optimized.sql
@@ -5,9 +5,9 @@ SELECT
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_15.metric_time__day, subq_20.metric_time__day) AS metric_time__day
- , MAX(subq_15.ref_bookings) AS ref_bookings
- , MAX(subq_20.bookings) AS bookings
+ COALESCE(subq_24.metric_time__day, subq_29.metric_time__day) AS metric_time__day
+ , MAX(subq_24.ref_bookings) AS ref_bookings
+ , MAX(subq_29.bookings) AS bookings
FROM (
-- Aggregate Measures
-- Compute Metrics via Expressions
@@ -21,11 +21,11 @@ FROM (
SELECT
DATE_TRUNC('day', ds) 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_28001
- ) subq_13
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_22
GROUP BY
metric_time__day
- ) subq_15
+ ) subq_24
FULL OUTER JOIN (
-- Aggregate Measures
-- Compute Metrics via Expressions
@@ -39,13 +39,13 @@ FROM (
SELECT
DATE_TRUNC('day', ds) AS metric_time__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_18
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_27
GROUP BY
metric_time__day
- ) subq_20
+ ) subq_29
ON
- subq_15.metric_time__day = subq_20.metric_time__day
+ subq_24.metric_time__day = subq_29.metric_time__day
GROUP BY
- COALESCE(subq_15.metric_time__day, subq_20.metric_time__day)
-) subq_21
+ COALESCE(subq_24.metric_time__day, subq_29.metric_time__day)
+) subq_30
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_month_dimension_and_offset_window__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_month_dimension_and_offset_window__plan0.sql
index 72735021e2..35be63856a 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_month_dimension_and_offset_window__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_month_dimension_and_offset_window__plan0.sql
@@ -1,73 +1,73 @@
-- Compute Metrics via Expressions
SELECT
- subq_7.metric_time__month
+ subq_9.metric_time__month
, bookings_last_month AS bookings_last_month
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_6.metric_time__month
- , subq_6.bookings_monthly AS bookings_last_month
+ subq_8.metric_time__month
+ , subq_8.bookings_monthly AS bookings_last_month
FROM (
-- Aggregate Measures
SELECT
- subq_5.metric_time__month
- , SUM(subq_5.bookings_monthly) AS bookings_monthly
+ subq_7.metric_time__month
+ , SUM(subq_7.bookings_monthly) AS bookings_monthly
FROM (
-- Pass Only Elements: ['bookings_monthly', 'metric_time__month']
SELECT
- subq_4.metric_time__month
- , subq_4.bookings_monthly
+ subq_6.metric_time__month
+ , subq_6.bookings_monthly
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_2.metric_time__month AS metric_time__month
- , subq_1.monthly_ds__month AS monthly_ds__month
- , subq_1.monthly_ds__quarter AS monthly_ds__quarter
- , subq_1.monthly_ds__year AS monthly_ds__year
- , subq_1.monthly_ds__extract_year AS monthly_ds__extract_year
- , subq_1.monthly_ds__extract_quarter AS monthly_ds__extract_quarter
- , subq_1.monthly_ds__extract_month AS monthly_ds__extract_month
- , subq_1.booking__monthly_ds__month AS booking__monthly_ds__month
- , subq_1.booking__monthly_ds__quarter AS booking__monthly_ds__quarter
- , subq_1.booking__monthly_ds__year AS booking__monthly_ds__year
- , subq_1.booking__monthly_ds__extract_year AS booking__monthly_ds__extract_year
- , subq_1.booking__monthly_ds__extract_quarter AS booking__monthly_ds__extract_quarter
- , subq_1.booking__monthly_ds__extract_month AS booking__monthly_ds__extract_month
- , subq_1.listing AS listing
- , subq_1.booking__listing AS booking__listing
- , subq_1.bookings_monthly AS bookings_monthly
+ subq_4.metric_time__month AS metric_time__month
+ , subq_3.monthly_ds__month AS monthly_ds__month
+ , subq_3.monthly_ds__quarter AS monthly_ds__quarter
+ , subq_3.monthly_ds__year AS monthly_ds__year
+ , subq_3.monthly_ds__extract_year AS monthly_ds__extract_year
+ , subq_3.monthly_ds__extract_quarter AS monthly_ds__extract_quarter
+ , subq_3.monthly_ds__extract_month AS monthly_ds__extract_month
+ , subq_3.booking__monthly_ds__month AS booking__monthly_ds__month
+ , subq_3.booking__monthly_ds__quarter AS booking__monthly_ds__quarter
+ , subq_3.booking__monthly_ds__year AS booking__monthly_ds__year
+ , subq_3.booking__monthly_ds__extract_year AS booking__monthly_ds__extract_year
+ , subq_3.booking__monthly_ds__extract_quarter AS booking__monthly_ds__extract_quarter
+ , subq_3.booking__monthly_ds__extract_month AS booking__monthly_ds__extract_month
+ , subq_3.listing AS listing
+ , subq_3.booking__listing AS booking__listing
+ , subq_3.bookings_monthly AS bookings_monthly
FROM (
-- Time Spine
SELECT
- DATE_TRUNC('month', subq_3.ds) AS metric_time__month
- FROM ***************************.mf_time_spine subq_3
+ DATE_TRUNC('month', subq_5.ds) AS metric_time__month
+ FROM ***************************.mf_time_spine subq_5
GROUP BY
- DATE_TRUNC('month', subq_3.ds)
- ) subq_2
+ DATE_TRUNC('month', subq_5.ds)
+ ) subq_4
INNER JOIN (
-- Metric Time Dimension 'monthly_ds'
SELECT
- subq_0.monthly_ds__month
- , subq_0.monthly_ds__quarter
- , subq_0.monthly_ds__year
- , subq_0.monthly_ds__extract_year
- , subq_0.monthly_ds__extract_quarter
- , subq_0.monthly_ds__extract_month
- , subq_0.booking__monthly_ds__month
- , subq_0.booking__monthly_ds__quarter
- , subq_0.booking__monthly_ds__year
- , subq_0.booking__monthly_ds__extract_year
- , subq_0.booking__monthly_ds__extract_quarter
- , subq_0.booking__monthly_ds__extract_month
- , subq_0.monthly_ds__month AS metric_time__month
- , subq_0.monthly_ds__quarter AS metric_time__quarter
- , subq_0.monthly_ds__year AS metric_time__year
- , subq_0.monthly_ds__extract_year AS metric_time__extract_year
- , subq_0.monthly_ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.monthly_ds__extract_month AS metric_time__extract_month
- , subq_0.listing
- , subq_0.booking__listing
- , subq_0.bookings_monthly
+ subq_2.monthly_ds__month
+ , subq_2.monthly_ds__quarter
+ , subq_2.monthly_ds__year
+ , subq_2.monthly_ds__extract_year
+ , subq_2.monthly_ds__extract_quarter
+ , subq_2.monthly_ds__extract_month
+ , subq_2.booking__monthly_ds__month
+ , subq_2.booking__monthly_ds__quarter
+ , subq_2.booking__monthly_ds__year
+ , subq_2.booking__monthly_ds__extract_year
+ , subq_2.booking__monthly_ds__extract_quarter
+ , subq_2.booking__monthly_ds__extract_month
+ , subq_2.monthly_ds__month AS metric_time__month
+ , subq_2.monthly_ds__quarter AS metric_time__quarter
+ , subq_2.monthly_ds__year AS metric_time__year
+ , subq_2.monthly_ds__extract_year AS metric_time__extract_year
+ , subq_2.monthly_ds__extract_quarter AS metric_time__extract_quarter
+ , subq_2.monthly_ds__extract_month AS metric_time__extract_month
+ , subq_2.listing
+ , subq_2.booking__listing
+ , subq_2.bookings_monthly
FROM (
-- Read Elements From Semantic Model 'bookings_monthly_source'
SELECT
@@ -87,13 +87,13 @@ FROM (
, bookings_monthly_source_src_16000.listing_id AS listing
, bookings_monthly_source_src_16000.listing_id AS booking__listing
FROM ***************************.fct_bookings_extended_monthly bookings_monthly_source_src_16000
- ) subq_0
- ) subq_1
+ ) subq_2
+ ) subq_3
ON
- DATEADD(month, -1, subq_2.metric_time__month) = subq_1.metric_time__month
- ) subq_4
- ) subq_5
+ DATEADD(month, -1, subq_4.metric_time__month) = subq_3.metric_time__month
+ ) subq_6
+ ) subq_7
GROUP BY
- subq_5.metric_time__month
- ) subq_6
-) subq_7
+ subq_7.metric_time__month
+ ) subq_8
+) subq_9
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_month_dimension_and_offset_window__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_month_dimension_and_offset_window__plan0_optimized.sql
index ccd562cfa6..75916f38d4 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_month_dimension_and_offset_window__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_month_dimension_and_offset_window__plan0_optimized.sql
@@ -8,20 +8,20 @@ FROM (
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_10.metric_time__month AS metric_time__month
+ subq_12.metric_time__month AS metric_time__month
, SUM(bookings_monthly_source_src_16000.bookings_monthly) AS bookings_last_month
FROM (
-- Time Spine
SELECT
DATE_TRUNC('month', ds) AS metric_time__month
- FROM ***************************.mf_time_spine subq_11
+ FROM ***************************.mf_time_spine subq_13
GROUP BY
DATE_TRUNC('month', ds)
- ) subq_10
+ ) subq_12
INNER JOIN
***************************.fct_bookings_extended_monthly bookings_monthly_source_src_16000
ON
- DATEADD(month, -1, subq_10.metric_time__month) = DATE_TRUNC('month', bookings_monthly_source_src_16000.ds)
+ DATEADD(month, -1, subq_12.metric_time__month) = DATE_TRUNC('month', bookings_monthly_source_src_16000.ds)
GROUP BY
- subq_10.metric_time__month
-) subq_15
+ subq_12.metric_time__month
+) subq_17
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_to_grain__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_to_grain__plan0.sql
index b833c0ffae..b40c3941e3 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_to_grain__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_to_grain__plan0.sql
@@ -1,545 +1,545 @@
-- Compute Metrics via Expressions
SELECT
- subq_13.metric_time__day
+ subq_22.metric_time__day
, bookings - bookings_at_start_of_month AS bookings_growth_since_start_of_month
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_4.metric_time__day, subq_12.metric_time__day) AS metric_time__day
- , MAX(subq_4.bookings) AS bookings
- , MAX(subq_12.bookings_at_start_of_month) AS bookings_at_start_of_month
+ COALESCE(subq_13.metric_time__day, subq_21.metric_time__day) AS metric_time__day
+ , MAX(subq_13.bookings) AS bookings
+ , MAX(subq_21.bookings_at_start_of_month) AS bookings_at_start_of_month
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_3.metric_time__day
- , subq_3.bookings
+ subq_12.metric_time__day
+ , subq_12.bookings
FROM (
-- Aggregate Measures
SELECT
- subq_2.metric_time__day
- , SUM(subq_2.bookings) AS bookings
+ subq_11.metric_time__day
+ , SUM(subq_11.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__day']
SELECT
- subq_1.metric_time__day
- , subq_1.bookings
+ subq_10.metric_time__day
+ , subq_10.bookings
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
- ) subq_2
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
GROUP BY
- subq_2.metric_time__day
- ) subq_3
- ) subq_4
+ subq_11.metric_time__day
+ ) subq_12
+ ) subq_13
FULL OUTER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_11.metric_time__day
- , subq_11.bookings AS bookings_at_start_of_month
+ subq_20.metric_time__day
+ , subq_20.bookings AS bookings_at_start_of_month
FROM (
-- Aggregate Measures
SELECT
- subq_10.metric_time__day
- , SUM(subq_10.bookings) AS bookings
+ subq_19.metric_time__day
+ , SUM(subq_19.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__day']
SELECT
- subq_9.metric_time__day
- , subq_9.bookings
+ subq_18.metric_time__day
+ , subq_18.bookings
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_7.metric_time__day AS metric_time__day
- , subq_6.ds__day AS ds__day
- , subq_6.ds__week AS ds__week
- , subq_6.ds__month AS ds__month
- , subq_6.ds__quarter AS ds__quarter
- , subq_6.ds__year AS ds__year
- , subq_6.ds__extract_year AS ds__extract_year
- , subq_6.ds__extract_quarter AS ds__extract_quarter
- , subq_6.ds__extract_month AS ds__extract_month
- , subq_6.ds__extract_day AS ds__extract_day
- , subq_6.ds__extract_dow AS ds__extract_dow
- , subq_6.ds__extract_doy AS ds__extract_doy
- , subq_6.ds_partitioned__day AS ds_partitioned__day
- , subq_6.ds_partitioned__week AS ds_partitioned__week
- , subq_6.ds_partitioned__month AS ds_partitioned__month
- , subq_6.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_6.ds_partitioned__year AS ds_partitioned__year
- , subq_6.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_6.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_6.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_6.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_6.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_6.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_6.paid_at__day AS paid_at__day
- , subq_6.paid_at__week AS paid_at__week
- , subq_6.paid_at__month AS paid_at__month
- , subq_6.paid_at__quarter AS paid_at__quarter
- , subq_6.paid_at__year AS paid_at__year
- , subq_6.paid_at__extract_year AS paid_at__extract_year
- , subq_6.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_6.paid_at__extract_month AS paid_at__extract_month
- , subq_6.paid_at__extract_day AS paid_at__extract_day
- , subq_6.paid_at__extract_dow AS paid_at__extract_dow
- , subq_6.paid_at__extract_doy AS paid_at__extract_doy
- , subq_6.booking__ds__day AS booking__ds__day
- , subq_6.booking__ds__week AS booking__ds__week
- , subq_6.booking__ds__month AS booking__ds__month
- , subq_6.booking__ds__quarter AS booking__ds__quarter
- , subq_6.booking__ds__year AS booking__ds__year
- , subq_6.booking__ds__extract_year AS booking__ds__extract_year
- , subq_6.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_6.booking__ds__extract_month AS booking__ds__extract_month
- , subq_6.booking__ds__extract_day AS booking__ds__extract_day
- , subq_6.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_6.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_6.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_6.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_6.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_6.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_6.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_6.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_6.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_6.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_6.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_6.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_6.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_6.booking__paid_at__day AS booking__paid_at__day
- , subq_6.booking__paid_at__week AS booking__paid_at__week
- , subq_6.booking__paid_at__month AS booking__paid_at__month
- , subq_6.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_6.booking__paid_at__year AS booking__paid_at__year
- , subq_6.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_6.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_6.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_6.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_6.listing AS listing
- , subq_6.guest AS guest
- , subq_6.host AS host
- , subq_6.booking__listing AS booking__listing
- , subq_6.booking__guest AS booking__guest
- , subq_6.booking__host AS booking__host
- , subq_6.is_instant AS is_instant
- , subq_6.booking__is_instant AS booking__is_instant
- , subq_6.bookings AS bookings
- , subq_6.instant_bookings AS instant_bookings
- , subq_6.booking_value AS booking_value
- , subq_6.max_booking_value AS max_booking_value
- , subq_6.min_booking_value AS min_booking_value
- , subq_6.bookers AS bookers
- , subq_6.average_booking_value AS average_booking_value
- , subq_6.referred_bookings AS referred_bookings
- , subq_6.median_booking_value AS median_booking_value
- , subq_6.booking_value_p99 AS booking_value_p99
- , subq_6.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_6.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_6.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ subq_16.metric_time__day AS metric_time__day
+ , subq_15.ds__day AS ds__day
+ , subq_15.ds__week AS ds__week
+ , subq_15.ds__month AS ds__month
+ , subq_15.ds__quarter AS ds__quarter
+ , subq_15.ds__year AS ds__year
+ , subq_15.ds__extract_year AS ds__extract_year
+ , subq_15.ds__extract_quarter AS ds__extract_quarter
+ , subq_15.ds__extract_month AS ds__extract_month
+ , subq_15.ds__extract_day AS ds__extract_day
+ , subq_15.ds__extract_dow AS ds__extract_dow
+ , subq_15.ds__extract_doy AS ds__extract_doy
+ , subq_15.ds_partitioned__day AS ds_partitioned__day
+ , subq_15.ds_partitioned__week AS ds_partitioned__week
+ , subq_15.ds_partitioned__month AS ds_partitioned__month
+ , subq_15.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_15.ds_partitioned__year AS ds_partitioned__year
+ , subq_15.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_15.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_15.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_15.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_15.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_15.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_15.paid_at__day AS paid_at__day
+ , subq_15.paid_at__week AS paid_at__week
+ , subq_15.paid_at__month AS paid_at__month
+ , subq_15.paid_at__quarter AS paid_at__quarter
+ , subq_15.paid_at__year AS paid_at__year
+ , subq_15.paid_at__extract_year AS paid_at__extract_year
+ , subq_15.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_15.paid_at__extract_month AS paid_at__extract_month
+ , subq_15.paid_at__extract_day AS paid_at__extract_day
+ , subq_15.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_15.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_15.booking__ds__day AS booking__ds__day
+ , subq_15.booking__ds__week AS booking__ds__week
+ , subq_15.booking__ds__month AS booking__ds__month
+ , subq_15.booking__ds__quarter AS booking__ds__quarter
+ , subq_15.booking__ds__year AS booking__ds__year
+ , subq_15.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_15.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_15.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_15.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_15.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_15.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_15.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_15.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_15.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_15.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_15.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_15.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_15.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_15.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_15.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_15.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_15.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_15.booking__paid_at__day AS booking__paid_at__day
+ , subq_15.booking__paid_at__week AS booking__paid_at__week
+ , subq_15.booking__paid_at__month AS booking__paid_at__month
+ , subq_15.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_15.booking__paid_at__year AS booking__paid_at__year
+ , subq_15.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_15.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_15.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_15.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_15.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_15.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_15.listing AS listing
+ , subq_15.guest AS guest
+ , subq_15.host AS host
+ , subq_15.booking__listing AS booking__listing
+ , subq_15.booking__guest AS booking__guest
+ , subq_15.booking__host AS booking__host
+ , subq_15.is_instant AS is_instant
+ , subq_15.booking__is_instant AS booking__is_instant
+ , subq_15.bookings AS bookings
+ , subq_15.instant_bookings AS instant_bookings
+ , subq_15.booking_value AS booking_value
+ , subq_15.max_booking_value AS max_booking_value
+ , subq_15.min_booking_value AS min_booking_value
+ , subq_15.bookers AS bookers
+ , subq_15.average_booking_value AS average_booking_value
+ , subq_15.referred_bookings AS referred_bookings
+ , subq_15.median_booking_value AS median_booking_value
+ , subq_15.booking_value_p99 AS booking_value_p99
+ , subq_15.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_15.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_15.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_8.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_8
- ) subq_7
+ subq_17.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_17
+ ) subq_16
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_5.ds__day
- , subq_5.ds__week
- , subq_5.ds__month
- , subq_5.ds__quarter
- , subq_5.ds__year
- , subq_5.ds__extract_year
- , subq_5.ds__extract_quarter
- , subq_5.ds__extract_month
- , subq_5.ds__extract_day
- , subq_5.ds__extract_dow
- , subq_5.ds__extract_doy
- , subq_5.ds_partitioned__day
- , subq_5.ds_partitioned__week
- , subq_5.ds_partitioned__month
- , subq_5.ds_partitioned__quarter
- , subq_5.ds_partitioned__year
- , subq_5.ds_partitioned__extract_year
- , subq_5.ds_partitioned__extract_quarter
- , subq_5.ds_partitioned__extract_month
- , subq_5.ds_partitioned__extract_day
- , subq_5.ds_partitioned__extract_dow
- , subq_5.ds_partitioned__extract_doy
- , subq_5.paid_at__day
- , subq_5.paid_at__week
- , subq_5.paid_at__month
- , subq_5.paid_at__quarter
- , subq_5.paid_at__year
- , subq_5.paid_at__extract_year
- , subq_5.paid_at__extract_quarter
- , subq_5.paid_at__extract_month
- , subq_5.paid_at__extract_day
- , subq_5.paid_at__extract_dow
- , subq_5.paid_at__extract_doy
- , subq_5.booking__ds__day
- , subq_5.booking__ds__week
- , subq_5.booking__ds__month
- , subq_5.booking__ds__quarter
- , subq_5.booking__ds__year
- , subq_5.booking__ds__extract_year
- , subq_5.booking__ds__extract_quarter
- , subq_5.booking__ds__extract_month
- , subq_5.booking__ds__extract_day
- , subq_5.booking__ds__extract_dow
- , subq_5.booking__ds__extract_doy
- , subq_5.booking__ds_partitioned__day
- , subq_5.booking__ds_partitioned__week
- , subq_5.booking__ds_partitioned__month
- , subq_5.booking__ds_partitioned__quarter
- , subq_5.booking__ds_partitioned__year
- , subq_5.booking__ds_partitioned__extract_year
- , subq_5.booking__ds_partitioned__extract_quarter
- , subq_5.booking__ds_partitioned__extract_month
- , subq_5.booking__ds_partitioned__extract_day
- , subq_5.booking__ds_partitioned__extract_dow
- , subq_5.booking__ds_partitioned__extract_doy
- , subq_5.booking__paid_at__day
- , subq_5.booking__paid_at__week
- , subq_5.booking__paid_at__month
- , subq_5.booking__paid_at__quarter
- , subq_5.booking__paid_at__year
- , subq_5.booking__paid_at__extract_year
- , subq_5.booking__paid_at__extract_quarter
- , subq_5.booking__paid_at__extract_month
- , subq_5.booking__paid_at__extract_day
- , subq_5.booking__paid_at__extract_dow
- , subq_5.booking__paid_at__extract_doy
- , subq_5.ds__day AS metric_time__day
- , subq_5.ds__week AS metric_time__week
- , subq_5.ds__month AS metric_time__month
- , subq_5.ds__quarter AS metric_time__quarter
- , subq_5.ds__year AS metric_time__year
- , subq_5.ds__extract_year AS metric_time__extract_year
- , subq_5.ds__extract_quarter AS metric_time__extract_quarter
- , subq_5.ds__extract_month AS metric_time__extract_month
- , subq_5.ds__extract_day AS metric_time__extract_day
- , subq_5.ds__extract_dow AS metric_time__extract_dow
- , subq_5.ds__extract_doy AS metric_time__extract_doy
- , subq_5.listing
- , subq_5.guest
- , subq_5.host
- , subq_5.booking__listing
- , subq_5.booking__guest
- , subq_5.booking__host
- , subq_5.is_instant
- , subq_5.booking__is_instant
- , subq_5.bookings
- , subq_5.instant_bookings
- , subq_5.booking_value
- , subq_5.max_booking_value
- , subq_5.min_booking_value
- , subq_5.bookers
- , subq_5.average_booking_value
- , subq_5.referred_bookings
- , subq_5.median_booking_value
- , subq_5.booking_value_p99
- , subq_5.discrete_booking_value_p99
- , subq_5.approximate_continuous_booking_value_p99
- , subq_5.approximate_discrete_booking_value_p99
+ subq_14.ds__day
+ , subq_14.ds__week
+ , subq_14.ds__month
+ , subq_14.ds__quarter
+ , subq_14.ds__year
+ , subq_14.ds__extract_year
+ , subq_14.ds__extract_quarter
+ , subq_14.ds__extract_month
+ , subq_14.ds__extract_day
+ , subq_14.ds__extract_dow
+ , subq_14.ds__extract_doy
+ , subq_14.ds_partitioned__day
+ , subq_14.ds_partitioned__week
+ , subq_14.ds_partitioned__month
+ , subq_14.ds_partitioned__quarter
+ , subq_14.ds_partitioned__year
+ , subq_14.ds_partitioned__extract_year
+ , subq_14.ds_partitioned__extract_quarter
+ , subq_14.ds_partitioned__extract_month
+ , subq_14.ds_partitioned__extract_day
+ , subq_14.ds_partitioned__extract_dow
+ , subq_14.ds_partitioned__extract_doy
+ , subq_14.paid_at__day
+ , subq_14.paid_at__week
+ , subq_14.paid_at__month
+ , subq_14.paid_at__quarter
+ , subq_14.paid_at__year
+ , subq_14.paid_at__extract_year
+ , subq_14.paid_at__extract_quarter
+ , subq_14.paid_at__extract_month
+ , subq_14.paid_at__extract_day
+ , subq_14.paid_at__extract_dow
+ , subq_14.paid_at__extract_doy
+ , subq_14.booking__ds__day
+ , subq_14.booking__ds__week
+ , subq_14.booking__ds__month
+ , subq_14.booking__ds__quarter
+ , subq_14.booking__ds__year
+ , subq_14.booking__ds__extract_year
+ , subq_14.booking__ds__extract_quarter
+ , subq_14.booking__ds__extract_month
+ , subq_14.booking__ds__extract_day
+ , subq_14.booking__ds__extract_dow
+ , subq_14.booking__ds__extract_doy
+ , subq_14.booking__ds_partitioned__day
+ , subq_14.booking__ds_partitioned__week
+ , subq_14.booking__ds_partitioned__month
+ , subq_14.booking__ds_partitioned__quarter
+ , subq_14.booking__ds_partitioned__year
+ , subq_14.booking__ds_partitioned__extract_year
+ , subq_14.booking__ds_partitioned__extract_quarter
+ , subq_14.booking__ds_partitioned__extract_month
+ , subq_14.booking__ds_partitioned__extract_day
+ , subq_14.booking__ds_partitioned__extract_dow
+ , subq_14.booking__ds_partitioned__extract_doy
+ , subq_14.booking__paid_at__day
+ , subq_14.booking__paid_at__week
+ , subq_14.booking__paid_at__month
+ , subq_14.booking__paid_at__quarter
+ , subq_14.booking__paid_at__year
+ , subq_14.booking__paid_at__extract_year
+ , subq_14.booking__paid_at__extract_quarter
+ , subq_14.booking__paid_at__extract_month
+ , subq_14.booking__paid_at__extract_day
+ , subq_14.booking__paid_at__extract_dow
+ , subq_14.booking__paid_at__extract_doy
+ , subq_14.ds__day AS metric_time__day
+ , subq_14.ds__week AS metric_time__week
+ , subq_14.ds__month AS metric_time__month
+ , subq_14.ds__quarter AS metric_time__quarter
+ , subq_14.ds__year AS metric_time__year
+ , subq_14.ds__extract_year AS metric_time__extract_year
+ , subq_14.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_14.ds__extract_month AS metric_time__extract_month
+ , subq_14.ds__extract_day AS metric_time__extract_day
+ , subq_14.ds__extract_dow AS metric_time__extract_dow
+ , subq_14.ds__extract_doy AS metric_time__extract_doy
+ , subq_14.listing
+ , subq_14.guest
+ , subq_14.host
+ , subq_14.booking__listing
+ , subq_14.booking__guest
+ , subq_14.booking__host
+ , subq_14.is_instant
+ , subq_14.booking__is_instant
+ , subq_14.bookings
+ , subq_14.instant_bookings
+ , subq_14.booking_value
+ , subq_14.max_booking_value
+ , subq_14.min_booking_value
+ , subq_14.bookers
+ , subq_14.average_booking_value
+ , subq_14.referred_bookings
+ , subq_14.median_booking_value
+ , subq_14.booking_value_p99
+ , subq_14.discrete_booking_value_p99
+ , subq_14.approximate_continuous_booking_value_p99
+ , subq_14.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_5
- ) subq_6
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_14
+ ) subq_15
ON
- DATE_TRUNC('month', subq_7.metric_time__day) = subq_6.metric_time__day
- ) subq_9
- ) subq_10
+ DATE_TRUNC('month', subq_16.metric_time__day) = subq_15.metric_time__day
+ ) subq_18
+ ) subq_19
GROUP BY
- subq_10.metric_time__day
- ) subq_11
- ) subq_12
+ subq_19.metric_time__day
+ ) subq_20
+ ) subq_21
ON
- subq_4.metric_time__day = subq_12.metric_time__day
+ subq_13.metric_time__day = subq_21.metric_time__day
GROUP BY
- COALESCE(subq_4.metric_time__day, subq_12.metric_time__day)
-) subq_13
+ COALESCE(subq_13.metric_time__day, subq_21.metric_time__day)
+) subq_22
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_to_grain__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_to_grain__plan0_optimized.sql
index 5138fe8ae6..2061be23cf 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_to_grain__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_to_grain__plan0_optimized.sql
@@ -5,9 +5,9 @@ SELECT
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_18.metric_time__day, subq_26.metric_time__day) AS metric_time__day
- , MAX(subq_18.bookings) AS bookings
- , MAX(subq_26.bookings_at_start_of_month) AS bookings_at_start_of_month
+ COALESCE(subq_27.metric_time__day, subq_35.metric_time__day) AS metric_time__day
+ , MAX(subq_27.bookings) AS bookings
+ , MAX(subq_35.bookings_at_start_of_month) AS bookings_at_start_of_month
FROM (
-- Aggregate Measures
-- Compute Metrics via Expressions
@@ -21,35 +21,35 @@ FROM (
SELECT
DATE_TRUNC('day', ds) AS metric_time__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_16
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_25
GROUP BY
metric_time__day
- ) subq_18
+ ) subq_27
FULL OUTER JOIN (
-- Join to Time Spine Dataset
-- Pass Only Elements: ['bookings', 'metric_time__day']
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_22.ds AS metric_time__day
- , SUM(subq_20.bookings) AS bookings_at_start_of_month
- FROM ***************************.mf_time_spine subq_22
+ subq_31.ds AS metric_time__day
+ , SUM(subq_29.bookings) AS bookings_at_start_of_month
+ FROM ***************************.mf_time_spine subq_31
INNER JOIN (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
SELECT
DATE_TRUNC('day', ds) AS metric_time__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_20
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_29
ON
- DATE_TRUNC('month', subq_22.ds) = subq_20.metric_time__day
+ DATE_TRUNC('month', subq_31.ds) = subq_29.metric_time__day
GROUP BY
- subq_22.ds
- ) subq_26
+ subq_31.ds
+ ) subq_35
ON
- subq_18.metric_time__day = subq_26.metric_time__day
+ subq_27.metric_time__day = subq_35.metric_time__day
GROUP BY
- COALESCE(subq_18.metric_time__day, subq_26.metric_time__day)
-) subq_27
+ COALESCE(subq_27.metric_time__day, subq_35.metric_time__day)
+) subq_36
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql
index cfe4bb809a..6355c29553 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql
@@ -1,546 +1,546 @@
-- Compute Metrics via Expressions
SELECT
- subq_13.metric_time__week
+ subq_22.metric_time__week
, bookings - bookings_at_start_of_month AS bookings_growth_since_start_of_month
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_4.metric_time__week, subq_12.metric_time__week) AS metric_time__week
- , MAX(subq_4.bookings) AS bookings
- , MAX(subq_12.bookings_at_start_of_month) AS bookings_at_start_of_month
+ COALESCE(subq_13.metric_time__week, subq_21.metric_time__week) AS metric_time__week
+ , MAX(subq_13.bookings) AS bookings
+ , MAX(subq_21.bookings_at_start_of_month) AS bookings_at_start_of_month
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_3.metric_time__week
- , subq_3.bookings
+ subq_12.metric_time__week
+ , subq_12.bookings
FROM (
-- Aggregate Measures
SELECT
- subq_2.metric_time__week
- , SUM(subq_2.bookings) AS bookings
+ subq_11.metric_time__week
+ , SUM(subq_11.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__week']
SELECT
- subq_1.metric_time__week
- , subq_1.bookings
+ subq_10.metric_time__week
+ , subq_10.bookings
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
- ) subq_2
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
GROUP BY
- subq_2.metric_time__week
- ) subq_3
- ) subq_4
+ subq_11.metric_time__week
+ ) subq_12
+ ) subq_13
FULL OUTER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_11.metric_time__week
- , subq_11.bookings AS bookings_at_start_of_month
+ subq_20.metric_time__week
+ , subq_20.bookings AS bookings_at_start_of_month
FROM (
-- Aggregate Measures
SELECT
- subq_10.metric_time__week
- , SUM(subq_10.bookings) AS bookings
+ subq_19.metric_time__week
+ , SUM(subq_19.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__week']
SELECT
- subq_9.metric_time__week
- , subq_9.bookings
+ subq_18.metric_time__week
+ , subq_18.bookings
FROM (
-- Join to Time Spine Dataset
SELECT
- DATE_TRUNC('week', subq_7.metric_time__day) AS metric_time__week
- , subq_6.ds__day AS ds__day
- , subq_6.ds__week AS ds__week
- , subq_6.ds__month AS ds__month
- , subq_6.ds__quarter AS ds__quarter
- , subq_6.ds__year AS ds__year
- , subq_6.ds__extract_year AS ds__extract_year
- , subq_6.ds__extract_quarter AS ds__extract_quarter
- , subq_6.ds__extract_month AS ds__extract_month
- , subq_6.ds__extract_day AS ds__extract_day
- , subq_6.ds__extract_dow AS ds__extract_dow
- , subq_6.ds__extract_doy AS ds__extract_doy
- , subq_6.ds_partitioned__day AS ds_partitioned__day
- , subq_6.ds_partitioned__week AS ds_partitioned__week
- , subq_6.ds_partitioned__month AS ds_partitioned__month
- , subq_6.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_6.ds_partitioned__year AS ds_partitioned__year
- , subq_6.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_6.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_6.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_6.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_6.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_6.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_6.paid_at__day AS paid_at__day
- , subq_6.paid_at__week AS paid_at__week
- , subq_6.paid_at__month AS paid_at__month
- , subq_6.paid_at__quarter AS paid_at__quarter
- , subq_6.paid_at__year AS paid_at__year
- , subq_6.paid_at__extract_year AS paid_at__extract_year
- , subq_6.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_6.paid_at__extract_month AS paid_at__extract_month
- , subq_6.paid_at__extract_day AS paid_at__extract_day
- , subq_6.paid_at__extract_dow AS paid_at__extract_dow
- , subq_6.paid_at__extract_doy AS paid_at__extract_doy
- , subq_6.booking__ds__day AS booking__ds__day
- , subq_6.booking__ds__week AS booking__ds__week
- , subq_6.booking__ds__month AS booking__ds__month
- , subq_6.booking__ds__quarter AS booking__ds__quarter
- , subq_6.booking__ds__year AS booking__ds__year
- , subq_6.booking__ds__extract_year AS booking__ds__extract_year
- , subq_6.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_6.booking__ds__extract_month AS booking__ds__extract_month
- , subq_6.booking__ds__extract_day AS booking__ds__extract_day
- , subq_6.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_6.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_6.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_6.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_6.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_6.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_6.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_6.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_6.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_6.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_6.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_6.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_6.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_6.booking__paid_at__day AS booking__paid_at__day
- , subq_6.booking__paid_at__week AS booking__paid_at__week
- , subq_6.booking__paid_at__month AS booking__paid_at__month
- , subq_6.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_6.booking__paid_at__year AS booking__paid_at__year
- , subq_6.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_6.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_6.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_6.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_6.listing AS listing
- , subq_6.guest AS guest
- , subq_6.host AS host
- , subq_6.booking__listing AS booking__listing
- , subq_6.booking__guest AS booking__guest
- , subq_6.booking__host AS booking__host
- , subq_6.is_instant AS is_instant
- , subq_6.booking__is_instant AS booking__is_instant
- , subq_6.bookings AS bookings
- , subq_6.instant_bookings AS instant_bookings
- , subq_6.booking_value AS booking_value
- , subq_6.max_booking_value AS max_booking_value
- , subq_6.min_booking_value AS min_booking_value
- , subq_6.bookers AS bookers
- , subq_6.average_booking_value AS average_booking_value
- , subq_6.referred_bookings AS referred_bookings
- , subq_6.median_booking_value AS median_booking_value
- , subq_6.booking_value_p99 AS booking_value_p99
- , subq_6.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_6.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_6.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ DATE_TRUNC('week', subq_16.metric_time__day) AS metric_time__week
+ , subq_15.ds__day AS ds__day
+ , subq_15.ds__week AS ds__week
+ , subq_15.ds__month AS ds__month
+ , subq_15.ds__quarter AS ds__quarter
+ , subq_15.ds__year AS ds__year
+ , subq_15.ds__extract_year AS ds__extract_year
+ , subq_15.ds__extract_quarter AS ds__extract_quarter
+ , subq_15.ds__extract_month AS ds__extract_month
+ , subq_15.ds__extract_day AS ds__extract_day
+ , subq_15.ds__extract_dow AS ds__extract_dow
+ , subq_15.ds__extract_doy AS ds__extract_doy
+ , subq_15.ds_partitioned__day AS ds_partitioned__day
+ , subq_15.ds_partitioned__week AS ds_partitioned__week
+ , subq_15.ds_partitioned__month AS ds_partitioned__month
+ , subq_15.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_15.ds_partitioned__year AS ds_partitioned__year
+ , subq_15.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_15.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_15.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_15.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_15.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_15.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_15.paid_at__day AS paid_at__day
+ , subq_15.paid_at__week AS paid_at__week
+ , subq_15.paid_at__month AS paid_at__month
+ , subq_15.paid_at__quarter AS paid_at__quarter
+ , subq_15.paid_at__year AS paid_at__year
+ , subq_15.paid_at__extract_year AS paid_at__extract_year
+ , subq_15.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_15.paid_at__extract_month AS paid_at__extract_month
+ , subq_15.paid_at__extract_day AS paid_at__extract_day
+ , subq_15.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_15.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_15.booking__ds__day AS booking__ds__day
+ , subq_15.booking__ds__week AS booking__ds__week
+ , subq_15.booking__ds__month AS booking__ds__month
+ , subq_15.booking__ds__quarter AS booking__ds__quarter
+ , subq_15.booking__ds__year AS booking__ds__year
+ , subq_15.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_15.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_15.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_15.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_15.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_15.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_15.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_15.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_15.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_15.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_15.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_15.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_15.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_15.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_15.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_15.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_15.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_15.booking__paid_at__day AS booking__paid_at__day
+ , subq_15.booking__paid_at__week AS booking__paid_at__week
+ , subq_15.booking__paid_at__month AS booking__paid_at__month
+ , subq_15.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_15.booking__paid_at__year AS booking__paid_at__year
+ , subq_15.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_15.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_15.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_15.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_15.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_15.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_15.listing AS listing
+ , subq_15.guest AS guest
+ , subq_15.host AS host
+ , subq_15.booking__listing AS booking__listing
+ , subq_15.booking__guest AS booking__guest
+ , subq_15.booking__host AS booking__host
+ , subq_15.is_instant AS is_instant
+ , subq_15.booking__is_instant AS booking__is_instant
+ , subq_15.bookings AS bookings
+ , subq_15.instant_bookings AS instant_bookings
+ , subq_15.booking_value AS booking_value
+ , subq_15.max_booking_value AS max_booking_value
+ , subq_15.min_booking_value AS min_booking_value
+ , subq_15.bookers AS bookers
+ , subq_15.average_booking_value AS average_booking_value
+ , subq_15.referred_bookings AS referred_bookings
+ , subq_15.median_booking_value AS median_booking_value
+ , subq_15.booking_value_p99 AS booking_value_p99
+ , subq_15.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_15.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_15.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_8.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_8
- ) subq_7
+ subq_17.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_17
+ ) subq_16
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_5.ds__day
- , subq_5.ds__week
- , subq_5.ds__month
- , subq_5.ds__quarter
- , subq_5.ds__year
- , subq_5.ds__extract_year
- , subq_5.ds__extract_quarter
- , subq_5.ds__extract_month
- , subq_5.ds__extract_day
- , subq_5.ds__extract_dow
- , subq_5.ds__extract_doy
- , subq_5.ds_partitioned__day
- , subq_5.ds_partitioned__week
- , subq_5.ds_partitioned__month
- , subq_5.ds_partitioned__quarter
- , subq_5.ds_partitioned__year
- , subq_5.ds_partitioned__extract_year
- , subq_5.ds_partitioned__extract_quarter
- , subq_5.ds_partitioned__extract_month
- , subq_5.ds_partitioned__extract_day
- , subq_5.ds_partitioned__extract_dow
- , subq_5.ds_partitioned__extract_doy
- , subq_5.paid_at__day
- , subq_5.paid_at__week
- , subq_5.paid_at__month
- , subq_5.paid_at__quarter
- , subq_5.paid_at__year
- , subq_5.paid_at__extract_year
- , subq_5.paid_at__extract_quarter
- , subq_5.paid_at__extract_month
- , subq_5.paid_at__extract_day
- , subq_5.paid_at__extract_dow
- , subq_5.paid_at__extract_doy
- , subq_5.booking__ds__day
- , subq_5.booking__ds__week
- , subq_5.booking__ds__month
- , subq_5.booking__ds__quarter
- , subq_5.booking__ds__year
- , subq_5.booking__ds__extract_year
- , subq_5.booking__ds__extract_quarter
- , subq_5.booking__ds__extract_month
- , subq_5.booking__ds__extract_day
- , subq_5.booking__ds__extract_dow
- , subq_5.booking__ds__extract_doy
- , subq_5.booking__ds_partitioned__day
- , subq_5.booking__ds_partitioned__week
- , subq_5.booking__ds_partitioned__month
- , subq_5.booking__ds_partitioned__quarter
- , subq_5.booking__ds_partitioned__year
- , subq_5.booking__ds_partitioned__extract_year
- , subq_5.booking__ds_partitioned__extract_quarter
- , subq_5.booking__ds_partitioned__extract_month
- , subq_5.booking__ds_partitioned__extract_day
- , subq_5.booking__ds_partitioned__extract_dow
- , subq_5.booking__ds_partitioned__extract_doy
- , subq_5.booking__paid_at__day
- , subq_5.booking__paid_at__week
- , subq_5.booking__paid_at__month
- , subq_5.booking__paid_at__quarter
- , subq_5.booking__paid_at__year
- , subq_5.booking__paid_at__extract_year
- , subq_5.booking__paid_at__extract_quarter
- , subq_5.booking__paid_at__extract_month
- , subq_5.booking__paid_at__extract_day
- , subq_5.booking__paid_at__extract_dow
- , subq_5.booking__paid_at__extract_doy
- , subq_5.ds__day AS metric_time__day
- , subq_5.ds__week AS metric_time__week
- , subq_5.ds__month AS metric_time__month
- , subq_5.ds__quarter AS metric_time__quarter
- , subq_5.ds__year AS metric_time__year
- , subq_5.ds__extract_year AS metric_time__extract_year
- , subq_5.ds__extract_quarter AS metric_time__extract_quarter
- , subq_5.ds__extract_month AS metric_time__extract_month
- , subq_5.ds__extract_day AS metric_time__extract_day
- , subq_5.ds__extract_dow AS metric_time__extract_dow
- , subq_5.ds__extract_doy AS metric_time__extract_doy
- , subq_5.listing
- , subq_5.guest
- , subq_5.host
- , subq_5.booking__listing
- , subq_5.booking__guest
- , subq_5.booking__host
- , subq_5.is_instant
- , subq_5.booking__is_instant
- , subq_5.bookings
- , subq_5.instant_bookings
- , subq_5.booking_value
- , subq_5.max_booking_value
- , subq_5.min_booking_value
- , subq_5.bookers
- , subq_5.average_booking_value
- , subq_5.referred_bookings
- , subq_5.median_booking_value
- , subq_5.booking_value_p99
- , subq_5.discrete_booking_value_p99
- , subq_5.approximate_continuous_booking_value_p99
- , subq_5.approximate_discrete_booking_value_p99
+ subq_14.ds__day
+ , subq_14.ds__week
+ , subq_14.ds__month
+ , subq_14.ds__quarter
+ , subq_14.ds__year
+ , subq_14.ds__extract_year
+ , subq_14.ds__extract_quarter
+ , subq_14.ds__extract_month
+ , subq_14.ds__extract_day
+ , subq_14.ds__extract_dow
+ , subq_14.ds__extract_doy
+ , subq_14.ds_partitioned__day
+ , subq_14.ds_partitioned__week
+ , subq_14.ds_partitioned__month
+ , subq_14.ds_partitioned__quarter
+ , subq_14.ds_partitioned__year
+ , subq_14.ds_partitioned__extract_year
+ , subq_14.ds_partitioned__extract_quarter
+ , subq_14.ds_partitioned__extract_month
+ , subq_14.ds_partitioned__extract_day
+ , subq_14.ds_partitioned__extract_dow
+ , subq_14.ds_partitioned__extract_doy
+ , subq_14.paid_at__day
+ , subq_14.paid_at__week
+ , subq_14.paid_at__month
+ , subq_14.paid_at__quarter
+ , subq_14.paid_at__year
+ , subq_14.paid_at__extract_year
+ , subq_14.paid_at__extract_quarter
+ , subq_14.paid_at__extract_month
+ , subq_14.paid_at__extract_day
+ , subq_14.paid_at__extract_dow
+ , subq_14.paid_at__extract_doy
+ , subq_14.booking__ds__day
+ , subq_14.booking__ds__week
+ , subq_14.booking__ds__month
+ , subq_14.booking__ds__quarter
+ , subq_14.booking__ds__year
+ , subq_14.booking__ds__extract_year
+ , subq_14.booking__ds__extract_quarter
+ , subq_14.booking__ds__extract_month
+ , subq_14.booking__ds__extract_day
+ , subq_14.booking__ds__extract_dow
+ , subq_14.booking__ds__extract_doy
+ , subq_14.booking__ds_partitioned__day
+ , subq_14.booking__ds_partitioned__week
+ , subq_14.booking__ds_partitioned__month
+ , subq_14.booking__ds_partitioned__quarter
+ , subq_14.booking__ds_partitioned__year
+ , subq_14.booking__ds_partitioned__extract_year
+ , subq_14.booking__ds_partitioned__extract_quarter
+ , subq_14.booking__ds_partitioned__extract_month
+ , subq_14.booking__ds_partitioned__extract_day
+ , subq_14.booking__ds_partitioned__extract_dow
+ , subq_14.booking__ds_partitioned__extract_doy
+ , subq_14.booking__paid_at__day
+ , subq_14.booking__paid_at__week
+ , subq_14.booking__paid_at__month
+ , subq_14.booking__paid_at__quarter
+ , subq_14.booking__paid_at__year
+ , subq_14.booking__paid_at__extract_year
+ , subq_14.booking__paid_at__extract_quarter
+ , subq_14.booking__paid_at__extract_month
+ , subq_14.booking__paid_at__extract_day
+ , subq_14.booking__paid_at__extract_dow
+ , subq_14.booking__paid_at__extract_doy
+ , subq_14.ds__day AS metric_time__day
+ , subq_14.ds__week AS metric_time__week
+ , subq_14.ds__month AS metric_time__month
+ , subq_14.ds__quarter AS metric_time__quarter
+ , subq_14.ds__year AS metric_time__year
+ , subq_14.ds__extract_year AS metric_time__extract_year
+ , subq_14.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_14.ds__extract_month AS metric_time__extract_month
+ , subq_14.ds__extract_day AS metric_time__extract_day
+ , subq_14.ds__extract_dow AS metric_time__extract_dow
+ , subq_14.ds__extract_doy AS metric_time__extract_doy
+ , subq_14.listing
+ , subq_14.guest
+ , subq_14.host
+ , subq_14.booking__listing
+ , subq_14.booking__guest
+ , subq_14.booking__host
+ , subq_14.is_instant
+ , subq_14.booking__is_instant
+ , subq_14.bookings
+ , subq_14.instant_bookings
+ , subq_14.booking_value
+ , subq_14.max_booking_value
+ , subq_14.min_booking_value
+ , subq_14.bookers
+ , subq_14.average_booking_value
+ , subq_14.referred_bookings
+ , subq_14.median_booking_value
+ , subq_14.booking_value_p99
+ , subq_14.discrete_booking_value_p99
+ , subq_14.approximate_continuous_booking_value_p99
+ , subq_14.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_5
- ) subq_6
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_14
+ ) subq_15
ON
- DATE_TRUNC('month', subq_7.metric_time__day) = subq_6.metric_time__day
- WHERE DATE_TRUNC('week', subq_7.metric_time__day) = subq_7.metric_time__day
- ) subq_9
- ) subq_10
+ DATE_TRUNC('month', subq_16.metric_time__day) = subq_15.metric_time__day
+ WHERE DATE_TRUNC('week', subq_16.metric_time__day) = subq_16.metric_time__day
+ ) subq_18
+ ) subq_19
GROUP BY
- subq_10.metric_time__week
- ) subq_11
- ) subq_12
+ subq_19.metric_time__week
+ ) subq_20
+ ) subq_21
ON
- subq_4.metric_time__week = subq_12.metric_time__week
+ subq_13.metric_time__week = subq_21.metric_time__week
GROUP BY
- COALESCE(subq_4.metric_time__week, subq_12.metric_time__week)
-) subq_13
+ COALESCE(subq_13.metric_time__week, subq_21.metric_time__week)
+) subq_22
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_to_grain_and_granularity__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_to_grain_and_granularity__plan0_optimized.sql
index b9e4162413..65cf132abd 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_to_grain_and_granularity__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_to_grain_and_granularity__plan0_optimized.sql
@@ -5,9 +5,9 @@ SELECT
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_18.metric_time__week, subq_26.metric_time__week) AS metric_time__week
- , MAX(subq_18.bookings) AS bookings
- , MAX(subq_26.bookings_at_start_of_month) AS bookings_at_start_of_month
+ COALESCE(subq_27.metric_time__week, subq_35.metric_time__week) AS metric_time__week
+ , MAX(subq_27.bookings) AS bookings
+ , MAX(subq_35.bookings_at_start_of_month) AS bookings_at_start_of_month
FROM (
-- Aggregate Measures
-- Compute Metrics via Expressions
@@ -21,36 +21,36 @@ FROM (
SELECT
DATE_TRUNC('week', ds) AS metric_time__week
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_16
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_25
GROUP BY
metric_time__week
- ) subq_18
+ ) subq_27
FULL OUTER JOIN (
-- Join to Time Spine Dataset
-- Pass Only Elements: ['bookings', 'metric_time__week']
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- DATE_TRUNC('week', subq_22.ds) AS metric_time__week
- , SUM(subq_20.bookings) AS bookings_at_start_of_month
- FROM ***************************.mf_time_spine subq_22
+ DATE_TRUNC('week', subq_31.ds) AS metric_time__week
+ , SUM(subq_29.bookings) AS bookings_at_start_of_month
+ FROM ***************************.mf_time_spine subq_31
INNER JOIN (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
SELECT
DATE_TRUNC('day', ds) AS metric_time__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_20
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_29
ON
- DATE_TRUNC('month', subq_22.ds) = subq_20.metric_time__day
- WHERE DATE_TRUNC('week', subq_22.ds) = subq_22.ds
+ DATE_TRUNC('month', subq_31.ds) = subq_29.metric_time__day
+ WHERE DATE_TRUNC('week', subq_31.ds) = subq_31.ds
GROUP BY
- DATE_TRUNC('week', subq_22.ds)
- ) subq_26
+ DATE_TRUNC('week', subq_31.ds)
+ ) subq_35
ON
- subq_18.metric_time__week = subq_26.metric_time__week
+ subq_27.metric_time__week = subq_35.metric_time__week
GROUP BY
- COALESCE(subq_18.metric_time__week, subq_26.metric_time__week)
-) subq_27
+ COALESCE(subq_27.metric_time__week, subq_35.metric_time__week)
+) subq_36
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window__plan0.sql
index 83c1b130c2..64918564ce 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window__plan0.sql
@@ -1,545 +1,545 @@
-- Compute Metrics via Expressions
SELECT
- subq_13.metric_time__day
+ subq_22.metric_time__day
, bookings - bookings_2_weeks_ago AS bookings_growth_2_weeks
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_4.metric_time__day, subq_12.metric_time__day) AS metric_time__day
- , MAX(subq_4.bookings) AS bookings
- , MAX(subq_12.bookings_2_weeks_ago) AS bookings_2_weeks_ago
+ COALESCE(subq_13.metric_time__day, subq_21.metric_time__day) AS metric_time__day
+ , MAX(subq_13.bookings) AS bookings
+ , MAX(subq_21.bookings_2_weeks_ago) AS bookings_2_weeks_ago
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_3.metric_time__day
- , subq_3.bookings
+ subq_12.metric_time__day
+ , subq_12.bookings
FROM (
-- Aggregate Measures
SELECT
- subq_2.metric_time__day
- , SUM(subq_2.bookings) AS bookings
+ subq_11.metric_time__day
+ , SUM(subq_11.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__day']
SELECT
- subq_1.metric_time__day
- , subq_1.bookings
+ subq_10.metric_time__day
+ , subq_10.bookings
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
- ) subq_2
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
GROUP BY
- subq_2.metric_time__day
- ) subq_3
- ) subq_4
+ subq_11.metric_time__day
+ ) subq_12
+ ) subq_13
FULL OUTER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_11.metric_time__day
- , subq_11.bookings AS bookings_2_weeks_ago
+ subq_20.metric_time__day
+ , subq_20.bookings AS bookings_2_weeks_ago
FROM (
-- Aggregate Measures
SELECT
- subq_10.metric_time__day
- , SUM(subq_10.bookings) AS bookings
+ subq_19.metric_time__day
+ , SUM(subq_19.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__day']
SELECT
- subq_9.metric_time__day
- , subq_9.bookings
+ subq_18.metric_time__day
+ , subq_18.bookings
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_7.metric_time__day AS metric_time__day
- , subq_6.ds__day AS ds__day
- , subq_6.ds__week AS ds__week
- , subq_6.ds__month AS ds__month
- , subq_6.ds__quarter AS ds__quarter
- , subq_6.ds__year AS ds__year
- , subq_6.ds__extract_year AS ds__extract_year
- , subq_6.ds__extract_quarter AS ds__extract_quarter
- , subq_6.ds__extract_month AS ds__extract_month
- , subq_6.ds__extract_day AS ds__extract_day
- , subq_6.ds__extract_dow AS ds__extract_dow
- , subq_6.ds__extract_doy AS ds__extract_doy
- , subq_6.ds_partitioned__day AS ds_partitioned__day
- , subq_6.ds_partitioned__week AS ds_partitioned__week
- , subq_6.ds_partitioned__month AS ds_partitioned__month
- , subq_6.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_6.ds_partitioned__year AS ds_partitioned__year
- , subq_6.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_6.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_6.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_6.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_6.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_6.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_6.paid_at__day AS paid_at__day
- , subq_6.paid_at__week AS paid_at__week
- , subq_6.paid_at__month AS paid_at__month
- , subq_6.paid_at__quarter AS paid_at__quarter
- , subq_6.paid_at__year AS paid_at__year
- , subq_6.paid_at__extract_year AS paid_at__extract_year
- , subq_6.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_6.paid_at__extract_month AS paid_at__extract_month
- , subq_6.paid_at__extract_day AS paid_at__extract_day
- , subq_6.paid_at__extract_dow AS paid_at__extract_dow
- , subq_6.paid_at__extract_doy AS paid_at__extract_doy
- , subq_6.booking__ds__day AS booking__ds__day
- , subq_6.booking__ds__week AS booking__ds__week
- , subq_6.booking__ds__month AS booking__ds__month
- , subq_6.booking__ds__quarter AS booking__ds__quarter
- , subq_6.booking__ds__year AS booking__ds__year
- , subq_6.booking__ds__extract_year AS booking__ds__extract_year
- , subq_6.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_6.booking__ds__extract_month AS booking__ds__extract_month
- , subq_6.booking__ds__extract_day AS booking__ds__extract_day
- , subq_6.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_6.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_6.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_6.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_6.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_6.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_6.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_6.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_6.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_6.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_6.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_6.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_6.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_6.booking__paid_at__day AS booking__paid_at__day
- , subq_6.booking__paid_at__week AS booking__paid_at__week
- , subq_6.booking__paid_at__month AS booking__paid_at__month
- , subq_6.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_6.booking__paid_at__year AS booking__paid_at__year
- , subq_6.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_6.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_6.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_6.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_6.listing AS listing
- , subq_6.guest AS guest
- , subq_6.host AS host
- , subq_6.booking__listing AS booking__listing
- , subq_6.booking__guest AS booking__guest
- , subq_6.booking__host AS booking__host
- , subq_6.is_instant AS is_instant
- , subq_6.booking__is_instant AS booking__is_instant
- , subq_6.bookings AS bookings
- , subq_6.instant_bookings AS instant_bookings
- , subq_6.booking_value AS booking_value
- , subq_6.max_booking_value AS max_booking_value
- , subq_6.min_booking_value AS min_booking_value
- , subq_6.bookers AS bookers
- , subq_6.average_booking_value AS average_booking_value
- , subq_6.referred_bookings AS referred_bookings
- , subq_6.median_booking_value AS median_booking_value
- , subq_6.booking_value_p99 AS booking_value_p99
- , subq_6.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_6.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_6.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ subq_16.metric_time__day AS metric_time__day
+ , subq_15.ds__day AS ds__day
+ , subq_15.ds__week AS ds__week
+ , subq_15.ds__month AS ds__month
+ , subq_15.ds__quarter AS ds__quarter
+ , subq_15.ds__year AS ds__year
+ , subq_15.ds__extract_year AS ds__extract_year
+ , subq_15.ds__extract_quarter AS ds__extract_quarter
+ , subq_15.ds__extract_month AS ds__extract_month
+ , subq_15.ds__extract_day AS ds__extract_day
+ , subq_15.ds__extract_dow AS ds__extract_dow
+ , subq_15.ds__extract_doy AS ds__extract_doy
+ , subq_15.ds_partitioned__day AS ds_partitioned__day
+ , subq_15.ds_partitioned__week AS ds_partitioned__week
+ , subq_15.ds_partitioned__month AS ds_partitioned__month
+ , subq_15.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_15.ds_partitioned__year AS ds_partitioned__year
+ , subq_15.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_15.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_15.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_15.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_15.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_15.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_15.paid_at__day AS paid_at__day
+ , subq_15.paid_at__week AS paid_at__week
+ , subq_15.paid_at__month AS paid_at__month
+ , subq_15.paid_at__quarter AS paid_at__quarter
+ , subq_15.paid_at__year AS paid_at__year
+ , subq_15.paid_at__extract_year AS paid_at__extract_year
+ , subq_15.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_15.paid_at__extract_month AS paid_at__extract_month
+ , subq_15.paid_at__extract_day AS paid_at__extract_day
+ , subq_15.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_15.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_15.booking__ds__day AS booking__ds__day
+ , subq_15.booking__ds__week AS booking__ds__week
+ , subq_15.booking__ds__month AS booking__ds__month
+ , subq_15.booking__ds__quarter AS booking__ds__quarter
+ , subq_15.booking__ds__year AS booking__ds__year
+ , subq_15.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_15.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_15.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_15.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_15.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_15.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_15.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_15.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_15.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_15.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_15.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_15.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_15.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_15.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_15.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_15.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_15.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_15.booking__paid_at__day AS booking__paid_at__day
+ , subq_15.booking__paid_at__week AS booking__paid_at__week
+ , subq_15.booking__paid_at__month AS booking__paid_at__month
+ , subq_15.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_15.booking__paid_at__year AS booking__paid_at__year
+ , subq_15.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_15.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_15.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_15.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_15.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_15.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_15.listing AS listing
+ , subq_15.guest AS guest
+ , subq_15.host AS host
+ , subq_15.booking__listing AS booking__listing
+ , subq_15.booking__guest AS booking__guest
+ , subq_15.booking__host AS booking__host
+ , subq_15.is_instant AS is_instant
+ , subq_15.booking__is_instant AS booking__is_instant
+ , subq_15.bookings AS bookings
+ , subq_15.instant_bookings AS instant_bookings
+ , subq_15.booking_value AS booking_value
+ , subq_15.max_booking_value AS max_booking_value
+ , subq_15.min_booking_value AS min_booking_value
+ , subq_15.bookers AS bookers
+ , subq_15.average_booking_value AS average_booking_value
+ , subq_15.referred_bookings AS referred_bookings
+ , subq_15.median_booking_value AS median_booking_value
+ , subq_15.booking_value_p99 AS booking_value_p99
+ , subq_15.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_15.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_15.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_8.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_8
- ) subq_7
+ subq_17.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_17
+ ) subq_16
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_5.ds__day
- , subq_5.ds__week
- , subq_5.ds__month
- , subq_5.ds__quarter
- , subq_5.ds__year
- , subq_5.ds__extract_year
- , subq_5.ds__extract_quarter
- , subq_5.ds__extract_month
- , subq_5.ds__extract_day
- , subq_5.ds__extract_dow
- , subq_5.ds__extract_doy
- , subq_5.ds_partitioned__day
- , subq_5.ds_partitioned__week
- , subq_5.ds_partitioned__month
- , subq_5.ds_partitioned__quarter
- , subq_5.ds_partitioned__year
- , subq_5.ds_partitioned__extract_year
- , subq_5.ds_partitioned__extract_quarter
- , subq_5.ds_partitioned__extract_month
- , subq_5.ds_partitioned__extract_day
- , subq_5.ds_partitioned__extract_dow
- , subq_5.ds_partitioned__extract_doy
- , subq_5.paid_at__day
- , subq_5.paid_at__week
- , subq_5.paid_at__month
- , subq_5.paid_at__quarter
- , subq_5.paid_at__year
- , subq_5.paid_at__extract_year
- , subq_5.paid_at__extract_quarter
- , subq_5.paid_at__extract_month
- , subq_5.paid_at__extract_day
- , subq_5.paid_at__extract_dow
- , subq_5.paid_at__extract_doy
- , subq_5.booking__ds__day
- , subq_5.booking__ds__week
- , subq_5.booking__ds__month
- , subq_5.booking__ds__quarter
- , subq_5.booking__ds__year
- , subq_5.booking__ds__extract_year
- , subq_5.booking__ds__extract_quarter
- , subq_5.booking__ds__extract_month
- , subq_5.booking__ds__extract_day
- , subq_5.booking__ds__extract_dow
- , subq_5.booking__ds__extract_doy
- , subq_5.booking__ds_partitioned__day
- , subq_5.booking__ds_partitioned__week
- , subq_5.booking__ds_partitioned__month
- , subq_5.booking__ds_partitioned__quarter
- , subq_5.booking__ds_partitioned__year
- , subq_5.booking__ds_partitioned__extract_year
- , subq_5.booking__ds_partitioned__extract_quarter
- , subq_5.booking__ds_partitioned__extract_month
- , subq_5.booking__ds_partitioned__extract_day
- , subq_5.booking__ds_partitioned__extract_dow
- , subq_5.booking__ds_partitioned__extract_doy
- , subq_5.booking__paid_at__day
- , subq_5.booking__paid_at__week
- , subq_5.booking__paid_at__month
- , subq_5.booking__paid_at__quarter
- , subq_5.booking__paid_at__year
- , subq_5.booking__paid_at__extract_year
- , subq_5.booking__paid_at__extract_quarter
- , subq_5.booking__paid_at__extract_month
- , subq_5.booking__paid_at__extract_day
- , subq_5.booking__paid_at__extract_dow
- , subq_5.booking__paid_at__extract_doy
- , subq_5.ds__day AS metric_time__day
- , subq_5.ds__week AS metric_time__week
- , subq_5.ds__month AS metric_time__month
- , subq_5.ds__quarter AS metric_time__quarter
- , subq_5.ds__year AS metric_time__year
- , subq_5.ds__extract_year AS metric_time__extract_year
- , subq_5.ds__extract_quarter AS metric_time__extract_quarter
- , subq_5.ds__extract_month AS metric_time__extract_month
- , subq_5.ds__extract_day AS metric_time__extract_day
- , subq_5.ds__extract_dow AS metric_time__extract_dow
- , subq_5.ds__extract_doy AS metric_time__extract_doy
- , subq_5.listing
- , subq_5.guest
- , subq_5.host
- , subq_5.booking__listing
- , subq_5.booking__guest
- , subq_5.booking__host
- , subq_5.is_instant
- , subq_5.booking__is_instant
- , subq_5.bookings
- , subq_5.instant_bookings
- , subq_5.booking_value
- , subq_5.max_booking_value
- , subq_5.min_booking_value
- , subq_5.bookers
- , subq_5.average_booking_value
- , subq_5.referred_bookings
- , subq_5.median_booking_value
- , subq_5.booking_value_p99
- , subq_5.discrete_booking_value_p99
- , subq_5.approximate_continuous_booking_value_p99
- , subq_5.approximate_discrete_booking_value_p99
+ subq_14.ds__day
+ , subq_14.ds__week
+ , subq_14.ds__month
+ , subq_14.ds__quarter
+ , subq_14.ds__year
+ , subq_14.ds__extract_year
+ , subq_14.ds__extract_quarter
+ , subq_14.ds__extract_month
+ , subq_14.ds__extract_day
+ , subq_14.ds__extract_dow
+ , subq_14.ds__extract_doy
+ , subq_14.ds_partitioned__day
+ , subq_14.ds_partitioned__week
+ , subq_14.ds_partitioned__month
+ , subq_14.ds_partitioned__quarter
+ , subq_14.ds_partitioned__year
+ , subq_14.ds_partitioned__extract_year
+ , subq_14.ds_partitioned__extract_quarter
+ , subq_14.ds_partitioned__extract_month
+ , subq_14.ds_partitioned__extract_day
+ , subq_14.ds_partitioned__extract_dow
+ , subq_14.ds_partitioned__extract_doy
+ , subq_14.paid_at__day
+ , subq_14.paid_at__week
+ , subq_14.paid_at__month
+ , subq_14.paid_at__quarter
+ , subq_14.paid_at__year
+ , subq_14.paid_at__extract_year
+ , subq_14.paid_at__extract_quarter
+ , subq_14.paid_at__extract_month
+ , subq_14.paid_at__extract_day
+ , subq_14.paid_at__extract_dow
+ , subq_14.paid_at__extract_doy
+ , subq_14.booking__ds__day
+ , subq_14.booking__ds__week
+ , subq_14.booking__ds__month
+ , subq_14.booking__ds__quarter
+ , subq_14.booking__ds__year
+ , subq_14.booking__ds__extract_year
+ , subq_14.booking__ds__extract_quarter
+ , subq_14.booking__ds__extract_month
+ , subq_14.booking__ds__extract_day
+ , subq_14.booking__ds__extract_dow
+ , subq_14.booking__ds__extract_doy
+ , subq_14.booking__ds_partitioned__day
+ , subq_14.booking__ds_partitioned__week
+ , subq_14.booking__ds_partitioned__month
+ , subq_14.booking__ds_partitioned__quarter
+ , subq_14.booking__ds_partitioned__year
+ , subq_14.booking__ds_partitioned__extract_year
+ , subq_14.booking__ds_partitioned__extract_quarter
+ , subq_14.booking__ds_partitioned__extract_month
+ , subq_14.booking__ds_partitioned__extract_day
+ , subq_14.booking__ds_partitioned__extract_dow
+ , subq_14.booking__ds_partitioned__extract_doy
+ , subq_14.booking__paid_at__day
+ , subq_14.booking__paid_at__week
+ , subq_14.booking__paid_at__month
+ , subq_14.booking__paid_at__quarter
+ , subq_14.booking__paid_at__year
+ , subq_14.booking__paid_at__extract_year
+ , subq_14.booking__paid_at__extract_quarter
+ , subq_14.booking__paid_at__extract_month
+ , subq_14.booking__paid_at__extract_day
+ , subq_14.booking__paid_at__extract_dow
+ , subq_14.booking__paid_at__extract_doy
+ , subq_14.ds__day AS metric_time__day
+ , subq_14.ds__week AS metric_time__week
+ , subq_14.ds__month AS metric_time__month
+ , subq_14.ds__quarter AS metric_time__quarter
+ , subq_14.ds__year AS metric_time__year
+ , subq_14.ds__extract_year AS metric_time__extract_year
+ , subq_14.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_14.ds__extract_month AS metric_time__extract_month
+ , subq_14.ds__extract_day AS metric_time__extract_day
+ , subq_14.ds__extract_dow AS metric_time__extract_dow
+ , subq_14.ds__extract_doy AS metric_time__extract_doy
+ , subq_14.listing
+ , subq_14.guest
+ , subq_14.host
+ , subq_14.booking__listing
+ , subq_14.booking__guest
+ , subq_14.booking__host
+ , subq_14.is_instant
+ , subq_14.booking__is_instant
+ , subq_14.bookings
+ , subq_14.instant_bookings
+ , subq_14.booking_value
+ , subq_14.max_booking_value
+ , subq_14.min_booking_value
+ , subq_14.bookers
+ , subq_14.average_booking_value
+ , subq_14.referred_bookings
+ , subq_14.median_booking_value
+ , subq_14.booking_value_p99
+ , subq_14.discrete_booking_value_p99
+ , subq_14.approximate_continuous_booking_value_p99
+ , subq_14.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_5
- ) subq_6
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_14
+ ) subq_15
ON
- DATEADD(day, -14, subq_7.metric_time__day) = subq_6.metric_time__day
- ) subq_9
- ) subq_10
+ DATEADD(day, -14, subq_16.metric_time__day) = subq_15.metric_time__day
+ ) subq_18
+ ) subq_19
GROUP BY
- subq_10.metric_time__day
- ) subq_11
- ) subq_12
+ subq_19.metric_time__day
+ ) subq_20
+ ) subq_21
ON
- subq_4.metric_time__day = subq_12.metric_time__day
+ subq_13.metric_time__day = subq_21.metric_time__day
GROUP BY
- COALESCE(subq_4.metric_time__day, subq_12.metric_time__day)
-) subq_13
+ COALESCE(subq_13.metric_time__day, subq_21.metric_time__day)
+) subq_22
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window__plan0_optimized.sql
index 197f4d5430..ba542c8a14 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window__plan0_optimized.sql
@@ -5,9 +5,9 @@ SELECT
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_18.metric_time__day, subq_26.metric_time__day) AS metric_time__day
- , MAX(subq_18.bookings) AS bookings
- , MAX(subq_26.bookings_2_weeks_ago) AS bookings_2_weeks_ago
+ COALESCE(subq_27.metric_time__day, subq_35.metric_time__day) AS metric_time__day
+ , MAX(subq_27.bookings) AS bookings
+ , MAX(subq_35.bookings_2_weeks_ago) AS bookings_2_weeks_ago
FROM (
-- Aggregate Measures
-- Compute Metrics via Expressions
@@ -21,35 +21,35 @@ FROM (
SELECT
DATE_TRUNC('day', ds) AS metric_time__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_16
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_25
GROUP BY
metric_time__day
- ) subq_18
+ ) subq_27
FULL OUTER JOIN (
-- Join to Time Spine Dataset
-- Pass Only Elements: ['bookings', 'metric_time__day']
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_22.ds AS metric_time__day
- , SUM(subq_20.bookings) AS bookings_2_weeks_ago
- FROM ***************************.mf_time_spine subq_22
+ subq_31.ds AS metric_time__day
+ , SUM(subq_29.bookings) AS bookings_2_weeks_ago
+ FROM ***************************.mf_time_spine subq_31
INNER JOIN (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
SELECT
DATE_TRUNC('day', ds) AS metric_time__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_20
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_29
ON
- DATEADD(day, -14, subq_22.ds) = subq_20.metric_time__day
+ DATEADD(day, -14, subq_31.ds) = subq_29.metric_time__day
GROUP BY
- subq_22.ds
- ) subq_26
+ subq_31.ds
+ ) subq_35
ON
- subq_18.metric_time__day = subq_26.metric_time__day
+ subq_27.metric_time__day = subq_35.metric_time__day
GROUP BY
- COALESCE(subq_18.metric_time__day, subq_26.metric_time__day)
-) subq_27
+ COALESCE(subq_27.metric_time__day, subq_35.metric_time__day)
+) subq_36
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window_and_granularity__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window_and_granularity__plan0.sql
index 3ebcc29772..ce6630401e 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window_and_granularity__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window_and_granularity__plan0.sql
@@ -1,545 +1,545 @@
-- Compute Metrics via Expressions
SELECT
- subq_13.metric_time__quarter
+ subq_22.metric_time__quarter
, bookings - bookings_2_weeks_ago AS bookings_growth_2_weeks
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_4.metric_time__quarter, subq_12.metric_time__quarter) AS metric_time__quarter
- , MAX(subq_4.bookings) AS bookings
- , MAX(subq_12.bookings_2_weeks_ago) AS bookings_2_weeks_ago
+ COALESCE(subq_13.metric_time__quarter, subq_21.metric_time__quarter) AS metric_time__quarter
+ , MAX(subq_13.bookings) AS bookings
+ , MAX(subq_21.bookings_2_weeks_ago) AS bookings_2_weeks_ago
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_3.metric_time__quarter
- , subq_3.bookings
+ subq_12.metric_time__quarter
+ , subq_12.bookings
FROM (
-- Aggregate Measures
SELECT
- subq_2.metric_time__quarter
- , SUM(subq_2.bookings) AS bookings
+ subq_11.metric_time__quarter
+ , SUM(subq_11.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__quarter']
SELECT
- subq_1.metric_time__quarter
- , subq_1.bookings
+ subq_10.metric_time__quarter
+ , subq_10.bookings
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
- ) subq_2
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
GROUP BY
- subq_2.metric_time__quarter
- ) subq_3
- ) subq_4
+ subq_11.metric_time__quarter
+ ) subq_12
+ ) subq_13
FULL OUTER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_11.metric_time__quarter
- , subq_11.bookings AS bookings_2_weeks_ago
+ subq_20.metric_time__quarter
+ , subq_20.bookings AS bookings_2_weeks_ago
FROM (
-- Aggregate Measures
SELECT
- subq_10.metric_time__quarter
- , SUM(subq_10.bookings) AS bookings
+ subq_19.metric_time__quarter
+ , SUM(subq_19.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__quarter']
SELECT
- subq_9.metric_time__quarter
- , subq_9.bookings
+ subq_18.metric_time__quarter
+ , subq_18.bookings
FROM (
-- Join to Time Spine Dataset
SELECT
- DATE_TRUNC('quarter', subq_7.metric_time__day) AS metric_time__quarter
- , subq_6.ds__day AS ds__day
- , subq_6.ds__week AS ds__week
- , subq_6.ds__month AS ds__month
- , subq_6.ds__quarter AS ds__quarter
- , subq_6.ds__year AS ds__year
- , subq_6.ds__extract_year AS ds__extract_year
- , subq_6.ds__extract_quarter AS ds__extract_quarter
- , subq_6.ds__extract_month AS ds__extract_month
- , subq_6.ds__extract_day AS ds__extract_day
- , subq_6.ds__extract_dow AS ds__extract_dow
- , subq_6.ds__extract_doy AS ds__extract_doy
- , subq_6.ds_partitioned__day AS ds_partitioned__day
- , subq_6.ds_partitioned__week AS ds_partitioned__week
- , subq_6.ds_partitioned__month AS ds_partitioned__month
- , subq_6.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_6.ds_partitioned__year AS ds_partitioned__year
- , subq_6.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_6.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_6.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_6.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_6.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_6.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_6.paid_at__day AS paid_at__day
- , subq_6.paid_at__week AS paid_at__week
- , subq_6.paid_at__month AS paid_at__month
- , subq_6.paid_at__quarter AS paid_at__quarter
- , subq_6.paid_at__year AS paid_at__year
- , subq_6.paid_at__extract_year AS paid_at__extract_year
- , subq_6.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_6.paid_at__extract_month AS paid_at__extract_month
- , subq_6.paid_at__extract_day AS paid_at__extract_day
- , subq_6.paid_at__extract_dow AS paid_at__extract_dow
- , subq_6.paid_at__extract_doy AS paid_at__extract_doy
- , subq_6.booking__ds__day AS booking__ds__day
- , subq_6.booking__ds__week AS booking__ds__week
- , subq_6.booking__ds__month AS booking__ds__month
- , subq_6.booking__ds__quarter AS booking__ds__quarter
- , subq_6.booking__ds__year AS booking__ds__year
- , subq_6.booking__ds__extract_year AS booking__ds__extract_year
- , subq_6.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_6.booking__ds__extract_month AS booking__ds__extract_month
- , subq_6.booking__ds__extract_day AS booking__ds__extract_day
- , subq_6.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_6.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_6.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_6.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_6.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_6.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_6.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_6.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_6.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_6.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_6.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_6.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_6.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_6.booking__paid_at__day AS booking__paid_at__day
- , subq_6.booking__paid_at__week AS booking__paid_at__week
- , subq_6.booking__paid_at__month AS booking__paid_at__month
- , subq_6.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_6.booking__paid_at__year AS booking__paid_at__year
- , subq_6.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_6.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_6.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_6.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_6.listing AS listing
- , subq_6.guest AS guest
- , subq_6.host AS host
- , subq_6.booking__listing AS booking__listing
- , subq_6.booking__guest AS booking__guest
- , subq_6.booking__host AS booking__host
- , subq_6.is_instant AS is_instant
- , subq_6.booking__is_instant AS booking__is_instant
- , subq_6.bookings AS bookings
- , subq_6.instant_bookings AS instant_bookings
- , subq_6.booking_value AS booking_value
- , subq_6.max_booking_value AS max_booking_value
- , subq_6.min_booking_value AS min_booking_value
- , subq_6.bookers AS bookers
- , subq_6.average_booking_value AS average_booking_value
- , subq_6.referred_bookings AS referred_bookings
- , subq_6.median_booking_value AS median_booking_value
- , subq_6.booking_value_p99 AS booking_value_p99
- , subq_6.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_6.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_6.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ DATE_TRUNC('quarter', subq_16.metric_time__day) AS metric_time__quarter
+ , subq_15.ds__day AS ds__day
+ , subq_15.ds__week AS ds__week
+ , subq_15.ds__month AS ds__month
+ , subq_15.ds__quarter AS ds__quarter
+ , subq_15.ds__year AS ds__year
+ , subq_15.ds__extract_year AS ds__extract_year
+ , subq_15.ds__extract_quarter AS ds__extract_quarter
+ , subq_15.ds__extract_month AS ds__extract_month
+ , subq_15.ds__extract_day AS ds__extract_day
+ , subq_15.ds__extract_dow AS ds__extract_dow
+ , subq_15.ds__extract_doy AS ds__extract_doy
+ , subq_15.ds_partitioned__day AS ds_partitioned__day
+ , subq_15.ds_partitioned__week AS ds_partitioned__week
+ , subq_15.ds_partitioned__month AS ds_partitioned__month
+ , subq_15.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_15.ds_partitioned__year AS ds_partitioned__year
+ , subq_15.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_15.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_15.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_15.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_15.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_15.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_15.paid_at__day AS paid_at__day
+ , subq_15.paid_at__week AS paid_at__week
+ , subq_15.paid_at__month AS paid_at__month
+ , subq_15.paid_at__quarter AS paid_at__quarter
+ , subq_15.paid_at__year AS paid_at__year
+ , subq_15.paid_at__extract_year AS paid_at__extract_year
+ , subq_15.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_15.paid_at__extract_month AS paid_at__extract_month
+ , subq_15.paid_at__extract_day AS paid_at__extract_day
+ , subq_15.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_15.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_15.booking__ds__day AS booking__ds__day
+ , subq_15.booking__ds__week AS booking__ds__week
+ , subq_15.booking__ds__month AS booking__ds__month
+ , subq_15.booking__ds__quarter AS booking__ds__quarter
+ , subq_15.booking__ds__year AS booking__ds__year
+ , subq_15.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_15.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_15.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_15.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_15.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_15.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_15.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_15.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_15.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_15.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_15.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_15.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_15.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_15.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_15.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_15.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_15.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_15.booking__paid_at__day AS booking__paid_at__day
+ , subq_15.booking__paid_at__week AS booking__paid_at__week
+ , subq_15.booking__paid_at__month AS booking__paid_at__month
+ , subq_15.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_15.booking__paid_at__year AS booking__paid_at__year
+ , subq_15.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_15.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_15.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_15.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_15.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_15.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_15.listing AS listing
+ , subq_15.guest AS guest
+ , subq_15.host AS host
+ , subq_15.booking__listing AS booking__listing
+ , subq_15.booking__guest AS booking__guest
+ , subq_15.booking__host AS booking__host
+ , subq_15.is_instant AS is_instant
+ , subq_15.booking__is_instant AS booking__is_instant
+ , subq_15.bookings AS bookings
+ , subq_15.instant_bookings AS instant_bookings
+ , subq_15.booking_value AS booking_value
+ , subq_15.max_booking_value AS max_booking_value
+ , subq_15.min_booking_value AS min_booking_value
+ , subq_15.bookers AS bookers
+ , subq_15.average_booking_value AS average_booking_value
+ , subq_15.referred_bookings AS referred_bookings
+ , subq_15.median_booking_value AS median_booking_value
+ , subq_15.booking_value_p99 AS booking_value_p99
+ , subq_15.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_15.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_15.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_8.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_8
- ) subq_7
+ subq_17.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_17
+ ) subq_16
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_5.ds__day
- , subq_5.ds__week
- , subq_5.ds__month
- , subq_5.ds__quarter
- , subq_5.ds__year
- , subq_5.ds__extract_year
- , subq_5.ds__extract_quarter
- , subq_5.ds__extract_month
- , subq_5.ds__extract_day
- , subq_5.ds__extract_dow
- , subq_5.ds__extract_doy
- , subq_5.ds_partitioned__day
- , subq_5.ds_partitioned__week
- , subq_5.ds_partitioned__month
- , subq_5.ds_partitioned__quarter
- , subq_5.ds_partitioned__year
- , subq_5.ds_partitioned__extract_year
- , subq_5.ds_partitioned__extract_quarter
- , subq_5.ds_partitioned__extract_month
- , subq_5.ds_partitioned__extract_day
- , subq_5.ds_partitioned__extract_dow
- , subq_5.ds_partitioned__extract_doy
- , subq_5.paid_at__day
- , subq_5.paid_at__week
- , subq_5.paid_at__month
- , subq_5.paid_at__quarter
- , subq_5.paid_at__year
- , subq_5.paid_at__extract_year
- , subq_5.paid_at__extract_quarter
- , subq_5.paid_at__extract_month
- , subq_5.paid_at__extract_day
- , subq_5.paid_at__extract_dow
- , subq_5.paid_at__extract_doy
- , subq_5.booking__ds__day
- , subq_5.booking__ds__week
- , subq_5.booking__ds__month
- , subq_5.booking__ds__quarter
- , subq_5.booking__ds__year
- , subq_5.booking__ds__extract_year
- , subq_5.booking__ds__extract_quarter
- , subq_5.booking__ds__extract_month
- , subq_5.booking__ds__extract_day
- , subq_5.booking__ds__extract_dow
- , subq_5.booking__ds__extract_doy
- , subq_5.booking__ds_partitioned__day
- , subq_5.booking__ds_partitioned__week
- , subq_5.booking__ds_partitioned__month
- , subq_5.booking__ds_partitioned__quarter
- , subq_5.booking__ds_partitioned__year
- , subq_5.booking__ds_partitioned__extract_year
- , subq_5.booking__ds_partitioned__extract_quarter
- , subq_5.booking__ds_partitioned__extract_month
- , subq_5.booking__ds_partitioned__extract_day
- , subq_5.booking__ds_partitioned__extract_dow
- , subq_5.booking__ds_partitioned__extract_doy
- , subq_5.booking__paid_at__day
- , subq_5.booking__paid_at__week
- , subq_5.booking__paid_at__month
- , subq_5.booking__paid_at__quarter
- , subq_5.booking__paid_at__year
- , subq_5.booking__paid_at__extract_year
- , subq_5.booking__paid_at__extract_quarter
- , subq_5.booking__paid_at__extract_month
- , subq_5.booking__paid_at__extract_day
- , subq_5.booking__paid_at__extract_dow
- , subq_5.booking__paid_at__extract_doy
- , subq_5.ds__day AS metric_time__day
- , subq_5.ds__week AS metric_time__week
- , subq_5.ds__month AS metric_time__month
- , subq_5.ds__quarter AS metric_time__quarter
- , subq_5.ds__year AS metric_time__year
- , subq_5.ds__extract_year AS metric_time__extract_year
- , subq_5.ds__extract_quarter AS metric_time__extract_quarter
- , subq_5.ds__extract_month AS metric_time__extract_month
- , subq_5.ds__extract_day AS metric_time__extract_day
- , subq_5.ds__extract_dow AS metric_time__extract_dow
- , subq_5.ds__extract_doy AS metric_time__extract_doy
- , subq_5.listing
- , subq_5.guest
- , subq_5.host
- , subq_5.booking__listing
- , subq_5.booking__guest
- , subq_5.booking__host
- , subq_5.is_instant
- , subq_5.booking__is_instant
- , subq_5.bookings
- , subq_5.instant_bookings
- , subq_5.booking_value
- , subq_5.max_booking_value
- , subq_5.min_booking_value
- , subq_5.bookers
- , subq_5.average_booking_value
- , subq_5.referred_bookings
- , subq_5.median_booking_value
- , subq_5.booking_value_p99
- , subq_5.discrete_booking_value_p99
- , subq_5.approximate_continuous_booking_value_p99
- , subq_5.approximate_discrete_booking_value_p99
+ subq_14.ds__day
+ , subq_14.ds__week
+ , subq_14.ds__month
+ , subq_14.ds__quarter
+ , subq_14.ds__year
+ , subq_14.ds__extract_year
+ , subq_14.ds__extract_quarter
+ , subq_14.ds__extract_month
+ , subq_14.ds__extract_day
+ , subq_14.ds__extract_dow
+ , subq_14.ds__extract_doy
+ , subq_14.ds_partitioned__day
+ , subq_14.ds_partitioned__week
+ , subq_14.ds_partitioned__month
+ , subq_14.ds_partitioned__quarter
+ , subq_14.ds_partitioned__year
+ , subq_14.ds_partitioned__extract_year
+ , subq_14.ds_partitioned__extract_quarter
+ , subq_14.ds_partitioned__extract_month
+ , subq_14.ds_partitioned__extract_day
+ , subq_14.ds_partitioned__extract_dow
+ , subq_14.ds_partitioned__extract_doy
+ , subq_14.paid_at__day
+ , subq_14.paid_at__week
+ , subq_14.paid_at__month
+ , subq_14.paid_at__quarter
+ , subq_14.paid_at__year
+ , subq_14.paid_at__extract_year
+ , subq_14.paid_at__extract_quarter
+ , subq_14.paid_at__extract_month
+ , subq_14.paid_at__extract_day
+ , subq_14.paid_at__extract_dow
+ , subq_14.paid_at__extract_doy
+ , subq_14.booking__ds__day
+ , subq_14.booking__ds__week
+ , subq_14.booking__ds__month
+ , subq_14.booking__ds__quarter
+ , subq_14.booking__ds__year
+ , subq_14.booking__ds__extract_year
+ , subq_14.booking__ds__extract_quarter
+ , subq_14.booking__ds__extract_month
+ , subq_14.booking__ds__extract_day
+ , subq_14.booking__ds__extract_dow
+ , subq_14.booking__ds__extract_doy
+ , subq_14.booking__ds_partitioned__day
+ , subq_14.booking__ds_partitioned__week
+ , subq_14.booking__ds_partitioned__month
+ , subq_14.booking__ds_partitioned__quarter
+ , subq_14.booking__ds_partitioned__year
+ , subq_14.booking__ds_partitioned__extract_year
+ , subq_14.booking__ds_partitioned__extract_quarter
+ , subq_14.booking__ds_partitioned__extract_month
+ , subq_14.booking__ds_partitioned__extract_day
+ , subq_14.booking__ds_partitioned__extract_dow
+ , subq_14.booking__ds_partitioned__extract_doy
+ , subq_14.booking__paid_at__day
+ , subq_14.booking__paid_at__week
+ , subq_14.booking__paid_at__month
+ , subq_14.booking__paid_at__quarter
+ , subq_14.booking__paid_at__year
+ , subq_14.booking__paid_at__extract_year
+ , subq_14.booking__paid_at__extract_quarter
+ , subq_14.booking__paid_at__extract_month
+ , subq_14.booking__paid_at__extract_day
+ , subq_14.booking__paid_at__extract_dow
+ , subq_14.booking__paid_at__extract_doy
+ , subq_14.ds__day AS metric_time__day
+ , subq_14.ds__week AS metric_time__week
+ , subq_14.ds__month AS metric_time__month
+ , subq_14.ds__quarter AS metric_time__quarter
+ , subq_14.ds__year AS metric_time__year
+ , subq_14.ds__extract_year AS metric_time__extract_year
+ , subq_14.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_14.ds__extract_month AS metric_time__extract_month
+ , subq_14.ds__extract_day AS metric_time__extract_day
+ , subq_14.ds__extract_dow AS metric_time__extract_dow
+ , subq_14.ds__extract_doy AS metric_time__extract_doy
+ , subq_14.listing
+ , subq_14.guest
+ , subq_14.host
+ , subq_14.booking__listing
+ , subq_14.booking__guest
+ , subq_14.booking__host
+ , subq_14.is_instant
+ , subq_14.booking__is_instant
+ , subq_14.bookings
+ , subq_14.instant_bookings
+ , subq_14.booking_value
+ , subq_14.max_booking_value
+ , subq_14.min_booking_value
+ , subq_14.bookers
+ , subq_14.average_booking_value
+ , subq_14.referred_bookings
+ , subq_14.median_booking_value
+ , subq_14.booking_value_p99
+ , subq_14.discrete_booking_value_p99
+ , subq_14.approximate_continuous_booking_value_p99
+ , subq_14.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_5
- ) subq_6
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_14
+ ) subq_15
ON
- DATEADD(day, -14, subq_7.metric_time__day) = subq_6.metric_time__day
- ) subq_9
- ) subq_10
+ DATEADD(day, -14, subq_16.metric_time__day) = subq_15.metric_time__day
+ ) subq_18
+ ) subq_19
GROUP BY
- subq_10.metric_time__quarter
- ) subq_11
- ) subq_12
+ subq_19.metric_time__quarter
+ ) subq_20
+ ) subq_21
ON
- subq_4.metric_time__quarter = subq_12.metric_time__quarter
+ subq_13.metric_time__quarter = subq_21.metric_time__quarter
GROUP BY
- COALESCE(subq_4.metric_time__quarter, subq_12.metric_time__quarter)
-) subq_13
+ COALESCE(subq_13.metric_time__quarter, subq_21.metric_time__quarter)
+) subq_22
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window_and_granularity__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window_and_granularity__plan0_optimized.sql
index 89f6dcf4d2..d31ffad9a6 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window_and_granularity__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window_and_granularity__plan0_optimized.sql
@@ -5,9 +5,9 @@ SELECT
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_18.metric_time__quarter, subq_26.metric_time__quarter) AS metric_time__quarter
- , MAX(subq_18.bookings) AS bookings
- , MAX(subq_26.bookings_2_weeks_ago) AS bookings_2_weeks_ago
+ COALESCE(subq_27.metric_time__quarter, subq_35.metric_time__quarter) AS metric_time__quarter
+ , MAX(subq_27.bookings) AS bookings
+ , MAX(subq_35.bookings_2_weeks_ago) AS bookings_2_weeks_ago
FROM (
-- Aggregate Measures
-- Compute Metrics via Expressions
@@ -21,35 +21,35 @@ FROM (
SELECT
DATE_TRUNC('quarter', ds) AS metric_time__quarter
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_16
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_25
GROUP BY
metric_time__quarter
- ) subq_18
+ ) subq_27
FULL OUTER JOIN (
-- Join to Time Spine Dataset
-- Pass Only Elements: ['bookings', 'metric_time__quarter']
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- DATE_TRUNC('quarter', subq_22.ds) AS metric_time__quarter
- , SUM(subq_20.bookings) AS bookings_2_weeks_ago
- FROM ***************************.mf_time_spine subq_22
+ DATE_TRUNC('quarter', subq_31.ds) AS metric_time__quarter
+ , SUM(subq_29.bookings) AS bookings_2_weeks_ago
+ FROM ***************************.mf_time_spine subq_31
INNER JOIN (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
SELECT
DATE_TRUNC('day', ds) AS metric_time__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_20
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_29
ON
- DATEADD(day, -14, subq_22.ds) = subq_20.metric_time__day
+ DATEADD(day, -14, subq_31.ds) = subq_29.metric_time__day
GROUP BY
- DATE_TRUNC('quarter', subq_22.ds)
- ) subq_26
+ DATE_TRUNC('quarter', subq_31.ds)
+ ) subq_35
ON
- subq_18.metric_time__quarter = subq_26.metric_time__quarter
+ subq_27.metric_time__quarter = subq_35.metric_time__quarter
GROUP BY
- COALESCE(subq_18.metric_time__quarter, subq_26.metric_time__quarter)
-) subq_27
+ COALESCE(subq_27.metric_time__quarter, subq_35.metric_time__quarter)
+) subq_36
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql
index 4f5c379351..956debe353 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql
@@ -1,645 +1,645 @@
-- Compute Metrics via Expressions
SELECT
- subq_16.metric_time__day
+ subq_25.metric_time__day
, month_start_bookings - bookings_1_month_ago AS bookings_month_start_compared_to_1_month_prior
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_7.metric_time__day, subq_15.metric_time__day) AS metric_time__day
- , MAX(subq_7.month_start_bookings) AS month_start_bookings
- , MAX(subq_15.bookings_1_month_ago) AS bookings_1_month_ago
+ COALESCE(subq_16.metric_time__day, subq_24.metric_time__day) AS metric_time__day
+ , MAX(subq_16.month_start_bookings) AS month_start_bookings
+ , MAX(subq_24.bookings_1_month_ago) AS bookings_1_month_ago
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_6.metric_time__day
- , subq_6.bookings AS month_start_bookings
+ subq_15.metric_time__day
+ , subq_15.bookings AS month_start_bookings
FROM (
-- Aggregate Measures
SELECT
- subq_5.metric_time__day
- , SUM(subq_5.bookings) AS bookings
+ subq_14.metric_time__day
+ , SUM(subq_14.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__day']
SELECT
- subq_4.metric_time__day
- , subq_4.bookings
+ subq_13.metric_time__day
+ , subq_13.bookings
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_2.metric_time__day AS metric_time__day
- , subq_1.ds__day AS ds__day
- , subq_1.ds__week AS ds__week
- , subq_1.ds__month AS ds__month
- , subq_1.ds__quarter AS ds__quarter
- , subq_1.ds__year AS ds__year
- , subq_1.ds__extract_year AS ds__extract_year
- , subq_1.ds__extract_quarter AS ds__extract_quarter
- , subq_1.ds__extract_month AS ds__extract_month
- , subq_1.ds__extract_day AS ds__extract_day
- , subq_1.ds__extract_dow AS ds__extract_dow
- , subq_1.ds__extract_doy AS ds__extract_doy
- , subq_1.ds_partitioned__day AS ds_partitioned__day
- , subq_1.ds_partitioned__week AS ds_partitioned__week
- , subq_1.ds_partitioned__month AS ds_partitioned__month
- , subq_1.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_1.ds_partitioned__year AS ds_partitioned__year
- , subq_1.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_1.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_1.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_1.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_1.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_1.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_1.paid_at__day AS paid_at__day
- , subq_1.paid_at__week AS paid_at__week
- , subq_1.paid_at__month AS paid_at__month
- , subq_1.paid_at__quarter AS paid_at__quarter
- , subq_1.paid_at__year AS paid_at__year
- , subq_1.paid_at__extract_year AS paid_at__extract_year
- , subq_1.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_1.paid_at__extract_month AS paid_at__extract_month
- , subq_1.paid_at__extract_day AS paid_at__extract_day
- , subq_1.paid_at__extract_dow AS paid_at__extract_dow
- , subq_1.paid_at__extract_doy AS paid_at__extract_doy
- , subq_1.booking__ds__day AS booking__ds__day
- , subq_1.booking__ds__week AS booking__ds__week
- , subq_1.booking__ds__month AS booking__ds__month
- , subq_1.booking__ds__quarter AS booking__ds__quarter
- , subq_1.booking__ds__year AS booking__ds__year
- , subq_1.booking__ds__extract_year AS booking__ds__extract_year
- , subq_1.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_1.booking__ds__extract_month AS booking__ds__extract_month
- , subq_1.booking__ds__extract_day AS booking__ds__extract_day
- , subq_1.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_1.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_1.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_1.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_1.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_1.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_1.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_1.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_1.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_1.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_1.booking__paid_at__day AS booking__paid_at__day
- , subq_1.booking__paid_at__week AS booking__paid_at__week
- , subq_1.booking__paid_at__month AS booking__paid_at__month
- , subq_1.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_1.booking__paid_at__year AS booking__paid_at__year
- , subq_1.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_1.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_1.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_1.listing AS listing
- , subq_1.guest AS guest
- , subq_1.host AS host
- , subq_1.booking__listing AS booking__listing
- , subq_1.booking__guest AS booking__guest
- , subq_1.booking__host AS booking__host
- , subq_1.is_instant AS is_instant
- , subq_1.booking__is_instant AS booking__is_instant
- , subq_1.bookings AS bookings
- , subq_1.instant_bookings AS instant_bookings
- , subq_1.booking_value AS booking_value
- , subq_1.max_booking_value AS max_booking_value
- , subq_1.min_booking_value AS min_booking_value
- , subq_1.bookers AS bookers
- , subq_1.average_booking_value AS average_booking_value
- , subq_1.referred_bookings AS referred_bookings
- , subq_1.median_booking_value AS median_booking_value
- , subq_1.booking_value_p99 AS booking_value_p99
- , subq_1.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_1.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_1.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ subq_11.metric_time__day AS metric_time__day
+ , subq_10.ds__day AS ds__day
+ , subq_10.ds__week AS ds__week
+ , subq_10.ds__month AS ds__month
+ , subq_10.ds__quarter AS ds__quarter
+ , subq_10.ds__year AS ds__year
+ , subq_10.ds__extract_year AS ds__extract_year
+ , subq_10.ds__extract_quarter AS ds__extract_quarter
+ , subq_10.ds__extract_month AS ds__extract_month
+ , subq_10.ds__extract_day AS ds__extract_day
+ , subq_10.ds__extract_dow AS ds__extract_dow
+ , subq_10.ds__extract_doy AS ds__extract_doy
+ , subq_10.ds_partitioned__day AS ds_partitioned__day
+ , subq_10.ds_partitioned__week AS ds_partitioned__week
+ , subq_10.ds_partitioned__month AS ds_partitioned__month
+ , subq_10.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_10.ds_partitioned__year AS ds_partitioned__year
+ , subq_10.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_10.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_10.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_10.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_10.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_10.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_10.paid_at__day AS paid_at__day
+ , subq_10.paid_at__week AS paid_at__week
+ , subq_10.paid_at__month AS paid_at__month
+ , subq_10.paid_at__quarter AS paid_at__quarter
+ , subq_10.paid_at__year AS paid_at__year
+ , subq_10.paid_at__extract_year AS paid_at__extract_year
+ , subq_10.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_10.paid_at__extract_month AS paid_at__extract_month
+ , subq_10.paid_at__extract_day AS paid_at__extract_day
+ , subq_10.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_10.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_10.booking__ds__day AS booking__ds__day
+ , subq_10.booking__ds__week AS booking__ds__week
+ , subq_10.booking__ds__month AS booking__ds__month
+ , subq_10.booking__ds__quarter AS booking__ds__quarter
+ , subq_10.booking__ds__year AS booking__ds__year
+ , subq_10.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_10.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_10.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_10.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_10.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_10.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_10.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_10.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_10.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_10.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_10.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_10.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_10.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_10.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_10.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_10.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_10.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_10.booking__paid_at__day AS booking__paid_at__day
+ , subq_10.booking__paid_at__week AS booking__paid_at__week
+ , subq_10.booking__paid_at__month AS booking__paid_at__month
+ , subq_10.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_10.booking__paid_at__year AS booking__paid_at__year
+ , subq_10.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_10.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_10.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_10.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_10.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_10.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_10.listing AS listing
+ , subq_10.guest AS guest
+ , subq_10.host AS host
+ , subq_10.booking__listing AS booking__listing
+ , subq_10.booking__guest AS booking__guest
+ , subq_10.booking__host AS booking__host
+ , subq_10.is_instant AS is_instant
+ , subq_10.booking__is_instant AS booking__is_instant
+ , subq_10.bookings AS bookings
+ , subq_10.instant_bookings AS instant_bookings
+ , subq_10.booking_value AS booking_value
+ , subq_10.max_booking_value AS max_booking_value
+ , subq_10.min_booking_value AS min_booking_value
+ , subq_10.bookers AS bookers
+ , subq_10.average_booking_value AS average_booking_value
+ , subq_10.referred_bookings AS referred_bookings
+ , subq_10.median_booking_value AS median_booking_value
+ , subq_10.booking_value_p99 AS booking_value_p99
+ , subq_10.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_10.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_10.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_3.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_3
- ) subq_2
+ subq_12.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_12
+ ) subq_11
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
ON
- DATE_TRUNC('month', subq_2.metric_time__day) = subq_1.metric_time__day
- ) subq_4
- ) subq_5
+ DATE_TRUNC('month', subq_11.metric_time__day) = subq_10.metric_time__day
+ ) subq_13
+ ) subq_14
GROUP BY
- subq_5.metric_time__day
- ) subq_6
- ) subq_7
+ subq_14.metric_time__day
+ ) subq_15
+ ) subq_16
FULL OUTER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_14.metric_time__day
- , subq_14.bookings AS bookings_1_month_ago
+ subq_23.metric_time__day
+ , subq_23.bookings AS bookings_1_month_ago
FROM (
-- Aggregate Measures
SELECT
- subq_13.metric_time__day
- , SUM(subq_13.bookings) AS bookings
+ subq_22.metric_time__day
+ , SUM(subq_22.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__day']
SELECT
- subq_12.metric_time__day
- , subq_12.bookings
+ subq_21.metric_time__day
+ , subq_21.bookings
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_10.metric_time__day AS metric_time__day
- , subq_9.ds__day AS ds__day
- , subq_9.ds__week AS ds__week
- , subq_9.ds__month AS ds__month
- , subq_9.ds__quarter AS ds__quarter
- , subq_9.ds__year AS ds__year
- , subq_9.ds__extract_year AS ds__extract_year
- , subq_9.ds__extract_quarter AS ds__extract_quarter
- , subq_9.ds__extract_month AS ds__extract_month
- , subq_9.ds__extract_day AS ds__extract_day
- , subq_9.ds__extract_dow AS ds__extract_dow
- , subq_9.ds__extract_doy AS ds__extract_doy
- , subq_9.ds_partitioned__day AS ds_partitioned__day
- , subq_9.ds_partitioned__week AS ds_partitioned__week
- , subq_9.ds_partitioned__month AS ds_partitioned__month
- , subq_9.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_9.ds_partitioned__year AS ds_partitioned__year
- , subq_9.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_9.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_9.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_9.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_9.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_9.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_9.paid_at__day AS paid_at__day
- , subq_9.paid_at__week AS paid_at__week
- , subq_9.paid_at__month AS paid_at__month
- , subq_9.paid_at__quarter AS paid_at__quarter
- , subq_9.paid_at__year AS paid_at__year
- , subq_9.paid_at__extract_year AS paid_at__extract_year
- , subq_9.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_9.paid_at__extract_month AS paid_at__extract_month
- , subq_9.paid_at__extract_day AS paid_at__extract_day
- , subq_9.paid_at__extract_dow AS paid_at__extract_dow
- , subq_9.paid_at__extract_doy AS paid_at__extract_doy
- , subq_9.booking__ds__day AS booking__ds__day
- , subq_9.booking__ds__week AS booking__ds__week
- , subq_9.booking__ds__month AS booking__ds__month
- , subq_9.booking__ds__quarter AS booking__ds__quarter
- , subq_9.booking__ds__year AS booking__ds__year
- , subq_9.booking__ds__extract_year AS booking__ds__extract_year
- , subq_9.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_9.booking__ds__extract_month AS booking__ds__extract_month
- , subq_9.booking__ds__extract_day AS booking__ds__extract_day
- , subq_9.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_9.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_9.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_9.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_9.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_9.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_9.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_9.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_9.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_9.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_9.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_9.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_9.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_9.booking__paid_at__day AS booking__paid_at__day
- , subq_9.booking__paid_at__week AS booking__paid_at__week
- , subq_9.booking__paid_at__month AS booking__paid_at__month
- , subq_9.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_9.booking__paid_at__year AS booking__paid_at__year
- , subq_9.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_9.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_9.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_9.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_9.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_9.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_9.listing AS listing
- , subq_9.guest AS guest
- , subq_9.host AS host
- , subq_9.booking__listing AS booking__listing
- , subq_9.booking__guest AS booking__guest
- , subq_9.booking__host AS booking__host
- , subq_9.is_instant AS is_instant
- , subq_9.booking__is_instant AS booking__is_instant
- , subq_9.bookings AS bookings
- , subq_9.instant_bookings AS instant_bookings
- , subq_9.booking_value AS booking_value
- , subq_9.max_booking_value AS max_booking_value
- , subq_9.min_booking_value AS min_booking_value
- , subq_9.bookers AS bookers
- , subq_9.average_booking_value AS average_booking_value
- , subq_9.referred_bookings AS referred_bookings
- , subq_9.median_booking_value AS median_booking_value
- , subq_9.booking_value_p99 AS booking_value_p99
- , subq_9.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_9.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_9.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ subq_19.metric_time__day AS metric_time__day
+ , subq_18.ds__day AS ds__day
+ , subq_18.ds__week AS ds__week
+ , subq_18.ds__month AS ds__month
+ , subq_18.ds__quarter AS ds__quarter
+ , subq_18.ds__year AS ds__year
+ , subq_18.ds__extract_year AS ds__extract_year
+ , subq_18.ds__extract_quarter AS ds__extract_quarter
+ , subq_18.ds__extract_month AS ds__extract_month
+ , subq_18.ds__extract_day AS ds__extract_day
+ , subq_18.ds__extract_dow AS ds__extract_dow
+ , subq_18.ds__extract_doy AS ds__extract_doy
+ , subq_18.ds_partitioned__day AS ds_partitioned__day
+ , subq_18.ds_partitioned__week AS ds_partitioned__week
+ , subq_18.ds_partitioned__month AS ds_partitioned__month
+ , subq_18.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_18.ds_partitioned__year AS ds_partitioned__year
+ , subq_18.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_18.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_18.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_18.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_18.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_18.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_18.paid_at__day AS paid_at__day
+ , subq_18.paid_at__week AS paid_at__week
+ , subq_18.paid_at__month AS paid_at__month
+ , subq_18.paid_at__quarter AS paid_at__quarter
+ , subq_18.paid_at__year AS paid_at__year
+ , subq_18.paid_at__extract_year AS paid_at__extract_year
+ , subq_18.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_18.paid_at__extract_month AS paid_at__extract_month
+ , subq_18.paid_at__extract_day AS paid_at__extract_day
+ , subq_18.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_18.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_18.booking__ds__day AS booking__ds__day
+ , subq_18.booking__ds__week AS booking__ds__week
+ , subq_18.booking__ds__month AS booking__ds__month
+ , subq_18.booking__ds__quarter AS booking__ds__quarter
+ , subq_18.booking__ds__year AS booking__ds__year
+ , subq_18.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_18.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_18.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_18.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_18.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_18.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_18.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_18.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_18.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_18.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_18.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_18.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_18.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_18.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_18.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_18.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_18.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_18.booking__paid_at__day AS booking__paid_at__day
+ , subq_18.booking__paid_at__week AS booking__paid_at__week
+ , subq_18.booking__paid_at__month AS booking__paid_at__month
+ , subq_18.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_18.booking__paid_at__year AS booking__paid_at__year
+ , subq_18.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_18.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_18.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_18.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_18.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_18.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_18.listing AS listing
+ , subq_18.guest AS guest
+ , subq_18.host AS host
+ , subq_18.booking__listing AS booking__listing
+ , subq_18.booking__guest AS booking__guest
+ , subq_18.booking__host AS booking__host
+ , subq_18.is_instant AS is_instant
+ , subq_18.booking__is_instant AS booking__is_instant
+ , subq_18.bookings AS bookings
+ , subq_18.instant_bookings AS instant_bookings
+ , subq_18.booking_value AS booking_value
+ , subq_18.max_booking_value AS max_booking_value
+ , subq_18.min_booking_value AS min_booking_value
+ , subq_18.bookers AS bookers
+ , subq_18.average_booking_value AS average_booking_value
+ , subq_18.referred_bookings AS referred_bookings
+ , subq_18.median_booking_value AS median_booking_value
+ , subq_18.booking_value_p99 AS booking_value_p99
+ , subq_18.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_18.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_18.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_11.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_11
- ) subq_10
+ subq_20.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_20
+ ) subq_19
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_8.ds__day
- , subq_8.ds__week
- , subq_8.ds__month
- , subq_8.ds__quarter
- , subq_8.ds__year
- , subq_8.ds__extract_year
- , subq_8.ds__extract_quarter
- , subq_8.ds__extract_month
- , subq_8.ds__extract_day
- , subq_8.ds__extract_dow
- , subq_8.ds__extract_doy
- , subq_8.ds_partitioned__day
- , subq_8.ds_partitioned__week
- , subq_8.ds_partitioned__month
- , subq_8.ds_partitioned__quarter
- , subq_8.ds_partitioned__year
- , subq_8.ds_partitioned__extract_year
- , subq_8.ds_partitioned__extract_quarter
- , subq_8.ds_partitioned__extract_month
- , subq_8.ds_partitioned__extract_day
- , subq_8.ds_partitioned__extract_dow
- , subq_8.ds_partitioned__extract_doy
- , subq_8.paid_at__day
- , subq_8.paid_at__week
- , subq_8.paid_at__month
- , subq_8.paid_at__quarter
- , subq_8.paid_at__year
- , subq_8.paid_at__extract_year
- , subq_8.paid_at__extract_quarter
- , subq_8.paid_at__extract_month
- , subq_8.paid_at__extract_day
- , subq_8.paid_at__extract_dow
- , subq_8.paid_at__extract_doy
- , subq_8.booking__ds__day
- , subq_8.booking__ds__week
- , subq_8.booking__ds__month
- , subq_8.booking__ds__quarter
- , subq_8.booking__ds__year
- , subq_8.booking__ds__extract_year
- , subq_8.booking__ds__extract_quarter
- , subq_8.booking__ds__extract_month
- , subq_8.booking__ds__extract_day
- , subq_8.booking__ds__extract_dow
- , subq_8.booking__ds__extract_doy
- , subq_8.booking__ds_partitioned__day
- , subq_8.booking__ds_partitioned__week
- , subq_8.booking__ds_partitioned__month
- , subq_8.booking__ds_partitioned__quarter
- , subq_8.booking__ds_partitioned__year
- , subq_8.booking__ds_partitioned__extract_year
- , subq_8.booking__ds_partitioned__extract_quarter
- , subq_8.booking__ds_partitioned__extract_month
- , subq_8.booking__ds_partitioned__extract_day
- , subq_8.booking__ds_partitioned__extract_dow
- , subq_8.booking__ds_partitioned__extract_doy
- , subq_8.booking__paid_at__day
- , subq_8.booking__paid_at__week
- , subq_8.booking__paid_at__month
- , subq_8.booking__paid_at__quarter
- , subq_8.booking__paid_at__year
- , subq_8.booking__paid_at__extract_year
- , subq_8.booking__paid_at__extract_quarter
- , subq_8.booking__paid_at__extract_month
- , subq_8.booking__paid_at__extract_day
- , subq_8.booking__paid_at__extract_dow
- , subq_8.booking__paid_at__extract_doy
- , subq_8.ds__day AS metric_time__day
- , subq_8.ds__week AS metric_time__week
- , subq_8.ds__month AS metric_time__month
- , subq_8.ds__quarter AS metric_time__quarter
- , subq_8.ds__year AS metric_time__year
- , subq_8.ds__extract_year AS metric_time__extract_year
- , subq_8.ds__extract_quarter AS metric_time__extract_quarter
- , subq_8.ds__extract_month AS metric_time__extract_month
- , subq_8.ds__extract_day AS metric_time__extract_day
- , subq_8.ds__extract_dow AS metric_time__extract_dow
- , subq_8.ds__extract_doy AS metric_time__extract_doy
- , subq_8.listing
- , subq_8.guest
- , subq_8.host
- , subq_8.booking__listing
- , subq_8.booking__guest
- , subq_8.booking__host
- , subq_8.is_instant
- , subq_8.booking__is_instant
- , subq_8.bookings
- , subq_8.instant_bookings
- , subq_8.booking_value
- , subq_8.max_booking_value
- , subq_8.min_booking_value
- , subq_8.bookers
- , subq_8.average_booking_value
- , subq_8.referred_bookings
- , subq_8.median_booking_value
- , subq_8.booking_value_p99
- , subq_8.discrete_booking_value_p99
- , subq_8.approximate_continuous_booking_value_p99
- , subq_8.approximate_discrete_booking_value_p99
+ subq_17.ds__day
+ , subq_17.ds__week
+ , subq_17.ds__month
+ , subq_17.ds__quarter
+ , subq_17.ds__year
+ , subq_17.ds__extract_year
+ , subq_17.ds__extract_quarter
+ , subq_17.ds__extract_month
+ , subq_17.ds__extract_day
+ , subq_17.ds__extract_dow
+ , subq_17.ds__extract_doy
+ , subq_17.ds_partitioned__day
+ , subq_17.ds_partitioned__week
+ , subq_17.ds_partitioned__month
+ , subq_17.ds_partitioned__quarter
+ , subq_17.ds_partitioned__year
+ , subq_17.ds_partitioned__extract_year
+ , subq_17.ds_partitioned__extract_quarter
+ , subq_17.ds_partitioned__extract_month
+ , subq_17.ds_partitioned__extract_day
+ , subq_17.ds_partitioned__extract_dow
+ , subq_17.ds_partitioned__extract_doy
+ , subq_17.paid_at__day
+ , subq_17.paid_at__week
+ , subq_17.paid_at__month
+ , subq_17.paid_at__quarter
+ , subq_17.paid_at__year
+ , subq_17.paid_at__extract_year
+ , subq_17.paid_at__extract_quarter
+ , subq_17.paid_at__extract_month
+ , subq_17.paid_at__extract_day
+ , subq_17.paid_at__extract_dow
+ , subq_17.paid_at__extract_doy
+ , subq_17.booking__ds__day
+ , subq_17.booking__ds__week
+ , subq_17.booking__ds__month
+ , subq_17.booking__ds__quarter
+ , subq_17.booking__ds__year
+ , subq_17.booking__ds__extract_year
+ , subq_17.booking__ds__extract_quarter
+ , subq_17.booking__ds__extract_month
+ , subq_17.booking__ds__extract_day
+ , subq_17.booking__ds__extract_dow
+ , subq_17.booking__ds__extract_doy
+ , subq_17.booking__ds_partitioned__day
+ , subq_17.booking__ds_partitioned__week
+ , subq_17.booking__ds_partitioned__month
+ , subq_17.booking__ds_partitioned__quarter
+ , subq_17.booking__ds_partitioned__year
+ , subq_17.booking__ds_partitioned__extract_year
+ , subq_17.booking__ds_partitioned__extract_quarter
+ , subq_17.booking__ds_partitioned__extract_month
+ , subq_17.booking__ds_partitioned__extract_day
+ , subq_17.booking__ds_partitioned__extract_dow
+ , subq_17.booking__ds_partitioned__extract_doy
+ , subq_17.booking__paid_at__day
+ , subq_17.booking__paid_at__week
+ , subq_17.booking__paid_at__month
+ , subq_17.booking__paid_at__quarter
+ , subq_17.booking__paid_at__year
+ , subq_17.booking__paid_at__extract_year
+ , subq_17.booking__paid_at__extract_quarter
+ , subq_17.booking__paid_at__extract_month
+ , subq_17.booking__paid_at__extract_day
+ , subq_17.booking__paid_at__extract_dow
+ , subq_17.booking__paid_at__extract_doy
+ , subq_17.ds__day AS metric_time__day
+ , subq_17.ds__week AS metric_time__week
+ , subq_17.ds__month AS metric_time__month
+ , subq_17.ds__quarter AS metric_time__quarter
+ , subq_17.ds__year AS metric_time__year
+ , subq_17.ds__extract_year AS metric_time__extract_year
+ , subq_17.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_17.ds__extract_month AS metric_time__extract_month
+ , subq_17.ds__extract_day AS metric_time__extract_day
+ , subq_17.ds__extract_dow AS metric_time__extract_dow
+ , subq_17.ds__extract_doy AS metric_time__extract_doy
+ , subq_17.listing
+ , subq_17.guest
+ , subq_17.host
+ , subq_17.booking__listing
+ , subq_17.booking__guest
+ , subq_17.booking__host
+ , subq_17.is_instant
+ , subq_17.booking__is_instant
+ , subq_17.bookings
+ , subq_17.instant_bookings
+ , subq_17.booking_value
+ , subq_17.max_booking_value
+ , subq_17.min_booking_value
+ , subq_17.bookers
+ , subq_17.average_booking_value
+ , subq_17.referred_bookings
+ , subq_17.median_booking_value
+ , subq_17.booking_value_p99
+ , subq_17.discrete_booking_value_p99
+ , subq_17.approximate_continuous_booking_value_p99
+ , subq_17.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_8
- ) subq_9
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_17
+ ) subq_18
ON
- DATEADD(month, -1, subq_10.metric_time__day) = subq_9.metric_time__day
- ) subq_12
- ) subq_13
+ DATEADD(month, -1, subq_19.metric_time__day) = subq_18.metric_time__day
+ ) subq_21
+ ) subq_22
GROUP BY
- subq_13.metric_time__day
- ) subq_14
- ) subq_15
+ subq_22.metric_time__day
+ ) subq_23
+ ) subq_24
ON
- subq_7.metric_time__day = subq_15.metric_time__day
+ subq_16.metric_time__day = subq_24.metric_time__day
GROUP BY
- COALESCE(subq_7.metric_time__day, subq_15.metric_time__day)
-) subq_16
+ COALESCE(subq_16.metric_time__day, subq_24.metric_time__day)
+) subq_25
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window_and_offset_to_grain__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window_and_offset_to_grain__plan0_optimized.sql
index 1f8ce4023a..bedc1e94c6 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window_and_offset_to_grain__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window_and_offset_to_grain__plan0_optimized.sql
@@ -5,55 +5,55 @@ SELECT
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_24.metric_time__day, subq_32.metric_time__day) AS metric_time__day
- , MAX(subq_24.month_start_bookings) AS month_start_bookings
- , MAX(subq_32.bookings_1_month_ago) AS bookings_1_month_ago
+ COALESCE(subq_33.metric_time__day, subq_41.metric_time__day) AS metric_time__day
+ , MAX(subq_33.month_start_bookings) AS month_start_bookings
+ , MAX(subq_41.bookings_1_month_ago) AS bookings_1_month_ago
FROM (
-- Join to Time Spine Dataset
-- Pass Only Elements: ['bookings', 'metric_time__day']
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_20.ds AS metric_time__day
- , SUM(subq_18.bookings) AS month_start_bookings
- FROM ***************************.mf_time_spine subq_20
+ subq_29.ds AS metric_time__day
+ , SUM(subq_27.bookings) AS month_start_bookings
+ FROM ***************************.mf_time_spine subq_29
INNER JOIN (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
SELECT
DATE_TRUNC('day', ds) AS metric_time__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_18
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_27
ON
- DATE_TRUNC('month', subq_20.ds) = subq_18.metric_time__day
+ DATE_TRUNC('month', subq_29.ds) = subq_27.metric_time__day
GROUP BY
- subq_20.ds
- ) subq_24
+ subq_29.ds
+ ) subq_33
FULL OUTER JOIN (
-- Join to Time Spine Dataset
-- Pass Only Elements: ['bookings', 'metric_time__day']
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_28.ds AS metric_time__day
- , SUM(subq_26.bookings) AS bookings_1_month_ago
- FROM ***************************.mf_time_spine subq_28
+ subq_37.ds AS metric_time__day
+ , SUM(subq_35.bookings) AS bookings_1_month_ago
+ FROM ***************************.mf_time_spine subq_37
INNER JOIN (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
SELECT
DATE_TRUNC('day', ds) AS metric_time__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_26
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_35
ON
- DATEADD(month, -1, subq_28.ds) = subq_26.metric_time__day
+ DATEADD(month, -1, subq_37.ds) = subq_35.metric_time__day
GROUP BY
- subq_28.ds
- ) subq_32
+ subq_37.ds
+ ) subq_41
ON
- subq_24.metric_time__day = subq_32.metric_time__day
+ subq_33.metric_time__day = subq_41.metric_time__day
GROUP BY
- COALESCE(subq_24.metric_time__day, subq_32.metric_time__day)
-) subq_33
+ COALESCE(subq_33.metric_time__day, subq_41.metric_time__day)
+) subq_42
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql
index aab4084404..c94bf5db54 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql
@@ -1,646 +1,646 @@
-- Compute Metrics via Expressions
SELECT
- subq_16.metric_time__year
+ subq_25.metric_time__year
, month_start_bookings - bookings_1_month_ago AS bookings_month_start_compared_to_1_month_prior
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_7.metric_time__year, subq_15.metric_time__year) AS metric_time__year
- , MAX(subq_7.month_start_bookings) AS month_start_bookings
- , MAX(subq_15.bookings_1_month_ago) AS bookings_1_month_ago
+ COALESCE(subq_16.metric_time__year, subq_24.metric_time__year) AS metric_time__year
+ , MAX(subq_16.month_start_bookings) AS month_start_bookings
+ , MAX(subq_24.bookings_1_month_ago) AS bookings_1_month_ago
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_6.metric_time__year
- , subq_6.bookings AS month_start_bookings
+ subq_15.metric_time__year
+ , subq_15.bookings AS month_start_bookings
FROM (
-- Aggregate Measures
SELECT
- subq_5.metric_time__year
- , SUM(subq_5.bookings) AS bookings
+ subq_14.metric_time__year
+ , SUM(subq_14.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__year']
SELECT
- subq_4.metric_time__year
- , subq_4.bookings
+ subq_13.metric_time__year
+ , subq_13.bookings
FROM (
-- Join to Time Spine Dataset
SELECT
- DATE_TRUNC('year', subq_2.metric_time__day) AS metric_time__year
- , subq_1.ds__day AS ds__day
- , subq_1.ds__week AS ds__week
- , subq_1.ds__month AS ds__month
- , subq_1.ds__quarter AS ds__quarter
- , subq_1.ds__year AS ds__year
- , subq_1.ds__extract_year AS ds__extract_year
- , subq_1.ds__extract_quarter AS ds__extract_quarter
- , subq_1.ds__extract_month AS ds__extract_month
- , subq_1.ds__extract_day AS ds__extract_day
- , subq_1.ds__extract_dow AS ds__extract_dow
- , subq_1.ds__extract_doy AS ds__extract_doy
- , subq_1.ds_partitioned__day AS ds_partitioned__day
- , subq_1.ds_partitioned__week AS ds_partitioned__week
- , subq_1.ds_partitioned__month AS ds_partitioned__month
- , subq_1.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_1.ds_partitioned__year AS ds_partitioned__year
- , subq_1.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_1.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_1.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_1.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_1.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_1.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_1.paid_at__day AS paid_at__day
- , subq_1.paid_at__week AS paid_at__week
- , subq_1.paid_at__month AS paid_at__month
- , subq_1.paid_at__quarter AS paid_at__quarter
- , subq_1.paid_at__year AS paid_at__year
- , subq_1.paid_at__extract_year AS paid_at__extract_year
- , subq_1.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_1.paid_at__extract_month AS paid_at__extract_month
- , subq_1.paid_at__extract_day AS paid_at__extract_day
- , subq_1.paid_at__extract_dow AS paid_at__extract_dow
- , subq_1.paid_at__extract_doy AS paid_at__extract_doy
- , subq_1.booking__ds__day AS booking__ds__day
- , subq_1.booking__ds__week AS booking__ds__week
- , subq_1.booking__ds__month AS booking__ds__month
- , subq_1.booking__ds__quarter AS booking__ds__quarter
- , subq_1.booking__ds__year AS booking__ds__year
- , subq_1.booking__ds__extract_year AS booking__ds__extract_year
- , subq_1.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_1.booking__ds__extract_month AS booking__ds__extract_month
- , subq_1.booking__ds__extract_day AS booking__ds__extract_day
- , subq_1.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_1.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_1.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_1.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_1.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_1.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_1.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_1.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_1.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_1.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_1.booking__paid_at__day AS booking__paid_at__day
- , subq_1.booking__paid_at__week AS booking__paid_at__week
- , subq_1.booking__paid_at__month AS booking__paid_at__month
- , subq_1.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_1.booking__paid_at__year AS booking__paid_at__year
- , subq_1.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_1.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_1.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_1.listing AS listing
- , subq_1.guest AS guest
- , subq_1.host AS host
- , subq_1.booking__listing AS booking__listing
- , subq_1.booking__guest AS booking__guest
- , subq_1.booking__host AS booking__host
- , subq_1.is_instant AS is_instant
- , subq_1.booking__is_instant AS booking__is_instant
- , subq_1.bookings AS bookings
- , subq_1.instant_bookings AS instant_bookings
- , subq_1.booking_value AS booking_value
- , subq_1.max_booking_value AS max_booking_value
- , subq_1.min_booking_value AS min_booking_value
- , subq_1.bookers AS bookers
- , subq_1.average_booking_value AS average_booking_value
- , subq_1.referred_bookings AS referred_bookings
- , subq_1.median_booking_value AS median_booking_value
- , subq_1.booking_value_p99 AS booking_value_p99
- , subq_1.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_1.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_1.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ DATE_TRUNC('year', subq_11.metric_time__day) AS metric_time__year
+ , subq_10.ds__day AS ds__day
+ , subq_10.ds__week AS ds__week
+ , subq_10.ds__month AS ds__month
+ , subq_10.ds__quarter AS ds__quarter
+ , subq_10.ds__year AS ds__year
+ , subq_10.ds__extract_year AS ds__extract_year
+ , subq_10.ds__extract_quarter AS ds__extract_quarter
+ , subq_10.ds__extract_month AS ds__extract_month
+ , subq_10.ds__extract_day AS ds__extract_day
+ , subq_10.ds__extract_dow AS ds__extract_dow
+ , subq_10.ds__extract_doy AS ds__extract_doy
+ , subq_10.ds_partitioned__day AS ds_partitioned__day
+ , subq_10.ds_partitioned__week AS ds_partitioned__week
+ , subq_10.ds_partitioned__month AS ds_partitioned__month
+ , subq_10.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_10.ds_partitioned__year AS ds_partitioned__year
+ , subq_10.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_10.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_10.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_10.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_10.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_10.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_10.paid_at__day AS paid_at__day
+ , subq_10.paid_at__week AS paid_at__week
+ , subq_10.paid_at__month AS paid_at__month
+ , subq_10.paid_at__quarter AS paid_at__quarter
+ , subq_10.paid_at__year AS paid_at__year
+ , subq_10.paid_at__extract_year AS paid_at__extract_year
+ , subq_10.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_10.paid_at__extract_month AS paid_at__extract_month
+ , subq_10.paid_at__extract_day AS paid_at__extract_day
+ , subq_10.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_10.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_10.booking__ds__day AS booking__ds__day
+ , subq_10.booking__ds__week AS booking__ds__week
+ , subq_10.booking__ds__month AS booking__ds__month
+ , subq_10.booking__ds__quarter AS booking__ds__quarter
+ , subq_10.booking__ds__year AS booking__ds__year
+ , subq_10.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_10.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_10.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_10.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_10.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_10.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_10.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_10.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_10.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_10.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_10.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_10.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_10.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_10.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_10.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_10.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_10.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_10.booking__paid_at__day AS booking__paid_at__day
+ , subq_10.booking__paid_at__week AS booking__paid_at__week
+ , subq_10.booking__paid_at__month AS booking__paid_at__month
+ , subq_10.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_10.booking__paid_at__year AS booking__paid_at__year
+ , subq_10.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_10.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_10.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_10.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_10.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_10.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_10.listing AS listing
+ , subq_10.guest AS guest
+ , subq_10.host AS host
+ , subq_10.booking__listing AS booking__listing
+ , subq_10.booking__guest AS booking__guest
+ , subq_10.booking__host AS booking__host
+ , subq_10.is_instant AS is_instant
+ , subq_10.booking__is_instant AS booking__is_instant
+ , subq_10.bookings AS bookings
+ , subq_10.instant_bookings AS instant_bookings
+ , subq_10.booking_value AS booking_value
+ , subq_10.max_booking_value AS max_booking_value
+ , subq_10.min_booking_value AS min_booking_value
+ , subq_10.bookers AS bookers
+ , subq_10.average_booking_value AS average_booking_value
+ , subq_10.referred_bookings AS referred_bookings
+ , subq_10.median_booking_value AS median_booking_value
+ , subq_10.booking_value_p99 AS booking_value_p99
+ , subq_10.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_10.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_10.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_3.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_3
- ) subq_2
+ subq_12.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_12
+ ) subq_11
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
ON
- DATE_TRUNC('month', subq_2.metric_time__day) = subq_1.metric_time__day
- WHERE DATE_TRUNC('year', subq_2.metric_time__day) = subq_2.metric_time__day
- ) subq_4
- ) subq_5
+ DATE_TRUNC('month', subq_11.metric_time__day) = subq_10.metric_time__day
+ WHERE DATE_TRUNC('year', subq_11.metric_time__day) = subq_11.metric_time__day
+ ) subq_13
+ ) subq_14
GROUP BY
- subq_5.metric_time__year
- ) subq_6
- ) subq_7
+ subq_14.metric_time__year
+ ) subq_15
+ ) subq_16
FULL OUTER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_14.metric_time__year
- , subq_14.bookings AS bookings_1_month_ago
+ subq_23.metric_time__year
+ , subq_23.bookings AS bookings_1_month_ago
FROM (
-- Aggregate Measures
SELECT
- subq_13.metric_time__year
- , SUM(subq_13.bookings) AS bookings
+ subq_22.metric_time__year
+ , SUM(subq_22.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__year']
SELECT
- subq_12.metric_time__year
- , subq_12.bookings
+ subq_21.metric_time__year
+ , subq_21.bookings
FROM (
-- Join to Time Spine Dataset
SELECT
- DATE_TRUNC('year', subq_10.metric_time__day) AS metric_time__year
- , subq_9.ds__day AS ds__day
- , subq_9.ds__week AS ds__week
- , subq_9.ds__month AS ds__month
- , subq_9.ds__quarter AS ds__quarter
- , subq_9.ds__year AS ds__year
- , subq_9.ds__extract_year AS ds__extract_year
- , subq_9.ds__extract_quarter AS ds__extract_quarter
- , subq_9.ds__extract_month AS ds__extract_month
- , subq_9.ds__extract_day AS ds__extract_day
- , subq_9.ds__extract_dow AS ds__extract_dow
- , subq_9.ds__extract_doy AS ds__extract_doy
- , subq_9.ds_partitioned__day AS ds_partitioned__day
- , subq_9.ds_partitioned__week AS ds_partitioned__week
- , subq_9.ds_partitioned__month AS ds_partitioned__month
- , subq_9.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_9.ds_partitioned__year AS ds_partitioned__year
- , subq_9.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_9.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_9.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_9.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_9.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_9.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_9.paid_at__day AS paid_at__day
- , subq_9.paid_at__week AS paid_at__week
- , subq_9.paid_at__month AS paid_at__month
- , subq_9.paid_at__quarter AS paid_at__quarter
- , subq_9.paid_at__year AS paid_at__year
- , subq_9.paid_at__extract_year AS paid_at__extract_year
- , subq_9.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_9.paid_at__extract_month AS paid_at__extract_month
- , subq_9.paid_at__extract_day AS paid_at__extract_day
- , subq_9.paid_at__extract_dow AS paid_at__extract_dow
- , subq_9.paid_at__extract_doy AS paid_at__extract_doy
- , subq_9.booking__ds__day AS booking__ds__day
- , subq_9.booking__ds__week AS booking__ds__week
- , subq_9.booking__ds__month AS booking__ds__month
- , subq_9.booking__ds__quarter AS booking__ds__quarter
- , subq_9.booking__ds__year AS booking__ds__year
- , subq_9.booking__ds__extract_year AS booking__ds__extract_year
- , subq_9.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_9.booking__ds__extract_month AS booking__ds__extract_month
- , subq_9.booking__ds__extract_day AS booking__ds__extract_day
- , subq_9.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_9.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_9.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_9.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_9.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_9.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_9.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_9.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_9.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_9.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_9.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_9.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_9.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_9.booking__paid_at__day AS booking__paid_at__day
- , subq_9.booking__paid_at__week AS booking__paid_at__week
- , subq_9.booking__paid_at__month AS booking__paid_at__month
- , subq_9.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_9.booking__paid_at__year AS booking__paid_at__year
- , subq_9.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_9.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_9.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_9.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_9.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_9.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_9.listing AS listing
- , subq_9.guest AS guest
- , subq_9.host AS host
- , subq_9.booking__listing AS booking__listing
- , subq_9.booking__guest AS booking__guest
- , subq_9.booking__host AS booking__host
- , subq_9.is_instant AS is_instant
- , subq_9.booking__is_instant AS booking__is_instant
- , subq_9.bookings AS bookings
- , subq_9.instant_bookings AS instant_bookings
- , subq_9.booking_value AS booking_value
- , subq_9.max_booking_value AS max_booking_value
- , subq_9.min_booking_value AS min_booking_value
- , subq_9.bookers AS bookers
- , subq_9.average_booking_value AS average_booking_value
- , subq_9.referred_bookings AS referred_bookings
- , subq_9.median_booking_value AS median_booking_value
- , subq_9.booking_value_p99 AS booking_value_p99
- , subq_9.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_9.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_9.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ DATE_TRUNC('year', subq_19.metric_time__day) AS metric_time__year
+ , subq_18.ds__day AS ds__day
+ , subq_18.ds__week AS ds__week
+ , subq_18.ds__month AS ds__month
+ , subq_18.ds__quarter AS ds__quarter
+ , subq_18.ds__year AS ds__year
+ , subq_18.ds__extract_year AS ds__extract_year
+ , subq_18.ds__extract_quarter AS ds__extract_quarter
+ , subq_18.ds__extract_month AS ds__extract_month
+ , subq_18.ds__extract_day AS ds__extract_day
+ , subq_18.ds__extract_dow AS ds__extract_dow
+ , subq_18.ds__extract_doy AS ds__extract_doy
+ , subq_18.ds_partitioned__day AS ds_partitioned__day
+ , subq_18.ds_partitioned__week AS ds_partitioned__week
+ , subq_18.ds_partitioned__month AS ds_partitioned__month
+ , subq_18.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_18.ds_partitioned__year AS ds_partitioned__year
+ , subq_18.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_18.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_18.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_18.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_18.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_18.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_18.paid_at__day AS paid_at__day
+ , subq_18.paid_at__week AS paid_at__week
+ , subq_18.paid_at__month AS paid_at__month
+ , subq_18.paid_at__quarter AS paid_at__quarter
+ , subq_18.paid_at__year AS paid_at__year
+ , subq_18.paid_at__extract_year AS paid_at__extract_year
+ , subq_18.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_18.paid_at__extract_month AS paid_at__extract_month
+ , subq_18.paid_at__extract_day AS paid_at__extract_day
+ , subq_18.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_18.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_18.booking__ds__day AS booking__ds__day
+ , subq_18.booking__ds__week AS booking__ds__week
+ , subq_18.booking__ds__month AS booking__ds__month
+ , subq_18.booking__ds__quarter AS booking__ds__quarter
+ , subq_18.booking__ds__year AS booking__ds__year
+ , subq_18.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_18.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_18.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_18.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_18.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_18.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_18.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_18.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_18.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_18.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_18.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_18.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_18.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_18.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_18.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_18.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_18.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_18.booking__paid_at__day AS booking__paid_at__day
+ , subq_18.booking__paid_at__week AS booking__paid_at__week
+ , subq_18.booking__paid_at__month AS booking__paid_at__month
+ , subq_18.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_18.booking__paid_at__year AS booking__paid_at__year
+ , subq_18.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_18.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_18.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_18.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_18.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_18.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_18.listing AS listing
+ , subq_18.guest AS guest
+ , subq_18.host AS host
+ , subq_18.booking__listing AS booking__listing
+ , subq_18.booking__guest AS booking__guest
+ , subq_18.booking__host AS booking__host
+ , subq_18.is_instant AS is_instant
+ , subq_18.booking__is_instant AS booking__is_instant
+ , subq_18.bookings AS bookings
+ , subq_18.instant_bookings AS instant_bookings
+ , subq_18.booking_value AS booking_value
+ , subq_18.max_booking_value AS max_booking_value
+ , subq_18.min_booking_value AS min_booking_value
+ , subq_18.bookers AS bookers
+ , subq_18.average_booking_value AS average_booking_value
+ , subq_18.referred_bookings AS referred_bookings
+ , subq_18.median_booking_value AS median_booking_value
+ , subq_18.booking_value_p99 AS booking_value_p99
+ , subq_18.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_18.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_18.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_11.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_11
- ) subq_10
+ subq_20.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_20
+ ) subq_19
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_8.ds__day
- , subq_8.ds__week
- , subq_8.ds__month
- , subq_8.ds__quarter
- , subq_8.ds__year
- , subq_8.ds__extract_year
- , subq_8.ds__extract_quarter
- , subq_8.ds__extract_month
- , subq_8.ds__extract_day
- , subq_8.ds__extract_dow
- , subq_8.ds__extract_doy
- , subq_8.ds_partitioned__day
- , subq_8.ds_partitioned__week
- , subq_8.ds_partitioned__month
- , subq_8.ds_partitioned__quarter
- , subq_8.ds_partitioned__year
- , subq_8.ds_partitioned__extract_year
- , subq_8.ds_partitioned__extract_quarter
- , subq_8.ds_partitioned__extract_month
- , subq_8.ds_partitioned__extract_day
- , subq_8.ds_partitioned__extract_dow
- , subq_8.ds_partitioned__extract_doy
- , subq_8.paid_at__day
- , subq_8.paid_at__week
- , subq_8.paid_at__month
- , subq_8.paid_at__quarter
- , subq_8.paid_at__year
- , subq_8.paid_at__extract_year
- , subq_8.paid_at__extract_quarter
- , subq_8.paid_at__extract_month
- , subq_8.paid_at__extract_day
- , subq_8.paid_at__extract_dow
- , subq_8.paid_at__extract_doy
- , subq_8.booking__ds__day
- , subq_8.booking__ds__week
- , subq_8.booking__ds__month
- , subq_8.booking__ds__quarter
- , subq_8.booking__ds__year
- , subq_8.booking__ds__extract_year
- , subq_8.booking__ds__extract_quarter
- , subq_8.booking__ds__extract_month
- , subq_8.booking__ds__extract_day
- , subq_8.booking__ds__extract_dow
- , subq_8.booking__ds__extract_doy
- , subq_8.booking__ds_partitioned__day
- , subq_8.booking__ds_partitioned__week
- , subq_8.booking__ds_partitioned__month
- , subq_8.booking__ds_partitioned__quarter
- , subq_8.booking__ds_partitioned__year
- , subq_8.booking__ds_partitioned__extract_year
- , subq_8.booking__ds_partitioned__extract_quarter
- , subq_8.booking__ds_partitioned__extract_month
- , subq_8.booking__ds_partitioned__extract_day
- , subq_8.booking__ds_partitioned__extract_dow
- , subq_8.booking__ds_partitioned__extract_doy
- , subq_8.booking__paid_at__day
- , subq_8.booking__paid_at__week
- , subq_8.booking__paid_at__month
- , subq_8.booking__paid_at__quarter
- , subq_8.booking__paid_at__year
- , subq_8.booking__paid_at__extract_year
- , subq_8.booking__paid_at__extract_quarter
- , subq_8.booking__paid_at__extract_month
- , subq_8.booking__paid_at__extract_day
- , subq_8.booking__paid_at__extract_dow
- , subq_8.booking__paid_at__extract_doy
- , subq_8.ds__day AS metric_time__day
- , subq_8.ds__week AS metric_time__week
- , subq_8.ds__month AS metric_time__month
- , subq_8.ds__quarter AS metric_time__quarter
- , subq_8.ds__year AS metric_time__year
- , subq_8.ds__extract_year AS metric_time__extract_year
- , subq_8.ds__extract_quarter AS metric_time__extract_quarter
- , subq_8.ds__extract_month AS metric_time__extract_month
- , subq_8.ds__extract_day AS metric_time__extract_day
- , subq_8.ds__extract_dow AS metric_time__extract_dow
- , subq_8.ds__extract_doy AS metric_time__extract_doy
- , subq_8.listing
- , subq_8.guest
- , subq_8.host
- , subq_8.booking__listing
- , subq_8.booking__guest
- , subq_8.booking__host
- , subq_8.is_instant
- , subq_8.booking__is_instant
- , subq_8.bookings
- , subq_8.instant_bookings
- , subq_8.booking_value
- , subq_8.max_booking_value
- , subq_8.min_booking_value
- , subq_8.bookers
- , subq_8.average_booking_value
- , subq_8.referred_bookings
- , subq_8.median_booking_value
- , subq_8.booking_value_p99
- , subq_8.discrete_booking_value_p99
- , subq_8.approximate_continuous_booking_value_p99
- , subq_8.approximate_discrete_booking_value_p99
+ subq_17.ds__day
+ , subq_17.ds__week
+ , subq_17.ds__month
+ , subq_17.ds__quarter
+ , subq_17.ds__year
+ , subq_17.ds__extract_year
+ , subq_17.ds__extract_quarter
+ , subq_17.ds__extract_month
+ , subq_17.ds__extract_day
+ , subq_17.ds__extract_dow
+ , subq_17.ds__extract_doy
+ , subq_17.ds_partitioned__day
+ , subq_17.ds_partitioned__week
+ , subq_17.ds_partitioned__month
+ , subq_17.ds_partitioned__quarter
+ , subq_17.ds_partitioned__year
+ , subq_17.ds_partitioned__extract_year
+ , subq_17.ds_partitioned__extract_quarter
+ , subq_17.ds_partitioned__extract_month
+ , subq_17.ds_partitioned__extract_day
+ , subq_17.ds_partitioned__extract_dow
+ , subq_17.ds_partitioned__extract_doy
+ , subq_17.paid_at__day
+ , subq_17.paid_at__week
+ , subq_17.paid_at__month
+ , subq_17.paid_at__quarter
+ , subq_17.paid_at__year
+ , subq_17.paid_at__extract_year
+ , subq_17.paid_at__extract_quarter
+ , subq_17.paid_at__extract_month
+ , subq_17.paid_at__extract_day
+ , subq_17.paid_at__extract_dow
+ , subq_17.paid_at__extract_doy
+ , subq_17.booking__ds__day
+ , subq_17.booking__ds__week
+ , subq_17.booking__ds__month
+ , subq_17.booking__ds__quarter
+ , subq_17.booking__ds__year
+ , subq_17.booking__ds__extract_year
+ , subq_17.booking__ds__extract_quarter
+ , subq_17.booking__ds__extract_month
+ , subq_17.booking__ds__extract_day
+ , subq_17.booking__ds__extract_dow
+ , subq_17.booking__ds__extract_doy
+ , subq_17.booking__ds_partitioned__day
+ , subq_17.booking__ds_partitioned__week
+ , subq_17.booking__ds_partitioned__month
+ , subq_17.booking__ds_partitioned__quarter
+ , subq_17.booking__ds_partitioned__year
+ , subq_17.booking__ds_partitioned__extract_year
+ , subq_17.booking__ds_partitioned__extract_quarter
+ , subq_17.booking__ds_partitioned__extract_month
+ , subq_17.booking__ds_partitioned__extract_day
+ , subq_17.booking__ds_partitioned__extract_dow
+ , subq_17.booking__ds_partitioned__extract_doy
+ , subq_17.booking__paid_at__day
+ , subq_17.booking__paid_at__week
+ , subq_17.booking__paid_at__month
+ , subq_17.booking__paid_at__quarter
+ , subq_17.booking__paid_at__year
+ , subq_17.booking__paid_at__extract_year
+ , subq_17.booking__paid_at__extract_quarter
+ , subq_17.booking__paid_at__extract_month
+ , subq_17.booking__paid_at__extract_day
+ , subq_17.booking__paid_at__extract_dow
+ , subq_17.booking__paid_at__extract_doy
+ , subq_17.ds__day AS metric_time__day
+ , subq_17.ds__week AS metric_time__week
+ , subq_17.ds__month AS metric_time__month
+ , subq_17.ds__quarter AS metric_time__quarter
+ , subq_17.ds__year AS metric_time__year
+ , subq_17.ds__extract_year AS metric_time__extract_year
+ , subq_17.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_17.ds__extract_month AS metric_time__extract_month
+ , subq_17.ds__extract_day AS metric_time__extract_day
+ , subq_17.ds__extract_dow AS metric_time__extract_dow
+ , subq_17.ds__extract_doy AS metric_time__extract_doy
+ , subq_17.listing
+ , subq_17.guest
+ , subq_17.host
+ , subq_17.booking__listing
+ , subq_17.booking__guest
+ , subq_17.booking__host
+ , subq_17.is_instant
+ , subq_17.booking__is_instant
+ , subq_17.bookings
+ , subq_17.instant_bookings
+ , subq_17.booking_value
+ , subq_17.max_booking_value
+ , subq_17.min_booking_value
+ , subq_17.bookers
+ , subq_17.average_booking_value
+ , subq_17.referred_bookings
+ , subq_17.median_booking_value
+ , subq_17.booking_value_p99
+ , subq_17.discrete_booking_value_p99
+ , subq_17.approximate_continuous_booking_value_p99
+ , subq_17.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_8
- ) subq_9
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_17
+ ) subq_18
ON
- DATEADD(month, -1, subq_10.metric_time__day) = subq_9.metric_time__day
- ) subq_12
- ) subq_13
+ DATEADD(month, -1, subq_19.metric_time__day) = subq_18.metric_time__day
+ ) subq_21
+ ) subq_22
GROUP BY
- subq_13.metric_time__year
- ) subq_14
- ) subq_15
+ subq_22.metric_time__year
+ ) subq_23
+ ) subq_24
ON
- subq_7.metric_time__year = subq_15.metric_time__year
+ subq_16.metric_time__year = subq_24.metric_time__year
GROUP BY
- COALESCE(subq_7.metric_time__year, subq_15.metric_time__year)
-) subq_16
+ COALESCE(subq_16.metric_time__year, subq_24.metric_time__year)
+) subq_25
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0_optimized.sql
index 6df1bd72d2..3b62cf5d4b 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0_optimized.sql
@@ -5,56 +5,56 @@ SELECT
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_24.metric_time__year, subq_32.metric_time__year) AS metric_time__year
- , MAX(subq_24.month_start_bookings) AS month_start_bookings
- , MAX(subq_32.bookings_1_month_ago) AS bookings_1_month_ago
+ COALESCE(subq_33.metric_time__year, subq_41.metric_time__year) AS metric_time__year
+ , MAX(subq_33.month_start_bookings) AS month_start_bookings
+ , MAX(subq_41.bookings_1_month_ago) AS bookings_1_month_ago
FROM (
-- Join to Time Spine Dataset
-- Pass Only Elements: ['bookings', 'metric_time__year']
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- DATE_TRUNC('year', subq_20.ds) AS metric_time__year
- , SUM(subq_18.bookings) AS month_start_bookings
- FROM ***************************.mf_time_spine subq_20
+ DATE_TRUNC('year', subq_29.ds) AS metric_time__year
+ , SUM(subq_27.bookings) AS month_start_bookings
+ FROM ***************************.mf_time_spine subq_29
INNER JOIN (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
SELECT
DATE_TRUNC('day', ds) AS metric_time__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_18
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_27
ON
- DATE_TRUNC('month', subq_20.ds) = subq_18.metric_time__day
- WHERE DATE_TRUNC('year', subq_20.ds) = subq_20.ds
+ DATE_TRUNC('month', subq_29.ds) = subq_27.metric_time__day
+ WHERE DATE_TRUNC('year', subq_29.ds) = subq_29.ds
GROUP BY
- DATE_TRUNC('year', subq_20.ds)
- ) subq_24
+ DATE_TRUNC('year', subq_29.ds)
+ ) subq_33
FULL OUTER JOIN (
-- Join to Time Spine Dataset
-- Pass Only Elements: ['bookings', 'metric_time__year']
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- DATE_TRUNC('year', subq_28.ds) AS metric_time__year
- , SUM(subq_26.bookings) AS bookings_1_month_ago
- FROM ***************************.mf_time_spine subq_28
+ DATE_TRUNC('year', subq_37.ds) AS metric_time__year
+ , SUM(subq_35.bookings) AS bookings_1_month_ago
+ FROM ***************************.mf_time_spine subq_37
INNER JOIN (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
SELECT
DATE_TRUNC('day', ds) AS metric_time__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_26
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_35
ON
- DATEADD(month, -1, subq_28.ds) = subq_26.metric_time__day
+ DATEADD(month, -1, subq_37.ds) = subq_35.metric_time__day
GROUP BY
- DATE_TRUNC('year', subq_28.ds)
- ) subq_32
+ DATE_TRUNC('year', subq_37.ds)
+ ) subq_41
ON
- subq_24.metric_time__year = subq_32.metric_time__year
+ subq_33.metric_time__year = subq_41.metric_time__year
GROUP BY
- COALESCE(subq_24.metric_time__year, subq_32.metric_time__year)
-) subq_33
+ COALESCE(subq_33.metric_time__year, subq_41.metric_time__year)
+) subq_42
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window_and_time_filter__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window_and_time_filter__plan0.sql
index 45894aea50..cd9c9ad6b4 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window_and_time_filter__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window_and_time_filter__plan0.sql
@@ -1,559 +1,559 @@
-- Compute Metrics via Expressions
SELECT
- subq_15.metric_time__day
+ subq_24.metric_time__day
, bookings - bookings_2_weeks_ago AS bookings_growth_2_weeks
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_5.metric_time__day, subq_14.metric_time__day) AS metric_time__day
- , MAX(subq_5.bookings) AS bookings
- , MAX(subq_14.bookings_2_weeks_ago) AS bookings_2_weeks_ago
+ COALESCE(subq_14.metric_time__day, subq_23.metric_time__day) AS metric_time__day
+ , MAX(subq_14.bookings) AS bookings
+ , MAX(subq_23.bookings_2_weeks_ago) AS bookings_2_weeks_ago
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_4.metric_time__day
- , subq_4.bookings
+ subq_13.metric_time__day
+ , subq_13.bookings
FROM (
-- Aggregate Measures
SELECT
- subq_3.metric_time__day
- , SUM(subq_3.bookings) AS bookings
+ subq_12.metric_time__day
+ , SUM(subq_12.bookings) AS bookings
FROM (
-- Constrain Output with WHERE
SELECT
- subq_2.metric_time__day
- , subq_2.bookings
+ subq_11.metric_time__day
+ , subq_11.bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__day']
SELECT
- subq_1.metric_time__day
- , subq_1.bookings
+ subq_10.metric_time__day
+ , subq_10.bookings
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
- ) subq_2
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
WHERE metric_time__day = '2020-01-01' or metric_time__day = '2020-01-14'
- ) subq_3
+ ) subq_12
GROUP BY
- subq_3.metric_time__day
- ) subq_4
- ) subq_5
+ subq_12.metric_time__day
+ ) subq_13
+ ) subq_14
FULL OUTER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_13.metric_time__day
- , subq_13.bookings AS bookings_2_weeks_ago
+ subq_22.metric_time__day
+ , subq_22.bookings AS bookings_2_weeks_ago
FROM (
-- Aggregate Measures
SELECT
- subq_12.metric_time__day
- , SUM(subq_12.bookings) AS bookings
+ subq_21.metric_time__day
+ , SUM(subq_21.bookings) AS bookings
FROM (
-- Constrain Output with WHERE
SELECT
- subq_11.metric_time__day
- , subq_11.bookings
+ subq_20.metric_time__day
+ , subq_20.bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__day']
SELECT
- subq_10.metric_time__day
- , subq_10.bookings
+ subq_19.metric_time__day
+ , subq_19.bookings
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_8.metric_time__day AS metric_time__day
- , subq_7.ds__day AS ds__day
- , subq_7.ds__week AS ds__week
- , subq_7.ds__month AS ds__month
- , subq_7.ds__quarter AS ds__quarter
- , subq_7.ds__year AS ds__year
- , subq_7.ds__extract_year AS ds__extract_year
- , subq_7.ds__extract_quarter AS ds__extract_quarter
- , subq_7.ds__extract_month AS ds__extract_month
- , subq_7.ds__extract_day AS ds__extract_day
- , subq_7.ds__extract_dow AS ds__extract_dow
- , subq_7.ds__extract_doy AS ds__extract_doy
- , subq_7.ds_partitioned__day AS ds_partitioned__day
- , subq_7.ds_partitioned__week AS ds_partitioned__week
- , subq_7.ds_partitioned__month AS ds_partitioned__month
- , subq_7.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_7.ds_partitioned__year AS ds_partitioned__year
- , subq_7.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_7.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_7.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_7.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_7.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_7.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_7.paid_at__day AS paid_at__day
- , subq_7.paid_at__week AS paid_at__week
- , subq_7.paid_at__month AS paid_at__month
- , subq_7.paid_at__quarter AS paid_at__quarter
- , subq_7.paid_at__year AS paid_at__year
- , subq_7.paid_at__extract_year AS paid_at__extract_year
- , subq_7.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_7.paid_at__extract_month AS paid_at__extract_month
- , subq_7.paid_at__extract_day AS paid_at__extract_day
- , subq_7.paid_at__extract_dow AS paid_at__extract_dow
- , subq_7.paid_at__extract_doy AS paid_at__extract_doy
- , subq_7.booking__ds__day AS booking__ds__day
- , subq_7.booking__ds__week AS booking__ds__week
- , subq_7.booking__ds__month AS booking__ds__month
- , subq_7.booking__ds__quarter AS booking__ds__quarter
- , subq_7.booking__ds__year AS booking__ds__year
- , subq_7.booking__ds__extract_year AS booking__ds__extract_year
- , subq_7.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_7.booking__ds__extract_month AS booking__ds__extract_month
- , subq_7.booking__ds__extract_day AS booking__ds__extract_day
- , subq_7.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_7.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_7.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_7.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_7.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_7.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_7.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_7.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_7.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_7.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_7.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_7.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_7.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_7.booking__paid_at__day AS booking__paid_at__day
- , subq_7.booking__paid_at__week AS booking__paid_at__week
- , subq_7.booking__paid_at__month AS booking__paid_at__month
- , subq_7.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_7.booking__paid_at__year AS booking__paid_at__year
- , subq_7.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_7.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_7.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_7.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_7.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_7.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_7.listing AS listing
- , subq_7.guest AS guest
- , subq_7.host AS host
- , subq_7.booking__listing AS booking__listing
- , subq_7.booking__guest AS booking__guest
- , subq_7.booking__host AS booking__host
- , subq_7.is_instant AS is_instant
- , subq_7.booking__is_instant AS booking__is_instant
- , subq_7.bookings AS bookings
- , subq_7.instant_bookings AS instant_bookings
- , subq_7.booking_value AS booking_value
- , subq_7.max_booking_value AS max_booking_value
- , subq_7.min_booking_value AS min_booking_value
- , subq_7.bookers AS bookers
- , subq_7.average_booking_value AS average_booking_value
- , subq_7.referred_bookings AS referred_bookings
- , subq_7.median_booking_value AS median_booking_value
- , subq_7.booking_value_p99 AS booking_value_p99
- , subq_7.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_7.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_7.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ subq_17.metric_time__day AS metric_time__day
+ , subq_16.ds__day AS ds__day
+ , subq_16.ds__week AS ds__week
+ , subq_16.ds__month AS ds__month
+ , subq_16.ds__quarter AS ds__quarter
+ , subq_16.ds__year AS ds__year
+ , subq_16.ds__extract_year AS ds__extract_year
+ , subq_16.ds__extract_quarter AS ds__extract_quarter
+ , subq_16.ds__extract_month AS ds__extract_month
+ , subq_16.ds__extract_day AS ds__extract_day
+ , subq_16.ds__extract_dow AS ds__extract_dow
+ , subq_16.ds__extract_doy AS ds__extract_doy
+ , subq_16.ds_partitioned__day AS ds_partitioned__day
+ , subq_16.ds_partitioned__week AS ds_partitioned__week
+ , subq_16.ds_partitioned__month AS ds_partitioned__month
+ , subq_16.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_16.ds_partitioned__year AS ds_partitioned__year
+ , subq_16.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_16.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_16.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_16.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_16.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_16.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_16.paid_at__day AS paid_at__day
+ , subq_16.paid_at__week AS paid_at__week
+ , subq_16.paid_at__month AS paid_at__month
+ , subq_16.paid_at__quarter AS paid_at__quarter
+ , subq_16.paid_at__year AS paid_at__year
+ , subq_16.paid_at__extract_year AS paid_at__extract_year
+ , subq_16.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_16.paid_at__extract_month AS paid_at__extract_month
+ , subq_16.paid_at__extract_day AS paid_at__extract_day
+ , subq_16.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_16.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_16.booking__ds__day AS booking__ds__day
+ , subq_16.booking__ds__week AS booking__ds__week
+ , subq_16.booking__ds__month AS booking__ds__month
+ , subq_16.booking__ds__quarter AS booking__ds__quarter
+ , subq_16.booking__ds__year AS booking__ds__year
+ , subq_16.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_16.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_16.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_16.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_16.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_16.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_16.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_16.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_16.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_16.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_16.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_16.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_16.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_16.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_16.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_16.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_16.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_16.booking__paid_at__day AS booking__paid_at__day
+ , subq_16.booking__paid_at__week AS booking__paid_at__week
+ , subq_16.booking__paid_at__month AS booking__paid_at__month
+ , subq_16.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_16.booking__paid_at__year AS booking__paid_at__year
+ , subq_16.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_16.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_16.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_16.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_16.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_16.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_16.listing AS listing
+ , subq_16.guest AS guest
+ , subq_16.host AS host
+ , subq_16.booking__listing AS booking__listing
+ , subq_16.booking__guest AS booking__guest
+ , subq_16.booking__host AS booking__host
+ , subq_16.is_instant AS is_instant
+ , subq_16.booking__is_instant AS booking__is_instant
+ , subq_16.bookings AS bookings
+ , subq_16.instant_bookings AS instant_bookings
+ , subq_16.booking_value AS booking_value
+ , subq_16.max_booking_value AS max_booking_value
+ , subq_16.min_booking_value AS min_booking_value
+ , subq_16.bookers AS bookers
+ , subq_16.average_booking_value AS average_booking_value
+ , subq_16.referred_bookings AS referred_bookings
+ , subq_16.median_booking_value AS median_booking_value
+ , subq_16.booking_value_p99 AS booking_value_p99
+ , subq_16.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_16.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_16.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_9.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_9
- ) subq_8
+ subq_18.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_18
+ ) subq_17
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_6.ds__day
- , subq_6.ds__week
- , subq_6.ds__month
- , subq_6.ds__quarter
- , subq_6.ds__year
- , subq_6.ds__extract_year
- , subq_6.ds__extract_quarter
- , subq_6.ds__extract_month
- , subq_6.ds__extract_day
- , subq_6.ds__extract_dow
- , subq_6.ds__extract_doy
- , subq_6.ds_partitioned__day
- , subq_6.ds_partitioned__week
- , subq_6.ds_partitioned__month
- , subq_6.ds_partitioned__quarter
- , subq_6.ds_partitioned__year
- , subq_6.ds_partitioned__extract_year
- , subq_6.ds_partitioned__extract_quarter
- , subq_6.ds_partitioned__extract_month
- , subq_6.ds_partitioned__extract_day
- , subq_6.ds_partitioned__extract_dow
- , subq_6.ds_partitioned__extract_doy
- , subq_6.paid_at__day
- , subq_6.paid_at__week
- , subq_6.paid_at__month
- , subq_6.paid_at__quarter
- , subq_6.paid_at__year
- , subq_6.paid_at__extract_year
- , subq_6.paid_at__extract_quarter
- , subq_6.paid_at__extract_month
- , subq_6.paid_at__extract_day
- , subq_6.paid_at__extract_dow
- , subq_6.paid_at__extract_doy
- , subq_6.booking__ds__day
- , subq_6.booking__ds__week
- , subq_6.booking__ds__month
- , subq_6.booking__ds__quarter
- , subq_6.booking__ds__year
- , subq_6.booking__ds__extract_year
- , subq_6.booking__ds__extract_quarter
- , subq_6.booking__ds__extract_month
- , subq_6.booking__ds__extract_day
- , subq_6.booking__ds__extract_dow
- , subq_6.booking__ds__extract_doy
- , subq_6.booking__ds_partitioned__day
- , subq_6.booking__ds_partitioned__week
- , subq_6.booking__ds_partitioned__month
- , subq_6.booking__ds_partitioned__quarter
- , subq_6.booking__ds_partitioned__year
- , subq_6.booking__ds_partitioned__extract_year
- , subq_6.booking__ds_partitioned__extract_quarter
- , subq_6.booking__ds_partitioned__extract_month
- , subq_6.booking__ds_partitioned__extract_day
- , subq_6.booking__ds_partitioned__extract_dow
- , subq_6.booking__ds_partitioned__extract_doy
- , subq_6.booking__paid_at__day
- , subq_6.booking__paid_at__week
- , subq_6.booking__paid_at__month
- , subq_6.booking__paid_at__quarter
- , subq_6.booking__paid_at__year
- , subq_6.booking__paid_at__extract_year
- , subq_6.booking__paid_at__extract_quarter
- , subq_6.booking__paid_at__extract_month
- , subq_6.booking__paid_at__extract_day
- , subq_6.booking__paid_at__extract_dow
- , subq_6.booking__paid_at__extract_doy
- , subq_6.ds__day AS metric_time__day
- , subq_6.ds__week AS metric_time__week
- , subq_6.ds__month AS metric_time__month
- , subq_6.ds__quarter AS metric_time__quarter
- , subq_6.ds__year AS metric_time__year
- , subq_6.ds__extract_year AS metric_time__extract_year
- , subq_6.ds__extract_quarter AS metric_time__extract_quarter
- , subq_6.ds__extract_month AS metric_time__extract_month
- , subq_6.ds__extract_day AS metric_time__extract_day
- , subq_6.ds__extract_dow AS metric_time__extract_dow
- , subq_6.ds__extract_doy AS metric_time__extract_doy
- , subq_6.listing
- , subq_6.guest
- , subq_6.host
- , subq_6.booking__listing
- , subq_6.booking__guest
- , subq_6.booking__host
- , subq_6.is_instant
- , subq_6.booking__is_instant
- , subq_6.bookings
- , subq_6.instant_bookings
- , subq_6.booking_value
- , subq_6.max_booking_value
- , subq_6.min_booking_value
- , subq_6.bookers
- , subq_6.average_booking_value
- , subq_6.referred_bookings
- , subq_6.median_booking_value
- , subq_6.booking_value_p99
- , subq_6.discrete_booking_value_p99
- , subq_6.approximate_continuous_booking_value_p99
- , subq_6.approximate_discrete_booking_value_p99
+ subq_15.ds__day
+ , subq_15.ds__week
+ , subq_15.ds__month
+ , subq_15.ds__quarter
+ , subq_15.ds__year
+ , subq_15.ds__extract_year
+ , subq_15.ds__extract_quarter
+ , subq_15.ds__extract_month
+ , subq_15.ds__extract_day
+ , subq_15.ds__extract_dow
+ , subq_15.ds__extract_doy
+ , subq_15.ds_partitioned__day
+ , subq_15.ds_partitioned__week
+ , subq_15.ds_partitioned__month
+ , subq_15.ds_partitioned__quarter
+ , subq_15.ds_partitioned__year
+ , subq_15.ds_partitioned__extract_year
+ , subq_15.ds_partitioned__extract_quarter
+ , subq_15.ds_partitioned__extract_month
+ , subq_15.ds_partitioned__extract_day
+ , subq_15.ds_partitioned__extract_dow
+ , subq_15.ds_partitioned__extract_doy
+ , subq_15.paid_at__day
+ , subq_15.paid_at__week
+ , subq_15.paid_at__month
+ , subq_15.paid_at__quarter
+ , subq_15.paid_at__year
+ , subq_15.paid_at__extract_year
+ , subq_15.paid_at__extract_quarter
+ , subq_15.paid_at__extract_month
+ , subq_15.paid_at__extract_day
+ , subq_15.paid_at__extract_dow
+ , subq_15.paid_at__extract_doy
+ , subq_15.booking__ds__day
+ , subq_15.booking__ds__week
+ , subq_15.booking__ds__month
+ , subq_15.booking__ds__quarter
+ , subq_15.booking__ds__year
+ , subq_15.booking__ds__extract_year
+ , subq_15.booking__ds__extract_quarter
+ , subq_15.booking__ds__extract_month
+ , subq_15.booking__ds__extract_day
+ , subq_15.booking__ds__extract_dow
+ , subq_15.booking__ds__extract_doy
+ , subq_15.booking__ds_partitioned__day
+ , subq_15.booking__ds_partitioned__week
+ , subq_15.booking__ds_partitioned__month
+ , subq_15.booking__ds_partitioned__quarter
+ , subq_15.booking__ds_partitioned__year
+ , subq_15.booking__ds_partitioned__extract_year
+ , subq_15.booking__ds_partitioned__extract_quarter
+ , subq_15.booking__ds_partitioned__extract_month
+ , subq_15.booking__ds_partitioned__extract_day
+ , subq_15.booking__ds_partitioned__extract_dow
+ , subq_15.booking__ds_partitioned__extract_doy
+ , subq_15.booking__paid_at__day
+ , subq_15.booking__paid_at__week
+ , subq_15.booking__paid_at__month
+ , subq_15.booking__paid_at__quarter
+ , subq_15.booking__paid_at__year
+ , subq_15.booking__paid_at__extract_year
+ , subq_15.booking__paid_at__extract_quarter
+ , subq_15.booking__paid_at__extract_month
+ , subq_15.booking__paid_at__extract_day
+ , subq_15.booking__paid_at__extract_dow
+ , subq_15.booking__paid_at__extract_doy
+ , subq_15.ds__day AS metric_time__day
+ , subq_15.ds__week AS metric_time__week
+ , subq_15.ds__month AS metric_time__month
+ , subq_15.ds__quarter AS metric_time__quarter
+ , subq_15.ds__year AS metric_time__year
+ , subq_15.ds__extract_year AS metric_time__extract_year
+ , subq_15.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_15.ds__extract_month AS metric_time__extract_month
+ , subq_15.ds__extract_day AS metric_time__extract_day
+ , subq_15.ds__extract_dow AS metric_time__extract_dow
+ , subq_15.ds__extract_doy AS metric_time__extract_doy
+ , subq_15.listing
+ , subq_15.guest
+ , subq_15.host
+ , subq_15.booking__listing
+ , subq_15.booking__guest
+ , subq_15.booking__host
+ , subq_15.is_instant
+ , subq_15.booking__is_instant
+ , subq_15.bookings
+ , subq_15.instant_bookings
+ , subq_15.booking_value
+ , subq_15.max_booking_value
+ , subq_15.min_booking_value
+ , subq_15.bookers
+ , subq_15.average_booking_value
+ , subq_15.referred_bookings
+ , subq_15.median_booking_value
+ , subq_15.booking_value_p99
+ , subq_15.discrete_booking_value_p99
+ , subq_15.approximate_continuous_booking_value_p99
+ , subq_15.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_6
- ) subq_7
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_15
+ ) subq_16
ON
- DATEADD(day, -14, subq_8.metric_time__day) = subq_7.metric_time__day
- ) subq_10
- ) subq_11
+ DATEADD(day, -14, subq_17.metric_time__day) = subq_16.metric_time__day
+ ) subq_19
+ ) subq_20
WHERE metric_time__day = '2020-01-01' or metric_time__day = '2020-01-14'
- ) subq_12
+ ) subq_21
GROUP BY
- subq_12.metric_time__day
- ) subq_13
- ) subq_14
+ subq_21.metric_time__day
+ ) subq_22
+ ) subq_23
ON
- subq_5.metric_time__day = subq_14.metric_time__day
+ subq_14.metric_time__day = subq_23.metric_time__day
GROUP BY
- COALESCE(subq_5.metric_time__day, subq_14.metric_time__day)
-) subq_15
+ COALESCE(subq_14.metric_time__day, subq_23.metric_time__day)
+) subq_24
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window_and_time_filter__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window_and_time_filter__plan0_optimized.sql
index 526089b4ce..e4dc96227a 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window_and_time_filter__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_metric_with_offset_window_and_time_filter__plan0_optimized.sql
@@ -5,9 +5,9 @@ SELECT
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_21.metric_time__day, subq_30.metric_time__day) AS metric_time__day
- , MAX(subq_21.bookings) AS bookings
- , MAX(subq_30.bookings_2_weeks_ago) AS bookings_2_weeks_ago
+ COALESCE(subq_30.metric_time__day, subq_39.metric_time__day) AS metric_time__day
+ , MAX(subq_30.bookings) AS bookings
+ , MAX(subq_39.bookings_2_weeks_ago) AS bookings_2_weeks_ago
FROM (
-- Constrain Output with WHERE
-- Aggregate Measures
@@ -22,12 +22,12 @@ FROM (
SELECT
DATE_TRUNC('day', ds) AS metric_time__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_18
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_27
WHERE metric_time__day = '2020-01-01' or metric_time__day = '2020-01-14'
GROUP BY
metric_time__day
- ) subq_21
+ ) subq_30
FULL OUTER JOIN (
-- Constrain Output with WHERE
-- Aggregate Measures
@@ -39,26 +39,26 @@ FROM (
-- Join to Time Spine Dataset
-- Pass Only Elements: ['bookings', 'metric_time__day']
SELECT
- subq_25.ds AS metric_time__day
- , subq_23.bookings AS bookings
- FROM ***************************.mf_time_spine subq_25
+ subq_34.ds AS metric_time__day
+ , subq_32.bookings AS bookings
+ FROM ***************************.mf_time_spine subq_34
INNER JOIN (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
SELECT
DATE_TRUNC('day', ds) AS metric_time__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_23
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_32
ON
- DATEADD(day, -14, subq_25.ds) = subq_23.metric_time__day
- ) subq_27
+ DATEADD(day, -14, subq_34.ds) = subq_32.metric_time__day
+ ) subq_36
WHERE metric_time__day = '2020-01-01' or metric_time__day = '2020-01-14'
GROUP BY
metric_time__day
- ) subq_30
+ ) subq_39
ON
- subq_21.metric_time__day = subq_30.metric_time__day
+ subq_30.metric_time__day = subq_39.metric_time__day
GROUP BY
- COALESCE(subq_21.metric_time__day, subq_30.metric_time__day)
-) subq_31
+ COALESCE(subq_30.metric_time__day, subq_39.metric_time__day)
+) subq_40
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_offset_cumulative_metric__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_offset_cumulative_metric__plan0.sql
index b1a5656c3f..851a5c1403 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_offset_cumulative_metric__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_offset_cumulative_metric__plan0.sql
@@ -1,433 +1,433 @@
-- Compute Metrics via Expressions
SELECT
- subq_10.metric_time__day
+ subq_19.metric_time__day
, every_2_days_bookers_2_days_ago AS every_2_days_bookers_2_days_ago
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_9.metric_time__day
- , subq_9.bookers AS every_2_days_bookers_2_days_ago
+ subq_18.metric_time__day
+ , subq_18.bookers AS every_2_days_bookers_2_days_ago
FROM (
-- Aggregate Measures
SELECT
- subq_8.metric_time__day
- , COUNT(DISTINCT subq_8.bookers) AS bookers
+ subq_17.metric_time__day
+ , COUNT(DISTINCT subq_17.bookers) AS bookers
FROM (
-- Pass Only Elements: ['bookers', 'metric_time__day']
SELECT
- subq_7.metric_time__day
- , subq_7.bookers
+ subq_16.metric_time__day
+ , subq_16.bookers
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_5.metric_time__day AS metric_time__day
- , subq_4.ds__day AS ds__day
- , subq_4.ds__week AS ds__week
- , subq_4.ds__month AS ds__month
- , subq_4.ds__quarter AS ds__quarter
- , subq_4.ds__year AS ds__year
- , subq_4.ds__extract_year AS ds__extract_year
- , subq_4.ds__extract_quarter AS ds__extract_quarter
- , subq_4.ds__extract_month AS ds__extract_month
- , subq_4.ds__extract_day AS ds__extract_day
- , subq_4.ds__extract_dow AS ds__extract_dow
- , subq_4.ds__extract_doy AS ds__extract_doy
- , subq_4.ds_partitioned__day AS ds_partitioned__day
- , subq_4.ds_partitioned__week AS ds_partitioned__week
- , subq_4.ds_partitioned__month AS ds_partitioned__month
- , subq_4.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_4.ds_partitioned__year AS ds_partitioned__year
- , subq_4.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_4.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_4.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_4.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_4.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_4.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_4.paid_at__day AS paid_at__day
- , subq_4.paid_at__week AS paid_at__week
- , subq_4.paid_at__month AS paid_at__month
- , subq_4.paid_at__quarter AS paid_at__quarter
- , subq_4.paid_at__year AS paid_at__year
- , subq_4.paid_at__extract_year AS paid_at__extract_year
- , subq_4.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_4.paid_at__extract_month AS paid_at__extract_month
- , subq_4.paid_at__extract_day AS paid_at__extract_day
- , subq_4.paid_at__extract_dow AS paid_at__extract_dow
- , subq_4.paid_at__extract_doy AS paid_at__extract_doy
- , subq_4.booking__ds__day AS booking__ds__day
- , subq_4.booking__ds__week AS booking__ds__week
- , subq_4.booking__ds__month AS booking__ds__month
- , subq_4.booking__ds__quarter AS booking__ds__quarter
- , subq_4.booking__ds__year AS booking__ds__year
- , subq_4.booking__ds__extract_year AS booking__ds__extract_year
- , subq_4.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_4.booking__ds__extract_month AS booking__ds__extract_month
- , subq_4.booking__ds__extract_day AS booking__ds__extract_day
- , subq_4.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_4.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_4.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_4.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_4.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_4.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_4.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_4.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_4.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_4.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_4.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_4.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_4.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_4.booking__paid_at__day AS booking__paid_at__day
- , subq_4.booking__paid_at__week AS booking__paid_at__week
- , subq_4.booking__paid_at__month AS booking__paid_at__month
- , subq_4.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_4.booking__paid_at__year AS booking__paid_at__year
- , subq_4.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_4.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_4.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_4.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_4.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_4.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_4.listing AS listing
- , subq_4.guest AS guest
- , subq_4.host AS host
- , subq_4.booking__listing AS booking__listing
- , subq_4.booking__guest AS booking__guest
- , subq_4.booking__host AS booking__host
- , subq_4.is_instant AS is_instant
- , subq_4.booking__is_instant AS booking__is_instant
- , subq_4.bookings AS bookings
- , subq_4.instant_bookings AS instant_bookings
- , subq_4.booking_value AS booking_value
- , subq_4.max_booking_value AS max_booking_value
- , subq_4.min_booking_value AS min_booking_value
- , subq_4.bookers AS bookers
- , subq_4.average_booking_value AS average_booking_value
- , subq_4.referred_bookings AS referred_bookings
- , subq_4.median_booking_value AS median_booking_value
- , subq_4.booking_value_p99 AS booking_value_p99
- , subq_4.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_4.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_4.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ subq_14.metric_time__day AS metric_time__day
+ , subq_13.ds__day AS ds__day
+ , subq_13.ds__week AS ds__week
+ , subq_13.ds__month AS ds__month
+ , subq_13.ds__quarter AS ds__quarter
+ , subq_13.ds__year AS ds__year
+ , subq_13.ds__extract_year AS ds__extract_year
+ , subq_13.ds__extract_quarter AS ds__extract_quarter
+ , subq_13.ds__extract_month AS ds__extract_month
+ , subq_13.ds__extract_day AS ds__extract_day
+ , subq_13.ds__extract_dow AS ds__extract_dow
+ , subq_13.ds__extract_doy AS ds__extract_doy
+ , subq_13.ds_partitioned__day AS ds_partitioned__day
+ , subq_13.ds_partitioned__week AS ds_partitioned__week
+ , subq_13.ds_partitioned__month AS ds_partitioned__month
+ , subq_13.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_13.ds_partitioned__year AS ds_partitioned__year
+ , subq_13.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_13.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_13.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_13.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_13.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_13.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_13.paid_at__day AS paid_at__day
+ , subq_13.paid_at__week AS paid_at__week
+ , subq_13.paid_at__month AS paid_at__month
+ , subq_13.paid_at__quarter AS paid_at__quarter
+ , subq_13.paid_at__year AS paid_at__year
+ , subq_13.paid_at__extract_year AS paid_at__extract_year
+ , subq_13.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_13.paid_at__extract_month AS paid_at__extract_month
+ , subq_13.paid_at__extract_day AS paid_at__extract_day
+ , subq_13.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_13.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_13.booking__ds__day AS booking__ds__day
+ , subq_13.booking__ds__week AS booking__ds__week
+ , subq_13.booking__ds__month AS booking__ds__month
+ , subq_13.booking__ds__quarter AS booking__ds__quarter
+ , subq_13.booking__ds__year AS booking__ds__year
+ , subq_13.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_13.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_13.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_13.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_13.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_13.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_13.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_13.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_13.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_13.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_13.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_13.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_13.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_13.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_13.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_13.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_13.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_13.booking__paid_at__day AS booking__paid_at__day
+ , subq_13.booking__paid_at__week AS booking__paid_at__week
+ , subq_13.booking__paid_at__month AS booking__paid_at__month
+ , subq_13.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_13.booking__paid_at__year AS booking__paid_at__year
+ , subq_13.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_13.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_13.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_13.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_13.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_13.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_13.listing AS listing
+ , subq_13.guest AS guest
+ , subq_13.host AS host
+ , subq_13.booking__listing AS booking__listing
+ , subq_13.booking__guest AS booking__guest
+ , subq_13.booking__host AS booking__host
+ , subq_13.is_instant AS is_instant
+ , subq_13.booking__is_instant AS booking__is_instant
+ , subq_13.bookings AS bookings
+ , subq_13.instant_bookings AS instant_bookings
+ , subq_13.booking_value AS booking_value
+ , subq_13.max_booking_value AS max_booking_value
+ , subq_13.min_booking_value AS min_booking_value
+ , subq_13.bookers AS bookers
+ , subq_13.average_booking_value AS average_booking_value
+ , subq_13.referred_bookings AS referred_bookings
+ , subq_13.median_booking_value AS median_booking_value
+ , subq_13.booking_value_p99 AS booking_value_p99
+ , subq_13.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_13.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_13.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_6.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_6
- ) subq_5
+ subq_15.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_15
+ ) subq_14
INNER JOIN (
-- Join Self Over Time Range
SELECT
- subq_2.metric_time__day AS metric_time__day
- , subq_1.ds__day AS ds__day
- , subq_1.ds__week AS ds__week
- , subq_1.ds__month AS ds__month
- , subq_1.ds__quarter AS ds__quarter
- , subq_1.ds__year AS ds__year
- , subq_1.ds__extract_year AS ds__extract_year
- , subq_1.ds__extract_quarter AS ds__extract_quarter
- , subq_1.ds__extract_month AS ds__extract_month
- , subq_1.ds__extract_day AS ds__extract_day
- , subq_1.ds__extract_dow AS ds__extract_dow
- , subq_1.ds__extract_doy AS ds__extract_doy
- , subq_1.ds_partitioned__day AS ds_partitioned__day
- , subq_1.ds_partitioned__week AS ds_partitioned__week
- , subq_1.ds_partitioned__month AS ds_partitioned__month
- , subq_1.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_1.ds_partitioned__year AS ds_partitioned__year
- , subq_1.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_1.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_1.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_1.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_1.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_1.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_1.paid_at__day AS paid_at__day
- , subq_1.paid_at__week AS paid_at__week
- , subq_1.paid_at__month AS paid_at__month
- , subq_1.paid_at__quarter AS paid_at__quarter
- , subq_1.paid_at__year AS paid_at__year
- , subq_1.paid_at__extract_year AS paid_at__extract_year
- , subq_1.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_1.paid_at__extract_month AS paid_at__extract_month
- , subq_1.paid_at__extract_day AS paid_at__extract_day
- , subq_1.paid_at__extract_dow AS paid_at__extract_dow
- , subq_1.paid_at__extract_doy AS paid_at__extract_doy
- , subq_1.booking__ds__day AS booking__ds__day
- , subq_1.booking__ds__week AS booking__ds__week
- , subq_1.booking__ds__month AS booking__ds__month
- , subq_1.booking__ds__quarter AS booking__ds__quarter
- , subq_1.booking__ds__year AS booking__ds__year
- , subq_1.booking__ds__extract_year AS booking__ds__extract_year
- , subq_1.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_1.booking__ds__extract_month AS booking__ds__extract_month
- , subq_1.booking__ds__extract_day AS booking__ds__extract_day
- , subq_1.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_1.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_1.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_1.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_1.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_1.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_1.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_1.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_1.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_1.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_1.booking__paid_at__day AS booking__paid_at__day
- , subq_1.booking__paid_at__week AS booking__paid_at__week
- , subq_1.booking__paid_at__month AS booking__paid_at__month
- , subq_1.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_1.booking__paid_at__year AS booking__paid_at__year
- , subq_1.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_1.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_1.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_1.metric_time__week AS metric_time__week
- , subq_1.metric_time__month AS metric_time__month
- , subq_1.metric_time__quarter AS metric_time__quarter
- , subq_1.metric_time__year AS metric_time__year
- , subq_1.metric_time__extract_year AS metric_time__extract_year
- , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter
- , subq_1.metric_time__extract_month AS metric_time__extract_month
- , subq_1.metric_time__extract_day AS metric_time__extract_day
- , subq_1.metric_time__extract_dow AS metric_time__extract_dow
- , subq_1.metric_time__extract_doy AS metric_time__extract_doy
- , subq_1.listing AS listing
- , subq_1.guest AS guest
- , subq_1.host AS host
- , subq_1.booking__listing AS booking__listing
- , subq_1.booking__guest AS booking__guest
- , subq_1.booking__host AS booking__host
- , subq_1.is_instant AS is_instant
- , subq_1.booking__is_instant AS booking__is_instant
- , subq_1.bookings AS bookings
- , subq_1.instant_bookings AS instant_bookings
- , subq_1.booking_value AS booking_value
- , subq_1.max_booking_value AS max_booking_value
- , subq_1.min_booking_value AS min_booking_value
- , subq_1.bookers AS bookers
- , subq_1.average_booking_value AS average_booking_value
- , subq_1.referred_bookings AS referred_bookings
- , subq_1.median_booking_value AS median_booking_value
- , subq_1.booking_value_p99 AS booking_value_p99
- , subq_1.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_1.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_1.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ subq_11.metric_time__day AS metric_time__day
+ , subq_10.ds__day AS ds__day
+ , subq_10.ds__week AS ds__week
+ , subq_10.ds__month AS ds__month
+ , subq_10.ds__quarter AS ds__quarter
+ , subq_10.ds__year AS ds__year
+ , subq_10.ds__extract_year AS ds__extract_year
+ , subq_10.ds__extract_quarter AS ds__extract_quarter
+ , subq_10.ds__extract_month AS ds__extract_month
+ , subq_10.ds__extract_day AS ds__extract_day
+ , subq_10.ds__extract_dow AS ds__extract_dow
+ , subq_10.ds__extract_doy AS ds__extract_doy
+ , subq_10.ds_partitioned__day AS ds_partitioned__day
+ , subq_10.ds_partitioned__week AS ds_partitioned__week
+ , subq_10.ds_partitioned__month AS ds_partitioned__month
+ , subq_10.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_10.ds_partitioned__year AS ds_partitioned__year
+ , subq_10.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_10.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_10.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_10.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_10.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_10.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_10.paid_at__day AS paid_at__day
+ , subq_10.paid_at__week AS paid_at__week
+ , subq_10.paid_at__month AS paid_at__month
+ , subq_10.paid_at__quarter AS paid_at__quarter
+ , subq_10.paid_at__year AS paid_at__year
+ , subq_10.paid_at__extract_year AS paid_at__extract_year
+ , subq_10.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_10.paid_at__extract_month AS paid_at__extract_month
+ , subq_10.paid_at__extract_day AS paid_at__extract_day
+ , subq_10.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_10.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_10.booking__ds__day AS booking__ds__day
+ , subq_10.booking__ds__week AS booking__ds__week
+ , subq_10.booking__ds__month AS booking__ds__month
+ , subq_10.booking__ds__quarter AS booking__ds__quarter
+ , subq_10.booking__ds__year AS booking__ds__year
+ , subq_10.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_10.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_10.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_10.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_10.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_10.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_10.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_10.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_10.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_10.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_10.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_10.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_10.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_10.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_10.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_10.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_10.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_10.booking__paid_at__day AS booking__paid_at__day
+ , subq_10.booking__paid_at__week AS booking__paid_at__week
+ , subq_10.booking__paid_at__month AS booking__paid_at__month
+ , subq_10.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_10.booking__paid_at__year AS booking__paid_at__year
+ , subq_10.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_10.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_10.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_10.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_10.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_10.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_10.metric_time__week AS metric_time__week
+ , subq_10.metric_time__month AS metric_time__month
+ , subq_10.metric_time__quarter AS metric_time__quarter
+ , subq_10.metric_time__year AS metric_time__year
+ , subq_10.metric_time__extract_year AS metric_time__extract_year
+ , subq_10.metric_time__extract_quarter AS metric_time__extract_quarter
+ , subq_10.metric_time__extract_month AS metric_time__extract_month
+ , subq_10.metric_time__extract_day AS metric_time__extract_day
+ , subq_10.metric_time__extract_dow AS metric_time__extract_dow
+ , subq_10.metric_time__extract_doy AS metric_time__extract_doy
+ , subq_10.listing AS listing
+ , subq_10.guest AS guest
+ , subq_10.host AS host
+ , subq_10.booking__listing AS booking__listing
+ , subq_10.booking__guest AS booking__guest
+ , subq_10.booking__host AS booking__host
+ , subq_10.is_instant AS is_instant
+ , subq_10.booking__is_instant AS booking__is_instant
+ , subq_10.bookings AS bookings
+ , subq_10.instant_bookings AS instant_bookings
+ , subq_10.booking_value AS booking_value
+ , subq_10.max_booking_value AS max_booking_value
+ , subq_10.min_booking_value AS min_booking_value
+ , subq_10.bookers AS bookers
+ , subq_10.average_booking_value AS average_booking_value
+ , subq_10.referred_bookings AS referred_bookings
+ , subq_10.median_booking_value AS median_booking_value
+ , subq_10.booking_value_p99 AS booking_value_p99
+ , subq_10.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_10.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_10.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_3.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_3
- ) subq_2
+ subq_12.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_12
+ ) subq_11
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
ON
(
- subq_1.metric_time__day <= subq_2.metric_time__day
+ subq_10.metric_time__day <= subq_11.metric_time__day
) AND (
- subq_1.metric_time__day > DATEADD(day, -2, subq_2.metric_time__day)
+ subq_10.metric_time__day > DATEADD(day, -2, subq_11.metric_time__day)
)
- ) subq_4
+ ) subq_13
ON
- DATEADD(day, -2, subq_5.metric_time__day) = subq_4.metric_time__day
- ) subq_7
- ) subq_8
+ DATEADD(day, -2, subq_14.metric_time__day) = subq_13.metric_time__day
+ ) subq_16
+ ) subq_17
GROUP BY
- subq_8.metric_time__day
- ) subq_9
-) subq_10
+ subq_17.metric_time__day
+ ) subq_18
+) subq_19
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_offset_cumulative_metric__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_offset_cumulative_metric__plan0_optimized.sql
index 866ba0a41b..d5e3a9771e 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_offset_cumulative_metric__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_offset_cumulative_metric__plan0_optimized.sql
@@ -8,26 +8,26 @@ FROM (
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_17.ds AS metric_time__day
- , COUNT(DISTINCT subq_15.bookers) AS every_2_days_bookers_2_days_ago
- FROM ***************************.mf_time_spine subq_17
+ subq_26.ds AS metric_time__day
+ , COUNT(DISTINCT subq_24.bookers) AS every_2_days_bookers_2_days_ago
+ FROM ***************************.mf_time_spine subq_26
INNER JOIN (
-- Join Self Over Time Range
SELECT
- subq_14.ds AS metric_time__day
- , bookings_source_src_28001.guest_id AS bookers
- FROM ***************************.mf_time_spine subq_14
+ subq_23.ds AS metric_time__day
+ , bookings_source_src_28000.guest_id AS bookers
+ FROM ***************************.mf_time_spine subq_23
INNER JOIN
- ***************************.fct_bookings bookings_source_src_28001
+ ***************************.fct_bookings bookings_source_src_28000
ON
(
- DATE_TRUNC('day', bookings_source_src_28001.ds) <= subq_14.ds
+ DATE_TRUNC('day', bookings_source_src_28000.ds) <= subq_23.ds
) AND (
- DATE_TRUNC('day', bookings_source_src_28001.ds) > DATEADD(day, -2, subq_14.ds)
+ DATE_TRUNC('day', bookings_source_src_28000.ds) > DATEADD(day, -2, subq_23.ds)
)
- ) subq_15
+ ) subq_24
ON
- DATEADD(day, -2, subq_17.ds) = subq_15.metric_time__day
+ DATEADD(day, -2, subq_26.ds) = subq_24.metric_time__day
GROUP BY
- subq_17.ds
-) subq_21
+ subq_26.ds
+) subq_30
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_offset_metric_with_agg_time_dim__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_offset_metric_with_agg_time_dim__plan0.sql
index 626adce121..25cb9e8e6d 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_offset_metric_with_agg_time_dim__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_offset_metric_with_agg_time_dim__plan0.sql
@@ -1,545 +1,545 @@
-- Compute Metrics via Expressions
SELECT
- subq_13.booking__ds__day
+ subq_22.booking__ds__day
, booking_value * 0.05 / bookers AS booking_fees_last_week_per_booker_this_week
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_7.booking__ds__day, subq_12.booking__ds__day) AS booking__ds__day
- , MAX(subq_7.booking_value) AS booking_value
- , MAX(subq_12.bookers) AS bookers
+ COALESCE(subq_16.booking__ds__day, subq_21.booking__ds__day) AS booking__ds__day
+ , MAX(subq_16.booking_value) AS booking_value
+ , MAX(subq_21.bookers) AS bookers
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_6.booking__ds__day
- , subq_6.booking_value
+ subq_15.booking__ds__day
+ , subq_15.booking_value
FROM (
-- Aggregate Measures
SELECT
- subq_5.booking__ds__day
- , SUM(subq_5.booking_value) AS booking_value
+ subq_14.booking__ds__day
+ , SUM(subq_14.booking_value) AS booking_value
FROM (
-- Pass Only Elements: ['booking_value', 'booking__ds__day']
SELECT
- subq_4.booking__ds__day
- , subq_4.booking_value
+ subq_13.booking__ds__day
+ , subq_13.booking_value
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_2.booking__ds__day AS booking__ds__day
- , subq_1.ds__day AS ds__day
- , subq_1.ds__week AS ds__week
- , subq_1.ds__month AS ds__month
- , subq_1.ds__quarter AS ds__quarter
- , subq_1.ds__year AS ds__year
- , subq_1.ds__extract_year AS ds__extract_year
- , subq_1.ds__extract_quarter AS ds__extract_quarter
- , subq_1.ds__extract_month AS ds__extract_month
- , subq_1.ds__extract_day AS ds__extract_day
- , subq_1.ds__extract_dow AS ds__extract_dow
- , subq_1.ds__extract_doy AS ds__extract_doy
- , subq_1.ds_partitioned__day AS ds_partitioned__day
- , subq_1.ds_partitioned__week AS ds_partitioned__week
- , subq_1.ds_partitioned__month AS ds_partitioned__month
- , subq_1.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_1.ds_partitioned__year AS ds_partitioned__year
- , subq_1.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_1.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_1.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_1.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_1.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_1.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_1.paid_at__day AS paid_at__day
- , subq_1.paid_at__week AS paid_at__week
- , subq_1.paid_at__month AS paid_at__month
- , subq_1.paid_at__quarter AS paid_at__quarter
- , subq_1.paid_at__year AS paid_at__year
- , subq_1.paid_at__extract_year AS paid_at__extract_year
- , subq_1.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_1.paid_at__extract_month AS paid_at__extract_month
- , subq_1.paid_at__extract_day AS paid_at__extract_day
- , subq_1.paid_at__extract_dow AS paid_at__extract_dow
- , subq_1.paid_at__extract_doy AS paid_at__extract_doy
- , subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_1.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_1.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_1.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_1.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_1.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_1.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_1.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_1.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_1.booking__paid_at__day AS booking__paid_at__day
- , subq_1.booking__paid_at__week AS booking__paid_at__week
- , subq_1.booking__paid_at__month AS booking__paid_at__month
- , subq_1.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_1.booking__paid_at__year AS booking__paid_at__year
- , subq_1.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_1.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_1.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_1.metric_time__day AS metric_time__day
- , subq_1.metric_time__week AS metric_time__week
- , subq_1.metric_time__month AS metric_time__month
- , subq_1.metric_time__quarter AS metric_time__quarter
- , subq_1.metric_time__year AS metric_time__year
- , subq_1.metric_time__extract_year AS metric_time__extract_year
- , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter
- , subq_1.metric_time__extract_month AS metric_time__extract_month
- , subq_1.metric_time__extract_day AS metric_time__extract_day
- , subq_1.metric_time__extract_dow AS metric_time__extract_dow
- , subq_1.metric_time__extract_doy AS metric_time__extract_doy
- , subq_1.listing AS listing
- , subq_1.guest AS guest
- , subq_1.host AS host
- , subq_1.booking__listing AS booking__listing
- , subq_1.booking__guest AS booking__guest
- , subq_1.booking__host AS booking__host
- , subq_1.is_instant AS is_instant
- , subq_1.booking__is_instant AS booking__is_instant
- , subq_1.bookings AS bookings
- , subq_1.instant_bookings AS instant_bookings
- , subq_1.booking_value AS booking_value
- , subq_1.max_booking_value AS max_booking_value
- , subq_1.min_booking_value AS min_booking_value
- , subq_1.bookers AS bookers
- , subq_1.average_booking_value AS average_booking_value
- , subq_1.referred_bookings AS referred_bookings
- , subq_1.median_booking_value AS median_booking_value
- , subq_1.booking_value_p99 AS booking_value_p99
- , subq_1.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_1.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_1.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ subq_11.booking__ds__day AS booking__ds__day
+ , subq_10.ds__day AS ds__day
+ , subq_10.ds__week AS ds__week
+ , subq_10.ds__month AS ds__month
+ , subq_10.ds__quarter AS ds__quarter
+ , subq_10.ds__year AS ds__year
+ , subq_10.ds__extract_year AS ds__extract_year
+ , subq_10.ds__extract_quarter AS ds__extract_quarter
+ , subq_10.ds__extract_month AS ds__extract_month
+ , subq_10.ds__extract_day AS ds__extract_day
+ , subq_10.ds__extract_dow AS ds__extract_dow
+ , subq_10.ds__extract_doy AS ds__extract_doy
+ , subq_10.ds_partitioned__day AS ds_partitioned__day
+ , subq_10.ds_partitioned__week AS ds_partitioned__week
+ , subq_10.ds_partitioned__month AS ds_partitioned__month
+ , subq_10.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_10.ds_partitioned__year AS ds_partitioned__year
+ , subq_10.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_10.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_10.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_10.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_10.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_10.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_10.paid_at__day AS paid_at__day
+ , subq_10.paid_at__week AS paid_at__week
+ , subq_10.paid_at__month AS paid_at__month
+ , subq_10.paid_at__quarter AS paid_at__quarter
+ , subq_10.paid_at__year AS paid_at__year
+ , subq_10.paid_at__extract_year AS paid_at__extract_year
+ , subq_10.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_10.paid_at__extract_month AS paid_at__extract_month
+ , subq_10.paid_at__extract_day AS paid_at__extract_day
+ , subq_10.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_10.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_10.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_10.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_10.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_10.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_10.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_10.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_10.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_10.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_10.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_10.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_10.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_10.booking__paid_at__day AS booking__paid_at__day
+ , subq_10.booking__paid_at__week AS booking__paid_at__week
+ , subq_10.booking__paid_at__month AS booking__paid_at__month
+ , subq_10.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_10.booking__paid_at__year AS booking__paid_at__year
+ , subq_10.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_10.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_10.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_10.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_10.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_10.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_10.metric_time__day AS metric_time__day
+ , subq_10.metric_time__week AS metric_time__week
+ , subq_10.metric_time__month AS metric_time__month
+ , subq_10.metric_time__quarter AS metric_time__quarter
+ , subq_10.metric_time__year AS metric_time__year
+ , subq_10.metric_time__extract_year AS metric_time__extract_year
+ , subq_10.metric_time__extract_quarter AS metric_time__extract_quarter
+ , subq_10.metric_time__extract_month AS metric_time__extract_month
+ , subq_10.metric_time__extract_day AS metric_time__extract_day
+ , subq_10.metric_time__extract_dow AS metric_time__extract_dow
+ , subq_10.metric_time__extract_doy AS metric_time__extract_doy
+ , subq_10.listing AS listing
+ , subq_10.guest AS guest
+ , subq_10.host AS host
+ , subq_10.booking__listing AS booking__listing
+ , subq_10.booking__guest AS booking__guest
+ , subq_10.booking__host AS booking__host
+ , subq_10.is_instant AS is_instant
+ , subq_10.booking__is_instant AS booking__is_instant
+ , subq_10.bookings AS bookings
+ , subq_10.instant_bookings AS instant_bookings
+ , subq_10.booking_value AS booking_value
+ , subq_10.max_booking_value AS max_booking_value
+ , subq_10.min_booking_value AS min_booking_value
+ , subq_10.bookers AS bookers
+ , subq_10.average_booking_value AS average_booking_value
+ , subq_10.referred_bookings AS referred_bookings
+ , subq_10.median_booking_value AS median_booking_value
+ , subq_10.booking_value_p99 AS booking_value_p99
+ , subq_10.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_10.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_10.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_3.ds AS booking__ds__day
- FROM ***************************.mf_time_spine subq_3
- ) subq_2
+ subq_12.ds AS booking__ds__day
+ FROM ***************************.mf_time_spine subq_12
+ ) subq_11
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
ON
- DATEADD(week, -1, subq_2.booking__ds__day) = subq_1.booking__ds__day
- ) subq_4
- ) subq_5
+ DATEADD(week, -1, subq_11.booking__ds__day) = subq_10.booking__ds__day
+ ) subq_13
+ ) subq_14
GROUP BY
- subq_5.booking__ds__day
- ) subq_6
- ) subq_7
+ subq_14.booking__ds__day
+ ) subq_15
+ ) subq_16
FULL OUTER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_11.booking__ds__day
- , subq_11.bookers
+ subq_20.booking__ds__day
+ , subq_20.bookers
FROM (
-- Aggregate Measures
SELECT
- subq_10.booking__ds__day
- , COUNT(DISTINCT subq_10.bookers) AS bookers
+ subq_19.booking__ds__day
+ , COUNT(DISTINCT subq_19.bookers) AS bookers
FROM (
-- Pass Only Elements: ['bookers', 'booking__ds__day']
SELECT
- subq_9.booking__ds__day
- , subq_9.bookers
+ subq_18.booking__ds__day
+ , subq_18.bookers
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_8.ds__day
- , subq_8.ds__week
- , subq_8.ds__month
- , subq_8.ds__quarter
- , subq_8.ds__year
- , subq_8.ds__extract_year
- , subq_8.ds__extract_quarter
- , subq_8.ds__extract_month
- , subq_8.ds__extract_day
- , subq_8.ds__extract_dow
- , subq_8.ds__extract_doy
- , subq_8.ds_partitioned__day
- , subq_8.ds_partitioned__week
- , subq_8.ds_partitioned__month
- , subq_8.ds_partitioned__quarter
- , subq_8.ds_partitioned__year
- , subq_8.ds_partitioned__extract_year
- , subq_8.ds_partitioned__extract_quarter
- , subq_8.ds_partitioned__extract_month
- , subq_8.ds_partitioned__extract_day
- , subq_8.ds_partitioned__extract_dow
- , subq_8.ds_partitioned__extract_doy
- , subq_8.paid_at__day
- , subq_8.paid_at__week
- , subq_8.paid_at__month
- , subq_8.paid_at__quarter
- , subq_8.paid_at__year
- , subq_8.paid_at__extract_year
- , subq_8.paid_at__extract_quarter
- , subq_8.paid_at__extract_month
- , subq_8.paid_at__extract_day
- , subq_8.paid_at__extract_dow
- , subq_8.paid_at__extract_doy
- , subq_8.booking__ds__day
- , subq_8.booking__ds__week
- , subq_8.booking__ds__month
- , subq_8.booking__ds__quarter
- , subq_8.booking__ds__year
- , subq_8.booking__ds__extract_year
- , subq_8.booking__ds__extract_quarter
- , subq_8.booking__ds__extract_month
- , subq_8.booking__ds__extract_day
- , subq_8.booking__ds__extract_dow
- , subq_8.booking__ds__extract_doy
- , subq_8.booking__ds_partitioned__day
- , subq_8.booking__ds_partitioned__week
- , subq_8.booking__ds_partitioned__month
- , subq_8.booking__ds_partitioned__quarter
- , subq_8.booking__ds_partitioned__year
- , subq_8.booking__ds_partitioned__extract_year
- , subq_8.booking__ds_partitioned__extract_quarter
- , subq_8.booking__ds_partitioned__extract_month
- , subq_8.booking__ds_partitioned__extract_day
- , subq_8.booking__ds_partitioned__extract_dow
- , subq_8.booking__ds_partitioned__extract_doy
- , subq_8.booking__paid_at__day
- , subq_8.booking__paid_at__week
- , subq_8.booking__paid_at__month
- , subq_8.booking__paid_at__quarter
- , subq_8.booking__paid_at__year
- , subq_8.booking__paid_at__extract_year
- , subq_8.booking__paid_at__extract_quarter
- , subq_8.booking__paid_at__extract_month
- , subq_8.booking__paid_at__extract_day
- , subq_8.booking__paid_at__extract_dow
- , subq_8.booking__paid_at__extract_doy
- , subq_8.ds__day AS metric_time__day
- , subq_8.ds__week AS metric_time__week
- , subq_8.ds__month AS metric_time__month
- , subq_8.ds__quarter AS metric_time__quarter
- , subq_8.ds__year AS metric_time__year
- , subq_8.ds__extract_year AS metric_time__extract_year
- , subq_8.ds__extract_quarter AS metric_time__extract_quarter
- , subq_8.ds__extract_month AS metric_time__extract_month
- , subq_8.ds__extract_day AS metric_time__extract_day
- , subq_8.ds__extract_dow AS metric_time__extract_dow
- , subq_8.ds__extract_doy AS metric_time__extract_doy
- , subq_8.listing
- , subq_8.guest
- , subq_8.host
- , subq_8.booking__listing
- , subq_8.booking__guest
- , subq_8.booking__host
- , subq_8.is_instant
- , subq_8.booking__is_instant
- , subq_8.bookings
- , subq_8.instant_bookings
- , subq_8.booking_value
- , subq_8.max_booking_value
- , subq_8.min_booking_value
- , subq_8.bookers
- , subq_8.average_booking_value
- , subq_8.referred_bookings
- , subq_8.median_booking_value
- , subq_8.booking_value_p99
- , subq_8.discrete_booking_value_p99
- , subq_8.approximate_continuous_booking_value_p99
- , subq_8.approximate_discrete_booking_value_p99
+ subq_17.ds__day
+ , subq_17.ds__week
+ , subq_17.ds__month
+ , subq_17.ds__quarter
+ , subq_17.ds__year
+ , subq_17.ds__extract_year
+ , subq_17.ds__extract_quarter
+ , subq_17.ds__extract_month
+ , subq_17.ds__extract_day
+ , subq_17.ds__extract_dow
+ , subq_17.ds__extract_doy
+ , subq_17.ds_partitioned__day
+ , subq_17.ds_partitioned__week
+ , subq_17.ds_partitioned__month
+ , subq_17.ds_partitioned__quarter
+ , subq_17.ds_partitioned__year
+ , subq_17.ds_partitioned__extract_year
+ , subq_17.ds_partitioned__extract_quarter
+ , subq_17.ds_partitioned__extract_month
+ , subq_17.ds_partitioned__extract_day
+ , subq_17.ds_partitioned__extract_dow
+ , subq_17.ds_partitioned__extract_doy
+ , subq_17.paid_at__day
+ , subq_17.paid_at__week
+ , subq_17.paid_at__month
+ , subq_17.paid_at__quarter
+ , subq_17.paid_at__year
+ , subq_17.paid_at__extract_year
+ , subq_17.paid_at__extract_quarter
+ , subq_17.paid_at__extract_month
+ , subq_17.paid_at__extract_day
+ , subq_17.paid_at__extract_dow
+ , subq_17.paid_at__extract_doy
+ , subq_17.booking__ds__day
+ , subq_17.booking__ds__week
+ , subq_17.booking__ds__month
+ , subq_17.booking__ds__quarter
+ , subq_17.booking__ds__year
+ , subq_17.booking__ds__extract_year
+ , subq_17.booking__ds__extract_quarter
+ , subq_17.booking__ds__extract_month
+ , subq_17.booking__ds__extract_day
+ , subq_17.booking__ds__extract_dow
+ , subq_17.booking__ds__extract_doy
+ , subq_17.booking__ds_partitioned__day
+ , subq_17.booking__ds_partitioned__week
+ , subq_17.booking__ds_partitioned__month
+ , subq_17.booking__ds_partitioned__quarter
+ , subq_17.booking__ds_partitioned__year
+ , subq_17.booking__ds_partitioned__extract_year
+ , subq_17.booking__ds_partitioned__extract_quarter
+ , subq_17.booking__ds_partitioned__extract_month
+ , subq_17.booking__ds_partitioned__extract_day
+ , subq_17.booking__ds_partitioned__extract_dow
+ , subq_17.booking__ds_partitioned__extract_doy
+ , subq_17.booking__paid_at__day
+ , subq_17.booking__paid_at__week
+ , subq_17.booking__paid_at__month
+ , subq_17.booking__paid_at__quarter
+ , subq_17.booking__paid_at__year
+ , subq_17.booking__paid_at__extract_year
+ , subq_17.booking__paid_at__extract_quarter
+ , subq_17.booking__paid_at__extract_month
+ , subq_17.booking__paid_at__extract_day
+ , subq_17.booking__paid_at__extract_dow
+ , subq_17.booking__paid_at__extract_doy
+ , subq_17.ds__day AS metric_time__day
+ , subq_17.ds__week AS metric_time__week
+ , subq_17.ds__month AS metric_time__month
+ , subq_17.ds__quarter AS metric_time__quarter
+ , subq_17.ds__year AS metric_time__year
+ , subq_17.ds__extract_year AS metric_time__extract_year
+ , subq_17.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_17.ds__extract_month AS metric_time__extract_month
+ , subq_17.ds__extract_day AS metric_time__extract_day
+ , subq_17.ds__extract_dow AS metric_time__extract_dow
+ , subq_17.ds__extract_doy AS metric_time__extract_doy
+ , subq_17.listing
+ , subq_17.guest
+ , subq_17.host
+ , subq_17.booking__listing
+ , subq_17.booking__guest
+ , subq_17.booking__host
+ , subq_17.is_instant
+ , subq_17.booking__is_instant
+ , subq_17.bookings
+ , subq_17.instant_bookings
+ , subq_17.booking_value
+ , subq_17.max_booking_value
+ , subq_17.min_booking_value
+ , subq_17.bookers
+ , subq_17.average_booking_value
+ , subq_17.referred_bookings
+ , subq_17.median_booking_value
+ , subq_17.booking_value_p99
+ , subq_17.discrete_booking_value_p99
+ , subq_17.approximate_continuous_booking_value_p99
+ , subq_17.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_8
- ) subq_9
- ) subq_10
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_17
+ ) subq_18
+ ) subq_19
GROUP BY
- subq_10.booking__ds__day
- ) subq_11
- ) subq_12
+ subq_19.booking__ds__day
+ ) subq_20
+ ) subq_21
ON
- subq_7.booking__ds__day = subq_12.booking__ds__day
+ subq_16.booking__ds__day = subq_21.booking__ds__day
GROUP BY
- COALESCE(subq_7.booking__ds__day, subq_12.booking__ds__day)
-) subq_13
+ COALESCE(subq_16.booking__ds__day, subq_21.booking__ds__day)
+) subq_22
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_offset_metric_with_agg_time_dim__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_offset_metric_with_agg_time_dim__plan0_optimized.sql
index 085c58e4f4..0edb7a0c7b 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_offset_metric_with_agg_time_dim__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_offset_metric_with_agg_time_dim__plan0_optimized.sql
@@ -5,25 +5,25 @@ SELECT
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_21.booking__ds__day, subq_26.booking__ds__day) AS booking__ds__day
- , MAX(subq_21.booking_value) AS booking_value
- , MAX(subq_26.bookers) AS bookers
+ COALESCE(subq_30.booking__ds__day, subq_35.booking__ds__day) AS booking__ds__day
+ , MAX(subq_30.booking_value) AS booking_value
+ , MAX(subq_35.bookers) AS bookers
FROM (
-- Join to Time Spine Dataset
-- Pass Only Elements: ['booking_value', 'booking__ds__day']
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_17.ds AS booking__ds__day
- , SUM(bookings_source_src_28001.booking_value) AS booking_value
- FROM ***************************.mf_time_spine subq_17
+ subq_26.ds AS booking__ds__day
+ , SUM(bookings_source_src_28000.booking_value) AS booking_value
+ FROM ***************************.mf_time_spine subq_26
INNER JOIN
- ***************************.fct_bookings bookings_source_src_28001
+ ***************************.fct_bookings bookings_source_src_28000
ON
- DATEADD(week, -1, subq_17.ds) = DATE_TRUNC('day', bookings_source_src_28001.ds)
+ DATEADD(week, -1, subq_26.ds) = DATE_TRUNC('day', bookings_source_src_28000.ds)
GROUP BY
- subq_17.ds
- ) subq_21
+ subq_26.ds
+ ) subq_30
FULL OUTER JOIN (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
@@ -33,12 +33,12 @@ FROM (
SELECT
DATE_TRUNC('day', ds) AS booking__ds__day
, COUNT(DISTINCT guest_id) AS bookers
- FROM ***************************.fct_bookings bookings_source_src_28001
+ FROM ***************************.fct_bookings bookings_source_src_28000
GROUP BY
DATE_TRUNC('day', ds)
- ) subq_26
+ ) subq_35
ON
- subq_21.booking__ds__day = subq_26.booking__ds__day
+ subq_30.booking__ds__day = subq_35.booking__ds__day
GROUP BY
- COALESCE(subq_21.booking__ds__day, subq_26.booking__ds__day)
-) subq_27
+ COALESCE(subq_30.booking__ds__day, subq_35.booking__ds__day)
+) subq_36
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_offset_metric_with_one_input_metric__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_offset_metric_with_one_input_metric__plan0.sql
index 4093b6845c..dd2d49776b 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_offset_metric_with_one_input_metric__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_offset_metric_with_one_input_metric__plan0.sql
@@ -1,319 +1,319 @@
-- Compute Metrics via Expressions
SELECT
- subq_7.metric_time__day
+ subq_16.metric_time__day
, bookings_5_days_ago AS bookings_5_day_lag
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_6.metric_time__day
- , subq_6.bookings AS bookings_5_days_ago
+ subq_15.metric_time__day
+ , subq_15.bookings AS bookings_5_days_ago
FROM (
-- Aggregate Measures
SELECT
- subq_5.metric_time__day
- , SUM(subq_5.bookings) AS bookings
+ subq_14.metric_time__day
+ , SUM(subq_14.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__day']
SELECT
- subq_4.metric_time__day
- , subq_4.bookings
+ subq_13.metric_time__day
+ , subq_13.bookings
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_2.metric_time__day AS metric_time__day
- , subq_1.ds__day AS ds__day
- , subq_1.ds__week AS ds__week
- , subq_1.ds__month AS ds__month
- , subq_1.ds__quarter AS ds__quarter
- , subq_1.ds__year AS ds__year
- , subq_1.ds__extract_year AS ds__extract_year
- , subq_1.ds__extract_quarter AS ds__extract_quarter
- , subq_1.ds__extract_month AS ds__extract_month
- , subq_1.ds__extract_day AS ds__extract_day
- , subq_1.ds__extract_dow AS ds__extract_dow
- , subq_1.ds__extract_doy AS ds__extract_doy
- , subq_1.ds_partitioned__day AS ds_partitioned__day
- , subq_1.ds_partitioned__week AS ds_partitioned__week
- , subq_1.ds_partitioned__month AS ds_partitioned__month
- , subq_1.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_1.ds_partitioned__year AS ds_partitioned__year
- , subq_1.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_1.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_1.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_1.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_1.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_1.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_1.paid_at__day AS paid_at__day
- , subq_1.paid_at__week AS paid_at__week
- , subq_1.paid_at__month AS paid_at__month
- , subq_1.paid_at__quarter AS paid_at__quarter
- , subq_1.paid_at__year AS paid_at__year
- , subq_1.paid_at__extract_year AS paid_at__extract_year
- , subq_1.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_1.paid_at__extract_month AS paid_at__extract_month
- , subq_1.paid_at__extract_day AS paid_at__extract_day
- , subq_1.paid_at__extract_dow AS paid_at__extract_dow
- , subq_1.paid_at__extract_doy AS paid_at__extract_doy
- , subq_1.booking__ds__day AS booking__ds__day
- , subq_1.booking__ds__week AS booking__ds__week
- , subq_1.booking__ds__month AS booking__ds__month
- , subq_1.booking__ds__quarter AS booking__ds__quarter
- , subq_1.booking__ds__year AS booking__ds__year
- , subq_1.booking__ds__extract_year AS booking__ds__extract_year
- , subq_1.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_1.booking__ds__extract_month AS booking__ds__extract_month
- , subq_1.booking__ds__extract_day AS booking__ds__extract_day
- , subq_1.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_1.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_1.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_1.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_1.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_1.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_1.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_1.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_1.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_1.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_1.booking__paid_at__day AS booking__paid_at__day
- , subq_1.booking__paid_at__week AS booking__paid_at__week
- , subq_1.booking__paid_at__month AS booking__paid_at__month
- , subq_1.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_1.booking__paid_at__year AS booking__paid_at__year
- , subq_1.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_1.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_1.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_1.listing AS listing
- , subq_1.guest AS guest
- , subq_1.host AS host
- , subq_1.booking__listing AS booking__listing
- , subq_1.booking__guest AS booking__guest
- , subq_1.booking__host AS booking__host
- , subq_1.is_instant AS is_instant
- , subq_1.booking__is_instant AS booking__is_instant
- , subq_1.bookings AS bookings
- , subq_1.instant_bookings AS instant_bookings
- , subq_1.booking_value AS booking_value
- , subq_1.max_booking_value AS max_booking_value
- , subq_1.min_booking_value AS min_booking_value
- , subq_1.bookers AS bookers
- , subq_1.average_booking_value AS average_booking_value
- , subq_1.referred_bookings AS referred_bookings
- , subq_1.median_booking_value AS median_booking_value
- , subq_1.booking_value_p99 AS booking_value_p99
- , subq_1.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_1.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_1.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ subq_11.metric_time__day AS metric_time__day
+ , subq_10.ds__day AS ds__day
+ , subq_10.ds__week AS ds__week
+ , subq_10.ds__month AS ds__month
+ , subq_10.ds__quarter AS ds__quarter
+ , subq_10.ds__year AS ds__year
+ , subq_10.ds__extract_year AS ds__extract_year
+ , subq_10.ds__extract_quarter AS ds__extract_quarter
+ , subq_10.ds__extract_month AS ds__extract_month
+ , subq_10.ds__extract_day AS ds__extract_day
+ , subq_10.ds__extract_dow AS ds__extract_dow
+ , subq_10.ds__extract_doy AS ds__extract_doy
+ , subq_10.ds_partitioned__day AS ds_partitioned__day
+ , subq_10.ds_partitioned__week AS ds_partitioned__week
+ , subq_10.ds_partitioned__month AS ds_partitioned__month
+ , subq_10.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_10.ds_partitioned__year AS ds_partitioned__year
+ , subq_10.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_10.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_10.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_10.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_10.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_10.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_10.paid_at__day AS paid_at__day
+ , subq_10.paid_at__week AS paid_at__week
+ , subq_10.paid_at__month AS paid_at__month
+ , subq_10.paid_at__quarter AS paid_at__quarter
+ , subq_10.paid_at__year AS paid_at__year
+ , subq_10.paid_at__extract_year AS paid_at__extract_year
+ , subq_10.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_10.paid_at__extract_month AS paid_at__extract_month
+ , subq_10.paid_at__extract_day AS paid_at__extract_day
+ , subq_10.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_10.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_10.booking__ds__day AS booking__ds__day
+ , subq_10.booking__ds__week AS booking__ds__week
+ , subq_10.booking__ds__month AS booking__ds__month
+ , subq_10.booking__ds__quarter AS booking__ds__quarter
+ , subq_10.booking__ds__year AS booking__ds__year
+ , subq_10.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_10.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_10.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_10.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_10.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_10.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_10.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_10.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_10.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_10.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_10.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_10.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_10.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_10.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_10.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_10.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_10.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_10.booking__paid_at__day AS booking__paid_at__day
+ , subq_10.booking__paid_at__week AS booking__paid_at__week
+ , subq_10.booking__paid_at__month AS booking__paid_at__month
+ , subq_10.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_10.booking__paid_at__year AS booking__paid_at__year
+ , subq_10.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_10.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_10.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_10.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_10.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_10.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_10.listing AS listing
+ , subq_10.guest AS guest
+ , subq_10.host AS host
+ , subq_10.booking__listing AS booking__listing
+ , subq_10.booking__guest AS booking__guest
+ , subq_10.booking__host AS booking__host
+ , subq_10.is_instant AS is_instant
+ , subq_10.booking__is_instant AS booking__is_instant
+ , subq_10.bookings AS bookings
+ , subq_10.instant_bookings AS instant_bookings
+ , subq_10.booking_value AS booking_value
+ , subq_10.max_booking_value AS max_booking_value
+ , subq_10.min_booking_value AS min_booking_value
+ , subq_10.bookers AS bookers
+ , subq_10.average_booking_value AS average_booking_value
+ , subq_10.referred_bookings AS referred_bookings
+ , subq_10.median_booking_value AS median_booking_value
+ , subq_10.booking_value_p99 AS booking_value_p99
+ , subq_10.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_10.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_10.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_3.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_3
- ) subq_2
+ subq_12.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_12
+ ) subq_11
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
ON
- DATEADD(day, -5, subq_2.metric_time__day) = subq_1.metric_time__day
- ) subq_4
- ) subq_5
+ DATEADD(day, -5, subq_11.metric_time__day) = subq_10.metric_time__day
+ ) subq_13
+ ) subq_14
GROUP BY
- subq_5.metric_time__day
- ) subq_6
-) subq_7
+ subq_14.metric_time__day
+ ) subq_15
+) subq_16
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_offset_metric_with_one_input_metric__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_offset_metric_with_one_input_metric__plan0_optimized.sql
index 56f1d26f59..1a6402a3bb 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_offset_metric_with_one_input_metric__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_derived_offset_metric_with_one_input_metric__plan0_optimized.sql
@@ -8,19 +8,19 @@ FROM (
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_11.ds AS metric_time__day
- , SUM(subq_9.bookings) AS bookings_5_days_ago
- FROM ***************************.mf_time_spine subq_11
+ subq_20.ds AS metric_time__day
+ , SUM(subq_18.bookings) AS bookings_5_days_ago
+ FROM ***************************.mf_time_spine subq_20
INNER JOIN (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
SELECT
DATE_TRUNC('day', ds) AS metric_time__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_9
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_18
ON
- DATEADD(day, -5, subq_11.ds) = subq_9.metric_time__day
+ DATEADD(day, -5, subq_20.ds) = subq_18.metric_time__day
GROUP BY
- subq_11.ds
-) subq_15
+ subq_20.ds
+) subq_24
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_derived_metric__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_derived_metric__plan0.sql
index 3552f891cc..eb50990558 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_derived_metric__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_derived_metric__plan0.sql
@@ -1,895 +1,895 @@
-- Compute Metrics via Expressions
SELECT
- subq_22.metric_time__day
+ subq_31.metric_time__day
, non_referred + (instant * 1.0 / bookings) AS instant_plus_non_referred_bookings_pct
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_11.metric_time__day, subq_16.metric_time__day, subq_21.metric_time__day) AS metric_time__day
- , MAX(subq_11.non_referred) AS non_referred
- , MAX(subq_16.instant) AS instant
- , MAX(subq_21.bookings) AS bookings
+ COALESCE(subq_20.metric_time__day, subq_25.metric_time__day, subq_30.metric_time__day) AS metric_time__day
+ , MAX(subq_20.non_referred) AS non_referred
+ , MAX(subq_25.instant) AS instant
+ , MAX(subq_30.bookings) AS bookings
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_10.metric_time__day
+ subq_19.metric_time__day
, (bookings - ref_bookings) * 1.0 / bookings AS non_referred
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_4.metric_time__day, subq_9.metric_time__day) AS metric_time__day
- , MAX(subq_4.ref_bookings) AS ref_bookings
- , MAX(subq_9.bookings) AS bookings
+ COALESCE(subq_13.metric_time__day, subq_18.metric_time__day) AS metric_time__day
+ , MAX(subq_13.ref_bookings) AS ref_bookings
+ , MAX(subq_18.bookings) AS bookings
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_3.metric_time__day
- , subq_3.referred_bookings AS ref_bookings
+ subq_12.metric_time__day
+ , subq_12.referred_bookings AS ref_bookings
FROM (
-- Aggregate Measures
SELECT
- subq_2.metric_time__day
- , SUM(subq_2.referred_bookings) AS referred_bookings
+ subq_11.metric_time__day
+ , SUM(subq_11.referred_bookings) AS referred_bookings
FROM (
-- Pass Only Elements: ['referred_bookings', 'metric_time__day']
SELECT
- subq_1.metric_time__day
- , subq_1.referred_bookings
+ subq_10.metric_time__day
+ , subq_10.referred_bookings
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
- ) subq_2
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
GROUP BY
- subq_2.metric_time__day
- ) subq_3
- ) subq_4
+ subq_11.metric_time__day
+ ) subq_12
+ ) subq_13
FULL OUTER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_8.metric_time__day
- , subq_8.bookings
+ subq_17.metric_time__day
+ , subq_17.bookings
FROM (
-- Aggregate Measures
SELECT
- subq_7.metric_time__day
- , SUM(subq_7.bookings) AS bookings
+ subq_16.metric_time__day
+ , SUM(subq_16.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__day']
SELECT
- subq_6.metric_time__day
- , subq_6.bookings
+ subq_15.metric_time__day
+ , subq_15.bookings
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_5.ds__day
- , subq_5.ds__week
- , subq_5.ds__month
- , subq_5.ds__quarter
- , subq_5.ds__year
- , subq_5.ds__extract_year
- , subq_5.ds__extract_quarter
- , subq_5.ds__extract_month
- , subq_5.ds__extract_day
- , subq_5.ds__extract_dow
- , subq_5.ds__extract_doy
- , subq_5.ds_partitioned__day
- , subq_5.ds_partitioned__week
- , subq_5.ds_partitioned__month
- , subq_5.ds_partitioned__quarter
- , subq_5.ds_partitioned__year
- , subq_5.ds_partitioned__extract_year
- , subq_5.ds_partitioned__extract_quarter
- , subq_5.ds_partitioned__extract_month
- , subq_5.ds_partitioned__extract_day
- , subq_5.ds_partitioned__extract_dow
- , subq_5.ds_partitioned__extract_doy
- , subq_5.paid_at__day
- , subq_5.paid_at__week
- , subq_5.paid_at__month
- , subq_5.paid_at__quarter
- , subq_5.paid_at__year
- , subq_5.paid_at__extract_year
- , subq_5.paid_at__extract_quarter
- , subq_5.paid_at__extract_month
- , subq_5.paid_at__extract_day
- , subq_5.paid_at__extract_dow
- , subq_5.paid_at__extract_doy
- , subq_5.booking__ds__day
- , subq_5.booking__ds__week
- , subq_5.booking__ds__month
- , subq_5.booking__ds__quarter
- , subq_5.booking__ds__year
- , subq_5.booking__ds__extract_year
- , subq_5.booking__ds__extract_quarter
- , subq_5.booking__ds__extract_month
- , subq_5.booking__ds__extract_day
- , subq_5.booking__ds__extract_dow
- , subq_5.booking__ds__extract_doy
- , subq_5.booking__ds_partitioned__day
- , subq_5.booking__ds_partitioned__week
- , subq_5.booking__ds_partitioned__month
- , subq_5.booking__ds_partitioned__quarter
- , subq_5.booking__ds_partitioned__year
- , subq_5.booking__ds_partitioned__extract_year
- , subq_5.booking__ds_partitioned__extract_quarter
- , subq_5.booking__ds_partitioned__extract_month
- , subq_5.booking__ds_partitioned__extract_day
- , subq_5.booking__ds_partitioned__extract_dow
- , subq_5.booking__ds_partitioned__extract_doy
- , subq_5.booking__paid_at__day
- , subq_5.booking__paid_at__week
- , subq_5.booking__paid_at__month
- , subq_5.booking__paid_at__quarter
- , subq_5.booking__paid_at__year
- , subq_5.booking__paid_at__extract_year
- , subq_5.booking__paid_at__extract_quarter
- , subq_5.booking__paid_at__extract_month
- , subq_5.booking__paid_at__extract_day
- , subq_5.booking__paid_at__extract_dow
- , subq_5.booking__paid_at__extract_doy
- , subq_5.ds__day AS metric_time__day
- , subq_5.ds__week AS metric_time__week
- , subq_5.ds__month AS metric_time__month
- , subq_5.ds__quarter AS metric_time__quarter
- , subq_5.ds__year AS metric_time__year
- , subq_5.ds__extract_year AS metric_time__extract_year
- , subq_5.ds__extract_quarter AS metric_time__extract_quarter
- , subq_5.ds__extract_month AS metric_time__extract_month
- , subq_5.ds__extract_day AS metric_time__extract_day
- , subq_5.ds__extract_dow AS metric_time__extract_dow
- , subq_5.ds__extract_doy AS metric_time__extract_doy
- , subq_5.listing
- , subq_5.guest
- , subq_5.host
- , subq_5.booking__listing
- , subq_5.booking__guest
- , subq_5.booking__host
- , subq_5.is_instant
- , subq_5.booking__is_instant
- , subq_5.bookings
- , subq_5.instant_bookings
- , subq_5.booking_value
- , subq_5.max_booking_value
- , subq_5.min_booking_value
- , subq_5.bookers
- , subq_5.average_booking_value
- , subq_5.referred_bookings
- , subq_5.median_booking_value
- , subq_5.booking_value_p99
- , subq_5.discrete_booking_value_p99
- , subq_5.approximate_continuous_booking_value_p99
- , subq_5.approximate_discrete_booking_value_p99
+ subq_14.ds__day
+ , subq_14.ds__week
+ , subq_14.ds__month
+ , subq_14.ds__quarter
+ , subq_14.ds__year
+ , subq_14.ds__extract_year
+ , subq_14.ds__extract_quarter
+ , subq_14.ds__extract_month
+ , subq_14.ds__extract_day
+ , subq_14.ds__extract_dow
+ , subq_14.ds__extract_doy
+ , subq_14.ds_partitioned__day
+ , subq_14.ds_partitioned__week
+ , subq_14.ds_partitioned__month
+ , subq_14.ds_partitioned__quarter
+ , subq_14.ds_partitioned__year
+ , subq_14.ds_partitioned__extract_year
+ , subq_14.ds_partitioned__extract_quarter
+ , subq_14.ds_partitioned__extract_month
+ , subq_14.ds_partitioned__extract_day
+ , subq_14.ds_partitioned__extract_dow
+ , subq_14.ds_partitioned__extract_doy
+ , subq_14.paid_at__day
+ , subq_14.paid_at__week
+ , subq_14.paid_at__month
+ , subq_14.paid_at__quarter
+ , subq_14.paid_at__year
+ , subq_14.paid_at__extract_year
+ , subq_14.paid_at__extract_quarter
+ , subq_14.paid_at__extract_month
+ , subq_14.paid_at__extract_day
+ , subq_14.paid_at__extract_dow
+ , subq_14.paid_at__extract_doy
+ , subq_14.booking__ds__day
+ , subq_14.booking__ds__week
+ , subq_14.booking__ds__month
+ , subq_14.booking__ds__quarter
+ , subq_14.booking__ds__year
+ , subq_14.booking__ds__extract_year
+ , subq_14.booking__ds__extract_quarter
+ , subq_14.booking__ds__extract_month
+ , subq_14.booking__ds__extract_day
+ , subq_14.booking__ds__extract_dow
+ , subq_14.booking__ds__extract_doy
+ , subq_14.booking__ds_partitioned__day
+ , subq_14.booking__ds_partitioned__week
+ , subq_14.booking__ds_partitioned__month
+ , subq_14.booking__ds_partitioned__quarter
+ , subq_14.booking__ds_partitioned__year
+ , subq_14.booking__ds_partitioned__extract_year
+ , subq_14.booking__ds_partitioned__extract_quarter
+ , subq_14.booking__ds_partitioned__extract_month
+ , subq_14.booking__ds_partitioned__extract_day
+ , subq_14.booking__ds_partitioned__extract_dow
+ , subq_14.booking__ds_partitioned__extract_doy
+ , subq_14.booking__paid_at__day
+ , subq_14.booking__paid_at__week
+ , subq_14.booking__paid_at__month
+ , subq_14.booking__paid_at__quarter
+ , subq_14.booking__paid_at__year
+ , subq_14.booking__paid_at__extract_year
+ , subq_14.booking__paid_at__extract_quarter
+ , subq_14.booking__paid_at__extract_month
+ , subq_14.booking__paid_at__extract_day
+ , subq_14.booking__paid_at__extract_dow
+ , subq_14.booking__paid_at__extract_doy
+ , subq_14.ds__day AS metric_time__day
+ , subq_14.ds__week AS metric_time__week
+ , subq_14.ds__month AS metric_time__month
+ , subq_14.ds__quarter AS metric_time__quarter
+ , subq_14.ds__year AS metric_time__year
+ , subq_14.ds__extract_year AS metric_time__extract_year
+ , subq_14.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_14.ds__extract_month AS metric_time__extract_month
+ , subq_14.ds__extract_day AS metric_time__extract_day
+ , subq_14.ds__extract_dow AS metric_time__extract_dow
+ , subq_14.ds__extract_doy AS metric_time__extract_doy
+ , subq_14.listing
+ , subq_14.guest
+ , subq_14.host
+ , subq_14.booking__listing
+ , subq_14.booking__guest
+ , subq_14.booking__host
+ , subq_14.is_instant
+ , subq_14.booking__is_instant
+ , subq_14.bookings
+ , subq_14.instant_bookings
+ , subq_14.booking_value
+ , subq_14.max_booking_value
+ , subq_14.min_booking_value
+ , subq_14.bookers
+ , subq_14.average_booking_value
+ , subq_14.referred_bookings
+ , subq_14.median_booking_value
+ , subq_14.booking_value_p99
+ , subq_14.discrete_booking_value_p99
+ , subq_14.approximate_continuous_booking_value_p99
+ , subq_14.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_5
- ) subq_6
- ) subq_7
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_14
+ ) subq_15
+ ) subq_16
GROUP BY
- subq_7.metric_time__day
- ) subq_8
- ) subq_9
+ subq_16.metric_time__day
+ ) subq_17
+ ) subq_18
ON
- subq_4.metric_time__day = subq_9.metric_time__day
+ subq_13.metric_time__day = subq_18.metric_time__day
GROUP BY
- COALESCE(subq_4.metric_time__day, subq_9.metric_time__day)
- ) subq_10
- ) subq_11
+ COALESCE(subq_13.metric_time__day, subq_18.metric_time__day)
+ ) subq_19
+ ) subq_20
FULL OUTER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_15.metric_time__day
- , subq_15.instant_bookings AS instant
+ subq_24.metric_time__day
+ , subq_24.instant_bookings AS instant
FROM (
-- Aggregate Measures
SELECT
- subq_14.metric_time__day
- , SUM(subq_14.instant_bookings) AS instant_bookings
+ subq_23.metric_time__day
+ , SUM(subq_23.instant_bookings) AS instant_bookings
FROM (
-- Pass Only Elements: ['instant_bookings', 'metric_time__day']
SELECT
- subq_13.metric_time__day
- , subq_13.instant_bookings
+ subq_22.metric_time__day
+ , subq_22.instant_bookings
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_12.ds__day
- , subq_12.ds__week
- , subq_12.ds__month
- , subq_12.ds__quarter
- , subq_12.ds__year
- , subq_12.ds__extract_year
- , subq_12.ds__extract_quarter
- , subq_12.ds__extract_month
- , subq_12.ds__extract_day
- , subq_12.ds__extract_dow
- , subq_12.ds__extract_doy
- , subq_12.ds_partitioned__day
- , subq_12.ds_partitioned__week
- , subq_12.ds_partitioned__month
- , subq_12.ds_partitioned__quarter
- , subq_12.ds_partitioned__year
- , subq_12.ds_partitioned__extract_year
- , subq_12.ds_partitioned__extract_quarter
- , subq_12.ds_partitioned__extract_month
- , subq_12.ds_partitioned__extract_day
- , subq_12.ds_partitioned__extract_dow
- , subq_12.ds_partitioned__extract_doy
- , subq_12.paid_at__day
- , subq_12.paid_at__week
- , subq_12.paid_at__month
- , subq_12.paid_at__quarter
- , subq_12.paid_at__year
- , subq_12.paid_at__extract_year
- , subq_12.paid_at__extract_quarter
- , subq_12.paid_at__extract_month
- , subq_12.paid_at__extract_day
- , subq_12.paid_at__extract_dow
- , subq_12.paid_at__extract_doy
- , subq_12.booking__ds__day
- , subq_12.booking__ds__week
- , subq_12.booking__ds__month
- , subq_12.booking__ds__quarter
- , subq_12.booking__ds__year
- , subq_12.booking__ds__extract_year
- , subq_12.booking__ds__extract_quarter
- , subq_12.booking__ds__extract_month
- , subq_12.booking__ds__extract_day
- , subq_12.booking__ds__extract_dow
- , subq_12.booking__ds__extract_doy
- , subq_12.booking__ds_partitioned__day
- , subq_12.booking__ds_partitioned__week
- , subq_12.booking__ds_partitioned__month
- , subq_12.booking__ds_partitioned__quarter
- , subq_12.booking__ds_partitioned__year
- , subq_12.booking__ds_partitioned__extract_year
- , subq_12.booking__ds_partitioned__extract_quarter
- , subq_12.booking__ds_partitioned__extract_month
- , subq_12.booking__ds_partitioned__extract_day
- , subq_12.booking__ds_partitioned__extract_dow
- , subq_12.booking__ds_partitioned__extract_doy
- , subq_12.booking__paid_at__day
- , subq_12.booking__paid_at__week
- , subq_12.booking__paid_at__month
- , subq_12.booking__paid_at__quarter
- , subq_12.booking__paid_at__year
- , subq_12.booking__paid_at__extract_year
- , subq_12.booking__paid_at__extract_quarter
- , subq_12.booking__paid_at__extract_month
- , subq_12.booking__paid_at__extract_day
- , subq_12.booking__paid_at__extract_dow
- , subq_12.booking__paid_at__extract_doy
- , subq_12.ds__day AS metric_time__day
- , subq_12.ds__week AS metric_time__week
- , subq_12.ds__month AS metric_time__month
- , subq_12.ds__quarter AS metric_time__quarter
- , subq_12.ds__year AS metric_time__year
- , subq_12.ds__extract_year AS metric_time__extract_year
- , subq_12.ds__extract_quarter AS metric_time__extract_quarter
- , subq_12.ds__extract_month AS metric_time__extract_month
- , subq_12.ds__extract_day AS metric_time__extract_day
- , subq_12.ds__extract_dow AS metric_time__extract_dow
- , subq_12.ds__extract_doy AS metric_time__extract_doy
- , subq_12.listing
- , subq_12.guest
- , subq_12.host
- , subq_12.booking__listing
- , subq_12.booking__guest
- , subq_12.booking__host
- , subq_12.is_instant
- , subq_12.booking__is_instant
- , subq_12.bookings
- , subq_12.instant_bookings
- , subq_12.booking_value
- , subq_12.max_booking_value
- , subq_12.min_booking_value
- , subq_12.bookers
- , subq_12.average_booking_value
- , subq_12.referred_bookings
- , subq_12.median_booking_value
- , subq_12.booking_value_p99
- , subq_12.discrete_booking_value_p99
- , subq_12.approximate_continuous_booking_value_p99
- , subq_12.approximate_discrete_booking_value_p99
+ subq_21.ds__day
+ , subq_21.ds__week
+ , subq_21.ds__month
+ , subq_21.ds__quarter
+ , subq_21.ds__year
+ , subq_21.ds__extract_year
+ , subq_21.ds__extract_quarter
+ , subq_21.ds__extract_month
+ , subq_21.ds__extract_day
+ , subq_21.ds__extract_dow
+ , subq_21.ds__extract_doy
+ , subq_21.ds_partitioned__day
+ , subq_21.ds_partitioned__week
+ , subq_21.ds_partitioned__month
+ , subq_21.ds_partitioned__quarter
+ , subq_21.ds_partitioned__year
+ , subq_21.ds_partitioned__extract_year
+ , subq_21.ds_partitioned__extract_quarter
+ , subq_21.ds_partitioned__extract_month
+ , subq_21.ds_partitioned__extract_day
+ , subq_21.ds_partitioned__extract_dow
+ , subq_21.ds_partitioned__extract_doy
+ , subq_21.paid_at__day
+ , subq_21.paid_at__week
+ , subq_21.paid_at__month
+ , subq_21.paid_at__quarter
+ , subq_21.paid_at__year
+ , subq_21.paid_at__extract_year
+ , subq_21.paid_at__extract_quarter
+ , subq_21.paid_at__extract_month
+ , subq_21.paid_at__extract_day
+ , subq_21.paid_at__extract_dow
+ , subq_21.paid_at__extract_doy
+ , subq_21.booking__ds__day
+ , subq_21.booking__ds__week
+ , subq_21.booking__ds__month
+ , subq_21.booking__ds__quarter
+ , subq_21.booking__ds__year
+ , subq_21.booking__ds__extract_year
+ , subq_21.booking__ds__extract_quarter
+ , subq_21.booking__ds__extract_month
+ , subq_21.booking__ds__extract_day
+ , subq_21.booking__ds__extract_dow
+ , subq_21.booking__ds__extract_doy
+ , subq_21.booking__ds_partitioned__day
+ , subq_21.booking__ds_partitioned__week
+ , subq_21.booking__ds_partitioned__month
+ , subq_21.booking__ds_partitioned__quarter
+ , subq_21.booking__ds_partitioned__year
+ , subq_21.booking__ds_partitioned__extract_year
+ , subq_21.booking__ds_partitioned__extract_quarter
+ , subq_21.booking__ds_partitioned__extract_month
+ , subq_21.booking__ds_partitioned__extract_day
+ , subq_21.booking__ds_partitioned__extract_dow
+ , subq_21.booking__ds_partitioned__extract_doy
+ , subq_21.booking__paid_at__day
+ , subq_21.booking__paid_at__week
+ , subq_21.booking__paid_at__month
+ , subq_21.booking__paid_at__quarter
+ , subq_21.booking__paid_at__year
+ , subq_21.booking__paid_at__extract_year
+ , subq_21.booking__paid_at__extract_quarter
+ , subq_21.booking__paid_at__extract_month
+ , subq_21.booking__paid_at__extract_day
+ , subq_21.booking__paid_at__extract_dow
+ , subq_21.booking__paid_at__extract_doy
+ , subq_21.ds__day AS metric_time__day
+ , subq_21.ds__week AS metric_time__week
+ , subq_21.ds__month AS metric_time__month
+ , subq_21.ds__quarter AS metric_time__quarter
+ , subq_21.ds__year AS metric_time__year
+ , subq_21.ds__extract_year AS metric_time__extract_year
+ , subq_21.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_21.ds__extract_month AS metric_time__extract_month
+ , subq_21.ds__extract_day AS metric_time__extract_day
+ , subq_21.ds__extract_dow AS metric_time__extract_dow
+ , subq_21.ds__extract_doy AS metric_time__extract_doy
+ , subq_21.listing
+ , subq_21.guest
+ , subq_21.host
+ , subq_21.booking__listing
+ , subq_21.booking__guest
+ , subq_21.booking__host
+ , subq_21.is_instant
+ , subq_21.booking__is_instant
+ , subq_21.bookings
+ , subq_21.instant_bookings
+ , subq_21.booking_value
+ , subq_21.max_booking_value
+ , subq_21.min_booking_value
+ , subq_21.bookers
+ , subq_21.average_booking_value
+ , subq_21.referred_bookings
+ , subq_21.median_booking_value
+ , subq_21.booking_value_p99
+ , subq_21.discrete_booking_value_p99
+ , subq_21.approximate_continuous_booking_value_p99
+ , subq_21.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_12
- ) subq_13
- ) subq_14
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_21
+ ) subq_22
+ ) subq_23
GROUP BY
- subq_14.metric_time__day
- ) subq_15
- ) subq_16
+ subq_23.metric_time__day
+ ) subq_24
+ ) subq_25
ON
- subq_11.metric_time__day = subq_16.metric_time__day
+ subq_20.metric_time__day = subq_25.metric_time__day
FULL OUTER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_20.metric_time__day
- , subq_20.bookings
+ subq_29.metric_time__day
+ , subq_29.bookings
FROM (
-- Aggregate Measures
SELECT
- subq_19.metric_time__day
- , SUM(subq_19.bookings) AS bookings
+ subq_28.metric_time__day
+ , SUM(subq_28.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__day']
SELECT
- subq_18.metric_time__day
- , subq_18.bookings
+ subq_27.metric_time__day
+ , subq_27.bookings
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_17.ds__day
- , subq_17.ds__week
- , subq_17.ds__month
- , subq_17.ds__quarter
- , subq_17.ds__year
- , subq_17.ds__extract_year
- , subq_17.ds__extract_quarter
- , subq_17.ds__extract_month
- , subq_17.ds__extract_day
- , subq_17.ds__extract_dow
- , subq_17.ds__extract_doy
- , subq_17.ds_partitioned__day
- , subq_17.ds_partitioned__week
- , subq_17.ds_partitioned__month
- , subq_17.ds_partitioned__quarter
- , subq_17.ds_partitioned__year
- , subq_17.ds_partitioned__extract_year
- , subq_17.ds_partitioned__extract_quarter
- , subq_17.ds_partitioned__extract_month
- , subq_17.ds_partitioned__extract_day
- , subq_17.ds_partitioned__extract_dow
- , subq_17.ds_partitioned__extract_doy
- , subq_17.paid_at__day
- , subq_17.paid_at__week
- , subq_17.paid_at__month
- , subq_17.paid_at__quarter
- , subq_17.paid_at__year
- , subq_17.paid_at__extract_year
- , subq_17.paid_at__extract_quarter
- , subq_17.paid_at__extract_month
- , subq_17.paid_at__extract_day
- , subq_17.paid_at__extract_dow
- , subq_17.paid_at__extract_doy
- , subq_17.booking__ds__day
- , subq_17.booking__ds__week
- , subq_17.booking__ds__month
- , subq_17.booking__ds__quarter
- , subq_17.booking__ds__year
- , subq_17.booking__ds__extract_year
- , subq_17.booking__ds__extract_quarter
- , subq_17.booking__ds__extract_month
- , subq_17.booking__ds__extract_day
- , subq_17.booking__ds__extract_dow
- , subq_17.booking__ds__extract_doy
- , subq_17.booking__ds_partitioned__day
- , subq_17.booking__ds_partitioned__week
- , subq_17.booking__ds_partitioned__month
- , subq_17.booking__ds_partitioned__quarter
- , subq_17.booking__ds_partitioned__year
- , subq_17.booking__ds_partitioned__extract_year
- , subq_17.booking__ds_partitioned__extract_quarter
- , subq_17.booking__ds_partitioned__extract_month
- , subq_17.booking__ds_partitioned__extract_day
- , subq_17.booking__ds_partitioned__extract_dow
- , subq_17.booking__ds_partitioned__extract_doy
- , subq_17.booking__paid_at__day
- , subq_17.booking__paid_at__week
- , subq_17.booking__paid_at__month
- , subq_17.booking__paid_at__quarter
- , subq_17.booking__paid_at__year
- , subq_17.booking__paid_at__extract_year
- , subq_17.booking__paid_at__extract_quarter
- , subq_17.booking__paid_at__extract_month
- , subq_17.booking__paid_at__extract_day
- , subq_17.booking__paid_at__extract_dow
- , subq_17.booking__paid_at__extract_doy
- , subq_17.ds__day AS metric_time__day
- , subq_17.ds__week AS metric_time__week
- , subq_17.ds__month AS metric_time__month
- , subq_17.ds__quarter AS metric_time__quarter
- , subq_17.ds__year AS metric_time__year
- , subq_17.ds__extract_year AS metric_time__extract_year
- , subq_17.ds__extract_quarter AS metric_time__extract_quarter
- , subq_17.ds__extract_month AS metric_time__extract_month
- , subq_17.ds__extract_day AS metric_time__extract_day
- , subq_17.ds__extract_dow AS metric_time__extract_dow
- , subq_17.ds__extract_doy AS metric_time__extract_doy
- , subq_17.listing
- , subq_17.guest
- , subq_17.host
- , subq_17.booking__listing
- , subq_17.booking__guest
- , subq_17.booking__host
- , subq_17.is_instant
- , subq_17.booking__is_instant
- , subq_17.bookings
- , subq_17.instant_bookings
- , subq_17.booking_value
- , subq_17.max_booking_value
- , subq_17.min_booking_value
- , subq_17.bookers
- , subq_17.average_booking_value
- , subq_17.referred_bookings
- , subq_17.median_booking_value
- , subq_17.booking_value_p99
- , subq_17.discrete_booking_value_p99
- , subq_17.approximate_continuous_booking_value_p99
- , subq_17.approximate_discrete_booking_value_p99
+ subq_26.ds__day
+ , subq_26.ds__week
+ , subq_26.ds__month
+ , subq_26.ds__quarter
+ , subq_26.ds__year
+ , subq_26.ds__extract_year
+ , subq_26.ds__extract_quarter
+ , subq_26.ds__extract_month
+ , subq_26.ds__extract_day
+ , subq_26.ds__extract_dow
+ , subq_26.ds__extract_doy
+ , subq_26.ds_partitioned__day
+ , subq_26.ds_partitioned__week
+ , subq_26.ds_partitioned__month
+ , subq_26.ds_partitioned__quarter
+ , subq_26.ds_partitioned__year
+ , subq_26.ds_partitioned__extract_year
+ , subq_26.ds_partitioned__extract_quarter
+ , subq_26.ds_partitioned__extract_month
+ , subq_26.ds_partitioned__extract_day
+ , subq_26.ds_partitioned__extract_dow
+ , subq_26.ds_partitioned__extract_doy
+ , subq_26.paid_at__day
+ , subq_26.paid_at__week
+ , subq_26.paid_at__month
+ , subq_26.paid_at__quarter
+ , subq_26.paid_at__year
+ , subq_26.paid_at__extract_year
+ , subq_26.paid_at__extract_quarter
+ , subq_26.paid_at__extract_month
+ , subq_26.paid_at__extract_day
+ , subq_26.paid_at__extract_dow
+ , subq_26.paid_at__extract_doy
+ , subq_26.booking__ds__day
+ , subq_26.booking__ds__week
+ , subq_26.booking__ds__month
+ , subq_26.booking__ds__quarter
+ , subq_26.booking__ds__year
+ , subq_26.booking__ds__extract_year
+ , subq_26.booking__ds__extract_quarter
+ , subq_26.booking__ds__extract_month
+ , subq_26.booking__ds__extract_day
+ , subq_26.booking__ds__extract_dow
+ , subq_26.booking__ds__extract_doy
+ , subq_26.booking__ds_partitioned__day
+ , subq_26.booking__ds_partitioned__week
+ , subq_26.booking__ds_partitioned__month
+ , subq_26.booking__ds_partitioned__quarter
+ , subq_26.booking__ds_partitioned__year
+ , subq_26.booking__ds_partitioned__extract_year
+ , subq_26.booking__ds_partitioned__extract_quarter
+ , subq_26.booking__ds_partitioned__extract_month
+ , subq_26.booking__ds_partitioned__extract_day
+ , subq_26.booking__ds_partitioned__extract_dow
+ , subq_26.booking__ds_partitioned__extract_doy
+ , subq_26.booking__paid_at__day
+ , subq_26.booking__paid_at__week
+ , subq_26.booking__paid_at__month
+ , subq_26.booking__paid_at__quarter
+ , subq_26.booking__paid_at__year
+ , subq_26.booking__paid_at__extract_year
+ , subq_26.booking__paid_at__extract_quarter
+ , subq_26.booking__paid_at__extract_month
+ , subq_26.booking__paid_at__extract_day
+ , subq_26.booking__paid_at__extract_dow
+ , subq_26.booking__paid_at__extract_doy
+ , subq_26.ds__day AS metric_time__day
+ , subq_26.ds__week AS metric_time__week
+ , subq_26.ds__month AS metric_time__month
+ , subq_26.ds__quarter AS metric_time__quarter
+ , subq_26.ds__year AS metric_time__year
+ , subq_26.ds__extract_year AS metric_time__extract_year
+ , subq_26.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_26.ds__extract_month AS metric_time__extract_month
+ , subq_26.ds__extract_day AS metric_time__extract_day
+ , subq_26.ds__extract_dow AS metric_time__extract_dow
+ , subq_26.ds__extract_doy AS metric_time__extract_doy
+ , subq_26.listing
+ , subq_26.guest
+ , subq_26.host
+ , subq_26.booking__listing
+ , subq_26.booking__guest
+ , subq_26.booking__host
+ , subq_26.is_instant
+ , subq_26.booking__is_instant
+ , subq_26.bookings
+ , subq_26.instant_bookings
+ , subq_26.booking_value
+ , subq_26.max_booking_value
+ , subq_26.min_booking_value
+ , subq_26.bookers
+ , subq_26.average_booking_value
+ , subq_26.referred_bookings
+ , subq_26.median_booking_value
+ , subq_26.booking_value_p99
+ , subq_26.discrete_booking_value_p99
+ , subq_26.approximate_continuous_booking_value_p99
+ , subq_26.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_17
- ) subq_18
- ) subq_19
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_26
+ ) subq_27
+ ) subq_28
GROUP BY
- subq_19.metric_time__day
- ) subq_20
- ) subq_21
+ subq_28.metric_time__day
+ ) subq_29
+ ) subq_30
ON
- COALESCE(subq_11.metric_time__day, subq_16.metric_time__day) = subq_21.metric_time__day
+ COALESCE(subq_20.metric_time__day, subq_25.metric_time__day) = subq_30.metric_time__day
GROUP BY
- COALESCE(subq_11.metric_time__day, subq_16.metric_time__day, subq_21.metric_time__day)
-) subq_22
+ COALESCE(subq_20.metric_time__day, subq_25.metric_time__day, subq_30.metric_time__day)
+) subq_31
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_derived_metric__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_derived_metric__plan0_optimized.sql
index 78837fdd96..da1e9fdd5a 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_derived_metric__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_derived_metric__plan0_optimized.sql
@@ -5,10 +5,10 @@ SELECT
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_34.metric_time__day, subq_39.metric_time__day, subq_44.metric_time__day) AS metric_time__day
- , MAX(subq_34.non_referred) AS non_referred
- , MAX(subq_39.instant) AS instant
- , MAX(subq_44.bookings) AS bookings
+ COALESCE(subq_43.metric_time__day, subq_48.metric_time__day, subq_53.metric_time__day) AS metric_time__day
+ , MAX(subq_43.non_referred) AS non_referred
+ , MAX(subq_48.instant) AS instant
+ , MAX(subq_53.bookings) AS bookings
FROM (
-- Compute Metrics via Expressions
SELECT
@@ -17,9 +17,9 @@ FROM (
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_27.metric_time__day, subq_32.metric_time__day) AS metric_time__day
- , MAX(subq_27.ref_bookings) AS ref_bookings
- , MAX(subq_32.bookings) AS bookings
+ COALESCE(subq_36.metric_time__day, subq_41.metric_time__day) AS metric_time__day
+ , MAX(subq_36.ref_bookings) AS ref_bookings
+ , MAX(subq_41.bookings) AS bookings
FROM (
-- Aggregate Measures
-- Compute Metrics via Expressions
@@ -33,11 +33,11 @@ FROM (
SELECT
DATE_TRUNC('day', ds) 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_28001
- ) subq_25
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_34
GROUP BY
metric_time__day
- ) subq_27
+ ) subq_36
FULL OUTER JOIN (
-- Aggregate Measures
-- Compute Metrics via Expressions
@@ -51,17 +51,17 @@ FROM (
SELECT
DATE_TRUNC('day', ds) AS metric_time__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_30
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_39
GROUP BY
metric_time__day
- ) subq_32
+ ) subq_41
ON
- subq_27.metric_time__day = subq_32.metric_time__day
+ subq_36.metric_time__day = subq_41.metric_time__day
GROUP BY
- COALESCE(subq_27.metric_time__day, subq_32.metric_time__day)
- ) subq_33
- ) subq_34
+ COALESCE(subq_36.metric_time__day, subq_41.metric_time__day)
+ ) subq_42
+ ) subq_43
FULL OUTER JOIN (
-- Aggregate Measures
-- Compute Metrics via Expressions
@@ -75,13 +75,13 @@ FROM (
SELECT
DATE_TRUNC('day', ds) AS metric_time__day
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_37
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_46
GROUP BY
metric_time__day
- ) subq_39
+ ) subq_48
ON
- subq_34.metric_time__day = subq_39.metric_time__day
+ subq_43.metric_time__day = subq_48.metric_time__day
FULL OUTER JOIN (
-- Aggregate Measures
-- Compute Metrics via Expressions
@@ -95,13 +95,13 @@ FROM (
SELECT
DATE_TRUNC('day', ds) AS metric_time__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_42
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_51
GROUP BY
metric_time__day
- ) subq_44
+ ) subq_53
ON
- COALESCE(subq_34.metric_time__day, subq_39.metric_time__day) = subq_44.metric_time__day
+ COALESCE(subq_43.metric_time__day, subq_48.metric_time__day) = subq_53.metric_time__day
GROUP BY
- COALESCE(subq_34.metric_time__day, subq_39.metric_time__day, subq_44.metric_time__day)
-) subq_45
+ COALESCE(subq_43.metric_time__day, subq_48.metric_time__day, subq_53.metric_time__day)
+) subq_54
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0.sql
index ded26bc259..d7b7936597 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0.sql
@@ -1,359 +1,359 @@
-- Compute Metrics via Expressions
SELECT
- subq_13.metric_time__day
+ subq_22.metric_time__day
, 2 * bookings_offset_once AS bookings_offset_twice
FROM (
-- Pass Only Elements: ['metric_time__day', 'bookings_offset_once']
SELECT
- subq_12.metric_time__day
- , subq_12.bookings_offset_once
+ subq_21.metric_time__day
+ , subq_21.bookings_offset_once
FROM (
-- Constrain Output with WHERE
SELECT
- subq_11.metric_time__day
- , subq_11.booking__is_instant
- , subq_11.bookings_offset_once
+ subq_20.metric_time__day
+ , subq_20.booking__is_instant
+ , subq_20.bookings_offset_once
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_9.metric_time__day AS metric_time__day
- , subq_8.booking__is_instant AS booking__is_instant
- , subq_8.bookings_offset_once AS bookings_offset_once
+ subq_18.metric_time__day AS metric_time__day
+ , subq_17.booking__is_instant AS booking__is_instant
+ , subq_17.bookings_offset_once AS bookings_offset_once
FROM (
-- Time Spine
SELECT
- subq_10.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_10
- ) subq_9
+ subq_19.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_19
+ ) subq_18
INNER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_7.metric_time__day
- , subq_7.booking__is_instant
+ subq_16.metric_time__day
+ , subq_16.booking__is_instant
, 2 * bookings AS bookings_offset_once
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_6.metric_time__day
- , subq_6.booking__is_instant
- , subq_6.bookings
+ subq_15.metric_time__day
+ , subq_15.booking__is_instant
+ , subq_15.bookings
FROM (
-- Aggregate Measures
SELECT
- subq_5.metric_time__day
- , subq_5.booking__is_instant
- , SUM(subq_5.bookings) AS bookings
+ subq_14.metric_time__day
+ , subq_14.booking__is_instant
+ , SUM(subq_14.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day']
SELECT
- subq_4.metric_time__day
- , subq_4.booking__is_instant
- , subq_4.bookings
+ subq_13.metric_time__day
+ , subq_13.booking__is_instant
+ , subq_13.bookings
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_2.metric_time__day AS metric_time__day
- , subq_1.ds__day AS ds__day
- , subq_1.ds__week AS ds__week
- , subq_1.ds__month AS ds__month
- , subq_1.ds__quarter AS ds__quarter
- , subq_1.ds__year AS ds__year
- , subq_1.ds__extract_year AS ds__extract_year
- , subq_1.ds__extract_quarter AS ds__extract_quarter
- , subq_1.ds__extract_month AS ds__extract_month
- , subq_1.ds__extract_day AS ds__extract_day
- , subq_1.ds__extract_dow AS ds__extract_dow
- , subq_1.ds__extract_doy AS ds__extract_doy
- , subq_1.ds_partitioned__day AS ds_partitioned__day
- , subq_1.ds_partitioned__week AS ds_partitioned__week
- , subq_1.ds_partitioned__month AS ds_partitioned__month
- , subq_1.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_1.ds_partitioned__year AS ds_partitioned__year
- , subq_1.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_1.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_1.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_1.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_1.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_1.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_1.paid_at__day AS paid_at__day
- , subq_1.paid_at__week AS paid_at__week
- , subq_1.paid_at__month AS paid_at__month
- , subq_1.paid_at__quarter AS paid_at__quarter
- , subq_1.paid_at__year AS paid_at__year
- , subq_1.paid_at__extract_year AS paid_at__extract_year
- , subq_1.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_1.paid_at__extract_month AS paid_at__extract_month
- , subq_1.paid_at__extract_day AS paid_at__extract_day
- , subq_1.paid_at__extract_dow AS paid_at__extract_dow
- , subq_1.paid_at__extract_doy AS paid_at__extract_doy
- , subq_1.booking__ds__day AS booking__ds__day
- , subq_1.booking__ds__week AS booking__ds__week
- , subq_1.booking__ds__month AS booking__ds__month
- , subq_1.booking__ds__quarter AS booking__ds__quarter
- , subq_1.booking__ds__year AS booking__ds__year
- , subq_1.booking__ds__extract_year AS booking__ds__extract_year
- , subq_1.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_1.booking__ds__extract_month AS booking__ds__extract_month
- , subq_1.booking__ds__extract_day AS booking__ds__extract_day
- , subq_1.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_1.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_1.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_1.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_1.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_1.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_1.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_1.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_1.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_1.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_1.booking__paid_at__day AS booking__paid_at__day
- , subq_1.booking__paid_at__week AS booking__paid_at__week
- , subq_1.booking__paid_at__month AS booking__paid_at__month
- , subq_1.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_1.booking__paid_at__year AS booking__paid_at__year
- , subq_1.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_1.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_1.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_1.listing AS listing
- , subq_1.guest AS guest
- , subq_1.host AS host
- , subq_1.booking__listing AS booking__listing
- , subq_1.booking__guest AS booking__guest
- , subq_1.booking__host AS booking__host
- , subq_1.is_instant AS is_instant
- , subq_1.booking__is_instant AS booking__is_instant
- , subq_1.bookings AS bookings
- , subq_1.instant_bookings AS instant_bookings
- , subq_1.booking_value AS booking_value
- , subq_1.max_booking_value AS max_booking_value
- , subq_1.min_booking_value AS min_booking_value
- , subq_1.bookers AS bookers
- , subq_1.average_booking_value AS average_booking_value
- , subq_1.referred_bookings AS referred_bookings
- , subq_1.median_booking_value AS median_booking_value
- , subq_1.booking_value_p99 AS booking_value_p99
- , subq_1.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_1.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_1.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ subq_11.metric_time__day AS metric_time__day
+ , subq_10.ds__day AS ds__day
+ , subq_10.ds__week AS ds__week
+ , subq_10.ds__month AS ds__month
+ , subq_10.ds__quarter AS ds__quarter
+ , subq_10.ds__year AS ds__year
+ , subq_10.ds__extract_year AS ds__extract_year
+ , subq_10.ds__extract_quarter AS ds__extract_quarter
+ , subq_10.ds__extract_month AS ds__extract_month
+ , subq_10.ds__extract_day AS ds__extract_day
+ , subq_10.ds__extract_dow AS ds__extract_dow
+ , subq_10.ds__extract_doy AS ds__extract_doy
+ , subq_10.ds_partitioned__day AS ds_partitioned__day
+ , subq_10.ds_partitioned__week AS ds_partitioned__week
+ , subq_10.ds_partitioned__month AS ds_partitioned__month
+ , subq_10.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_10.ds_partitioned__year AS ds_partitioned__year
+ , subq_10.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_10.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_10.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_10.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_10.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_10.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_10.paid_at__day AS paid_at__day
+ , subq_10.paid_at__week AS paid_at__week
+ , subq_10.paid_at__month AS paid_at__month
+ , subq_10.paid_at__quarter AS paid_at__quarter
+ , subq_10.paid_at__year AS paid_at__year
+ , subq_10.paid_at__extract_year AS paid_at__extract_year
+ , subq_10.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_10.paid_at__extract_month AS paid_at__extract_month
+ , subq_10.paid_at__extract_day AS paid_at__extract_day
+ , subq_10.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_10.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_10.booking__ds__day AS booking__ds__day
+ , subq_10.booking__ds__week AS booking__ds__week
+ , subq_10.booking__ds__month AS booking__ds__month
+ , subq_10.booking__ds__quarter AS booking__ds__quarter
+ , subq_10.booking__ds__year AS booking__ds__year
+ , subq_10.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_10.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_10.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_10.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_10.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_10.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_10.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_10.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_10.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_10.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_10.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_10.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_10.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_10.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_10.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_10.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_10.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_10.booking__paid_at__day AS booking__paid_at__day
+ , subq_10.booking__paid_at__week AS booking__paid_at__week
+ , subq_10.booking__paid_at__month AS booking__paid_at__month
+ , subq_10.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_10.booking__paid_at__year AS booking__paid_at__year
+ , subq_10.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_10.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_10.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_10.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_10.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_10.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_10.listing AS listing
+ , subq_10.guest AS guest
+ , subq_10.host AS host
+ , subq_10.booking__listing AS booking__listing
+ , subq_10.booking__guest AS booking__guest
+ , subq_10.booking__host AS booking__host
+ , subq_10.is_instant AS is_instant
+ , subq_10.booking__is_instant AS booking__is_instant
+ , subq_10.bookings AS bookings
+ , subq_10.instant_bookings AS instant_bookings
+ , subq_10.booking_value AS booking_value
+ , subq_10.max_booking_value AS max_booking_value
+ , subq_10.min_booking_value AS min_booking_value
+ , subq_10.bookers AS bookers
+ , subq_10.average_booking_value AS average_booking_value
+ , subq_10.referred_bookings AS referred_bookings
+ , subq_10.median_booking_value AS median_booking_value
+ , subq_10.booking_value_p99 AS booking_value_p99
+ , subq_10.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_10.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_10.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_3.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_3
- ) subq_2
+ subq_12.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_12
+ ) subq_11
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
ON
- DATEADD(day, -5, subq_2.metric_time__day) = subq_1.metric_time__day
- ) subq_4
- ) subq_5
+ DATEADD(day, -5, subq_11.metric_time__day) = subq_10.metric_time__day
+ ) subq_13
+ ) subq_14
GROUP BY
- subq_5.metric_time__day
- , subq_5.booking__is_instant
- ) subq_6
- ) subq_7
- ) subq_8
+ subq_14.metric_time__day
+ , subq_14.booking__is_instant
+ ) subq_15
+ ) subq_16
+ ) subq_17
ON
- DATEADD(day, -2, subq_9.metric_time__day) = subq_8.metric_time__day
- ) subq_11
+ DATEADD(day, -2, subq_18.metric_time__day) = subq_17.metric_time__day
+ ) subq_20
WHERE booking__is_instant
- ) subq_12
-) subq_13
+ ) subq_21
+) subq_22
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0_optimized.sql
index 611927c9a2..558939c098 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0_optimized.sql
@@ -11,10 +11,10 @@ FROM (
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_24.ds AS metric_time__day
- , subq_22.booking__is_instant AS booking__is_instant
- , subq_22.bookings_offset_once AS bookings_offset_once
- FROM ***************************.mf_time_spine subq_24
+ subq_33.ds AS metric_time__day
+ , subq_31.booking__is_instant AS booking__is_instant
+ , subq_31.bookings_offset_once AS bookings_offset_once
+ FROM ***************************.mf_time_spine subq_33
INNER JOIN (
-- Compute Metrics via Expressions
SELECT
@@ -27,10 +27,10 @@ FROM (
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_17.ds AS metric_time__day
- , subq_15.booking__is_instant AS booking__is_instant
- , SUM(subq_15.bookings) AS bookings
- FROM ***************************.mf_time_spine subq_17
+ subq_26.ds AS metric_time__day
+ , subq_24.booking__is_instant AS booking__is_instant
+ , SUM(subq_24.bookings) AS bookings
+ FROM ***************************.mf_time_spine subq_26
INNER JOIN (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
@@ -38,17 +38,17 @@ FROM (
DATE_TRUNC('day', ds) AS metric_time__day
, is_instant AS booking__is_instant
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_15
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_24
ON
- DATEADD(day, -5, subq_17.ds) = subq_15.metric_time__day
+ DATEADD(day, -5, subq_26.ds) = subq_24.metric_time__day
GROUP BY
- subq_17.ds
- , subq_15.booking__is_instant
- ) subq_21
- ) subq_22
+ subq_26.ds
+ , subq_24.booking__is_instant
+ ) subq_30
+ ) subq_31
ON
- DATEADD(day, -2, subq_24.ds) = subq_22.metric_time__day
- ) subq_25
+ DATEADD(day, -2, subq_33.ds) = subq_31.metric_time__day
+ ) subq_34
WHERE booking__is_instant
-) subq_27
+) subq_36
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0.sql
index b0fa998f59..8188abfa75 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0.sql
@@ -1,471 +1,471 @@
-- Compute Metrics via Expressions
SELECT
- subq_15.metric_time__day
+ subq_24.metric_time__day
, booking_fees - booking_fees_start_of_month AS booking_fees_since_start_of_month
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_8.metric_time__day, subq_14.metric_time__day) AS metric_time__day
- , MAX(subq_8.booking_fees_start_of_month) AS booking_fees_start_of_month
- , MAX(subq_14.booking_fees) AS booking_fees
+ COALESCE(subq_17.metric_time__day, subq_23.metric_time__day) AS metric_time__day
+ , MAX(subq_17.booking_fees_start_of_month) AS booking_fees_start_of_month
+ , MAX(subq_23.booking_fees) AS booking_fees
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_6.metric_time__day AS metric_time__day
- , subq_5.booking_fees_start_of_month AS booking_fees_start_of_month
+ subq_15.metric_time__day AS metric_time__day
+ , subq_14.booking_fees_start_of_month AS booking_fees_start_of_month
FROM (
-- Time Spine
SELECT
- subq_7.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_7
- ) subq_6
+ subq_16.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_16
+ ) subq_15
INNER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_4.metric_time__day
+ subq_13.metric_time__day
, booking_value * 0.05 AS booking_fees_start_of_month
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_3.metric_time__day
- , subq_3.booking_value
+ subq_12.metric_time__day
+ , subq_12.booking_value
FROM (
-- Aggregate Measures
SELECT
- subq_2.metric_time__day
- , SUM(subq_2.booking_value) AS booking_value
+ subq_11.metric_time__day
+ , SUM(subq_11.booking_value) AS booking_value
FROM (
-- Pass Only Elements: ['booking_value', 'metric_time__day']
SELECT
- subq_1.metric_time__day
- , subq_1.booking_value
+ subq_10.metric_time__day
+ , subq_10.booking_value
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
- ) subq_2
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
GROUP BY
- subq_2.metric_time__day
- ) subq_3
- ) subq_4
- ) subq_5
+ subq_11.metric_time__day
+ ) subq_12
+ ) subq_13
+ ) subq_14
ON
- DATE_TRUNC('month', subq_6.metric_time__day) = subq_5.metric_time__day
- ) subq_8
+ DATE_TRUNC('month', subq_15.metric_time__day) = subq_14.metric_time__day
+ ) subq_17
FULL OUTER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_13.metric_time__day
+ subq_22.metric_time__day
, booking_value * 0.05 AS booking_fees
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_12.metric_time__day
- , subq_12.booking_value
+ subq_21.metric_time__day
+ , subq_21.booking_value
FROM (
-- Aggregate Measures
SELECT
- subq_11.metric_time__day
- , SUM(subq_11.booking_value) AS booking_value
+ subq_20.metric_time__day
+ , SUM(subq_20.booking_value) AS booking_value
FROM (
-- Pass Only Elements: ['booking_value', 'metric_time__day']
SELECT
- subq_10.metric_time__day
- , subq_10.booking_value
+ subq_19.metric_time__day
+ , subq_19.booking_value
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_9.ds__day
- , subq_9.ds__week
- , subq_9.ds__month
- , subq_9.ds__quarter
- , subq_9.ds__year
- , subq_9.ds__extract_year
- , subq_9.ds__extract_quarter
- , subq_9.ds__extract_month
- , subq_9.ds__extract_day
- , subq_9.ds__extract_dow
- , subq_9.ds__extract_doy
- , subq_9.ds_partitioned__day
- , subq_9.ds_partitioned__week
- , subq_9.ds_partitioned__month
- , subq_9.ds_partitioned__quarter
- , subq_9.ds_partitioned__year
- , subq_9.ds_partitioned__extract_year
- , subq_9.ds_partitioned__extract_quarter
- , subq_9.ds_partitioned__extract_month
- , subq_9.ds_partitioned__extract_day
- , subq_9.ds_partitioned__extract_dow
- , subq_9.ds_partitioned__extract_doy
- , subq_9.paid_at__day
- , subq_9.paid_at__week
- , subq_9.paid_at__month
- , subq_9.paid_at__quarter
- , subq_9.paid_at__year
- , subq_9.paid_at__extract_year
- , subq_9.paid_at__extract_quarter
- , subq_9.paid_at__extract_month
- , subq_9.paid_at__extract_day
- , subq_9.paid_at__extract_dow
- , subq_9.paid_at__extract_doy
- , subq_9.booking__ds__day
- , subq_9.booking__ds__week
- , subq_9.booking__ds__month
- , subq_9.booking__ds__quarter
- , subq_9.booking__ds__year
- , subq_9.booking__ds__extract_year
- , subq_9.booking__ds__extract_quarter
- , subq_9.booking__ds__extract_month
- , subq_9.booking__ds__extract_day
- , subq_9.booking__ds__extract_dow
- , subq_9.booking__ds__extract_doy
- , subq_9.booking__ds_partitioned__day
- , subq_9.booking__ds_partitioned__week
- , subq_9.booking__ds_partitioned__month
- , subq_9.booking__ds_partitioned__quarter
- , subq_9.booking__ds_partitioned__year
- , subq_9.booking__ds_partitioned__extract_year
- , subq_9.booking__ds_partitioned__extract_quarter
- , subq_9.booking__ds_partitioned__extract_month
- , subq_9.booking__ds_partitioned__extract_day
- , subq_9.booking__ds_partitioned__extract_dow
- , subq_9.booking__ds_partitioned__extract_doy
- , subq_9.booking__paid_at__day
- , subq_9.booking__paid_at__week
- , subq_9.booking__paid_at__month
- , subq_9.booking__paid_at__quarter
- , subq_9.booking__paid_at__year
- , subq_9.booking__paid_at__extract_year
- , subq_9.booking__paid_at__extract_quarter
- , subq_9.booking__paid_at__extract_month
- , subq_9.booking__paid_at__extract_day
- , subq_9.booking__paid_at__extract_dow
- , subq_9.booking__paid_at__extract_doy
- , subq_9.ds__day AS metric_time__day
- , subq_9.ds__week AS metric_time__week
- , subq_9.ds__month AS metric_time__month
- , subq_9.ds__quarter AS metric_time__quarter
- , subq_9.ds__year AS metric_time__year
- , subq_9.ds__extract_year AS metric_time__extract_year
- , subq_9.ds__extract_quarter AS metric_time__extract_quarter
- , subq_9.ds__extract_month AS metric_time__extract_month
- , subq_9.ds__extract_day AS metric_time__extract_day
- , subq_9.ds__extract_dow AS metric_time__extract_dow
- , subq_9.ds__extract_doy AS metric_time__extract_doy
- , subq_9.listing
- , subq_9.guest
- , subq_9.host
- , subq_9.booking__listing
- , subq_9.booking__guest
- , subq_9.booking__host
- , subq_9.is_instant
- , subq_9.booking__is_instant
- , subq_9.bookings
- , subq_9.instant_bookings
- , subq_9.booking_value
- , subq_9.max_booking_value
- , subq_9.min_booking_value
- , subq_9.bookers
- , subq_9.average_booking_value
- , subq_9.referred_bookings
- , subq_9.median_booking_value
- , subq_9.booking_value_p99
- , subq_9.discrete_booking_value_p99
- , subq_9.approximate_continuous_booking_value_p99
- , subq_9.approximate_discrete_booking_value_p99
+ subq_18.ds__day
+ , subq_18.ds__week
+ , subq_18.ds__month
+ , subq_18.ds__quarter
+ , subq_18.ds__year
+ , subq_18.ds__extract_year
+ , subq_18.ds__extract_quarter
+ , subq_18.ds__extract_month
+ , subq_18.ds__extract_day
+ , subq_18.ds__extract_dow
+ , subq_18.ds__extract_doy
+ , subq_18.ds_partitioned__day
+ , subq_18.ds_partitioned__week
+ , subq_18.ds_partitioned__month
+ , subq_18.ds_partitioned__quarter
+ , subq_18.ds_partitioned__year
+ , subq_18.ds_partitioned__extract_year
+ , subq_18.ds_partitioned__extract_quarter
+ , subq_18.ds_partitioned__extract_month
+ , subq_18.ds_partitioned__extract_day
+ , subq_18.ds_partitioned__extract_dow
+ , subq_18.ds_partitioned__extract_doy
+ , subq_18.paid_at__day
+ , subq_18.paid_at__week
+ , subq_18.paid_at__month
+ , subq_18.paid_at__quarter
+ , subq_18.paid_at__year
+ , subq_18.paid_at__extract_year
+ , subq_18.paid_at__extract_quarter
+ , subq_18.paid_at__extract_month
+ , subq_18.paid_at__extract_day
+ , subq_18.paid_at__extract_dow
+ , subq_18.paid_at__extract_doy
+ , subq_18.booking__ds__day
+ , subq_18.booking__ds__week
+ , subq_18.booking__ds__month
+ , subq_18.booking__ds__quarter
+ , subq_18.booking__ds__year
+ , subq_18.booking__ds__extract_year
+ , subq_18.booking__ds__extract_quarter
+ , subq_18.booking__ds__extract_month
+ , subq_18.booking__ds__extract_day
+ , subq_18.booking__ds__extract_dow
+ , subq_18.booking__ds__extract_doy
+ , subq_18.booking__ds_partitioned__day
+ , subq_18.booking__ds_partitioned__week
+ , subq_18.booking__ds_partitioned__month
+ , subq_18.booking__ds_partitioned__quarter
+ , subq_18.booking__ds_partitioned__year
+ , subq_18.booking__ds_partitioned__extract_year
+ , subq_18.booking__ds_partitioned__extract_quarter
+ , subq_18.booking__ds_partitioned__extract_month
+ , subq_18.booking__ds_partitioned__extract_day
+ , subq_18.booking__ds_partitioned__extract_dow
+ , subq_18.booking__ds_partitioned__extract_doy
+ , subq_18.booking__paid_at__day
+ , subq_18.booking__paid_at__week
+ , subq_18.booking__paid_at__month
+ , subq_18.booking__paid_at__quarter
+ , subq_18.booking__paid_at__year
+ , subq_18.booking__paid_at__extract_year
+ , subq_18.booking__paid_at__extract_quarter
+ , subq_18.booking__paid_at__extract_month
+ , subq_18.booking__paid_at__extract_day
+ , subq_18.booking__paid_at__extract_dow
+ , subq_18.booking__paid_at__extract_doy
+ , subq_18.ds__day AS metric_time__day
+ , subq_18.ds__week AS metric_time__week
+ , subq_18.ds__month AS metric_time__month
+ , subq_18.ds__quarter AS metric_time__quarter
+ , subq_18.ds__year AS metric_time__year
+ , subq_18.ds__extract_year AS metric_time__extract_year
+ , subq_18.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_18.ds__extract_month AS metric_time__extract_month
+ , subq_18.ds__extract_day AS metric_time__extract_day
+ , subq_18.ds__extract_dow AS metric_time__extract_dow
+ , subq_18.ds__extract_doy AS metric_time__extract_doy
+ , subq_18.listing
+ , subq_18.guest
+ , subq_18.host
+ , subq_18.booking__listing
+ , subq_18.booking__guest
+ , subq_18.booking__host
+ , subq_18.is_instant
+ , subq_18.booking__is_instant
+ , subq_18.bookings
+ , subq_18.instant_bookings
+ , subq_18.booking_value
+ , subq_18.max_booking_value
+ , subq_18.min_booking_value
+ , subq_18.bookers
+ , subq_18.average_booking_value
+ , subq_18.referred_bookings
+ , subq_18.median_booking_value
+ , subq_18.booking_value_p99
+ , subq_18.discrete_booking_value_p99
+ , subq_18.approximate_continuous_booking_value_p99
+ , subq_18.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_9
- ) subq_10
- ) subq_11
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_18
+ ) subq_19
+ ) subq_20
GROUP BY
- subq_11.metric_time__day
- ) subq_12
- ) subq_13
- ) subq_14
+ subq_20.metric_time__day
+ ) subq_21
+ ) subq_22
+ ) subq_23
ON
- subq_8.metric_time__day = subq_14.metric_time__day
+ subq_17.metric_time__day = subq_23.metric_time__day
GROUP BY
- COALESCE(subq_8.metric_time__day, subq_14.metric_time__day)
-) subq_15
+ COALESCE(subq_17.metric_time__day, subq_23.metric_time__day)
+) subq_24
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0_optimized.sql
index fc648c54b6..b28105f311 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0_optimized.sql
@@ -5,15 +5,15 @@ SELECT
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_24.metric_time__day, subq_30.metric_time__day) AS metric_time__day
- , MAX(subq_24.booking_fees_start_of_month) AS booking_fees_start_of_month
- , MAX(subq_30.booking_fees) AS booking_fees
+ COALESCE(subq_33.metric_time__day, subq_39.metric_time__day) AS metric_time__day
+ , MAX(subq_33.booking_fees_start_of_month) AS booking_fees_start_of_month
+ , MAX(subq_39.booking_fees) AS booking_fees
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_23.ds AS metric_time__day
- , subq_21.booking_fees_start_of_month AS booking_fees_start_of_month
- FROM ***************************.mf_time_spine subq_23
+ subq_32.ds AS metric_time__day
+ , subq_30.booking_fees_start_of_month AS booking_fees_start_of_month
+ FROM ***************************.mf_time_spine subq_32
INNER JOIN (
-- Compute Metrics via Expressions
SELECT
@@ -28,14 +28,14 @@ FROM (
SELECT
DATE_TRUNC('day', ds) AS metric_time__day
, SUM(booking_value) AS booking_value
- FROM ***************************.fct_bookings bookings_source_src_28001
+ FROM ***************************.fct_bookings bookings_source_src_28000
GROUP BY
DATE_TRUNC('day', ds)
- ) subq_20
- ) subq_21
+ ) subq_29
+ ) subq_30
ON
- DATE_TRUNC('month', subq_23.ds) = subq_21.metric_time__day
- ) subq_24
+ DATE_TRUNC('month', subq_32.ds) = subq_30.metric_time__day
+ ) subq_33
FULL OUTER JOIN (
-- Compute Metrics via Expressions
SELECT
@@ -50,13 +50,13 @@ FROM (
SELECT
DATE_TRUNC('day', ds) AS metric_time__day
, SUM(booking_value) AS booking_value
- FROM ***************************.fct_bookings bookings_source_src_28001
+ FROM ***************************.fct_bookings bookings_source_src_28000
GROUP BY
DATE_TRUNC('day', ds)
- ) subq_29
- ) subq_30
+ ) subq_38
+ ) subq_39
ON
- subq_24.metric_time__day = subq_30.metric_time__day
+ subq_33.metric_time__day = subq_39.metric_time__day
GROUP BY
- COALESCE(subq_24.metric_time__day, subq_30.metric_time__day)
-) subq_31
+ COALESCE(subq_33.metric_time__day, subq_39.metric_time__day)
+) subq_40
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_filters__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_filters__plan0.sql
index eac718f93e..aff0c63eff 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_filters__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_filters__plan0.sql
@@ -8,991 +8,991 @@ FROM (
FROM (
-- Combine Aggregated Outputs
SELECT
- MAX(subq_11.average_booking_value) AS average_booking_value
- , MAX(subq_23.bookings) AS bookings
- , MAX(subq_30.booking_value) AS booking_value
+ MAX(subq_20.average_booking_value) AS average_booking_value
+ , MAX(subq_32.bookings) AS bookings
+ , MAX(subq_39.booking_value) AS booking_value
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_10.average_booking_value
+ subq_19.average_booking_value
FROM (
-- Aggregate Measures
SELECT
- AVG(subq_9.average_booking_value) AS average_booking_value
+ AVG(subq_18.average_booking_value) AS average_booking_value
FROM (
-- Pass Only Elements: ['average_booking_value',]
SELECT
- subq_8.average_booking_value
+ subq_17.average_booking_value
FROM (
-- Constrain Output with WHERE
SELECT
- subq_7.booking__is_instant
- , subq_7.listing__is_lux_latest
- , subq_7.average_booking_value
+ subq_16.booking__is_instant
+ , subq_16.listing__is_lux_latest
+ , subq_16.average_booking_value
FROM (
-- Pass Only Elements: ['average_booking_value', 'listing__is_lux_latest', 'booking__is_instant']
SELECT
- subq_6.booking__is_instant
- , subq_6.listing__is_lux_latest
- , subq_6.average_booking_value
+ subq_15.booking__is_instant
+ , subq_15.listing__is_lux_latest
+ , subq_15.average_booking_value
FROM (
-- Join Standard Outputs
SELECT
- subq_2.listing AS listing
- , subq_2.booking__is_instant AS booking__is_instant
- , subq_5.is_lux_latest AS listing__is_lux_latest
- , subq_2.average_booking_value AS average_booking_value
+ subq_11.listing AS listing
+ , subq_11.booking__is_instant AS booking__is_instant
+ , subq_14.is_lux_latest AS listing__is_lux_latest
+ , subq_11.average_booking_value AS average_booking_value
FROM (
-- Pass Only Elements: ['average_booking_value', 'booking__is_instant', 'listing']
SELECT
- subq_1.listing
- , subq_1.booking__is_instant
- , subq_1.average_booking_value
+ subq_10.listing
+ , subq_10.booking__is_instant
+ , subq_10.average_booking_value
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
- ) subq_2
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
LEFT OUTER JOIN (
-- Pass Only Elements: ['is_lux_latest', 'listing']
SELECT
- subq_4.listing
- , subq_4.is_lux_latest
+ subq_13.listing
+ , subq_13.is_lux_latest
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_3.ds__day
- , subq_3.ds__week
- , subq_3.ds__month
- , subq_3.ds__quarter
- , subq_3.ds__year
- , subq_3.ds__extract_year
- , subq_3.ds__extract_quarter
- , subq_3.ds__extract_month
- , subq_3.ds__extract_day
- , subq_3.ds__extract_dow
- , subq_3.ds__extract_doy
- , subq_3.created_at__day
- , subq_3.created_at__week
- , subq_3.created_at__month
- , subq_3.created_at__quarter
- , subq_3.created_at__year
- , subq_3.created_at__extract_year
- , subq_3.created_at__extract_quarter
- , subq_3.created_at__extract_month
- , subq_3.created_at__extract_day
- , subq_3.created_at__extract_dow
- , subq_3.created_at__extract_doy
- , subq_3.listing__ds__day
- , subq_3.listing__ds__week
- , subq_3.listing__ds__month
- , subq_3.listing__ds__quarter
- , subq_3.listing__ds__year
- , subq_3.listing__ds__extract_year
- , subq_3.listing__ds__extract_quarter
- , subq_3.listing__ds__extract_month
- , subq_3.listing__ds__extract_day
- , subq_3.listing__ds__extract_dow
- , subq_3.listing__ds__extract_doy
- , subq_3.listing__created_at__day
- , subq_3.listing__created_at__week
- , subq_3.listing__created_at__month
- , subq_3.listing__created_at__quarter
- , subq_3.listing__created_at__year
- , subq_3.listing__created_at__extract_year
- , subq_3.listing__created_at__extract_quarter
- , subq_3.listing__created_at__extract_month
- , subq_3.listing__created_at__extract_day
- , subq_3.listing__created_at__extract_dow
- , subq_3.listing__created_at__extract_doy
- , subq_3.ds__day AS metric_time__day
- , subq_3.ds__week AS metric_time__week
- , subq_3.ds__month AS metric_time__month
- , subq_3.ds__quarter AS metric_time__quarter
- , subq_3.ds__year AS metric_time__year
- , subq_3.ds__extract_year AS metric_time__extract_year
- , subq_3.ds__extract_quarter AS metric_time__extract_quarter
- , subq_3.ds__extract_month AS metric_time__extract_month
- , subq_3.ds__extract_day AS metric_time__extract_day
- , subq_3.ds__extract_dow AS metric_time__extract_dow
- , subq_3.ds__extract_doy AS metric_time__extract_doy
- , subq_3.listing
- , subq_3.user
- , subq_3.listing__user
- , subq_3.country_latest
- , subq_3.is_lux_latest
- , subq_3.capacity_latest
- , subq_3.listing__country_latest
- , subq_3.listing__is_lux_latest
- , subq_3.listing__capacity_latest
- , subq_3.listings
- , subq_3.largest_listing
- , subq_3.smallest_listing
+ subq_12.ds__day
+ , subq_12.ds__week
+ , subq_12.ds__month
+ , subq_12.ds__quarter
+ , subq_12.ds__year
+ , subq_12.ds__extract_year
+ , subq_12.ds__extract_quarter
+ , subq_12.ds__extract_month
+ , subq_12.ds__extract_day
+ , subq_12.ds__extract_dow
+ , subq_12.ds__extract_doy
+ , subq_12.created_at__day
+ , subq_12.created_at__week
+ , subq_12.created_at__month
+ , subq_12.created_at__quarter
+ , subq_12.created_at__year
+ , subq_12.created_at__extract_year
+ , subq_12.created_at__extract_quarter
+ , subq_12.created_at__extract_month
+ , subq_12.created_at__extract_day
+ , subq_12.created_at__extract_dow
+ , subq_12.created_at__extract_doy
+ , subq_12.listing__ds__day
+ , subq_12.listing__ds__week
+ , subq_12.listing__ds__month
+ , subq_12.listing__ds__quarter
+ , subq_12.listing__ds__year
+ , subq_12.listing__ds__extract_year
+ , subq_12.listing__ds__extract_quarter
+ , subq_12.listing__ds__extract_month
+ , subq_12.listing__ds__extract_day
+ , subq_12.listing__ds__extract_dow
+ , subq_12.listing__ds__extract_doy
+ , subq_12.listing__created_at__day
+ , subq_12.listing__created_at__week
+ , subq_12.listing__created_at__month
+ , subq_12.listing__created_at__quarter
+ , subq_12.listing__created_at__year
+ , subq_12.listing__created_at__extract_year
+ , subq_12.listing__created_at__extract_quarter
+ , subq_12.listing__created_at__extract_month
+ , subq_12.listing__created_at__extract_day
+ , subq_12.listing__created_at__extract_dow
+ , subq_12.listing__created_at__extract_doy
+ , subq_12.ds__day AS metric_time__day
+ , subq_12.ds__week AS metric_time__week
+ , subq_12.ds__month AS metric_time__month
+ , subq_12.ds__quarter AS metric_time__quarter
+ , subq_12.ds__year AS metric_time__year
+ , subq_12.ds__extract_year AS metric_time__extract_year
+ , subq_12.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_12.ds__extract_month AS metric_time__extract_month
+ , subq_12.ds__extract_day AS metric_time__extract_day
+ , subq_12.ds__extract_dow AS metric_time__extract_dow
+ , subq_12.ds__extract_doy AS metric_time__extract_doy
+ , subq_12.listing
+ , subq_12.user
+ , subq_12.listing__user
+ , subq_12.country_latest
+ , subq_12.is_lux_latest
+ , subq_12.capacity_latest
+ , subq_12.listing__country_latest
+ , subq_12.listing__is_lux_latest
+ , subq_12.listing__capacity_latest
+ , subq_12.listings
+ , subq_12.largest_listing
+ , subq_12.smallest_listing
FROM (
-- Read Elements From Semantic Model 'listings_latest'
SELECT
1 AS listings
- , listings_latest_src_28005.capacity AS largest_listing
- , listings_latest_src_28005.capacity AS smallest_listing
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy
- , listings_latest_src_28005.country AS country_latest
- , listings_latest_src_28005.is_lux AS is_lux_latest
- , listings_latest_src_28005.capacity AS capacity_latest
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy
- , listings_latest_src_28005.country AS listing__country_latest
- , listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , listings_latest_src_28005.capacity AS listing__capacity_latest
- , listings_latest_src_28005.listing_id AS listing
- , listings_latest_src_28005.user_id AS user
- , listings_latest_src_28005.user_id AS listing__user
- FROM ***************************.dim_listings_latest listings_latest_src_28005
- ) subq_3
- ) subq_4
- ) subq_5
+ , listings_latest_src_28000.capacity AS largest_listing
+ , listings_latest_src_28000.capacity AS smallest_listing
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS created_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28000.created_at) AS created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS created_at__extract_doy
+ , 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('day', listings_latest_src_28000.created_at) AS listing__ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28000.created_at) AS listing__ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS listing__created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_doy
+ , listings_latest_src_28000.country AS listing__country_latest
+ , listings_latest_src_28000.is_lux AS listing__is_lux_latest
+ , listings_latest_src_28000.capacity AS listing__capacity_latest
+ , listings_latest_src_28000.listing_id AS listing
+ , listings_latest_src_28000.user_id AS user
+ , listings_latest_src_28000.user_id AS listing__user
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
+ ) subq_12
+ ) subq_13
+ ) subq_14
ON
- subq_2.listing = subq_5.listing
- ) subq_6
- ) subq_7
+ subq_11.listing = subq_14.listing
+ ) subq_15
+ ) subq_16
WHERE (listing__is_lux_latest) AND (booking__is_instant)
- ) subq_8
- ) subq_9
- ) subq_10
- ) subq_11
+ ) subq_17
+ ) subq_18
+ ) subq_19
+ ) subq_20
CROSS JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_22.bookings
+ subq_31.bookings
FROM (
-- Aggregate Measures
SELECT
- SUM(subq_21.bookings) AS bookings
+ SUM(subq_30.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings',]
SELECT
- subq_20.bookings
+ subq_29.bookings
FROM (
-- Constrain Output with WHERE
SELECT
- subq_19.booking__is_instant
- , subq_19.listing__is_lux_latest
- , subq_19.bookings
+ subq_28.booking__is_instant
+ , subq_28.listing__is_lux_latest
+ , subq_28.bookings
FROM (
-- Pass Only Elements: ['bookings', 'listing__is_lux_latest', 'booking__is_instant']
SELECT
- subq_18.booking__is_instant
- , subq_18.listing__is_lux_latest
- , subq_18.bookings
+ subq_27.booking__is_instant
+ , subq_27.listing__is_lux_latest
+ , subq_27.bookings
FROM (
-- Join Standard Outputs
SELECT
- subq_14.listing AS listing
- , subq_14.booking__is_instant AS booking__is_instant
- , subq_17.is_lux_latest AS listing__is_lux_latest
- , subq_14.bookings AS bookings
+ subq_23.listing AS listing
+ , subq_23.booking__is_instant AS booking__is_instant
+ , subq_26.is_lux_latest AS listing__is_lux_latest
+ , subq_23.bookings AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'booking__is_instant', 'listing']
SELECT
- subq_13.listing
- , subq_13.booking__is_instant
- , subq_13.bookings
+ subq_22.listing
+ , subq_22.booking__is_instant
+ , subq_22.bookings
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_12.ds__day
- , subq_12.ds__week
- , subq_12.ds__month
- , subq_12.ds__quarter
- , subq_12.ds__year
- , subq_12.ds__extract_year
- , subq_12.ds__extract_quarter
- , subq_12.ds__extract_month
- , subq_12.ds__extract_day
- , subq_12.ds__extract_dow
- , subq_12.ds__extract_doy
- , subq_12.ds_partitioned__day
- , subq_12.ds_partitioned__week
- , subq_12.ds_partitioned__month
- , subq_12.ds_partitioned__quarter
- , subq_12.ds_partitioned__year
- , subq_12.ds_partitioned__extract_year
- , subq_12.ds_partitioned__extract_quarter
- , subq_12.ds_partitioned__extract_month
- , subq_12.ds_partitioned__extract_day
- , subq_12.ds_partitioned__extract_dow
- , subq_12.ds_partitioned__extract_doy
- , subq_12.paid_at__day
- , subq_12.paid_at__week
- , subq_12.paid_at__month
- , subq_12.paid_at__quarter
- , subq_12.paid_at__year
- , subq_12.paid_at__extract_year
- , subq_12.paid_at__extract_quarter
- , subq_12.paid_at__extract_month
- , subq_12.paid_at__extract_day
- , subq_12.paid_at__extract_dow
- , subq_12.paid_at__extract_doy
- , subq_12.booking__ds__day
- , subq_12.booking__ds__week
- , subq_12.booking__ds__month
- , subq_12.booking__ds__quarter
- , subq_12.booking__ds__year
- , subq_12.booking__ds__extract_year
- , subq_12.booking__ds__extract_quarter
- , subq_12.booking__ds__extract_month
- , subq_12.booking__ds__extract_day
- , subq_12.booking__ds__extract_dow
- , subq_12.booking__ds__extract_doy
- , subq_12.booking__ds_partitioned__day
- , subq_12.booking__ds_partitioned__week
- , subq_12.booking__ds_partitioned__month
- , subq_12.booking__ds_partitioned__quarter
- , subq_12.booking__ds_partitioned__year
- , subq_12.booking__ds_partitioned__extract_year
- , subq_12.booking__ds_partitioned__extract_quarter
- , subq_12.booking__ds_partitioned__extract_month
- , subq_12.booking__ds_partitioned__extract_day
- , subq_12.booking__ds_partitioned__extract_dow
- , subq_12.booking__ds_partitioned__extract_doy
- , subq_12.booking__paid_at__day
- , subq_12.booking__paid_at__week
- , subq_12.booking__paid_at__month
- , subq_12.booking__paid_at__quarter
- , subq_12.booking__paid_at__year
- , subq_12.booking__paid_at__extract_year
- , subq_12.booking__paid_at__extract_quarter
- , subq_12.booking__paid_at__extract_month
- , subq_12.booking__paid_at__extract_day
- , subq_12.booking__paid_at__extract_dow
- , subq_12.booking__paid_at__extract_doy
- , subq_12.ds__day AS metric_time__day
- , subq_12.ds__week AS metric_time__week
- , subq_12.ds__month AS metric_time__month
- , subq_12.ds__quarter AS metric_time__quarter
- , subq_12.ds__year AS metric_time__year
- , subq_12.ds__extract_year AS metric_time__extract_year
- , subq_12.ds__extract_quarter AS metric_time__extract_quarter
- , subq_12.ds__extract_month AS metric_time__extract_month
- , subq_12.ds__extract_day AS metric_time__extract_day
- , subq_12.ds__extract_dow AS metric_time__extract_dow
- , subq_12.ds__extract_doy AS metric_time__extract_doy
- , subq_12.listing
- , subq_12.guest
- , subq_12.host
- , subq_12.booking__listing
- , subq_12.booking__guest
- , subq_12.booking__host
- , subq_12.is_instant
- , subq_12.booking__is_instant
- , subq_12.bookings
- , subq_12.instant_bookings
- , subq_12.booking_value
- , subq_12.max_booking_value
- , subq_12.min_booking_value
- , subq_12.bookers
- , subq_12.average_booking_value
- , subq_12.referred_bookings
- , subq_12.median_booking_value
- , subq_12.booking_value_p99
- , subq_12.discrete_booking_value_p99
- , subq_12.approximate_continuous_booking_value_p99
- , subq_12.approximate_discrete_booking_value_p99
+ subq_21.ds__day
+ , subq_21.ds__week
+ , subq_21.ds__month
+ , subq_21.ds__quarter
+ , subq_21.ds__year
+ , subq_21.ds__extract_year
+ , subq_21.ds__extract_quarter
+ , subq_21.ds__extract_month
+ , subq_21.ds__extract_day
+ , subq_21.ds__extract_dow
+ , subq_21.ds__extract_doy
+ , subq_21.ds_partitioned__day
+ , subq_21.ds_partitioned__week
+ , subq_21.ds_partitioned__month
+ , subq_21.ds_partitioned__quarter
+ , subq_21.ds_partitioned__year
+ , subq_21.ds_partitioned__extract_year
+ , subq_21.ds_partitioned__extract_quarter
+ , subq_21.ds_partitioned__extract_month
+ , subq_21.ds_partitioned__extract_day
+ , subq_21.ds_partitioned__extract_dow
+ , subq_21.ds_partitioned__extract_doy
+ , subq_21.paid_at__day
+ , subq_21.paid_at__week
+ , subq_21.paid_at__month
+ , subq_21.paid_at__quarter
+ , subq_21.paid_at__year
+ , subq_21.paid_at__extract_year
+ , subq_21.paid_at__extract_quarter
+ , subq_21.paid_at__extract_month
+ , subq_21.paid_at__extract_day
+ , subq_21.paid_at__extract_dow
+ , subq_21.paid_at__extract_doy
+ , subq_21.booking__ds__day
+ , subq_21.booking__ds__week
+ , subq_21.booking__ds__month
+ , subq_21.booking__ds__quarter
+ , subq_21.booking__ds__year
+ , subq_21.booking__ds__extract_year
+ , subq_21.booking__ds__extract_quarter
+ , subq_21.booking__ds__extract_month
+ , subq_21.booking__ds__extract_day
+ , subq_21.booking__ds__extract_dow
+ , subq_21.booking__ds__extract_doy
+ , subq_21.booking__ds_partitioned__day
+ , subq_21.booking__ds_partitioned__week
+ , subq_21.booking__ds_partitioned__month
+ , subq_21.booking__ds_partitioned__quarter
+ , subq_21.booking__ds_partitioned__year
+ , subq_21.booking__ds_partitioned__extract_year
+ , subq_21.booking__ds_partitioned__extract_quarter
+ , subq_21.booking__ds_partitioned__extract_month
+ , subq_21.booking__ds_partitioned__extract_day
+ , subq_21.booking__ds_partitioned__extract_dow
+ , subq_21.booking__ds_partitioned__extract_doy
+ , subq_21.booking__paid_at__day
+ , subq_21.booking__paid_at__week
+ , subq_21.booking__paid_at__month
+ , subq_21.booking__paid_at__quarter
+ , subq_21.booking__paid_at__year
+ , subq_21.booking__paid_at__extract_year
+ , subq_21.booking__paid_at__extract_quarter
+ , subq_21.booking__paid_at__extract_month
+ , subq_21.booking__paid_at__extract_day
+ , subq_21.booking__paid_at__extract_dow
+ , subq_21.booking__paid_at__extract_doy
+ , subq_21.ds__day AS metric_time__day
+ , subq_21.ds__week AS metric_time__week
+ , subq_21.ds__month AS metric_time__month
+ , subq_21.ds__quarter AS metric_time__quarter
+ , subq_21.ds__year AS metric_time__year
+ , subq_21.ds__extract_year AS metric_time__extract_year
+ , subq_21.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_21.ds__extract_month AS metric_time__extract_month
+ , subq_21.ds__extract_day AS metric_time__extract_day
+ , subq_21.ds__extract_dow AS metric_time__extract_dow
+ , subq_21.ds__extract_doy AS metric_time__extract_doy
+ , subq_21.listing
+ , subq_21.guest
+ , subq_21.host
+ , subq_21.booking__listing
+ , subq_21.booking__guest
+ , subq_21.booking__host
+ , subq_21.is_instant
+ , subq_21.booking__is_instant
+ , subq_21.bookings
+ , subq_21.instant_bookings
+ , subq_21.booking_value
+ , subq_21.max_booking_value
+ , subq_21.min_booking_value
+ , subq_21.bookers
+ , subq_21.average_booking_value
+ , subq_21.referred_bookings
+ , subq_21.median_booking_value
+ , subq_21.booking_value_p99
+ , subq_21.discrete_booking_value_p99
+ , subq_21.approximate_continuous_booking_value_p99
+ , subq_21.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_12
- ) subq_13
- ) subq_14
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_21
+ ) subq_22
+ ) subq_23
LEFT OUTER JOIN (
-- Pass Only Elements: ['is_lux_latest', 'listing']
SELECT
- subq_16.listing
- , subq_16.is_lux_latest
+ subq_25.listing
+ , subq_25.is_lux_latest
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_15.ds__day
- , subq_15.ds__week
- , subq_15.ds__month
- , subq_15.ds__quarter
- , subq_15.ds__year
- , subq_15.ds__extract_year
- , subq_15.ds__extract_quarter
- , subq_15.ds__extract_month
- , subq_15.ds__extract_day
- , subq_15.ds__extract_dow
- , subq_15.ds__extract_doy
- , subq_15.created_at__day
- , subq_15.created_at__week
- , subq_15.created_at__month
- , subq_15.created_at__quarter
- , subq_15.created_at__year
- , subq_15.created_at__extract_year
- , subq_15.created_at__extract_quarter
- , subq_15.created_at__extract_month
- , subq_15.created_at__extract_day
- , subq_15.created_at__extract_dow
- , subq_15.created_at__extract_doy
- , subq_15.listing__ds__day
- , subq_15.listing__ds__week
- , subq_15.listing__ds__month
- , subq_15.listing__ds__quarter
- , subq_15.listing__ds__year
- , subq_15.listing__ds__extract_year
- , subq_15.listing__ds__extract_quarter
- , subq_15.listing__ds__extract_month
- , subq_15.listing__ds__extract_day
- , subq_15.listing__ds__extract_dow
- , subq_15.listing__ds__extract_doy
- , subq_15.listing__created_at__day
- , subq_15.listing__created_at__week
- , subq_15.listing__created_at__month
- , subq_15.listing__created_at__quarter
- , subq_15.listing__created_at__year
- , subq_15.listing__created_at__extract_year
- , subq_15.listing__created_at__extract_quarter
- , subq_15.listing__created_at__extract_month
- , subq_15.listing__created_at__extract_day
- , subq_15.listing__created_at__extract_dow
- , subq_15.listing__created_at__extract_doy
- , subq_15.ds__day AS metric_time__day
- , subq_15.ds__week AS metric_time__week
- , subq_15.ds__month AS metric_time__month
- , subq_15.ds__quarter AS metric_time__quarter
- , subq_15.ds__year AS metric_time__year
- , subq_15.ds__extract_year AS metric_time__extract_year
- , subq_15.ds__extract_quarter AS metric_time__extract_quarter
- , subq_15.ds__extract_month AS metric_time__extract_month
- , subq_15.ds__extract_day AS metric_time__extract_day
- , subq_15.ds__extract_dow AS metric_time__extract_dow
- , subq_15.ds__extract_doy AS metric_time__extract_doy
- , subq_15.listing
- , subq_15.user
- , subq_15.listing__user
- , subq_15.country_latest
- , subq_15.is_lux_latest
- , subq_15.capacity_latest
- , subq_15.listing__country_latest
- , subq_15.listing__is_lux_latest
- , subq_15.listing__capacity_latest
- , subq_15.listings
- , subq_15.largest_listing
- , subq_15.smallest_listing
+ subq_24.ds__day
+ , subq_24.ds__week
+ , subq_24.ds__month
+ , subq_24.ds__quarter
+ , subq_24.ds__year
+ , subq_24.ds__extract_year
+ , subq_24.ds__extract_quarter
+ , subq_24.ds__extract_month
+ , subq_24.ds__extract_day
+ , subq_24.ds__extract_dow
+ , subq_24.ds__extract_doy
+ , subq_24.created_at__day
+ , subq_24.created_at__week
+ , subq_24.created_at__month
+ , subq_24.created_at__quarter
+ , subq_24.created_at__year
+ , subq_24.created_at__extract_year
+ , subq_24.created_at__extract_quarter
+ , subq_24.created_at__extract_month
+ , subq_24.created_at__extract_day
+ , subq_24.created_at__extract_dow
+ , subq_24.created_at__extract_doy
+ , subq_24.listing__ds__day
+ , subq_24.listing__ds__week
+ , subq_24.listing__ds__month
+ , subq_24.listing__ds__quarter
+ , subq_24.listing__ds__year
+ , subq_24.listing__ds__extract_year
+ , subq_24.listing__ds__extract_quarter
+ , subq_24.listing__ds__extract_month
+ , subq_24.listing__ds__extract_day
+ , subq_24.listing__ds__extract_dow
+ , subq_24.listing__ds__extract_doy
+ , subq_24.listing__created_at__day
+ , subq_24.listing__created_at__week
+ , subq_24.listing__created_at__month
+ , subq_24.listing__created_at__quarter
+ , subq_24.listing__created_at__year
+ , subq_24.listing__created_at__extract_year
+ , subq_24.listing__created_at__extract_quarter
+ , subq_24.listing__created_at__extract_month
+ , subq_24.listing__created_at__extract_day
+ , subq_24.listing__created_at__extract_dow
+ , subq_24.listing__created_at__extract_doy
+ , subq_24.ds__day AS metric_time__day
+ , subq_24.ds__week AS metric_time__week
+ , subq_24.ds__month AS metric_time__month
+ , subq_24.ds__quarter AS metric_time__quarter
+ , subq_24.ds__year AS metric_time__year
+ , subq_24.ds__extract_year AS metric_time__extract_year
+ , subq_24.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_24.ds__extract_month AS metric_time__extract_month
+ , subq_24.ds__extract_day AS metric_time__extract_day
+ , subq_24.ds__extract_dow AS metric_time__extract_dow
+ , subq_24.ds__extract_doy AS metric_time__extract_doy
+ , subq_24.listing
+ , subq_24.user
+ , subq_24.listing__user
+ , subq_24.country_latest
+ , subq_24.is_lux_latest
+ , subq_24.capacity_latest
+ , subq_24.listing__country_latest
+ , subq_24.listing__is_lux_latest
+ , subq_24.listing__capacity_latest
+ , subq_24.listings
+ , subq_24.largest_listing
+ , subq_24.smallest_listing
FROM (
-- Read Elements From Semantic Model 'listings_latest'
SELECT
1 AS listings
- , listings_latest_src_28005.capacity AS largest_listing
- , listings_latest_src_28005.capacity AS smallest_listing
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy
- , listings_latest_src_28005.country AS country_latest
- , listings_latest_src_28005.is_lux AS is_lux_latest
- , listings_latest_src_28005.capacity AS capacity_latest
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy
- , listings_latest_src_28005.country AS listing__country_latest
- , listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , listings_latest_src_28005.capacity AS listing__capacity_latest
- , listings_latest_src_28005.listing_id AS listing
- , listings_latest_src_28005.user_id AS user
- , listings_latest_src_28005.user_id AS listing__user
- FROM ***************************.dim_listings_latest listings_latest_src_28005
- ) subq_15
- ) subq_16
- ) subq_17
+ , listings_latest_src_28000.capacity AS largest_listing
+ , listings_latest_src_28000.capacity AS smallest_listing
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS created_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28000.created_at) AS created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS created_at__extract_doy
+ , 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('day', listings_latest_src_28000.created_at) AS listing__ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28000.created_at) AS listing__ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS listing__created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_doy
+ , listings_latest_src_28000.country AS listing__country_latest
+ , listings_latest_src_28000.is_lux AS listing__is_lux_latest
+ , listings_latest_src_28000.capacity AS listing__capacity_latest
+ , listings_latest_src_28000.listing_id AS listing
+ , listings_latest_src_28000.user_id AS user
+ , listings_latest_src_28000.user_id AS listing__user
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
+ ) subq_24
+ ) subq_25
+ ) subq_26
ON
- subq_14.listing = subq_17.listing
- ) subq_18
- ) subq_19
+ subq_23.listing = subq_26.listing
+ ) subq_27
+ ) subq_28
WHERE (listing__is_lux_latest) AND (booking__is_instant)
- ) subq_20
- ) subq_21
- ) subq_22
- ) subq_23
+ ) subq_29
+ ) subq_30
+ ) subq_31
+ ) subq_32
CROSS JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_29.booking_value
+ subq_38.booking_value
FROM (
-- Aggregate Measures
SELECT
- SUM(subq_28.booking_value) AS booking_value
+ SUM(subq_37.booking_value) AS booking_value
FROM (
-- Pass Only Elements: ['booking_value',]
SELECT
- subq_27.booking_value
+ subq_36.booking_value
FROM (
-- Constrain Output with WHERE
SELECT
- subq_26.booking__is_instant
- , subq_26.booking_value
+ subq_35.booking__is_instant
+ , subq_35.booking_value
FROM (
-- Pass Only Elements: ['booking_value', 'booking__is_instant']
SELECT
- subq_25.booking__is_instant
- , subq_25.booking_value
+ subq_34.booking__is_instant
+ , subq_34.booking_value
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_24.ds__day
- , subq_24.ds__week
- , subq_24.ds__month
- , subq_24.ds__quarter
- , subq_24.ds__year
- , subq_24.ds__extract_year
- , subq_24.ds__extract_quarter
- , subq_24.ds__extract_month
- , subq_24.ds__extract_day
- , subq_24.ds__extract_dow
- , subq_24.ds__extract_doy
- , subq_24.ds_partitioned__day
- , subq_24.ds_partitioned__week
- , subq_24.ds_partitioned__month
- , subq_24.ds_partitioned__quarter
- , subq_24.ds_partitioned__year
- , subq_24.ds_partitioned__extract_year
- , subq_24.ds_partitioned__extract_quarter
- , subq_24.ds_partitioned__extract_month
- , subq_24.ds_partitioned__extract_day
- , subq_24.ds_partitioned__extract_dow
- , subq_24.ds_partitioned__extract_doy
- , subq_24.paid_at__day
- , subq_24.paid_at__week
- , subq_24.paid_at__month
- , subq_24.paid_at__quarter
- , subq_24.paid_at__year
- , subq_24.paid_at__extract_year
- , subq_24.paid_at__extract_quarter
- , subq_24.paid_at__extract_month
- , subq_24.paid_at__extract_day
- , subq_24.paid_at__extract_dow
- , subq_24.paid_at__extract_doy
- , subq_24.booking__ds__day
- , subq_24.booking__ds__week
- , subq_24.booking__ds__month
- , subq_24.booking__ds__quarter
- , subq_24.booking__ds__year
- , subq_24.booking__ds__extract_year
- , subq_24.booking__ds__extract_quarter
- , subq_24.booking__ds__extract_month
- , subq_24.booking__ds__extract_day
- , subq_24.booking__ds__extract_dow
- , subq_24.booking__ds__extract_doy
- , subq_24.booking__ds_partitioned__day
- , subq_24.booking__ds_partitioned__week
- , subq_24.booking__ds_partitioned__month
- , subq_24.booking__ds_partitioned__quarter
- , subq_24.booking__ds_partitioned__year
- , subq_24.booking__ds_partitioned__extract_year
- , subq_24.booking__ds_partitioned__extract_quarter
- , subq_24.booking__ds_partitioned__extract_month
- , subq_24.booking__ds_partitioned__extract_day
- , subq_24.booking__ds_partitioned__extract_dow
- , subq_24.booking__ds_partitioned__extract_doy
- , subq_24.booking__paid_at__day
- , subq_24.booking__paid_at__week
- , subq_24.booking__paid_at__month
- , subq_24.booking__paid_at__quarter
- , subq_24.booking__paid_at__year
- , subq_24.booking__paid_at__extract_year
- , subq_24.booking__paid_at__extract_quarter
- , subq_24.booking__paid_at__extract_month
- , subq_24.booking__paid_at__extract_day
- , subq_24.booking__paid_at__extract_dow
- , subq_24.booking__paid_at__extract_doy
- , subq_24.ds__day AS metric_time__day
- , subq_24.ds__week AS metric_time__week
- , subq_24.ds__month AS metric_time__month
- , subq_24.ds__quarter AS metric_time__quarter
- , subq_24.ds__year AS metric_time__year
- , subq_24.ds__extract_year AS metric_time__extract_year
- , subq_24.ds__extract_quarter AS metric_time__extract_quarter
- , subq_24.ds__extract_month AS metric_time__extract_month
- , subq_24.ds__extract_day AS metric_time__extract_day
- , subq_24.ds__extract_dow AS metric_time__extract_dow
- , subq_24.ds__extract_doy AS metric_time__extract_doy
- , subq_24.listing
- , subq_24.guest
- , subq_24.host
- , subq_24.booking__listing
- , subq_24.booking__guest
- , subq_24.booking__host
- , subq_24.is_instant
- , subq_24.booking__is_instant
- , subq_24.bookings
- , subq_24.instant_bookings
- , subq_24.booking_value
- , subq_24.max_booking_value
- , subq_24.min_booking_value
- , subq_24.bookers
- , subq_24.average_booking_value
- , subq_24.referred_bookings
- , subq_24.median_booking_value
- , subq_24.booking_value_p99
- , subq_24.discrete_booking_value_p99
- , subq_24.approximate_continuous_booking_value_p99
- , subq_24.approximate_discrete_booking_value_p99
+ subq_33.ds__day
+ , subq_33.ds__week
+ , subq_33.ds__month
+ , subq_33.ds__quarter
+ , subq_33.ds__year
+ , subq_33.ds__extract_year
+ , subq_33.ds__extract_quarter
+ , subq_33.ds__extract_month
+ , subq_33.ds__extract_day
+ , subq_33.ds__extract_dow
+ , subq_33.ds__extract_doy
+ , subq_33.ds_partitioned__day
+ , subq_33.ds_partitioned__week
+ , subq_33.ds_partitioned__month
+ , subq_33.ds_partitioned__quarter
+ , subq_33.ds_partitioned__year
+ , subq_33.ds_partitioned__extract_year
+ , subq_33.ds_partitioned__extract_quarter
+ , subq_33.ds_partitioned__extract_month
+ , subq_33.ds_partitioned__extract_day
+ , subq_33.ds_partitioned__extract_dow
+ , subq_33.ds_partitioned__extract_doy
+ , subq_33.paid_at__day
+ , subq_33.paid_at__week
+ , subq_33.paid_at__month
+ , subq_33.paid_at__quarter
+ , subq_33.paid_at__year
+ , subq_33.paid_at__extract_year
+ , subq_33.paid_at__extract_quarter
+ , subq_33.paid_at__extract_month
+ , subq_33.paid_at__extract_day
+ , subq_33.paid_at__extract_dow
+ , subq_33.paid_at__extract_doy
+ , subq_33.booking__ds__day
+ , subq_33.booking__ds__week
+ , subq_33.booking__ds__month
+ , subq_33.booking__ds__quarter
+ , subq_33.booking__ds__year
+ , subq_33.booking__ds__extract_year
+ , subq_33.booking__ds__extract_quarter
+ , subq_33.booking__ds__extract_month
+ , subq_33.booking__ds__extract_day
+ , subq_33.booking__ds__extract_dow
+ , subq_33.booking__ds__extract_doy
+ , subq_33.booking__ds_partitioned__day
+ , subq_33.booking__ds_partitioned__week
+ , subq_33.booking__ds_partitioned__month
+ , subq_33.booking__ds_partitioned__quarter
+ , subq_33.booking__ds_partitioned__year
+ , subq_33.booking__ds_partitioned__extract_year
+ , subq_33.booking__ds_partitioned__extract_quarter
+ , subq_33.booking__ds_partitioned__extract_month
+ , subq_33.booking__ds_partitioned__extract_day
+ , subq_33.booking__ds_partitioned__extract_dow
+ , subq_33.booking__ds_partitioned__extract_doy
+ , subq_33.booking__paid_at__day
+ , subq_33.booking__paid_at__week
+ , subq_33.booking__paid_at__month
+ , subq_33.booking__paid_at__quarter
+ , subq_33.booking__paid_at__year
+ , subq_33.booking__paid_at__extract_year
+ , subq_33.booking__paid_at__extract_quarter
+ , subq_33.booking__paid_at__extract_month
+ , subq_33.booking__paid_at__extract_day
+ , subq_33.booking__paid_at__extract_dow
+ , subq_33.booking__paid_at__extract_doy
+ , subq_33.ds__day AS metric_time__day
+ , subq_33.ds__week AS metric_time__week
+ , subq_33.ds__month AS metric_time__month
+ , subq_33.ds__quarter AS metric_time__quarter
+ , subq_33.ds__year AS metric_time__year
+ , subq_33.ds__extract_year AS metric_time__extract_year
+ , subq_33.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_33.ds__extract_month AS metric_time__extract_month
+ , subq_33.ds__extract_day AS metric_time__extract_day
+ , subq_33.ds__extract_dow AS metric_time__extract_dow
+ , subq_33.ds__extract_doy AS metric_time__extract_doy
+ , subq_33.listing
+ , subq_33.guest
+ , subq_33.host
+ , subq_33.booking__listing
+ , subq_33.booking__guest
+ , subq_33.booking__host
+ , subq_33.is_instant
+ , subq_33.booking__is_instant
+ , subq_33.bookings
+ , subq_33.instant_bookings
+ , subq_33.booking_value
+ , subq_33.max_booking_value
+ , subq_33.min_booking_value
+ , subq_33.bookers
+ , subq_33.average_booking_value
+ , subq_33.referred_bookings
+ , subq_33.median_booking_value
+ , subq_33.booking_value_p99
+ , subq_33.discrete_booking_value_p99
+ , subq_33.approximate_continuous_booking_value_p99
+ , subq_33.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_24
- ) subq_25
- ) subq_26
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_33
+ ) subq_34
+ ) subq_35
WHERE booking__is_instant
- ) subq_27
- ) subq_28
- ) subq_29
- ) subq_30
- ) subq_31
-) subq_32
+ ) subq_36
+ ) subq_37
+ ) subq_38
+ ) subq_39
+ ) subq_40
+) subq_41
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_filters__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_filters__plan0_optimized.sql
index 14649c62dd..35859d3713 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_filters__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_filters__plan0_optimized.sql
@@ -8,9 +8,9 @@ FROM (
FROM (
-- Combine Aggregated Outputs
SELECT
- MAX(subq_44.average_booking_value) AS average_booking_value
- , MAX(subq_56.bookings) AS bookings
- , MAX(subq_63.booking_value) AS booking_value
+ MAX(subq_53.average_booking_value) AS average_booking_value
+ , MAX(subq_65.bookings) AS bookings
+ , MAX(subq_72.booking_value) AS booking_value
FROM (
-- Constrain Output with WHERE
-- Pass Only Elements: ['average_booking_value',]
@@ -22,17 +22,17 @@ FROM (
-- Join Standard Outputs
-- Pass Only Elements: ['average_booking_value', 'listing__is_lux_latest', 'booking__is_instant']
SELECT
- bookings_source_src_28001.is_instant AS booking__is_instant
- , listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , bookings_source_src_28001.booking_value AS average_booking_value
- FROM ***************************.fct_bookings bookings_source_src_28001
+ bookings_source_src_28000.is_instant AS booking__is_instant
+ , 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
LEFT OUTER JOIN
- ***************************.dim_listings_latest listings_latest_src_28005
+ ***************************.dim_listings_latest listings_latest_src_28000
ON
- bookings_source_src_28001.listing_id = listings_latest_src_28005.listing_id
- ) subq_40
+ bookings_source_src_28000.listing_id = listings_latest_src_28000.listing_id
+ ) subq_49
WHERE (listing__is_lux_latest) AND (booking__is_instant)
- ) subq_44
+ ) subq_53
CROSS JOIN (
-- Constrain Output with WHERE
-- Pass Only Elements: ['bookings',]
@@ -44,9 +44,9 @@ FROM (
-- Join Standard Outputs
-- Pass Only Elements: ['bookings', 'listing__is_lux_latest', 'booking__is_instant']
SELECT
- subq_47.booking__is_instant AS booking__is_instant
- , listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , subq_47.bookings AS bookings
+ subq_56.booking__is_instant AS booking__is_instant
+ , listings_latest_src_28000.is_lux AS listing__is_lux_latest
+ , subq_56.bookings AS bookings
FROM (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
@@ -55,15 +55,15 @@ FROM (
listing_id AS listing
, is_instant AS booking__is_instant
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_47
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_56
LEFT OUTER JOIN
- ***************************.dim_listings_latest listings_latest_src_28005
+ ***************************.dim_listings_latest listings_latest_src_28000
ON
- subq_47.listing = listings_latest_src_28005.listing_id
- ) subq_52
+ subq_56.listing = listings_latest_src_28000.listing_id
+ ) subq_61
WHERE (listing__is_lux_latest) AND (booking__is_instant)
- ) subq_56
+ ) subq_65
CROSS JOIN (
-- Constrain Output with WHERE
-- Pass Only Elements: ['booking_value',]
@@ -78,9 +78,9 @@ FROM (
SELECT
is_instant AS booking__is_instant
, booking_value
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_59
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_68
WHERE booking__is_instant
- ) subq_63
- ) subq_64
-) subq_65
+ ) subq_72
+ ) subq_73
+) subq_74
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_offsets__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_offsets__plan0.sql
index 3cc6820071..9f0e348418 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_offsets__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_offsets__plan0.sql
@@ -1,339 +1,339 @@
-- Compute Metrics via Expressions
SELECT
- subq_11.metric_time__day
+ subq_20.metric_time__day
, 2 * bookings_offset_once AS bookings_offset_twice
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_9.metric_time__day AS metric_time__day
- , subq_8.bookings_offset_once AS bookings_offset_once
+ subq_18.metric_time__day AS metric_time__day
+ , subq_17.bookings_offset_once AS bookings_offset_once
FROM (
-- Time Spine
SELECT
- subq_10.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_10
- ) subq_9
+ subq_19.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_19
+ ) subq_18
INNER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_7.metric_time__day
+ subq_16.metric_time__day
, 2 * bookings AS bookings_offset_once
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_6.metric_time__day
- , subq_6.bookings
+ subq_15.metric_time__day
+ , subq_15.bookings
FROM (
-- Aggregate Measures
SELECT
- subq_5.metric_time__day
- , SUM(subq_5.bookings) AS bookings
+ subq_14.metric_time__day
+ , SUM(subq_14.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__day']
SELECT
- subq_4.metric_time__day
- , subq_4.bookings
+ subq_13.metric_time__day
+ , subq_13.bookings
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_2.metric_time__day AS metric_time__day
- , subq_1.ds__day AS ds__day
- , subq_1.ds__week AS ds__week
- , subq_1.ds__month AS ds__month
- , subq_1.ds__quarter AS ds__quarter
- , subq_1.ds__year AS ds__year
- , subq_1.ds__extract_year AS ds__extract_year
- , subq_1.ds__extract_quarter AS ds__extract_quarter
- , subq_1.ds__extract_month AS ds__extract_month
- , subq_1.ds__extract_day AS ds__extract_day
- , subq_1.ds__extract_dow AS ds__extract_dow
- , subq_1.ds__extract_doy AS ds__extract_doy
- , subq_1.ds_partitioned__day AS ds_partitioned__day
- , subq_1.ds_partitioned__week AS ds_partitioned__week
- , subq_1.ds_partitioned__month AS ds_partitioned__month
- , subq_1.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_1.ds_partitioned__year AS ds_partitioned__year
- , subq_1.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_1.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_1.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_1.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_1.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_1.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_1.paid_at__day AS paid_at__day
- , subq_1.paid_at__week AS paid_at__week
- , subq_1.paid_at__month AS paid_at__month
- , subq_1.paid_at__quarter AS paid_at__quarter
- , subq_1.paid_at__year AS paid_at__year
- , subq_1.paid_at__extract_year AS paid_at__extract_year
- , subq_1.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_1.paid_at__extract_month AS paid_at__extract_month
- , subq_1.paid_at__extract_day AS paid_at__extract_day
- , subq_1.paid_at__extract_dow AS paid_at__extract_dow
- , subq_1.paid_at__extract_doy AS paid_at__extract_doy
- , subq_1.booking__ds__day AS booking__ds__day
- , subq_1.booking__ds__week AS booking__ds__week
- , subq_1.booking__ds__month AS booking__ds__month
- , subq_1.booking__ds__quarter AS booking__ds__quarter
- , subq_1.booking__ds__year AS booking__ds__year
- , subq_1.booking__ds__extract_year AS booking__ds__extract_year
- , subq_1.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_1.booking__ds__extract_month AS booking__ds__extract_month
- , subq_1.booking__ds__extract_day AS booking__ds__extract_day
- , subq_1.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_1.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_1.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_1.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_1.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_1.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_1.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_1.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_1.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_1.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_1.booking__paid_at__day AS booking__paid_at__day
- , subq_1.booking__paid_at__week AS booking__paid_at__week
- , subq_1.booking__paid_at__month AS booking__paid_at__month
- , subq_1.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_1.booking__paid_at__year AS booking__paid_at__year
- , subq_1.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_1.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_1.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_1.listing AS listing
- , subq_1.guest AS guest
- , subq_1.host AS host
- , subq_1.booking__listing AS booking__listing
- , subq_1.booking__guest AS booking__guest
- , subq_1.booking__host AS booking__host
- , subq_1.is_instant AS is_instant
- , subq_1.booking__is_instant AS booking__is_instant
- , subq_1.bookings AS bookings
- , subq_1.instant_bookings AS instant_bookings
- , subq_1.booking_value AS booking_value
- , subq_1.max_booking_value AS max_booking_value
- , subq_1.min_booking_value AS min_booking_value
- , subq_1.bookers AS bookers
- , subq_1.average_booking_value AS average_booking_value
- , subq_1.referred_bookings AS referred_bookings
- , subq_1.median_booking_value AS median_booking_value
- , subq_1.booking_value_p99 AS booking_value_p99
- , subq_1.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_1.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_1.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ subq_11.metric_time__day AS metric_time__day
+ , subq_10.ds__day AS ds__day
+ , subq_10.ds__week AS ds__week
+ , subq_10.ds__month AS ds__month
+ , subq_10.ds__quarter AS ds__quarter
+ , subq_10.ds__year AS ds__year
+ , subq_10.ds__extract_year AS ds__extract_year
+ , subq_10.ds__extract_quarter AS ds__extract_quarter
+ , subq_10.ds__extract_month AS ds__extract_month
+ , subq_10.ds__extract_day AS ds__extract_day
+ , subq_10.ds__extract_dow AS ds__extract_dow
+ , subq_10.ds__extract_doy AS ds__extract_doy
+ , subq_10.ds_partitioned__day AS ds_partitioned__day
+ , subq_10.ds_partitioned__week AS ds_partitioned__week
+ , subq_10.ds_partitioned__month AS ds_partitioned__month
+ , subq_10.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_10.ds_partitioned__year AS ds_partitioned__year
+ , subq_10.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_10.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_10.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_10.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_10.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_10.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_10.paid_at__day AS paid_at__day
+ , subq_10.paid_at__week AS paid_at__week
+ , subq_10.paid_at__month AS paid_at__month
+ , subq_10.paid_at__quarter AS paid_at__quarter
+ , subq_10.paid_at__year AS paid_at__year
+ , subq_10.paid_at__extract_year AS paid_at__extract_year
+ , subq_10.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_10.paid_at__extract_month AS paid_at__extract_month
+ , subq_10.paid_at__extract_day AS paid_at__extract_day
+ , subq_10.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_10.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_10.booking__ds__day AS booking__ds__day
+ , subq_10.booking__ds__week AS booking__ds__week
+ , subq_10.booking__ds__month AS booking__ds__month
+ , subq_10.booking__ds__quarter AS booking__ds__quarter
+ , subq_10.booking__ds__year AS booking__ds__year
+ , subq_10.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_10.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_10.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_10.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_10.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_10.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_10.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_10.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_10.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_10.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_10.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_10.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_10.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_10.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_10.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_10.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_10.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_10.booking__paid_at__day AS booking__paid_at__day
+ , subq_10.booking__paid_at__week AS booking__paid_at__week
+ , subq_10.booking__paid_at__month AS booking__paid_at__month
+ , subq_10.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_10.booking__paid_at__year AS booking__paid_at__year
+ , subq_10.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_10.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_10.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_10.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_10.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_10.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_10.listing AS listing
+ , subq_10.guest AS guest
+ , subq_10.host AS host
+ , subq_10.booking__listing AS booking__listing
+ , subq_10.booking__guest AS booking__guest
+ , subq_10.booking__host AS booking__host
+ , subq_10.is_instant AS is_instant
+ , subq_10.booking__is_instant AS booking__is_instant
+ , subq_10.bookings AS bookings
+ , subq_10.instant_bookings AS instant_bookings
+ , subq_10.booking_value AS booking_value
+ , subq_10.max_booking_value AS max_booking_value
+ , subq_10.min_booking_value AS min_booking_value
+ , subq_10.bookers AS bookers
+ , subq_10.average_booking_value AS average_booking_value
+ , subq_10.referred_bookings AS referred_bookings
+ , subq_10.median_booking_value AS median_booking_value
+ , subq_10.booking_value_p99 AS booking_value_p99
+ , subq_10.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_10.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_10.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_3.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_3
- ) subq_2
+ subq_12.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_12
+ ) subq_11
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
ON
- DATEADD(day, -5, subq_2.metric_time__day) = subq_1.metric_time__day
- ) subq_4
- ) subq_5
+ DATEADD(day, -5, subq_11.metric_time__day) = subq_10.metric_time__day
+ ) subq_13
+ ) subq_14
GROUP BY
- subq_5.metric_time__day
- ) subq_6
- ) subq_7
- ) subq_8
+ subq_14.metric_time__day
+ ) subq_15
+ ) subq_16
+ ) subq_17
ON
- DATEADD(day, -2, subq_9.metric_time__day) = subq_8.metric_time__day
-) subq_11
+ DATEADD(day, -2, subq_18.metric_time__day) = subq_17.metric_time__day
+) subq_20
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_offsets__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_offsets__plan0_optimized.sql
index e9df61ae2f..a1458a856e 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_offsets__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_offsets__plan0_optimized.sql
@@ -5,9 +5,9 @@ SELECT
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_22.ds AS metric_time__day
- , subq_20.bookings_offset_once AS bookings_offset_once
- FROM ***************************.mf_time_spine subq_22
+ subq_31.ds AS metric_time__day
+ , subq_29.bookings_offset_once AS bookings_offset_once
+ FROM ***************************.mf_time_spine subq_31
INNER JOIN (
-- Compute Metrics via Expressions
SELECT
@@ -19,23 +19,23 @@ FROM (
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_15.ds AS metric_time__day
- , SUM(subq_13.bookings) AS bookings
- FROM ***************************.mf_time_spine subq_15
+ subq_24.ds AS metric_time__day
+ , SUM(subq_22.bookings) AS bookings
+ FROM ***************************.mf_time_spine subq_24
INNER JOIN (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
SELECT
DATE_TRUNC('day', ds) AS metric_time__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_13
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_22
ON
- DATEADD(day, -5, subq_15.ds) = subq_13.metric_time__day
+ DATEADD(day, -5, subq_24.ds) = subq_22.metric_time__day
GROUP BY
- subq_15.ds
- ) subq_19
- ) subq_20
+ subq_24.ds
+ ) subq_28
+ ) subq_29
ON
- DATEADD(day, -2, subq_22.ds) = subq_20.metric_time__day
-) subq_23
+ DATEADD(day, -2, subq_31.ds) = subq_29.metric_time__day
+) subq_32
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_offsets_with_time_constraint__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_offsets_with_time_constraint__plan0.sql
index b94d38afb3..8b521664ea 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_offsets_with_time_constraint__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_offsets_with_time_constraint__plan0.sql
@@ -1,340 +1,340 @@
-- Compute Metrics via Expressions
SELECT
- subq_11.metric_time__day
+ subq_20.metric_time__day
, 2 * bookings_offset_once AS bookings_offset_twice
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_9.metric_time__day AS metric_time__day
- , subq_8.bookings_offset_once AS bookings_offset_once
+ subq_18.metric_time__day AS metric_time__day
+ , subq_17.bookings_offset_once AS bookings_offset_once
FROM (
-- Time Spine
SELECT
- subq_10.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_10
- WHERE subq_10.ds BETWEEN '2020-01-12' AND '2020-01-13'
- ) subq_9
+ subq_19.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_19
+ WHERE subq_19.ds BETWEEN '2020-01-12' AND '2020-01-13'
+ ) subq_18
INNER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_7.metric_time__day
+ subq_16.metric_time__day
, 2 * bookings AS bookings_offset_once
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_6.metric_time__day
- , subq_6.bookings
+ subq_15.metric_time__day
+ , subq_15.bookings
FROM (
-- Aggregate Measures
SELECT
- subq_5.metric_time__day
- , SUM(subq_5.bookings) AS bookings
+ subq_14.metric_time__day
+ , SUM(subq_14.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__day']
SELECT
- subq_4.metric_time__day
- , subq_4.bookings
+ subq_13.metric_time__day
+ , subq_13.bookings
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_2.metric_time__day AS metric_time__day
- , subq_1.ds__day AS ds__day
- , subq_1.ds__week AS ds__week
- , subq_1.ds__month AS ds__month
- , subq_1.ds__quarter AS ds__quarter
- , subq_1.ds__year AS ds__year
- , subq_1.ds__extract_year AS ds__extract_year
- , subq_1.ds__extract_quarter AS ds__extract_quarter
- , subq_1.ds__extract_month AS ds__extract_month
- , subq_1.ds__extract_day AS ds__extract_day
- , subq_1.ds__extract_dow AS ds__extract_dow
- , subq_1.ds__extract_doy AS ds__extract_doy
- , subq_1.ds_partitioned__day AS ds_partitioned__day
- , subq_1.ds_partitioned__week AS ds_partitioned__week
- , subq_1.ds_partitioned__month AS ds_partitioned__month
- , subq_1.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_1.ds_partitioned__year AS ds_partitioned__year
- , subq_1.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_1.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_1.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_1.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_1.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_1.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_1.paid_at__day AS paid_at__day
- , subq_1.paid_at__week AS paid_at__week
- , subq_1.paid_at__month AS paid_at__month
- , subq_1.paid_at__quarter AS paid_at__quarter
- , subq_1.paid_at__year AS paid_at__year
- , subq_1.paid_at__extract_year AS paid_at__extract_year
- , subq_1.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_1.paid_at__extract_month AS paid_at__extract_month
- , subq_1.paid_at__extract_day AS paid_at__extract_day
- , subq_1.paid_at__extract_dow AS paid_at__extract_dow
- , subq_1.paid_at__extract_doy AS paid_at__extract_doy
- , subq_1.booking__ds__day AS booking__ds__day
- , subq_1.booking__ds__week AS booking__ds__week
- , subq_1.booking__ds__month AS booking__ds__month
- , subq_1.booking__ds__quarter AS booking__ds__quarter
- , subq_1.booking__ds__year AS booking__ds__year
- , subq_1.booking__ds__extract_year AS booking__ds__extract_year
- , subq_1.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_1.booking__ds__extract_month AS booking__ds__extract_month
- , subq_1.booking__ds__extract_day AS booking__ds__extract_day
- , subq_1.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_1.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_1.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_1.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_1.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_1.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_1.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_1.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_1.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_1.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_1.booking__paid_at__day AS booking__paid_at__day
- , subq_1.booking__paid_at__week AS booking__paid_at__week
- , subq_1.booking__paid_at__month AS booking__paid_at__month
- , subq_1.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_1.booking__paid_at__year AS booking__paid_at__year
- , subq_1.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_1.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_1.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_1.listing AS listing
- , subq_1.guest AS guest
- , subq_1.host AS host
- , subq_1.booking__listing AS booking__listing
- , subq_1.booking__guest AS booking__guest
- , subq_1.booking__host AS booking__host
- , subq_1.is_instant AS is_instant
- , subq_1.booking__is_instant AS booking__is_instant
- , subq_1.bookings AS bookings
- , subq_1.instant_bookings AS instant_bookings
- , subq_1.booking_value AS booking_value
- , subq_1.max_booking_value AS max_booking_value
- , subq_1.min_booking_value AS min_booking_value
- , subq_1.bookers AS bookers
- , subq_1.average_booking_value AS average_booking_value
- , subq_1.referred_bookings AS referred_bookings
- , subq_1.median_booking_value AS median_booking_value
- , subq_1.booking_value_p99 AS booking_value_p99
- , subq_1.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_1.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_1.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ subq_11.metric_time__day AS metric_time__day
+ , subq_10.ds__day AS ds__day
+ , subq_10.ds__week AS ds__week
+ , subq_10.ds__month AS ds__month
+ , subq_10.ds__quarter AS ds__quarter
+ , subq_10.ds__year AS ds__year
+ , subq_10.ds__extract_year AS ds__extract_year
+ , subq_10.ds__extract_quarter AS ds__extract_quarter
+ , subq_10.ds__extract_month AS ds__extract_month
+ , subq_10.ds__extract_day AS ds__extract_day
+ , subq_10.ds__extract_dow AS ds__extract_dow
+ , subq_10.ds__extract_doy AS ds__extract_doy
+ , subq_10.ds_partitioned__day AS ds_partitioned__day
+ , subq_10.ds_partitioned__week AS ds_partitioned__week
+ , subq_10.ds_partitioned__month AS ds_partitioned__month
+ , subq_10.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_10.ds_partitioned__year AS ds_partitioned__year
+ , subq_10.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_10.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_10.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_10.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_10.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_10.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_10.paid_at__day AS paid_at__day
+ , subq_10.paid_at__week AS paid_at__week
+ , subq_10.paid_at__month AS paid_at__month
+ , subq_10.paid_at__quarter AS paid_at__quarter
+ , subq_10.paid_at__year AS paid_at__year
+ , subq_10.paid_at__extract_year AS paid_at__extract_year
+ , subq_10.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_10.paid_at__extract_month AS paid_at__extract_month
+ , subq_10.paid_at__extract_day AS paid_at__extract_day
+ , subq_10.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_10.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_10.booking__ds__day AS booking__ds__day
+ , subq_10.booking__ds__week AS booking__ds__week
+ , subq_10.booking__ds__month AS booking__ds__month
+ , subq_10.booking__ds__quarter AS booking__ds__quarter
+ , subq_10.booking__ds__year AS booking__ds__year
+ , subq_10.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_10.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_10.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_10.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_10.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_10.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_10.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_10.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_10.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_10.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_10.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_10.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_10.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_10.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_10.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_10.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_10.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_10.booking__paid_at__day AS booking__paid_at__day
+ , subq_10.booking__paid_at__week AS booking__paid_at__week
+ , subq_10.booking__paid_at__month AS booking__paid_at__month
+ , subq_10.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_10.booking__paid_at__year AS booking__paid_at__year
+ , subq_10.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_10.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_10.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_10.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_10.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_10.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_10.listing AS listing
+ , subq_10.guest AS guest
+ , subq_10.host AS host
+ , subq_10.booking__listing AS booking__listing
+ , subq_10.booking__guest AS booking__guest
+ , subq_10.booking__host AS booking__host
+ , subq_10.is_instant AS is_instant
+ , subq_10.booking__is_instant AS booking__is_instant
+ , subq_10.bookings AS bookings
+ , subq_10.instant_bookings AS instant_bookings
+ , subq_10.booking_value AS booking_value
+ , subq_10.max_booking_value AS max_booking_value
+ , subq_10.min_booking_value AS min_booking_value
+ , subq_10.bookers AS bookers
+ , subq_10.average_booking_value AS average_booking_value
+ , subq_10.referred_bookings AS referred_bookings
+ , subq_10.median_booking_value AS median_booking_value
+ , subq_10.booking_value_p99 AS booking_value_p99
+ , subq_10.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_10.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_10.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_3.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_3
- ) subq_2
+ subq_12.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_12
+ ) subq_11
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
ON
- DATEADD(day, -5, subq_2.metric_time__day) = subq_1.metric_time__day
- ) subq_4
- ) subq_5
+ DATEADD(day, -5, subq_11.metric_time__day) = subq_10.metric_time__day
+ ) subq_13
+ ) subq_14
GROUP BY
- subq_5.metric_time__day
- ) subq_6
- ) subq_7
- ) subq_8
+ subq_14.metric_time__day
+ ) subq_15
+ ) subq_16
+ ) subq_17
ON
- DATEADD(day, -2, subq_9.metric_time__day) = subq_8.metric_time__day
-) subq_11
+ DATEADD(day, -2, subq_18.metric_time__day) = subq_17.metric_time__day
+) subq_20
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_offsets_with_time_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_offsets_with_time_constraint__plan0_optimized.sql
index 82beb8296d..ce05de9f1e 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_offsets_with_time_constraint__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_offsets_with_time_constraint__plan0_optimized.sql
@@ -5,15 +5,15 @@ SELECT
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_21.metric_time__day AS metric_time__day
- , subq_20.bookings_offset_once AS bookings_offset_once
+ subq_30.metric_time__day AS metric_time__day
+ , subq_29.bookings_offset_once AS bookings_offset_once
FROM (
-- Time Spine
SELECT
ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_22
+ FROM ***************************.mf_time_spine subq_31
WHERE ds BETWEEN '2020-01-12' AND '2020-01-13'
- ) subq_21
+ ) subq_30
INNER JOIN (
-- Compute Metrics via Expressions
SELECT
@@ -25,23 +25,23 @@ FROM (
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_15.ds AS metric_time__day
- , SUM(subq_13.bookings) AS bookings
- FROM ***************************.mf_time_spine subq_15
+ subq_24.ds AS metric_time__day
+ , SUM(subq_22.bookings) AS bookings
+ FROM ***************************.mf_time_spine subq_24
INNER JOIN (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
SELECT
DATE_TRUNC('day', ds) AS metric_time__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_13
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_22
ON
- DATEADD(day, -5, subq_15.ds) = subq_13.metric_time__day
+ DATEADD(day, -5, subq_24.ds) = subq_22.metric_time__day
GROUP BY
- subq_15.ds
- ) subq_19
- ) subq_20
+ subq_24.ds
+ ) subq_28
+ ) subq_29
ON
- DATEADD(day, -2, subq_21.metric_time__day) = subq_20.metric_time__day
-) subq_23
+ DATEADD(day, -2, subq_30.metric_time__day) = subq_29.metric_time__day
+) subq_32
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_offsets_with_where_constraint__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_offsets_with_where_constraint__plan0.sql
index db15a1e982..87e05d640e 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_offsets_with_where_constraint__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_offsets_with_where_constraint__plan0.sql
@@ -1,346 +1,346 @@
-- Compute Metrics via Expressions
SELECT
- subq_12.metric_time__day
+ subq_21.metric_time__day
, 2 * bookings_offset_once AS bookings_offset_twice
FROM (
-- Constrain Output with WHERE
SELECT
- subq_11.metric_time__day
- , subq_11.bookings_offset_once
+ subq_20.metric_time__day
+ , subq_20.bookings_offset_once
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_9.metric_time__day AS metric_time__day
- , subq_8.bookings_offset_once AS bookings_offset_once
+ subq_18.metric_time__day AS metric_time__day
+ , subq_17.bookings_offset_once AS bookings_offset_once
FROM (
-- Time Spine
SELECT
- subq_10.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_10
- ) subq_9
+ subq_19.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_19
+ ) subq_18
INNER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_7.metric_time__day
+ subq_16.metric_time__day
, 2 * bookings AS bookings_offset_once
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_6.metric_time__day
- , subq_6.bookings
+ subq_15.metric_time__day
+ , subq_15.bookings
FROM (
-- Aggregate Measures
SELECT
- subq_5.metric_time__day
- , SUM(subq_5.bookings) AS bookings
+ subq_14.metric_time__day
+ , SUM(subq_14.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__day']
SELECT
- subq_4.metric_time__day
- , subq_4.bookings
+ subq_13.metric_time__day
+ , subq_13.bookings
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_2.metric_time__day AS metric_time__day
- , subq_1.ds__day AS ds__day
- , subq_1.ds__week AS ds__week
- , subq_1.ds__month AS ds__month
- , subq_1.ds__quarter AS ds__quarter
- , subq_1.ds__year AS ds__year
- , subq_1.ds__extract_year AS ds__extract_year
- , subq_1.ds__extract_quarter AS ds__extract_quarter
- , subq_1.ds__extract_month AS ds__extract_month
- , subq_1.ds__extract_day AS ds__extract_day
- , subq_1.ds__extract_dow AS ds__extract_dow
- , subq_1.ds__extract_doy AS ds__extract_doy
- , subq_1.ds_partitioned__day AS ds_partitioned__day
- , subq_1.ds_partitioned__week AS ds_partitioned__week
- , subq_1.ds_partitioned__month AS ds_partitioned__month
- , subq_1.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_1.ds_partitioned__year AS ds_partitioned__year
- , subq_1.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_1.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_1.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_1.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_1.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_1.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_1.paid_at__day AS paid_at__day
- , subq_1.paid_at__week AS paid_at__week
- , subq_1.paid_at__month AS paid_at__month
- , subq_1.paid_at__quarter AS paid_at__quarter
- , subq_1.paid_at__year AS paid_at__year
- , subq_1.paid_at__extract_year AS paid_at__extract_year
- , subq_1.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_1.paid_at__extract_month AS paid_at__extract_month
- , subq_1.paid_at__extract_day AS paid_at__extract_day
- , subq_1.paid_at__extract_dow AS paid_at__extract_dow
- , subq_1.paid_at__extract_doy AS paid_at__extract_doy
- , subq_1.booking__ds__day AS booking__ds__day
- , subq_1.booking__ds__week AS booking__ds__week
- , subq_1.booking__ds__month AS booking__ds__month
- , subq_1.booking__ds__quarter AS booking__ds__quarter
- , subq_1.booking__ds__year AS booking__ds__year
- , subq_1.booking__ds__extract_year AS booking__ds__extract_year
- , subq_1.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_1.booking__ds__extract_month AS booking__ds__extract_month
- , subq_1.booking__ds__extract_day AS booking__ds__extract_day
- , subq_1.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_1.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_1.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_1.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_1.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_1.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_1.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_1.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_1.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_1.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_1.booking__paid_at__day AS booking__paid_at__day
- , subq_1.booking__paid_at__week AS booking__paid_at__week
- , subq_1.booking__paid_at__month AS booking__paid_at__month
- , subq_1.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_1.booking__paid_at__year AS booking__paid_at__year
- , subq_1.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_1.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_1.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_1.listing AS listing
- , subq_1.guest AS guest
- , subq_1.host AS host
- , subq_1.booking__listing AS booking__listing
- , subq_1.booking__guest AS booking__guest
- , subq_1.booking__host AS booking__host
- , subq_1.is_instant AS is_instant
- , subq_1.booking__is_instant AS booking__is_instant
- , subq_1.bookings AS bookings
- , subq_1.instant_bookings AS instant_bookings
- , subq_1.booking_value AS booking_value
- , subq_1.max_booking_value AS max_booking_value
- , subq_1.min_booking_value AS min_booking_value
- , subq_1.bookers AS bookers
- , subq_1.average_booking_value AS average_booking_value
- , subq_1.referred_bookings AS referred_bookings
- , subq_1.median_booking_value AS median_booking_value
- , subq_1.booking_value_p99 AS booking_value_p99
- , subq_1.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_1.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_1.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ subq_11.metric_time__day AS metric_time__day
+ , subq_10.ds__day AS ds__day
+ , subq_10.ds__week AS ds__week
+ , subq_10.ds__month AS ds__month
+ , subq_10.ds__quarter AS ds__quarter
+ , subq_10.ds__year AS ds__year
+ , subq_10.ds__extract_year AS ds__extract_year
+ , subq_10.ds__extract_quarter AS ds__extract_quarter
+ , subq_10.ds__extract_month AS ds__extract_month
+ , subq_10.ds__extract_day AS ds__extract_day
+ , subq_10.ds__extract_dow AS ds__extract_dow
+ , subq_10.ds__extract_doy AS ds__extract_doy
+ , subq_10.ds_partitioned__day AS ds_partitioned__day
+ , subq_10.ds_partitioned__week AS ds_partitioned__week
+ , subq_10.ds_partitioned__month AS ds_partitioned__month
+ , subq_10.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_10.ds_partitioned__year AS ds_partitioned__year
+ , subq_10.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_10.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_10.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_10.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_10.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_10.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_10.paid_at__day AS paid_at__day
+ , subq_10.paid_at__week AS paid_at__week
+ , subq_10.paid_at__month AS paid_at__month
+ , subq_10.paid_at__quarter AS paid_at__quarter
+ , subq_10.paid_at__year AS paid_at__year
+ , subq_10.paid_at__extract_year AS paid_at__extract_year
+ , subq_10.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_10.paid_at__extract_month AS paid_at__extract_month
+ , subq_10.paid_at__extract_day AS paid_at__extract_day
+ , subq_10.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_10.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_10.booking__ds__day AS booking__ds__day
+ , subq_10.booking__ds__week AS booking__ds__week
+ , subq_10.booking__ds__month AS booking__ds__month
+ , subq_10.booking__ds__quarter AS booking__ds__quarter
+ , subq_10.booking__ds__year AS booking__ds__year
+ , subq_10.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_10.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_10.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_10.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_10.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_10.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_10.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_10.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_10.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_10.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_10.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_10.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_10.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_10.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_10.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_10.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_10.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_10.booking__paid_at__day AS booking__paid_at__day
+ , subq_10.booking__paid_at__week AS booking__paid_at__week
+ , subq_10.booking__paid_at__month AS booking__paid_at__month
+ , subq_10.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_10.booking__paid_at__year AS booking__paid_at__year
+ , subq_10.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_10.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_10.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_10.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_10.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_10.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_10.listing AS listing
+ , subq_10.guest AS guest
+ , subq_10.host AS host
+ , subq_10.booking__listing AS booking__listing
+ , subq_10.booking__guest AS booking__guest
+ , subq_10.booking__host AS booking__host
+ , subq_10.is_instant AS is_instant
+ , subq_10.booking__is_instant AS booking__is_instant
+ , subq_10.bookings AS bookings
+ , subq_10.instant_bookings AS instant_bookings
+ , subq_10.booking_value AS booking_value
+ , subq_10.max_booking_value AS max_booking_value
+ , subq_10.min_booking_value AS min_booking_value
+ , subq_10.bookers AS bookers
+ , subq_10.average_booking_value AS average_booking_value
+ , subq_10.referred_bookings AS referred_bookings
+ , subq_10.median_booking_value AS median_booking_value
+ , subq_10.booking_value_p99 AS booking_value_p99
+ , subq_10.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_10.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_10.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_3.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_3
- ) subq_2
+ subq_12.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_12
+ ) subq_11
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
ON
- DATEADD(day, -5, subq_2.metric_time__day) = subq_1.metric_time__day
- ) subq_4
- ) subq_5
+ DATEADD(day, -5, subq_11.metric_time__day) = subq_10.metric_time__day
+ ) subq_13
+ ) subq_14
GROUP BY
- subq_5.metric_time__day
- ) subq_6
- ) subq_7
- ) subq_8
+ subq_14.metric_time__day
+ ) subq_15
+ ) subq_16
+ ) subq_17
ON
- DATEADD(day, -2, subq_9.metric_time__day) = subq_8.metric_time__day
- ) subq_11
+ DATEADD(day, -2, subq_18.metric_time__day) = subq_17.metric_time__day
+ ) subq_20
WHERE metric_time__day = '2020-01-12' or metric_time__day = '2020-01-13'
-) subq_12
+) subq_21
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_offsets_with_where_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_offsets_with_where_constraint__plan0_optimized.sql
index e17438d2ae..533c803d41 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_offsets_with_where_constraint__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_nested_offsets_with_where_constraint__plan0_optimized.sql
@@ -10,9 +10,9 @@ FROM (
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_23.ds AS metric_time__day
- , subq_21.bookings_offset_once AS bookings_offset_once
- FROM ***************************.mf_time_spine subq_23
+ subq_32.ds AS metric_time__day
+ , subq_30.bookings_offset_once AS bookings_offset_once
+ FROM ***************************.mf_time_spine subq_32
INNER JOIN (
-- Compute Metrics via Expressions
SELECT
@@ -24,25 +24,25 @@ FROM (
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_16.ds AS metric_time__day
- , SUM(subq_14.bookings) AS bookings
- FROM ***************************.mf_time_spine subq_16
+ subq_25.ds AS metric_time__day
+ , SUM(subq_23.bookings) AS bookings
+ FROM ***************************.mf_time_spine subq_25
INNER JOIN (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
SELECT
DATE_TRUNC('day', ds) AS metric_time__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_14
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_23
ON
- DATEADD(day, -5, subq_16.ds) = subq_14.metric_time__day
+ DATEADD(day, -5, subq_25.ds) = subq_23.metric_time__day
GROUP BY
- subq_16.ds
- ) subq_20
- ) subq_21
+ subq_25.ds
+ ) subq_29
+ ) subq_30
ON
- DATEADD(day, -2, subq_23.ds) = subq_21.metric_time__day
- ) subq_24
+ DATEADD(day, -2, subq_32.ds) = subq_30.metric_time__day
+ ) subq_33
WHERE metric_time__day = '2020-01-12' or metric_time__day = '2020-01-13'
-) subq_25
+) subq_34
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_offset_to_grain_with_agg_time_dim__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_offset_to_grain_with_agg_time_dim__plan0.sql
index 4d62ef95b3..4984b94ddc 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_offset_to_grain_with_agg_time_dim__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_offset_to_grain_with_agg_time_dim__plan0.sql
@@ -1,545 +1,545 @@
-- Compute Metrics via Expressions
SELECT
- subq_13.booking__ds__day
+ subq_22.booking__ds__day
, bookings - bookings_at_start_of_month AS bookings_growth_since_start_of_month
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_4.booking__ds__day, subq_12.booking__ds__day) AS booking__ds__day
- , MAX(subq_4.bookings) AS bookings
- , MAX(subq_12.bookings_at_start_of_month) AS bookings_at_start_of_month
+ COALESCE(subq_13.booking__ds__day, subq_21.booking__ds__day) AS booking__ds__day
+ , MAX(subq_13.bookings) AS bookings
+ , MAX(subq_21.bookings_at_start_of_month) AS bookings_at_start_of_month
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_3.booking__ds__day
- , subq_3.bookings
+ subq_12.booking__ds__day
+ , subq_12.bookings
FROM (
-- Aggregate Measures
SELECT
- subq_2.booking__ds__day
- , SUM(subq_2.bookings) AS bookings
+ subq_11.booking__ds__day
+ , SUM(subq_11.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'booking__ds__day']
SELECT
- subq_1.booking__ds__day
- , subq_1.bookings
+ subq_10.booking__ds__day
+ , subq_10.bookings
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
- ) subq_2
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
GROUP BY
- subq_2.booking__ds__day
- ) subq_3
- ) subq_4
+ subq_11.booking__ds__day
+ ) subq_12
+ ) subq_13
FULL OUTER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_11.booking__ds__day
- , subq_11.bookings AS bookings_at_start_of_month
+ subq_20.booking__ds__day
+ , subq_20.bookings AS bookings_at_start_of_month
FROM (
-- Aggregate Measures
SELECT
- subq_10.booking__ds__day
- , SUM(subq_10.bookings) AS bookings
+ subq_19.booking__ds__day
+ , SUM(subq_19.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'booking__ds__day']
SELECT
- subq_9.booking__ds__day
- , subq_9.bookings
+ subq_18.booking__ds__day
+ , subq_18.bookings
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_7.booking__ds__day AS booking__ds__day
- , subq_6.ds__day AS ds__day
- , subq_6.ds__week AS ds__week
- , subq_6.ds__month AS ds__month
- , subq_6.ds__quarter AS ds__quarter
- , subq_6.ds__year AS ds__year
- , subq_6.ds__extract_year AS ds__extract_year
- , subq_6.ds__extract_quarter AS ds__extract_quarter
- , subq_6.ds__extract_month AS ds__extract_month
- , subq_6.ds__extract_day AS ds__extract_day
- , subq_6.ds__extract_dow AS ds__extract_dow
- , subq_6.ds__extract_doy AS ds__extract_doy
- , subq_6.ds_partitioned__day AS ds_partitioned__day
- , subq_6.ds_partitioned__week AS ds_partitioned__week
- , subq_6.ds_partitioned__month AS ds_partitioned__month
- , subq_6.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_6.ds_partitioned__year AS ds_partitioned__year
- , subq_6.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_6.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_6.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_6.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_6.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_6.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_6.paid_at__day AS paid_at__day
- , subq_6.paid_at__week AS paid_at__week
- , subq_6.paid_at__month AS paid_at__month
- , subq_6.paid_at__quarter AS paid_at__quarter
- , subq_6.paid_at__year AS paid_at__year
- , subq_6.paid_at__extract_year AS paid_at__extract_year
- , subq_6.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_6.paid_at__extract_month AS paid_at__extract_month
- , subq_6.paid_at__extract_day AS paid_at__extract_day
- , subq_6.paid_at__extract_dow AS paid_at__extract_dow
- , subq_6.paid_at__extract_doy AS paid_at__extract_doy
- , subq_6.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_6.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_6.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_6.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_6.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_6.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_6.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_6.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_6.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_6.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_6.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_6.booking__paid_at__day AS booking__paid_at__day
- , subq_6.booking__paid_at__week AS booking__paid_at__week
- , subq_6.booking__paid_at__month AS booking__paid_at__month
- , subq_6.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_6.booking__paid_at__year AS booking__paid_at__year
- , subq_6.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_6.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_6.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_6.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_6.metric_time__day AS metric_time__day
- , subq_6.metric_time__week AS metric_time__week
- , subq_6.metric_time__month AS metric_time__month
- , subq_6.metric_time__quarter AS metric_time__quarter
- , subq_6.metric_time__year AS metric_time__year
- , subq_6.metric_time__extract_year AS metric_time__extract_year
- , subq_6.metric_time__extract_quarter AS metric_time__extract_quarter
- , subq_6.metric_time__extract_month AS metric_time__extract_month
- , subq_6.metric_time__extract_day AS metric_time__extract_day
- , subq_6.metric_time__extract_dow AS metric_time__extract_dow
- , subq_6.metric_time__extract_doy AS metric_time__extract_doy
- , subq_6.listing AS listing
- , subq_6.guest AS guest
- , subq_6.host AS host
- , subq_6.booking__listing AS booking__listing
- , subq_6.booking__guest AS booking__guest
- , subq_6.booking__host AS booking__host
- , subq_6.is_instant AS is_instant
- , subq_6.booking__is_instant AS booking__is_instant
- , subq_6.bookings AS bookings
- , subq_6.instant_bookings AS instant_bookings
- , subq_6.booking_value AS booking_value
- , subq_6.max_booking_value AS max_booking_value
- , subq_6.min_booking_value AS min_booking_value
- , subq_6.bookers AS bookers
- , subq_6.average_booking_value AS average_booking_value
- , subq_6.referred_bookings AS referred_bookings
- , subq_6.median_booking_value AS median_booking_value
- , subq_6.booking_value_p99 AS booking_value_p99
- , subq_6.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_6.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_6.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ subq_16.booking__ds__day AS booking__ds__day
+ , subq_15.ds__day AS ds__day
+ , subq_15.ds__week AS ds__week
+ , subq_15.ds__month AS ds__month
+ , subq_15.ds__quarter AS ds__quarter
+ , subq_15.ds__year AS ds__year
+ , subq_15.ds__extract_year AS ds__extract_year
+ , subq_15.ds__extract_quarter AS ds__extract_quarter
+ , subq_15.ds__extract_month AS ds__extract_month
+ , subq_15.ds__extract_day AS ds__extract_day
+ , subq_15.ds__extract_dow AS ds__extract_dow
+ , subq_15.ds__extract_doy AS ds__extract_doy
+ , subq_15.ds_partitioned__day AS ds_partitioned__day
+ , subq_15.ds_partitioned__week AS ds_partitioned__week
+ , subq_15.ds_partitioned__month AS ds_partitioned__month
+ , subq_15.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_15.ds_partitioned__year AS ds_partitioned__year
+ , subq_15.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_15.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_15.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_15.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_15.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_15.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_15.paid_at__day AS paid_at__day
+ , subq_15.paid_at__week AS paid_at__week
+ , subq_15.paid_at__month AS paid_at__month
+ , subq_15.paid_at__quarter AS paid_at__quarter
+ , subq_15.paid_at__year AS paid_at__year
+ , subq_15.paid_at__extract_year AS paid_at__extract_year
+ , subq_15.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_15.paid_at__extract_month AS paid_at__extract_month
+ , subq_15.paid_at__extract_day AS paid_at__extract_day
+ , subq_15.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_15.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_15.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_15.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_15.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_15.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_15.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_15.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_15.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_15.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_15.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_15.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_15.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_15.booking__paid_at__day AS booking__paid_at__day
+ , subq_15.booking__paid_at__week AS booking__paid_at__week
+ , subq_15.booking__paid_at__month AS booking__paid_at__month
+ , subq_15.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_15.booking__paid_at__year AS booking__paid_at__year
+ , subq_15.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_15.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_15.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_15.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_15.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_15.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_15.metric_time__day AS metric_time__day
+ , subq_15.metric_time__week AS metric_time__week
+ , subq_15.metric_time__month AS metric_time__month
+ , subq_15.metric_time__quarter AS metric_time__quarter
+ , subq_15.metric_time__year AS metric_time__year
+ , subq_15.metric_time__extract_year AS metric_time__extract_year
+ , subq_15.metric_time__extract_quarter AS metric_time__extract_quarter
+ , subq_15.metric_time__extract_month AS metric_time__extract_month
+ , subq_15.metric_time__extract_day AS metric_time__extract_day
+ , subq_15.metric_time__extract_dow AS metric_time__extract_dow
+ , subq_15.metric_time__extract_doy AS metric_time__extract_doy
+ , subq_15.listing AS listing
+ , subq_15.guest AS guest
+ , subq_15.host AS host
+ , subq_15.booking__listing AS booking__listing
+ , subq_15.booking__guest AS booking__guest
+ , subq_15.booking__host AS booking__host
+ , subq_15.is_instant AS is_instant
+ , subq_15.booking__is_instant AS booking__is_instant
+ , subq_15.bookings AS bookings
+ , subq_15.instant_bookings AS instant_bookings
+ , subq_15.booking_value AS booking_value
+ , subq_15.max_booking_value AS max_booking_value
+ , subq_15.min_booking_value AS min_booking_value
+ , subq_15.bookers AS bookers
+ , subq_15.average_booking_value AS average_booking_value
+ , subq_15.referred_bookings AS referred_bookings
+ , subq_15.median_booking_value AS median_booking_value
+ , subq_15.booking_value_p99 AS booking_value_p99
+ , subq_15.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_15.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_15.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_8.ds AS booking__ds__day
- FROM ***************************.mf_time_spine subq_8
- ) subq_7
+ subq_17.ds AS booking__ds__day
+ FROM ***************************.mf_time_spine subq_17
+ ) subq_16
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_5.ds__day
- , subq_5.ds__week
- , subq_5.ds__month
- , subq_5.ds__quarter
- , subq_5.ds__year
- , subq_5.ds__extract_year
- , subq_5.ds__extract_quarter
- , subq_5.ds__extract_month
- , subq_5.ds__extract_day
- , subq_5.ds__extract_dow
- , subq_5.ds__extract_doy
- , subq_5.ds_partitioned__day
- , subq_5.ds_partitioned__week
- , subq_5.ds_partitioned__month
- , subq_5.ds_partitioned__quarter
- , subq_5.ds_partitioned__year
- , subq_5.ds_partitioned__extract_year
- , subq_5.ds_partitioned__extract_quarter
- , subq_5.ds_partitioned__extract_month
- , subq_5.ds_partitioned__extract_day
- , subq_5.ds_partitioned__extract_dow
- , subq_5.ds_partitioned__extract_doy
- , subq_5.paid_at__day
- , subq_5.paid_at__week
- , subq_5.paid_at__month
- , subq_5.paid_at__quarter
- , subq_5.paid_at__year
- , subq_5.paid_at__extract_year
- , subq_5.paid_at__extract_quarter
- , subq_5.paid_at__extract_month
- , subq_5.paid_at__extract_day
- , subq_5.paid_at__extract_dow
- , subq_5.paid_at__extract_doy
- , subq_5.booking__ds__day
- , subq_5.booking__ds__week
- , subq_5.booking__ds__month
- , subq_5.booking__ds__quarter
- , subq_5.booking__ds__year
- , subq_5.booking__ds__extract_year
- , subq_5.booking__ds__extract_quarter
- , subq_5.booking__ds__extract_month
- , subq_5.booking__ds__extract_day
- , subq_5.booking__ds__extract_dow
- , subq_5.booking__ds__extract_doy
- , subq_5.booking__ds_partitioned__day
- , subq_5.booking__ds_partitioned__week
- , subq_5.booking__ds_partitioned__month
- , subq_5.booking__ds_partitioned__quarter
- , subq_5.booking__ds_partitioned__year
- , subq_5.booking__ds_partitioned__extract_year
- , subq_5.booking__ds_partitioned__extract_quarter
- , subq_5.booking__ds_partitioned__extract_month
- , subq_5.booking__ds_partitioned__extract_day
- , subq_5.booking__ds_partitioned__extract_dow
- , subq_5.booking__ds_partitioned__extract_doy
- , subq_5.booking__paid_at__day
- , subq_5.booking__paid_at__week
- , subq_5.booking__paid_at__month
- , subq_5.booking__paid_at__quarter
- , subq_5.booking__paid_at__year
- , subq_5.booking__paid_at__extract_year
- , subq_5.booking__paid_at__extract_quarter
- , subq_5.booking__paid_at__extract_month
- , subq_5.booking__paid_at__extract_day
- , subq_5.booking__paid_at__extract_dow
- , subq_5.booking__paid_at__extract_doy
- , subq_5.ds__day AS metric_time__day
- , subq_5.ds__week AS metric_time__week
- , subq_5.ds__month AS metric_time__month
- , subq_5.ds__quarter AS metric_time__quarter
- , subq_5.ds__year AS metric_time__year
- , subq_5.ds__extract_year AS metric_time__extract_year
- , subq_5.ds__extract_quarter AS metric_time__extract_quarter
- , subq_5.ds__extract_month AS metric_time__extract_month
- , subq_5.ds__extract_day AS metric_time__extract_day
- , subq_5.ds__extract_dow AS metric_time__extract_dow
- , subq_5.ds__extract_doy AS metric_time__extract_doy
- , subq_5.listing
- , subq_5.guest
- , subq_5.host
- , subq_5.booking__listing
- , subq_5.booking__guest
- , subq_5.booking__host
- , subq_5.is_instant
- , subq_5.booking__is_instant
- , subq_5.bookings
- , subq_5.instant_bookings
- , subq_5.booking_value
- , subq_5.max_booking_value
- , subq_5.min_booking_value
- , subq_5.bookers
- , subq_5.average_booking_value
- , subq_5.referred_bookings
- , subq_5.median_booking_value
- , subq_5.booking_value_p99
- , subq_5.discrete_booking_value_p99
- , subq_5.approximate_continuous_booking_value_p99
- , subq_5.approximate_discrete_booking_value_p99
+ subq_14.ds__day
+ , subq_14.ds__week
+ , subq_14.ds__month
+ , subq_14.ds__quarter
+ , subq_14.ds__year
+ , subq_14.ds__extract_year
+ , subq_14.ds__extract_quarter
+ , subq_14.ds__extract_month
+ , subq_14.ds__extract_day
+ , subq_14.ds__extract_dow
+ , subq_14.ds__extract_doy
+ , subq_14.ds_partitioned__day
+ , subq_14.ds_partitioned__week
+ , subq_14.ds_partitioned__month
+ , subq_14.ds_partitioned__quarter
+ , subq_14.ds_partitioned__year
+ , subq_14.ds_partitioned__extract_year
+ , subq_14.ds_partitioned__extract_quarter
+ , subq_14.ds_partitioned__extract_month
+ , subq_14.ds_partitioned__extract_day
+ , subq_14.ds_partitioned__extract_dow
+ , subq_14.ds_partitioned__extract_doy
+ , subq_14.paid_at__day
+ , subq_14.paid_at__week
+ , subq_14.paid_at__month
+ , subq_14.paid_at__quarter
+ , subq_14.paid_at__year
+ , subq_14.paid_at__extract_year
+ , subq_14.paid_at__extract_quarter
+ , subq_14.paid_at__extract_month
+ , subq_14.paid_at__extract_day
+ , subq_14.paid_at__extract_dow
+ , subq_14.paid_at__extract_doy
+ , subq_14.booking__ds__day
+ , subq_14.booking__ds__week
+ , subq_14.booking__ds__month
+ , subq_14.booking__ds__quarter
+ , subq_14.booking__ds__year
+ , subq_14.booking__ds__extract_year
+ , subq_14.booking__ds__extract_quarter
+ , subq_14.booking__ds__extract_month
+ , subq_14.booking__ds__extract_day
+ , subq_14.booking__ds__extract_dow
+ , subq_14.booking__ds__extract_doy
+ , subq_14.booking__ds_partitioned__day
+ , subq_14.booking__ds_partitioned__week
+ , subq_14.booking__ds_partitioned__month
+ , subq_14.booking__ds_partitioned__quarter
+ , subq_14.booking__ds_partitioned__year
+ , subq_14.booking__ds_partitioned__extract_year
+ , subq_14.booking__ds_partitioned__extract_quarter
+ , subq_14.booking__ds_partitioned__extract_month
+ , subq_14.booking__ds_partitioned__extract_day
+ , subq_14.booking__ds_partitioned__extract_dow
+ , subq_14.booking__ds_partitioned__extract_doy
+ , subq_14.booking__paid_at__day
+ , subq_14.booking__paid_at__week
+ , subq_14.booking__paid_at__month
+ , subq_14.booking__paid_at__quarter
+ , subq_14.booking__paid_at__year
+ , subq_14.booking__paid_at__extract_year
+ , subq_14.booking__paid_at__extract_quarter
+ , subq_14.booking__paid_at__extract_month
+ , subq_14.booking__paid_at__extract_day
+ , subq_14.booking__paid_at__extract_dow
+ , subq_14.booking__paid_at__extract_doy
+ , subq_14.ds__day AS metric_time__day
+ , subq_14.ds__week AS metric_time__week
+ , subq_14.ds__month AS metric_time__month
+ , subq_14.ds__quarter AS metric_time__quarter
+ , subq_14.ds__year AS metric_time__year
+ , subq_14.ds__extract_year AS metric_time__extract_year
+ , subq_14.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_14.ds__extract_month AS metric_time__extract_month
+ , subq_14.ds__extract_day AS metric_time__extract_day
+ , subq_14.ds__extract_dow AS metric_time__extract_dow
+ , subq_14.ds__extract_doy AS metric_time__extract_doy
+ , subq_14.listing
+ , subq_14.guest
+ , subq_14.host
+ , subq_14.booking__listing
+ , subq_14.booking__guest
+ , subq_14.booking__host
+ , subq_14.is_instant
+ , subq_14.booking__is_instant
+ , subq_14.bookings
+ , subq_14.instant_bookings
+ , subq_14.booking_value
+ , subq_14.max_booking_value
+ , subq_14.min_booking_value
+ , subq_14.bookers
+ , subq_14.average_booking_value
+ , subq_14.referred_bookings
+ , subq_14.median_booking_value
+ , subq_14.booking_value_p99
+ , subq_14.discrete_booking_value_p99
+ , subq_14.approximate_continuous_booking_value_p99
+ , subq_14.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_5
- ) subq_6
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_14
+ ) subq_15
ON
- DATE_TRUNC('month', subq_7.booking__ds__day) = subq_6.booking__ds__day
- ) subq_9
- ) subq_10
+ DATE_TRUNC('month', subq_16.booking__ds__day) = subq_15.booking__ds__day
+ ) subq_18
+ ) subq_19
GROUP BY
- subq_10.booking__ds__day
- ) subq_11
- ) subq_12
+ subq_19.booking__ds__day
+ ) subq_20
+ ) subq_21
ON
- subq_4.booking__ds__day = subq_12.booking__ds__day
+ subq_13.booking__ds__day = subq_21.booking__ds__day
GROUP BY
- COALESCE(subq_4.booking__ds__day, subq_12.booking__ds__day)
-) subq_13
+ COALESCE(subq_13.booking__ds__day, subq_21.booking__ds__day)
+) subq_22
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_offset_to_grain_with_agg_time_dim__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_offset_to_grain_with_agg_time_dim__plan0_optimized.sql
index 1b7dbc4725..9f6d4b5769 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_offset_to_grain_with_agg_time_dim__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_offset_to_grain_with_agg_time_dim__plan0_optimized.sql
@@ -5,9 +5,9 @@ SELECT
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_18.booking__ds__day, subq_26.booking__ds__day) AS booking__ds__day
- , MAX(subq_18.bookings) AS bookings
- , MAX(subq_26.bookings_at_start_of_month) AS bookings_at_start_of_month
+ COALESCE(subq_27.booking__ds__day, subq_35.booking__ds__day) AS booking__ds__day
+ , MAX(subq_27.bookings) AS bookings
+ , MAX(subq_35.bookings_at_start_of_month) AS bookings_at_start_of_month
FROM (
-- Aggregate Measures
-- Compute Metrics via Expressions
@@ -21,35 +21,35 @@ FROM (
SELECT
DATE_TRUNC('day', ds) AS booking__ds__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_16
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_25
GROUP BY
booking__ds__day
- ) subq_18
+ ) subq_27
FULL OUTER JOIN (
-- Join to Time Spine Dataset
-- Pass Only Elements: ['bookings', 'booking__ds__day']
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_22.ds AS booking__ds__day
- , SUM(subq_20.bookings) AS bookings_at_start_of_month
- FROM ***************************.mf_time_spine subq_22
+ subq_31.ds AS booking__ds__day
+ , SUM(subq_29.bookings) AS bookings_at_start_of_month
+ FROM ***************************.mf_time_spine subq_31
INNER JOIN (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
SELECT
DATE_TRUNC('day', ds) AS booking__ds__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_20
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_29
ON
- DATE_TRUNC('month', subq_22.ds) = subq_20.booking__ds__day
+ DATE_TRUNC('month', subq_31.ds) = subq_29.booking__ds__day
GROUP BY
- subq_22.ds
- ) subq_26
+ subq_31.ds
+ ) subq_35
ON
- subq_18.booking__ds__day = subq_26.booking__ds__day
+ subq_27.booking__ds__day = subq_35.booking__ds__day
GROUP BY
- COALESCE(subq_18.booking__ds__day, subq_26.booking__ds__day)
-) subq_27
+ COALESCE(subq_27.booking__ds__day, subq_35.booking__ds__day)
+) subq_36
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_offset_window_with_agg_time_dim__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_offset_window_with_agg_time_dim__plan0.sql
index b7ef21c966..0f81d58776 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_offset_window_with_agg_time_dim__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_offset_window_with_agg_time_dim__plan0.sql
@@ -1,545 +1,545 @@
-- Compute Metrics via Expressions
SELECT
- subq_13.booking__ds__day
+ subq_22.booking__ds__day
, bookings - bookings_2_weeks_ago AS bookings_growth_2_weeks
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_4.booking__ds__day, subq_12.booking__ds__day) AS booking__ds__day
- , MAX(subq_4.bookings) AS bookings
- , MAX(subq_12.bookings_2_weeks_ago) AS bookings_2_weeks_ago
+ COALESCE(subq_13.booking__ds__day, subq_21.booking__ds__day) AS booking__ds__day
+ , MAX(subq_13.bookings) AS bookings
+ , MAX(subq_21.bookings_2_weeks_ago) AS bookings_2_weeks_ago
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_3.booking__ds__day
- , subq_3.bookings
+ subq_12.booking__ds__day
+ , subq_12.bookings
FROM (
-- Aggregate Measures
SELECT
- subq_2.booking__ds__day
- , SUM(subq_2.bookings) AS bookings
+ subq_11.booking__ds__day
+ , SUM(subq_11.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'booking__ds__day']
SELECT
- subq_1.booking__ds__day
- , subq_1.bookings
+ subq_10.booking__ds__day
+ , subq_10.bookings
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
- ) subq_2
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
GROUP BY
- subq_2.booking__ds__day
- ) subq_3
- ) subq_4
+ subq_11.booking__ds__day
+ ) subq_12
+ ) subq_13
FULL OUTER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_11.booking__ds__day
- , subq_11.bookings AS bookings_2_weeks_ago
+ subq_20.booking__ds__day
+ , subq_20.bookings AS bookings_2_weeks_ago
FROM (
-- Aggregate Measures
SELECT
- subq_10.booking__ds__day
- , SUM(subq_10.bookings) AS bookings
+ subq_19.booking__ds__day
+ , SUM(subq_19.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'booking__ds__day']
SELECT
- subq_9.booking__ds__day
- , subq_9.bookings
+ subq_18.booking__ds__day
+ , subq_18.bookings
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_7.booking__ds__day AS booking__ds__day
- , subq_6.ds__day AS ds__day
- , subq_6.ds__week AS ds__week
- , subq_6.ds__month AS ds__month
- , subq_6.ds__quarter AS ds__quarter
- , subq_6.ds__year AS ds__year
- , subq_6.ds__extract_year AS ds__extract_year
- , subq_6.ds__extract_quarter AS ds__extract_quarter
- , subq_6.ds__extract_month AS ds__extract_month
- , subq_6.ds__extract_day AS ds__extract_day
- , subq_6.ds__extract_dow AS ds__extract_dow
- , subq_6.ds__extract_doy AS ds__extract_doy
- , subq_6.ds_partitioned__day AS ds_partitioned__day
- , subq_6.ds_partitioned__week AS ds_partitioned__week
- , subq_6.ds_partitioned__month AS ds_partitioned__month
- , subq_6.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_6.ds_partitioned__year AS ds_partitioned__year
- , subq_6.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_6.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_6.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_6.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_6.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_6.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_6.paid_at__day AS paid_at__day
- , subq_6.paid_at__week AS paid_at__week
- , subq_6.paid_at__month AS paid_at__month
- , subq_6.paid_at__quarter AS paid_at__quarter
- , subq_6.paid_at__year AS paid_at__year
- , subq_6.paid_at__extract_year AS paid_at__extract_year
- , subq_6.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_6.paid_at__extract_month AS paid_at__extract_month
- , subq_6.paid_at__extract_day AS paid_at__extract_day
- , subq_6.paid_at__extract_dow AS paid_at__extract_dow
- , subq_6.paid_at__extract_doy AS paid_at__extract_doy
- , subq_6.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_6.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_6.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_6.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_6.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_6.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_6.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_6.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_6.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_6.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_6.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_6.booking__paid_at__day AS booking__paid_at__day
- , subq_6.booking__paid_at__week AS booking__paid_at__week
- , subq_6.booking__paid_at__month AS booking__paid_at__month
- , subq_6.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_6.booking__paid_at__year AS booking__paid_at__year
- , subq_6.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_6.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_6.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_6.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_6.metric_time__day AS metric_time__day
- , subq_6.metric_time__week AS metric_time__week
- , subq_6.metric_time__month AS metric_time__month
- , subq_6.metric_time__quarter AS metric_time__quarter
- , subq_6.metric_time__year AS metric_time__year
- , subq_6.metric_time__extract_year AS metric_time__extract_year
- , subq_6.metric_time__extract_quarter AS metric_time__extract_quarter
- , subq_6.metric_time__extract_month AS metric_time__extract_month
- , subq_6.metric_time__extract_day AS metric_time__extract_day
- , subq_6.metric_time__extract_dow AS metric_time__extract_dow
- , subq_6.metric_time__extract_doy AS metric_time__extract_doy
- , subq_6.listing AS listing
- , subq_6.guest AS guest
- , subq_6.host AS host
- , subq_6.booking__listing AS booking__listing
- , subq_6.booking__guest AS booking__guest
- , subq_6.booking__host AS booking__host
- , subq_6.is_instant AS is_instant
- , subq_6.booking__is_instant AS booking__is_instant
- , subq_6.bookings AS bookings
- , subq_6.instant_bookings AS instant_bookings
- , subq_6.booking_value AS booking_value
- , subq_6.max_booking_value AS max_booking_value
- , subq_6.min_booking_value AS min_booking_value
- , subq_6.bookers AS bookers
- , subq_6.average_booking_value AS average_booking_value
- , subq_6.referred_bookings AS referred_bookings
- , subq_6.median_booking_value AS median_booking_value
- , subq_6.booking_value_p99 AS booking_value_p99
- , subq_6.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_6.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_6.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ subq_16.booking__ds__day AS booking__ds__day
+ , subq_15.ds__day AS ds__day
+ , subq_15.ds__week AS ds__week
+ , subq_15.ds__month AS ds__month
+ , subq_15.ds__quarter AS ds__quarter
+ , subq_15.ds__year AS ds__year
+ , subq_15.ds__extract_year AS ds__extract_year
+ , subq_15.ds__extract_quarter AS ds__extract_quarter
+ , subq_15.ds__extract_month AS ds__extract_month
+ , subq_15.ds__extract_day AS ds__extract_day
+ , subq_15.ds__extract_dow AS ds__extract_dow
+ , subq_15.ds__extract_doy AS ds__extract_doy
+ , subq_15.ds_partitioned__day AS ds_partitioned__day
+ , subq_15.ds_partitioned__week AS ds_partitioned__week
+ , subq_15.ds_partitioned__month AS ds_partitioned__month
+ , subq_15.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_15.ds_partitioned__year AS ds_partitioned__year
+ , subq_15.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_15.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_15.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_15.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_15.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_15.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_15.paid_at__day AS paid_at__day
+ , subq_15.paid_at__week AS paid_at__week
+ , subq_15.paid_at__month AS paid_at__month
+ , subq_15.paid_at__quarter AS paid_at__quarter
+ , subq_15.paid_at__year AS paid_at__year
+ , subq_15.paid_at__extract_year AS paid_at__extract_year
+ , subq_15.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_15.paid_at__extract_month AS paid_at__extract_month
+ , subq_15.paid_at__extract_day AS paid_at__extract_day
+ , subq_15.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_15.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_15.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_15.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_15.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_15.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_15.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_15.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_15.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_15.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_15.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_15.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_15.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_15.booking__paid_at__day AS booking__paid_at__day
+ , subq_15.booking__paid_at__week AS booking__paid_at__week
+ , subq_15.booking__paid_at__month AS booking__paid_at__month
+ , subq_15.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_15.booking__paid_at__year AS booking__paid_at__year
+ , subq_15.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_15.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_15.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_15.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_15.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_15.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_15.metric_time__day AS metric_time__day
+ , subq_15.metric_time__week AS metric_time__week
+ , subq_15.metric_time__month AS metric_time__month
+ , subq_15.metric_time__quarter AS metric_time__quarter
+ , subq_15.metric_time__year AS metric_time__year
+ , subq_15.metric_time__extract_year AS metric_time__extract_year
+ , subq_15.metric_time__extract_quarter AS metric_time__extract_quarter
+ , subq_15.metric_time__extract_month AS metric_time__extract_month
+ , subq_15.metric_time__extract_day AS metric_time__extract_day
+ , subq_15.metric_time__extract_dow AS metric_time__extract_dow
+ , subq_15.metric_time__extract_doy AS metric_time__extract_doy
+ , subq_15.listing AS listing
+ , subq_15.guest AS guest
+ , subq_15.host AS host
+ , subq_15.booking__listing AS booking__listing
+ , subq_15.booking__guest AS booking__guest
+ , subq_15.booking__host AS booking__host
+ , subq_15.is_instant AS is_instant
+ , subq_15.booking__is_instant AS booking__is_instant
+ , subq_15.bookings AS bookings
+ , subq_15.instant_bookings AS instant_bookings
+ , subq_15.booking_value AS booking_value
+ , subq_15.max_booking_value AS max_booking_value
+ , subq_15.min_booking_value AS min_booking_value
+ , subq_15.bookers AS bookers
+ , subq_15.average_booking_value AS average_booking_value
+ , subq_15.referred_bookings AS referred_bookings
+ , subq_15.median_booking_value AS median_booking_value
+ , subq_15.booking_value_p99 AS booking_value_p99
+ , subq_15.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_15.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_15.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_8.ds AS booking__ds__day
- FROM ***************************.mf_time_spine subq_8
- ) subq_7
+ subq_17.ds AS booking__ds__day
+ FROM ***************************.mf_time_spine subq_17
+ ) subq_16
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_5.ds__day
- , subq_5.ds__week
- , subq_5.ds__month
- , subq_5.ds__quarter
- , subq_5.ds__year
- , subq_5.ds__extract_year
- , subq_5.ds__extract_quarter
- , subq_5.ds__extract_month
- , subq_5.ds__extract_day
- , subq_5.ds__extract_dow
- , subq_5.ds__extract_doy
- , subq_5.ds_partitioned__day
- , subq_5.ds_partitioned__week
- , subq_5.ds_partitioned__month
- , subq_5.ds_partitioned__quarter
- , subq_5.ds_partitioned__year
- , subq_5.ds_partitioned__extract_year
- , subq_5.ds_partitioned__extract_quarter
- , subq_5.ds_partitioned__extract_month
- , subq_5.ds_partitioned__extract_day
- , subq_5.ds_partitioned__extract_dow
- , subq_5.ds_partitioned__extract_doy
- , subq_5.paid_at__day
- , subq_5.paid_at__week
- , subq_5.paid_at__month
- , subq_5.paid_at__quarter
- , subq_5.paid_at__year
- , subq_5.paid_at__extract_year
- , subq_5.paid_at__extract_quarter
- , subq_5.paid_at__extract_month
- , subq_5.paid_at__extract_day
- , subq_5.paid_at__extract_dow
- , subq_5.paid_at__extract_doy
- , subq_5.booking__ds__day
- , subq_5.booking__ds__week
- , subq_5.booking__ds__month
- , subq_5.booking__ds__quarter
- , subq_5.booking__ds__year
- , subq_5.booking__ds__extract_year
- , subq_5.booking__ds__extract_quarter
- , subq_5.booking__ds__extract_month
- , subq_5.booking__ds__extract_day
- , subq_5.booking__ds__extract_dow
- , subq_5.booking__ds__extract_doy
- , subq_5.booking__ds_partitioned__day
- , subq_5.booking__ds_partitioned__week
- , subq_5.booking__ds_partitioned__month
- , subq_5.booking__ds_partitioned__quarter
- , subq_5.booking__ds_partitioned__year
- , subq_5.booking__ds_partitioned__extract_year
- , subq_5.booking__ds_partitioned__extract_quarter
- , subq_5.booking__ds_partitioned__extract_month
- , subq_5.booking__ds_partitioned__extract_day
- , subq_5.booking__ds_partitioned__extract_dow
- , subq_5.booking__ds_partitioned__extract_doy
- , subq_5.booking__paid_at__day
- , subq_5.booking__paid_at__week
- , subq_5.booking__paid_at__month
- , subq_5.booking__paid_at__quarter
- , subq_5.booking__paid_at__year
- , subq_5.booking__paid_at__extract_year
- , subq_5.booking__paid_at__extract_quarter
- , subq_5.booking__paid_at__extract_month
- , subq_5.booking__paid_at__extract_day
- , subq_5.booking__paid_at__extract_dow
- , subq_5.booking__paid_at__extract_doy
- , subq_5.ds__day AS metric_time__day
- , subq_5.ds__week AS metric_time__week
- , subq_5.ds__month AS metric_time__month
- , subq_5.ds__quarter AS metric_time__quarter
- , subq_5.ds__year AS metric_time__year
- , subq_5.ds__extract_year AS metric_time__extract_year
- , subq_5.ds__extract_quarter AS metric_time__extract_quarter
- , subq_5.ds__extract_month AS metric_time__extract_month
- , subq_5.ds__extract_day AS metric_time__extract_day
- , subq_5.ds__extract_dow AS metric_time__extract_dow
- , subq_5.ds__extract_doy AS metric_time__extract_doy
- , subq_5.listing
- , subq_5.guest
- , subq_5.host
- , subq_5.booking__listing
- , subq_5.booking__guest
- , subq_5.booking__host
- , subq_5.is_instant
- , subq_5.booking__is_instant
- , subq_5.bookings
- , subq_5.instant_bookings
- , subq_5.booking_value
- , subq_5.max_booking_value
- , subq_5.min_booking_value
- , subq_5.bookers
- , subq_5.average_booking_value
- , subq_5.referred_bookings
- , subq_5.median_booking_value
- , subq_5.booking_value_p99
- , subq_5.discrete_booking_value_p99
- , subq_5.approximate_continuous_booking_value_p99
- , subq_5.approximate_discrete_booking_value_p99
+ subq_14.ds__day
+ , subq_14.ds__week
+ , subq_14.ds__month
+ , subq_14.ds__quarter
+ , subq_14.ds__year
+ , subq_14.ds__extract_year
+ , subq_14.ds__extract_quarter
+ , subq_14.ds__extract_month
+ , subq_14.ds__extract_day
+ , subq_14.ds__extract_dow
+ , subq_14.ds__extract_doy
+ , subq_14.ds_partitioned__day
+ , subq_14.ds_partitioned__week
+ , subq_14.ds_partitioned__month
+ , subq_14.ds_partitioned__quarter
+ , subq_14.ds_partitioned__year
+ , subq_14.ds_partitioned__extract_year
+ , subq_14.ds_partitioned__extract_quarter
+ , subq_14.ds_partitioned__extract_month
+ , subq_14.ds_partitioned__extract_day
+ , subq_14.ds_partitioned__extract_dow
+ , subq_14.ds_partitioned__extract_doy
+ , subq_14.paid_at__day
+ , subq_14.paid_at__week
+ , subq_14.paid_at__month
+ , subq_14.paid_at__quarter
+ , subq_14.paid_at__year
+ , subq_14.paid_at__extract_year
+ , subq_14.paid_at__extract_quarter
+ , subq_14.paid_at__extract_month
+ , subq_14.paid_at__extract_day
+ , subq_14.paid_at__extract_dow
+ , subq_14.paid_at__extract_doy
+ , subq_14.booking__ds__day
+ , subq_14.booking__ds__week
+ , subq_14.booking__ds__month
+ , subq_14.booking__ds__quarter
+ , subq_14.booking__ds__year
+ , subq_14.booking__ds__extract_year
+ , subq_14.booking__ds__extract_quarter
+ , subq_14.booking__ds__extract_month
+ , subq_14.booking__ds__extract_day
+ , subq_14.booking__ds__extract_dow
+ , subq_14.booking__ds__extract_doy
+ , subq_14.booking__ds_partitioned__day
+ , subq_14.booking__ds_partitioned__week
+ , subq_14.booking__ds_partitioned__month
+ , subq_14.booking__ds_partitioned__quarter
+ , subq_14.booking__ds_partitioned__year
+ , subq_14.booking__ds_partitioned__extract_year
+ , subq_14.booking__ds_partitioned__extract_quarter
+ , subq_14.booking__ds_partitioned__extract_month
+ , subq_14.booking__ds_partitioned__extract_day
+ , subq_14.booking__ds_partitioned__extract_dow
+ , subq_14.booking__ds_partitioned__extract_doy
+ , subq_14.booking__paid_at__day
+ , subq_14.booking__paid_at__week
+ , subq_14.booking__paid_at__month
+ , subq_14.booking__paid_at__quarter
+ , subq_14.booking__paid_at__year
+ , subq_14.booking__paid_at__extract_year
+ , subq_14.booking__paid_at__extract_quarter
+ , subq_14.booking__paid_at__extract_month
+ , subq_14.booking__paid_at__extract_day
+ , subq_14.booking__paid_at__extract_dow
+ , subq_14.booking__paid_at__extract_doy
+ , subq_14.ds__day AS metric_time__day
+ , subq_14.ds__week AS metric_time__week
+ , subq_14.ds__month AS metric_time__month
+ , subq_14.ds__quarter AS metric_time__quarter
+ , subq_14.ds__year AS metric_time__year
+ , subq_14.ds__extract_year AS metric_time__extract_year
+ , subq_14.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_14.ds__extract_month AS metric_time__extract_month
+ , subq_14.ds__extract_day AS metric_time__extract_day
+ , subq_14.ds__extract_dow AS metric_time__extract_dow
+ , subq_14.ds__extract_doy AS metric_time__extract_doy
+ , subq_14.listing
+ , subq_14.guest
+ , subq_14.host
+ , subq_14.booking__listing
+ , subq_14.booking__guest
+ , subq_14.booking__host
+ , subq_14.is_instant
+ , subq_14.booking__is_instant
+ , subq_14.bookings
+ , subq_14.instant_bookings
+ , subq_14.booking_value
+ , subq_14.max_booking_value
+ , subq_14.min_booking_value
+ , subq_14.bookers
+ , subq_14.average_booking_value
+ , subq_14.referred_bookings
+ , subq_14.median_booking_value
+ , subq_14.booking_value_p99
+ , subq_14.discrete_booking_value_p99
+ , subq_14.approximate_continuous_booking_value_p99
+ , subq_14.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_5
- ) subq_6
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_14
+ ) subq_15
ON
- DATEADD(day, -14, subq_7.booking__ds__day) = subq_6.booking__ds__day
- ) subq_9
- ) subq_10
+ DATEADD(day, -14, subq_16.booking__ds__day) = subq_15.booking__ds__day
+ ) subq_18
+ ) subq_19
GROUP BY
- subq_10.booking__ds__day
- ) subq_11
- ) subq_12
+ subq_19.booking__ds__day
+ ) subq_20
+ ) subq_21
ON
- subq_4.booking__ds__day = subq_12.booking__ds__day
+ subq_13.booking__ds__day = subq_21.booking__ds__day
GROUP BY
- COALESCE(subq_4.booking__ds__day, subq_12.booking__ds__day)
-) subq_13
+ COALESCE(subq_13.booking__ds__day, subq_21.booking__ds__day)
+) subq_22
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_offset_window_with_agg_time_dim__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_offset_window_with_agg_time_dim__plan0_optimized.sql
index 272991a8dc..dc58b2992d 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_offset_window_with_agg_time_dim__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_offset_window_with_agg_time_dim__plan0_optimized.sql
@@ -5,9 +5,9 @@ SELECT
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_18.booking__ds__day, subq_26.booking__ds__day) AS booking__ds__day
- , MAX(subq_18.bookings) AS bookings
- , MAX(subq_26.bookings_2_weeks_ago) AS bookings_2_weeks_ago
+ COALESCE(subq_27.booking__ds__day, subq_35.booking__ds__day) AS booking__ds__day
+ , MAX(subq_27.bookings) AS bookings
+ , MAX(subq_35.bookings_2_weeks_ago) AS bookings_2_weeks_ago
FROM (
-- Aggregate Measures
-- Compute Metrics via Expressions
@@ -21,35 +21,35 @@ FROM (
SELECT
DATE_TRUNC('day', ds) AS booking__ds__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_16
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_25
GROUP BY
booking__ds__day
- ) subq_18
+ ) subq_27
FULL OUTER JOIN (
-- Join to Time Spine Dataset
-- Pass Only Elements: ['bookings', 'booking__ds__day']
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_22.ds AS booking__ds__day
- , SUM(subq_20.bookings) AS bookings_2_weeks_ago
- FROM ***************************.mf_time_spine subq_22
+ subq_31.ds AS booking__ds__day
+ , SUM(subq_29.bookings) AS bookings_2_weeks_ago
+ FROM ***************************.mf_time_spine subq_31
INNER JOIN (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
SELECT
DATE_TRUNC('day', ds) AS booking__ds__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_20
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_29
ON
- DATEADD(day, -14, subq_22.ds) = subq_20.booking__ds__day
+ DATEADD(day, -14, subq_31.ds) = subq_29.booking__ds__day
GROUP BY
- subq_22.ds
- ) subq_26
+ subq_31.ds
+ ) subq_35
ON
- subq_18.booking__ds__day = subq_26.booking__ds__day
+ subq_27.booking__ds__day = subq_35.booking__ds__day
GROUP BY
- COALESCE(subq_18.booking__ds__day, subq_26.booking__ds__day)
-) subq_27
+ COALESCE(subq_27.booking__ds__day, subq_35.booking__ds__day)
+) subq_36
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_time_offset_metric_with_time_constraint__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_time_offset_metric_with_time_constraint__plan0.sql
index 7db0055b6d..2bcc49dc1e 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_time_offset_metric_with_time_constraint__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_time_offset_metric_with_time_constraint__plan0.sql
@@ -1,320 +1,320 @@
-- Compute Metrics via Expressions
SELECT
- subq_7.metric_time__day
+ subq_16.metric_time__day
, bookings_5_days_ago AS bookings_5_day_lag
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_6.metric_time__day
- , subq_6.bookings AS bookings_5_days_ago
+ subq_15.metric_time__day
+ , subq_15.bookings AS bookings_5_days_ago
FROM (
-- Aggregate Measures
SELECT
- subq_5.metric_time__day
- , SUM(subq_5.bookings) AS bookings
+ subq_14.metric_time__day
+ , SUM(subq_14.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__day']
SELECT
- subq_4.metric_time__day
- , subq_4.bookings
+ subq_13.metric_time__day
+ , subq_13.bookings
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_2.metric_time__day AS metric_time__day
- , subq_1.ds__day AS ds__day
- , subq_1.ds__week AS ds__week
- , subq_1.ds__month AS ds__month
- , subq_1.ds__quarter AS ds__quarter
- , subq_1.ds__year AS ds__year
- , subq_1.ds__extract_year AS ds__extract_year
- , subq_1.ds__extract_quarter AS ds__extract_quarter
- , subq_1.ds__extract_month AS ds__extract_month
- , subq_1.ds__extract_day AS ds__extract_day
- , subq_1.ds__extract_dow AS ds__extract_dow
- , subq_1.ds__extract_doy AS ds__extract_doy
- , subq_1.ds_partitioned__day AS ds_partitioned__day
- , subq_1.ds_partitioned__week AS ds_partitioned__week
- , subq_1.ds_partitioned__month AS ds_partitioned__month
- , subq_1.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_1.ds_partitioned__year AS ds_partitioned__year
- , subq_1.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_1.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_1.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_1.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_1.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_1.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_1.paid_at__day AS paid_at__day
- , subq_1.paid_at__week AS paid_at__week
- , subq_1.paid_at__month AS paid_at__month
- , subq_1.paid_at__quarter AS paid_at__quarter
- , subq_1.paid_at__year AS paid_at__year
- , subq_1.paid_at__extract_year AS paid_at__extract_year
- , subq_1.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_1.paid_at__extract_month AS paid_at__extract_month
- , subq_1.paid_at__extract_day AS paid_at__extract_day
- , subq_1.paid_at__extract_dow AS paid_at__extract_dow
- , subq_1.paid_at__extract_doy AS paid_at__extract_doy
- , subq_1.booking__ds__day AS booking__ds__day
- , subq_1.booking__ds__week AS booking__ds__week
- , subq_1.booking__ds__month AS booking__ds__month
- , subq_1.booking__ds__quarter AS booking__ds__quarter
- , subq_1.booking__ds__year AS booking__ds__year
- , subq_1.booking__ds__extract_year AS booking__ds__extract_year
- , subq_1.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_1.booking__ds__extract_month AS booking__ds__extract_month
- , subq_1.booking__ds__extract_day AS booking__ds__extract_day
- , subq_1.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_1.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_1.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_1.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_1.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_1.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_1.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_1.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_1.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_1.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_1.booking__paid_at__day AS booking__paid_at__day
- , subq_1.booking__paid_at__week AS booking__paid_at__week
- , subq_1.booking__paid_at__month AS booking__paid_at__month
- , subq_1.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_1.booking__paid_at__year AS booking__paid_at__year
- , subq_1.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_1.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_1.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_1.listing AS listing
- , subq_1.guest AS guest
- , subq_1.host AS host
- , subq_1.booking__listing AS booking__listing
- , subq_1.booking__guest AS booking__guest
- , subq_1.booking__host AS booking__host
- , subq_1.is_instant AS is_instant
- , subq_1.booking__is_instant AS booking__is_instant
- , subq_1.bookings AS bookings
- , subq_1.instant_bookings AS instant_bookings
- , subq_1.booking_value AS booking_value
- , subq_1.max_booking_value AS max_booking_value
- , subq_1.min_booking_value AS min_booking_value
- , subq_1.bookers AS bookers
- , subq_1.average_booking_value AS average_booking_value
- , subq_1.referred_bookings AS referred_bookings
- , subq_1.median_booking_value AS median_booking_value
- , subq_1.booking_value_p99 AS booking_value_p99
- , subq_1.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_1.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_1.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ subq_11.metric_time__day AS metric_time__day
+ , subq_10.ds__day AS ds__day
+ , subq_10.ds__week AS ds__week
+ , subq_10.ds__month AS ds__month
+ , subq_10.ds__quarter AS ds__quarter
+ , subq_10.ds__year AS ds__year
+ , subq_10.ds__extract_year AS ds__extract_year
+ , subq_10.ds__extract_quarter AS ds__extract_quarter
+ , subq_10.ds__extract_month AS ds__extract_month
+ , subq_10.ds__extract_day AS ds__extract_day
+ , subq_10.ds__extract_dow AS ds__extract_dow
+ , subq_10.ds__extract_doy AS ds__extract_doy
+ , subq_10.ds_partitioned__day AS ds_partitioned__day
+ , subq_10.ds_partitioned__week AS ds_partitioned__week
+ , subq_10.ds_partitioned__month AS ds_partitioned__month
+ , subq_10.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_10.ds_partitioned__year AS ds_partitioned__year
+ , subq_10.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_10.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_10.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_10.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_10.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_10.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_10.paid_at__day AS paid_at__day
+ , subq_10.paid_at__week AS paid_at__week
+ , subq_10.paid_at__month AS paid_at__month
+ , subq_10.paid_at__quarter AS paid_at__quarter
+ , subq_10.paid_at__year AS paid_at__year
+ , subq_10.paid_at__extract_year AS paid_at__extract_year
+ , subq_10.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_10.paid_at__extract_month AS paid_at__extract_month
+ , subq_10.paid_at__extract_day AS paid_at__extract_day
+ , subq_10.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_10.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_10.booking__ds__day AS booking__ds__day
+ , subq_10.booking__ds__week AS booking__ds__week
+ , subq_10.booking__ds__month AS booking__ds__month
+ , subq_10.booking__ds__quarter AS booking__ds__quarter
+ , subq_10.booking__ds__year AS booking__ds__year
+ , subq_10.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_10.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_10.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_10.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_10.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_10.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_10.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_10.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_10.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_10.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_10.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_10.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_10.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_10.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_10.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_10.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_10.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_10.booking__paid_at__day AS booking__paid_at__day
+ , subq_10.booking__paid_at__week AS booking__paid_at__week
+ , subq_10.booking__paid_at__month AS booking__paid_at__month
+ , subq_10.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_10.booking__paid_at__year AS booking__paid_at__year
+ , subq_10.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_10.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_10.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_10.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_10.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_10.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_10.listing AS listing
+ , subq_10.guest AS guest
+ , subq_10.host AS host
+ , subq_10.booking__listing AS booking__listing
+ , subq_10.booking__guest AS booking__guest
+ , subq_10.booking__host AS booking__host
+ , subq_10.is_instant AS is_instant
+ , subq_10.booking__is_instant AS booking__is_instant
+ , subq_10.bookings AS bookings
+ , subq_10.instant_bookings AS instant_bookings
+ , subq_10.booking_value AS booking_value
+ , subq_10.max_booking_value AS max_booking_value
+ , subq_10.min_booking_value AS min_booking_value
+ , subq_10.bookers AS bookers
+ , subq_10.average_booking_value AS average_booking_value
+ , subq_10.referred_bookings AS referred_bookings
+ , subq_10.median_booking_value AS median_booking_value
+ , subq_10.booking_value_p99 AS booking_value_p99
+ , subq_10.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_10.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_10.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_3.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_3
- WHERE subq_3.ds BETWEEN '2019-12-19' AND '2020-01-02'
- ) subq_2
+ subq_12.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_12
+ WHERE subq_12.ds BETWEEN '2019-12-19' AND '2020-01-02'
+ ) subq_11
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(DAYOFWEEK_ISO FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
ON
- DATEADD(day, -5, subq_2.metric_time__day) = subq_1.metric_time__day
- ) subq_4
- ) subq_5
+ DATEADD(day, -5, subq_11.metric_time__day) = subq_10.metric_time__day
+ ) subq_13
+ ) subq_14
GROUP BY
- subq_5.metric_time__day
- ) subq_6
-) subq_7
+ subq_14.metric_time__day
+ ) subq_15
+) subq_16
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_time_offset_metric_with_time_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_time_offset_metric_with_time_constraint__plan0_optimized.sql
index ee1dcbf475..f3a30decfa 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_time_offset_metric_with_time_constraint__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Databricks/test_time_offset_metric_with_time_constraint__plan0_optimized.sql
@@ -8,25 +8,25 @@ FROM (
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_10.metric_time__day AS metric_time__day
- , SUM(subq_9.bookings) AS bookings_5_days_ago
+ subq_19.metric_time__day AS metric_time__day
+ , SUM(subq_18.bookings) AS bookings_5_days_ago
FROM (
-- Time Spine
SELECT
ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_11
+ FROM ***************************.mf_time_spine subq_20
WHERE ds BETWEEN '2019-12-19' AND '2020-01-02'
- ) subq_10
+ ) subq_19
INNER JOIN (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
SELECT
DATE_TRUNC('day', ds) AS metric_time__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_9
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_18
ON
- DATEADD(day, -5, subq_10.metric_time__day) = subq_9.metric_time__day
+ DATEADD(day, -5, subq_19.metric_time__day) = subq_18.metric_time__day
GROUP BY
- subq_10.metric_time__day
-) subq_15
+ subq_19.metric_time__day
+) subq_24
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_time_offset_metric_with_time_constraint__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_time_offset_metric_with_time_constraint__plan0.sql
index dce7659bbc..88727e99da 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_time_offset_metric_with_time_constraint__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_time_offset_metric_with_time_constraint__plan0.sql
@@ -1,441 +1,441 @@
-- Compute Metrics via Expressions
SELECT
- subq_11.metric_time__day
+ subq_20.metric_time__day
, every_2_days_bookers_2_days_ago AS every_2_days_bookers_2_days_ago
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_10.metric_time__day
- , subq_10.bookers AS every_2_days_bookers_2_days_ago
+ subq_19.metric_time__day
+ , subq_19.bookers AS every_2_days_bookers_2_days_ago
FROM (
-- Aggregate Measures
SELECT
- subq_9.metric_time__day
- , COUNT(DISTINCT subq_9.bookers) AS bookers
+ subq_18.metric_time__day
+ , COUNT(DISTINCT subq_18.bookers) AS bookers
FROM (
-- Constrain Time Range to [2019-12-19T00:00:00, 2020-01-02T00:00:00]
SELECT
- subq_8.metric_time__day
- , subq_8.bookers
+ subq_17.metric_time__day
+ , subq_17.bookers
FROM (
-- Pass Only Elements: ['bookers', 'metric_time__day']
SELECT
- subq_7.metric_time__day
- , subq_7.bookers
+ subq_16.metric_time__day
+ , subq_16.bookers
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_5.metric_time__day AS metric_time__day
- , subq_4.ds__day AS ds__day
- , subq_4.ds__week AS ds__week
- , subq_4.ds__month AS ds__month
- , subq_4.ds__quarter AS ds__quarter
- , subq_4.ds__year AS ds__year
- , subq_4.ds__extract_year AS ds__extract_year
- , subq_4.ds__extract_quarter AS ds__extract_quarter
- , subq_4.ds__extract_month AS ds__extract_month
- , subq_4.ds__extract_day AS ds__extract_day
- , subq_4.ds__extract_dow AS ds__extract_dow
- , subq_4.ds__extract_doy AS ds__extract_doy
- , subq_4.ds_partitioned__day AS ds_partitioned__day
- , subq_4.ds_partitioned__week AS ds_partitioned__week
- , subq_4.ds_partitioned__month AS ds_partitioned__month
- , subq_4.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_4.ds_partitioned__year AS ds_partitioned__year
- , subq_4.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_4.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_4.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_4.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_4.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_4.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_4.paid_at__day AS paid_at__day
- , subq_4.paid_at__week AS paid_at__week
- , subq_4.paid_at__month AS paid_at__month
- , subq_4.paid_at__quarter AS paid_at__quarter
- , subq_4.paid_at__year AS paid_at__year
- , subq_4.paid_at__extract_year AS paid_at__extract_year
- , subq_4.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_4.paid_at__extract_month AS paid_at__extract_month
- , subq_4.paid_at__extract_day AS paid_at__extract_day
- , subq_4.paid_at__extract_dow AS paid_at__extract_dow
- , subq_4.paid_at__extract_doy AS paid_at__extract_doy
- , subq_4.booking__ds__day AS booking__ds__day
- , subq_4.booking__ds__week AS booking__ds__week
- , subq_4.booking__ds__month AS booking__ds__month
- , subq_4.booking__ds__quarter AS booking__ds__quarter
- , subq_4.booking__ds__year AS booking__ds__year
- , subq_4.booking__ds__extract_year AS booking__ds__extract_year
- , subq_4.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_4.booking__ds__extract_month AS booking__ds__extract_month
- , subq_4.booking__ds__extract_day AS booking__ds__extract_day
- , subq_4.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_4.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_4.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_4.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_4.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_4.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_4.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_4.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_4.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_4.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_4.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_4.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_4.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_4.booking__paid_at__day AS booking__paid_at__day
- , subq_4.booking__paid_at__week AS booking__paid_at__week
- , subq_4.booking__paid_at__month AS booking__paid_at__month
- , subq_4.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_4.booking__paid_at__year AS booking__paid_at__year
- , subq_4.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_4.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_4.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_4.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_4.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_4.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_4.listing AS listing
- , subq_4.guest AS guest
- , subq_4.host AS host
- , subq_4.booking__listing AS booking__listing
- , subq_4.booking__guest AS booking__guest
- , subq_4.booking__host AS booking__host
- , subq_4.is_instant AS is_instant
- , subq_4.booking__is_instant AS booking__is_instant
- , subq_4.bookings AS bookings
- , subq_4.instant_bookings AS instant_bookings
- , subq_4.booking_value AS booking_value
- , subq_4.max_booking_value AS max_booking_value
- , subq_4.min_booking_value AS min_booking_value
- , subq_4.bookers AS bookers
- , subq_4.average_booking_value AS average_booking_value
- , subq_4.referred_bookings AS referred_bookings
- , subq_4.median_booking_value AS median_booking_value
- , subq_4.booking_value_p99 AS booking_value_p99
- , subq_4.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_4.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_4.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ subq_14.metric_time__day AS metric_time__day
+ , subq_13.ds__day AS ds__day
+ , subq_13.ds__week AS ds__week
+ , subq_13.ds__month AS ds__month
+ , subq_13.ds__quarter AS ds__quarter
+ , subq_13.ds__year AS ds__year
+ , subq_13.ds__extract_year AS ds__extract_year
+ , subq_13.ds__extract_quarter AS ds__extract_quarter
+ , subq_13.ds__extract_month AS ds__extract_month
+ , subq_13.ds__extract_day AS ds__extract_day
+ , subq_13.ds__extract_dow AS ds__extract_dow
+ , subq_13.ds__extract_doy AS ds__extract_doy
+ , subq_13.ds_partitioned__day AS ds_partitioned__day
+ , subq_13.ds_partitioned__week AS ds_partitioned__week
+ , subq_13.ds_partitioned__month AS ds_partitioned__month
+ , subq_13.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_13.ds_partitioned__year AS ds_partitioned__year
+ , subq_13.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_13.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_13.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_13.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_13.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_13.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_13.paid_at__day AS paid_at__day
+ , subq_13.paid_at__week AS paid_at__week
+ , subq_13.paid_at__month AS paid_at__month
+ , subq_13.paid_at__quarter AS paid_at__quarter
+ , subq_13.paid_at__year AS paid_at__year
+ , subq_13.paid_at__extract_year AS paid_at__extract_year
+ , subq_13.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_13.paid_at__extract_month AS paid_at__extract_month
+ , subq_13.paid_at__extract_day AS paid_at__extract_day
+ , subq_13.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_13.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_13.booking__ds__day AS booking__ds__day
+ , subq_13.booking__ds__week AS booking__ds__week
+ , subq_13.booking__ds__month AS booking__ds__month
+ , subq_13.booking__ds__quarter AS booking__ds__quarter
+ , subq_13.booking__ds__year AS booking__ds__year
+ , subq_13.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_13.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_13.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_13.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_13.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_13.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_13.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_13.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_13.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_13.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_13.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_13.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_13.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_13.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_13.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_13.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_13.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_13.booking__paid_at__day AS booking__paid_at__day
+ , subq_13.booking__paid_at__week AS booking__paid_at__week
+ , subq_13.booking__paid_at__month AS booking__paid_at__month
+ , subq_13.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_13.booking__paid_at__year AS booking__paid_at__year
+ , subq_13.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_13.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_13.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_13.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_13.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_13.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_13.listing AS listing
+ , subq_13.guest AS guest
+ , subq_13.host AS host
+ , subq_13.booking__listing AS booking__listing
+ , subq_13.booking__guest AS booking__guest
+ , subq_13.booking__host AS booking__host
+ , subq_13.is_instant AS is_instant
+ , subq_13.booking__is_instant AS booking__is_instant
+ , subq_13.bookings AS bookings
+ , subq_13.instant_bookings AS instant_bookings
+ , subq_13.booking_value AS booking_value
+ , subq_13.max_booking_value AS max_booking_value
+ , subq_13.min_booking_value AS min_booking_value
+ , subq_13.bookers AS bookers
+ , subq_13.average_booking_value AS average_booking_value
+ , subq_13.referred_bookings AS referred_bookings
+ , subq_13.median_booking_value AS median_booking_value
+ , subq_13.booking_value_p99 AS booking_value_p99
+ , subq_13.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_13.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_13.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_6.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_6
- WHERE subq_6.ds BETWEEN '2019-12-19' AND '2020-01-02'
- ) subq_5
+ subq_15.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_15
+ WHERE subq_15.ds BETWEEN '2019-12-19' AND '2020-01-02'
+ ) subq_14
INNER JOIN (
-- Join Self Over Time Range
SELECT
- subq_2.metric_time__day AS metric_time__day
- , subq_1.ds__day AS ds__day
- , subq_1.ds__week AS ds__week
- , subq_1.ds__month AS ds__month
- , subq_1.ds__quarter AS ds__quarter
- , subq_1.ds__year AS ds__year
- , subq_1.ds__extract_year AS ds__extract_year
- , subq_1.ds__extract_quarter AS ds__extract_quarter
- , subq_1.ds__extract_month AS ds__extract_month
- , subq_1.ds__extract_day AS ds__extract_day
- , subq_1.ds__extract_dow AS ds__extract_dow
- , subq_1.ds__extract_doy AS ds__extract_doy
- , subq_1.ds_partitioned__day AS ds_partitioned__day
- , subq_1.ds_partitioned__week AS ds_partitioned__week
- , subq_1.ds_partitioned__month AS ds_partitioned__month
- , subq_1.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_1.ds_partitioned__year AS ds_partitioned__year
- , subq_1.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_1.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_1.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_1.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_1.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_1.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_1.paid_at__day AS paid_at__day
- , subq_1.paid_at__week AS paid_at__week
- , subq_1.paid_at__month AS paid_at__month
- , subq_1.paid_at__quarter AS paid_at__quarter
- , subq_1.paid_at__year AS paid_at__year
- , subq_1.paid_at__extract_year AS paid_at__extract_year
- , subq_1.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_1.paid_at__extract_month AS paid_at__extract_month
- , subq_1.paid_at__extract_day AS paid_at__extract_day
- , subq_1.paid_at__extract_dow AS paid_at__extract_dow
- , subq_1.paid_at__extract_doy AS paid_at__extract_doy
- , subq_1.booking__ds__day AS booking__ds__day
- , subq_1.booking__ds__week AS booking__ds__week
- , subq_1.booking__ds__month AS booking__ds__month
- , subq_1.booking__ds__quarter AS booking__ds__quarter
- , subq_1.booking__ds__year AS booking__ds__year
- , subq_1.booking__ds__extract_year AS booking__ds__extract_year
- , subq_1.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_1.booking__ds__extract_month AS booking__ds__extract_month
- , subq_1.booking__ds__extract_day AS booking__ds__extract_day
- , subq_1.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_1.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_1.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_1.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_1.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_1.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_1.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_1.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_1.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_1.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_1.booking__paid_at__day AS booking__paid_at__day
- , subq_1.booking__paid_at__week AS booking__paid_at__week
- , subq_1.booking__paid_at__month AS booking__paid_at__month
- , subq_1.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_1.booking__paid_at__year AS booking__paid_at__year
- , subq_1.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_1.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_1.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_1.metric_time__week AS metric_time__week
- , subq_1.metric_time__month AS metric_time__month
- , subq_1.metric_time__quarter AS metric_time__quarter
- , subq_1.metric_time__year AS metric_time__year
- , subq_1.metric_time__extract_year AS metric_time__extract_year
- , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter
- , subq_1.metric_time__extract_month AS metric_time__extract_month
- , subq_1.metric_time__extract_day AS metric_time__extract_day
- , subq_1.metric_time__extract_dow AS metric_time__extract_dow
- , subq_1.metric_time__extract_doy AS metric_time__extract_doy
- , subq_1.listing AS listing
- , subq_1.guest AS guest
- , subq_1.host AS host
- , subq_1.booking__listing AS booking__listing
- , subq_1.booking__guest AS booking__guest
- , subq_1.booking__host AS booking__host
- , subq_1.is_instant AS is_instant
- , subq_1.booking__is_instant AS booking__is_instant
- , subq_1.bookings AS bookings
- , subq_1.instant_bookings AS instant_bookings
- , subq_1.booking_value AS booking_value
- , subq_1.max_booking_value AS max_booking_value
- , subq_1.min_booking_value AS min_booking_value
- , subq_1.bookers AS bookers
- , subq_1.average_booking_value AS average_booking_value
- , subq_1.referred_bookings AS referred_bookings
- , subq_1.median_booking_value AS median_booking_value
- , subq_1.booking_value_p99 AS booking_value_p99
- , subq_1.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_1.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_1.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ subq_11.metric_time__day AS metric_time__day
+ , subq_10.ds__day AS ds__day
+ , subq_10.ds__week AS ds__week
+ , subq_10.ds__month AS ds__month
+ , subq_10.ds__quarter AS ds__quarter
+ , subq_10.ds__year AS ds__year
+ , subq_10.ds__extract_year AS ds__extract_year
+ , subq_10.ds__extract_quarter AS ds__extract_quarter
+ , subq_10.ds__extract_month AS ds__extract_month
+ , subq_10.ds__extract_day AS ds__extract_day
+ , subq_10.ds__extract_dow AS ds__extract_dow
+ , subq_10.ds__extract_doy AS ds__extract_doy
+ , subq_10.ds_partitioned__day AS ds_partitioned__day
+ , subq_10.ds_partitioned__week AS ds_partitioned__week
+ , subq_10.ds_partitioned__month AS ds_partitioned__month
+ , subq_10.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_10.ds_partitioned__year AS ds_partitioned__year
+ , subq_10.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_10.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_10.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_10.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_10.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_10.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_10.paid_at__day AS paid_at__day
+ , subq_10.paid_at__week AS paid_at__week
+ , subq_10.paid_at__month AS paid_at__month
+ , subq_10.paid_at__quarter AS paid_at__quarter
+ , subq_10.paid_at__year AS paid_at__year
+ , subq_10.paid_at__extract_year AS paid_at__extract_year
+ , subq_10.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_10.paid_at__extract_month AS paid_at__extract_month
+ , subq_10.paid_at__extract_day AS paid_at__extract_day
+ , subq_10.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_10.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_10.booking__ds__day AS booking__ds__day
+ , subq_10.booking__ds__week AS booking__ds__week
+ , subq_10.booking__ds__month AS booking__ds__month
+ , subq_10.booking__ds__quarter AS booking__ds__quarter
+ , subq_10.booking__ds__year AS booking__ds__year
+ , subq_10.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_10.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_10.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_10.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_10.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_10.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_10.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_10.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_10.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_10.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_10.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_10.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_10.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_10.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_10.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_10.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_10.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_10.booking__paid_at__day AS booking__paid_at__day
+ , subq_10.booking__paid_at__week AS booking__paid_at__week
+ , subq_10.booking__paid_at__month AS booking__paid_at__month
+ , subq_10.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_10.booking__paid_at__year AS booking__paid_at__year
+ , subq_10.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_10.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_10.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_10.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_10.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_10.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_10.metric_time__week AS metric_time__week
+ , subq_10.metric_time__month AS metric_time__month
+ , subq_10.metric_time__quarter AS metric_time__quarter
+ , subq_10.metric_time__year AS metric_time__year
+ , subq_10.metric_time__extract_year AS metric_time__extract_year
+ , subq_10.metric_time__extract_quarter AS metric_time__extract_quarter
+ , subq_10.metric_time__extract_month AS metric_time__extract_month
+ , subq_10.metric_time__extract_day AS metric_time__extract_day
+ , subq_10.metric_time__extract_dow AS metric_time__extract_dow
+ , subq_10.metric_time__extract_doy AS metric_time__extract_doy
+ , subq_10.listing AS listing
+ , subq_10.guest AS guest
+ , subq_10.host AS host
+ , subq_10.booking__listing AS booking__listing
+ , subq_10.booking__guest AS booking__guest
+ , subq_10.booking__host AS booking__host
+ , subq_10.is_instant AS is_instant
+ , subq_10.booking__is_instant AS booking__is_instant
+ , subq_10.bookings AS bookings
+ , subq_10.instant_bookings AS instant_bookings
+ , subq_10.booking_value AS booking_value
+ , subq_10.max_booking_value AS max_booking_value
+ , subq_10.min_booking_value AS min_booking_value
+ , subq_10.bookers AS bookers
+ , subq_10.average_booking_value AS average_booking_value
+ , subq_10.referred_bookings AS referred_bookings
+ , subq_10.median_booking_value AS median_booking_value
+ , subq_10.booking_value_p99 AS booking_value_p99
+ , subq_10.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_10.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_10.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_3.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_3
- ) subq_2
+ subq_12.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_12
+ ) subq_11
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
ON
(
- subq_1.metric_time__day <= subq_2.metric_time__day
+ subq_10.metric_time__day <= subq_11.metric_time__day
) AND (
- subq_1.metric_time__day > subq_2.metric_time__day - INTERVAL 2 day
+ subq_10.metric_time__day > subq_11.metric_time__day - INTERVAL 2 day
)
- ) subq_4
+ ) subq_13
ON
- subq_5.metric_time__day - INTERVAL 2 day = subq_4.metric_time__day
- ) subq_7
- ) subq_8
- WHERE subq_8.metric_time__day BETWEEN '2019-12-19' AND '2020-01-02'
- ) subq_9
+ subq_14.metric_time__day - INTERVAL 2 day = subq_13.metric_time__day
+ ) subq_16
+ ) subq_17
+ WHERE subq_17.metric_time__day BETWEEN '2019-12-19' AND '2020-01-02'
+ ) subq_18
GROUP BY
- subq_9.metric_time__day
- ) subq_10
-) subq_11
+ subq_18.metric_time__day
+ ) subq_19
+) subq_20
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_time_offset_metric_with_time_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_time_offset_metric_with_time_constraint__plan0_optimized.sql
index 7412a7d091..a60bc4a0e3 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_time_offset_metric_with_time_constraint__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_cumulative_time_offset_metric_with_time_constraint__plan0_optimized.sql
@@ -9,33 +9,33 @@ FROM (
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_17.metric_time__day AS metric_time__day
- , COUNT(DISTINCT subq_16.bookers) AS every_2_days_bookers_2_days_ago
+ subq_26.metric_time__day AS metric_time__day
+ , COUNT(DISTINCT subq_25.bookers) AS every_2_days_bookers_2_days_ago
FROM (
-- Time Spine
SELECT
ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_18
+ FROM ***************************.mf_time_spine subq_27
WHERE ds BETWEEN '2019-12-19' AND '2020-01-02'
- ) subq_17
+ ) subq_26
INNER JOIN (
-- Join Self Over Time Range
SELECT
- subq_15.ds AS metric_time__day
- , bookings_source_src_28001.guest_id AS bookers
- FROM ***************************.mf_time_spine subq_15
+ subq_24.ds AS metric_time__day
+ , bookings_source_src_28000.guest_id AS bookers
+ FROM ***************************.mf_time_spine subq_24
INNER JOIN
- ***************************.fct_bookings bookings_source_src_28001
+ ***************************.fct_bookings bookings_source_src_28000
ON
(
- DATE_TRUNC('day', bookings_source_src_28001.ds) <= subq_15.ds
+ DATE_TRUNC('day', bookings_source_src_28000.ds) <= subq_24.ds
) AND (
- DATE_TRUNC('day', bookings_source_src_28001.ds) > subq_15.ds - INTERVAL 2 day
+ DATE_TRUNC('day', bookings_source_src_28000.ds) > subq_24.ds - INTERVAL 2 day
)
- ) subq_16
+ ) subq_25
ON
- subq_17.metric_time__day - INTERVAL 2 day = subq_16.metric_time__day
- WHERE subq_17.metric_time__day BETWEEN '2019-12-19' AND '2020-01-02'
+ subq_26.metric_time__day - INTERVAL 2 day = subq_25.metric_time__day
+ WHERE subq_26.metric_time__day BETWEEN '2019-12-19' AND '2020-01-02'
GROUP BY
- subq_17.metric_time__day
-) subq_23
+ subq_26.metric_time__day
+) subq_32
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric__plan0.sql
index ea8a884590..7d019a0866 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric__plan0.sql
@@ -1,445 +1,445 @@
-- Compute Metrics via Expressions
SELECT
- subq_10.metric_time__day
+ subq_19.metric_time__day
, (bookings - ref_bookings) * 1.0 / bookings AS non_referred_bookings_pct
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_4.metric_time__day, subq_9.metric_time__day) AS metric_time__day
- , MAX(subq_4.ref_bookings) AS ref_bookings
- , MAX(subq_9.bookings) AS bookings
+ COALESCE(subq_13.metric_time__day, subq_18.metric_time__day) AS metric_time__day
+ , MAX(subq_13.ref_bookings) AS ref_bookings
+ , MAX(subq_18.bookings) AS bookings
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_3.metric_time__day
- , subq_3.referred_bookings AS ref_bookings
+ subq_12.metric_time__day
+ , subq_12.referred_bookings AS ref_bookings
FROM (
-- Aggregate Measures
SELECT
- subq_2.metric_time__day
- , SUM(subq_2.referred_bookings) AS referred_bookings
+ subq_11.metric_time__day
+ , SUM(subq_11.referred_bookings) AS referred_bookings
FROM (
-- Pass Only Elements: ['referred_bookings', 'metric_time__day']
SELECT
- subq_1.metric_time__day
- , subq_1.referred_bookings
+ subq_10.metric_time__day
+ , subq_10.referred_bookings
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
- ) subq_2
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
GROUP BY
- subq_2.metric_time__day
- ) subq_3
- ) subq_4
+ subq_11.metric_time__day
+ ) subq_12
+ ) subq_13
FULL OUTER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_8.metric_time__day
- , subq_8.bookings
+ subq_17.metric_time__day
+ , subq_17.bookings
FROM (
-- Aggregate Measures
SELECT
- subq_7.metric_time__day
- , SUM(subq_7.bookings) AS bookings
+ subq_16.metric_time__day
+ , SUM(subq_16.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__day']
SELECT
- subq_6.metric_time__day
- , subq_6.bookings
+ subq_15.metric_time__day
+ , subq_15.bookings
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_5.ds__day
- , subq_5.ds__week
- , subq_5.ds__month
- , subq_5.ds__quarter
- , subq_5.ds__year
- , subq_5.ds__extract_year
- , subq_5.ds__extract_quarter
- , subq_5.ds__extract_month
- , subq_5.ds__extract_day
- , subq_5.ds__extract_dow
- , subq_5.ds__extract_doy
- , subq_5.ds_partitioned__day
- , subq_5.ds_partitioned__week
- , subq_5.ds_partitioned__month
- , subq_5.ds_partitioned__quarter
- , subq_5.ds_partitioned__year
- , subq_5.ds_partitioned__extract_year
- , subq_5.ds_partitioned__extract_quarter
- , subq_5.ds_partitioned__extract_month
- , subq_5.ds_partitioned__extract_day
- , subq_5.ds_partitioned__extract_dow
- , subq_5.ds_partitioned__extract_doy
- , subq_5.paid_at__day
- , subq_5.paid_at__week
- , subq_5.paid_at__month
- , subq_5.paid_at__quarter
- , subq_5.paid_at__year
- , subq_5.paid_at__extract_year
- , subq_5.paid_at__extract_quarter
- , subq_5.paid_at__extract_month
- , subq_5.paid_at__extract_day
- , subq_5.paid_at__extract_dow
- , subq_5.paid_at__extract_doy
- , subq_5.booking__ds__day
- , subq_5.booking__ds__week
- , subq_5.booking__ds__month
- , subq_5.booking__ds__quarter
- , subq_5.booking__ds__year
- , subq_5.booking__ds__extract_year
- , subq_5.booking__ds__extract_quarter
- , subq_5.booking__ds__extract_month
- , subq_5.booking__ds__extract_day
- , subq_5.booking__ds__extract_dow
- , subq_5.booking__ds__extract_doy
- , subq_5.booking__ds_partitioned__day
- , subq_5.booking__ds_partitioned__week
- , subq_5.booking__ds_partitioned__month
- , subq_5.booking__ds_partitioned__quarter
- , subq_5.booking__ds_partitioned__year
- , subq_5.booking__ds_partitioned__extract_year
- , subq_5.booking__ds_partitioned__extract_quarter
- , subq_5.booking__ds_partitioned__extract_month
- , subq_5.booking__ds_partitioned__extract_day
- , subq_5.booking__ds_partitioned__extract_dow
- , subq_5.booking__ds_partitioned__extract_doy
- , subq_5.booking__paid_at__day
- , subq_5.booking__paid_at__week
- , subq_5.booking__paid_at__month
- , subq_5.booking__paid_at__quarter
- , subq_5.booking__paid_at__year
- , subq_5.booking__paid_at__extract_year
- , subq_5.booking__paid_at__extract_quarter
- , subq_5.booking__paid_at__extract_month
- , subq_5.booking__paid_at__extract_day
- , subq_5.booking__paid_at__extract_dow
- , subq_5.booking__paid_at__extract_doy
- , subq_5.ds__day AS metric_time__day
- , subq_5.ds__week AS metric_time__week
- , subq_5.ds__month AS metric_time__month
- , subq_5.ds__quarter AS metric_time__quarter
- , subq_5.ds__year AS metric_time__year
- , subq_5.ds__extract_year AS metric_time__extract_year
- , subq_5.ds__extract_quarter AS metric_time__extract_quarter
- , subq_5.ds__extract_month AS metric_time__extract_month
- , subq_5.ds__extract_day AS metric_time__extract_day
- , subq_5.ds__extract_dow AS metric_time__extract_dow
- , subq_5.ds__extract_doy AS metric_time__extract_doy
- , subq_5.listing
- , subq_5.guest
- , subq_5.host
- , subq_5.booking__listing
- , subq_5.booking__guest
- , subq_5.booking__host
- , subq_5.is_instant
- , subq_5.booking__is_instant
- , subq_5.bookings
- , subq_5.instant_bookings
- , subq_5.booking_value
- , subq_5.max_booking_value
- , subq_5.min_booking_value
- , subq_5.bookers
- , subq_5.average_booking_value
- , subq_5.referred_bookings
- , subq_5.median_booking_value
- , subq_5.booking_value_p99
- , subq_5.discrete_booking_value_p99
- , subq_5.approximate_continuous_booking_value_p99
- , subq_5.approximate_discrete_booking_value_p99
+ subq_14.ds__day
+ , subq_14.ds__week
+ , subq_14.ds__month
+ , subq_14.ds__quarter
+ , subq_14.ds__year
+ , subq_14.ds__extract_year
+ , subq_14.ds__extract_quarter
+ , subq_14.ds__extract_month
+ , subq_14.ds__extract_day
+ , subq_14.ds__extract_dow
+ , subq_14.ds__extract_doy
+ , subq_14.ds_partitioned__day
+ , subq_14.ds_partitioned__week
+ , subq_14.ds_partitioned__month
+ , subq_14.ds_partitioned__quarter
+ , subq_14.ds_partitioned__year
+ , subq_14.ds_partitioned__extract_year
+ , subq_14.ds_partitioned__extract_quarter
+ , subq_14.ds_partitioned__extract_month
+ , subq_14.ds_partitioned__extract_day
+ , subq_14.ds_partitioned__extract_dow
+ , subq_14.ds_partitioned__extract_doy
+ , subq_14.paid_at__day
+ , subq_14.paid_at__week
+ , subq_14.paid_at__month
+ , subq_14.paid_at__quarter
+ , subq_14.paid_at__year
+ , subq_14.paid_at__extract_year
+ , subq_14.paid_at__extract_quarter
+ , subq_14.paid_at__extract_month
+ , subq_14.paid_at__extract_day
+ , subq_14.paid_at__extract_dow
+ , subq_14.paid_at__extract_doy
+ , subq_14.booking__ds__day
+ , subq_14.booking__ds__week
+ , subq_14.booking__ds__month
+ , subq_14.booking__ds__quarter
+ , subq_14.booking__ds__year
+ , subq_14.booking__ds__extract_year
+ , subq_14.booking__ds__extract_quarter
+ , subq_14.booking__ds__extract_month
+ , subq_14.booking__ds__extract_day
+ , subq_14.booking__ds__extract_dow
+ , subq_14.booking__ds__extract_doy
+ , subq_14.booking__ds_partitioned__day
+ , subq_14.booking__ds_partitioned__week
+ , subq_14.booking__ds_partitioned__month
+ , subq_14.booking__ds_partitioned__quarter
+ , subq_14.booking__ds_partitioned__year
+ , subq_14.booking__ds_partitioned__extract_year
+ , subq_14.booking__ds_partitioned__extract_quarter
+ , subq_14.booking__ds_partitioned__extract_month
+ , subq_14.booking__ds_partitioned__extract_day
+ , subq_14.booking__ds_partitioned__extract_dow
+ , subq_14.booking__ds_partitioned__extract_doy
+ , subq_14.booking__paid_at__day
+ , subq_14.booking__paid_at__week
+ , subq_14.booking__paid_at__month
+ , subq_14.booking__paid_at__quarter
+ , subq_14.booking__paid_at__year
+ , subq_14.booking__paid_at__extract_year
+ , subq_14.booking__paid_at__extract_quarter
+ , subq_14.booking__paid_at__extract_month
+ , subq_14.booking__paid_at__extract_day
+ , subq_14.booking__paid_at__extract_dow
+ , subq_14.booking__paid_at__extract_doy
+ , subq_14.ds__day AS metric_time__day
+ , subq_14.ds__week AS metric_time__week
+ , subq_14.ds__month AS metric_time__month
+ , subq_14.ds__quarter AS metric_time__quarter
+ , subq_14.ds__year AS metric_time__year
+ , subq_14.ds__extract_year AS metric_time__extract_year
+ , subq_14.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_14.ds__extract_month AS metric_time__extract_month
+ , subq_14.ds__extract_day AS metric_time__extract_day
+ , subq_14.ds__extract_dow AS metric_time__extract_dow
+ , subq_14.ds__extract_doy AS metric_time__extract_doy
+ , subq_14.listing
+ , subq_14.guest
+ , subq_14.host
+ , subq_14.booking__listing
+ , subq_14.booking__guest
+ , subq_14.booking__host
+ , subq_14.is_instant
+ , subq_14.booking__is_instant
+ , subq_14.bookings
+ , subq_14.instant_bookings
+ , subq_14.booking_value
+ , subq_14.max_booking_value
+ , subq_14.min_booking_value
+ , subq_14.bookers
+ , subq_14.average_booking_value
+ , subq_14.referred_bookings
+ , subq_14.median_booking_value
+ , subq_14.booking_value_p99
+ , subq_14.discrete_booking_value_p99
+ , subq_14.approximate_continuous_booking_value_p99
+ , subq_14.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_5
- ) subq_6
- ) subq_7
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_14
+ ) subq_15
+ ) subq_16
GROUP BY
- subq_7.metric_time__day
- ) subq_8
- ) subq_9
+ subq_16.metric_time__day
+ ) subq_17
+ ) subq_18
ON
- subq_4.metric_time__day = subq_9.metric_time__day
+ subq_13.metric_time__day = subq_18.metric_time__day
GROUP BY
- COALESCE(subq_4.metric_time__day, subq_9.metric_time__day)
-) subq_10
+ COALESCE(subq_13.metric_time__day, subq_18.metric_time__day)
+) subq_19
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric__plan0_optimized.sql
index 23f7234c6e..1638560b4d 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric__plan0_optimized.sql
@@ -5,9 +5,9 @@ SELECT
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_15.metric_time__day, subq_20.metric_time__day) AS metric_time__day
- , MAX(subq_15.ref_bookings) AS ref_bookings
- , MAX(subq_20.bookings) AS bookings
+ COALESCE(subq_24.metric_time__day, subq_29.metric_time__day) AS metric_time__day
+ , MAX(subq_24.ref_bookings) AS ref_bookings
+ , MAX(subq_29.bookings) AS bookings
FROM (
-- Aggregate Measures
-- Compute Metrics via Expressions
@@ -21,11 +21,11 @@ FROM (
SELECT
DATE_TRUNC('day', ds) 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_28001
- ) subq_13
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_22
GROUP BY
metric_time__day
- ) subq_15
+ ) subq_24
FULL OUTER JOIN (
-- Aggregate Measures
-- Compute Metrics via Expressions
@@ -39,13 +39,13 @@ FROM (
SELECT
DATE_TRUNC('day', ds) AS metric_time__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_18
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_27
GROUP BY
metric_time__day
- ) subq_20
+ ) subq_29
ON
- subq_15.metric_time__day = subq_20.metric_time__day
+ subq_24.metric_time__day = subq_29.metric_time__day
GROUP BY
- COALESCE(subq_15.metric_time__day, subq_20.metric_time__day)
-) subq_21
+ COALESCE(subq_24.metric_time__day, subq_29.metric_time__day)
+) subq_30
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_month_dimension_and_offset_window__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_month_dimension_and_offset_window__plan0.sql
index 243d2d1af4..8cdf29bee8 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_month_dimension_and_offset_window__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_month_dimension_and_offset_window__plan0.sql
@@ -1,73 +1,73 @@
-- Compute Metrics via Expressions
SELECT
- subq_7.metric_time__month
+ subq_9.metric_time__month
, bookings_last_month AS bookings_last_month
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_6.metric_time__month
- , subq_6.bookings_monthly AS bookings_last_month
+ subq_8.metric_time__month
+ , subq_8.bookings_monthly AS bookings_last_month
FROM (
-- Aggregate Measures
SELECT
- subq_5.metric_time__month
- , SUM(subq_5.bookings_monthly) AS bookings_monthly
+ subq_7.metric_time__month
+ , SUM(subq_7.bookings_monthly) AS bookings_monthly
FROM (
-- Pass Only Elements: ['bookings_monthly', 'metric_time__month']
SELECT
- subq_4.metric_time__month
- , subq_4.bookings_monthly
+ subq_6.metric_time__month
+ , subq_6.bookings_monthly
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_2.metric_time__month AS metric_time__month
- , subq_1.monthly_ds__month AS monthly_ds__month
- , subq_1.monthly_ds__quarter AS monthly_ds__quarter
- , subq_1.monthly_ds__year AS monthly_ds__year
- , subq_1.monthly_ds__extract_year AS monthly_ds__extract_year
- , subq_1.monthly_ds__extract_quarter AS monthly_ds__extract_quarter
- , subq_1.monthly_ds__extract_month AS monthly_ds__extract_month
- , subq_1.booking__monthly_ds__month AS booking__monthly_ds__month
- , subq_1.booking__monthly_ds__quarter AS booking__monthly_ds__quarter
- , subq_1.booking__monthly_ds__year AS booking__monthly_ds__year
- , subq_1.booking__monthly_ds__extract_year AS booking__monthly_ds__extract_year
- , subq_1.booking__monthly_ds__extract_quarter AS booking__monthly_ds__extract_quarter
- , subq_1.booking__monthly_ds__extract_month AS booking__monthly_ds__extract_month
- , subq_1.listing AS listing
- , subq_1.booking__listing AS booking__listing
- , subq_1.bookings_monthly AS bookings_monthly
+ subq_4.metric_time__month AS metric_time__month
+ , subq_3.monthly_ds__month AS monthly_ds__month
+ , subq_3.monthly_ds__quarter AS monthly_ds__quarter
+ , subq_3.monthly_ds__year AS monthly_ds__year
+ , subq_3.monthly_ds__extract_year AS monthly_ds__extract_year
+ , subq_3.monthly_ds__extract_quarter AS monthly_ds__extract_quarter
+ , subq_3.monthly_ds__extract_month AS monthly_ds__extract_month
+ , subq_3.booking__monthly_ds__month AS booking__monthly_ds__month
+ , subq_3.booking__monthly_ds__quarter AS booking__monthly_ds__quarter
+ , subq_3.booking__monthly_ds__year AS booking__monthly_ds__year
+ , subq_3.booking__monthly_ds__extract_year AS booking__monthly_ds__extract_year
+ , subq_3.booking__monthly_ds__extract_quarter AS booking__monthly_ds__extract_quarter
+ , subq_3.booking__monthly_ds__extract_month AS booking__monthly_ds__extract_month
+ , subq_3.listing AS listing
+ , subq_3.booking__listing AS booking__listing
+ , subq_3.bookings_monthly AS bookings_monthly
FROM (
-- Time Spine
SELECT
- DATE_TRUNC('month', subq_3.ds) AS metric_time__month
- FROM ***************************.mf_time_spine subq_3
+ DATE_TRUNC('month', subq_5.ds) AS metric_time__month
+ FROM ***************************.mf_time_spine subq_5
GROUP BY
- DATE_TRUNC('month', subq_3.ds)
- ) subq_2
+ DATE_TRUNC('month', subq_5.ds)
+ ) subq_4
INNER JOIN (
-- Metric Time Dimension 'monthly_ds'
SELECT
- subq_0.monthly_ds__month
- , subq_0.monthly_ds__quarter
- , subq_0.monthly_ds__year
- , subq_0.monthly_ds__extract_year
- , subq_0.monthly_ds__extract_quarter
- , subq_0.monthly_ds__extract_month
- , subq_0.booking__monthly_ds__month
- , subq_0.booking__monthly_ds__quarter
- , subq_0.booking__monthly_ds__year
- , subq_0.booking__monthly_ds__extract_year
- , subq_0.booking__monthly_ds__extract_quarter
- , subq_0.booking__monthly_ds__extract_month
- , subq_0.monthly_ds__month AS metric_time__month
- , subq_0.monthly_ds__quarter AS metric_time__quarter
- , subq_0.monthly_ds__year AS metric_time__year
- , subq_0.monthly_ds__extract_year AS metric_time__extract_year
- , subq_0.monthly_ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.monthly_ds__extract_month AS metric_time__extract_month
- , subq_0.listing
- , subq_0.booking__listing
- , subq_0.bookings_monthly
+ subq_2.monthly_ds__month
+ , subq_2.monthly_ds__quarter
+ , subq_2.monthly_ds__year
+ , subq_2.monthly_ds__extract_year
+ , subq_2.monthly_ds__extract_quarter
+ , subq_2.monthly_ds__extract_month
+ , subq_2.booking__monthly_ds__month
+ , subq_2.booking__monthly_ds__quarter
+ , subq_2.booking__monthly_ds__year
+ , subq_2.booking__monthly_ds__extract_year
+ , subq_2.booking__monthly_ds__extract_quarter
+ , subq_2.booking__monthly_ds__extract_month
+ , subq_2.monthly_ds__month AS metric_time__month
+ , subq_2.monthly_ds__quarter AS metric_time__quarter
+ , subq_2.monthly_ds__year AS metric_time__year
+ , subq_2.monthly_ds__extract_year AS metric_time__extract_year
+ , subq_2.monthly_ds__extract_quarter AS metric_time__extract_quarter
+ , subq_2.monthly_ds__extract_month AS metric_time__extract_month
+ , subq_2.listing
+ , subq_2.booking__listing
+ , subq_2.bookings_monthly
FROM (
-- Read Elements From Semantic Model 'bookings_monthly_source'
SELECT
@@ -87,13 +87,13 @@ FROM (
, bookings_monthly_source_src_16000.listing_id AS listing
, bookings_monthly_source_src_16000.listing_id AS booking__listing
FROM ***************************.fct_bookings_extended_monthly bookings_monthly_source_src_16000
- ) subq_0
- ) subq_1
+ ) subq_2
+ ) subq_3
ON
- subq_2.metric_time__month - INTERVAL 1 month = subq_1.metric_time__month
- ) subq_4
- ) subq_5
+ subq_4.metric_time__month - INTERVAL 1 month = subq_3.metric_time__month
+ ) subq_6
+ ) subq_7
GROUP BY
- subq_5.metric_time__month
- ) subq_6
-) subq_7
+ subq_7.metric_time__month
+ ) subq_8
+) subq_9
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_month_dimension_and_offset_window__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_month_dimension_and_offset_window__plan0_optimized.sql
index 9e93cbb724..85d84cf924 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_month_dimension_and_offset_window__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_month_dimension_and_offset_window__plan0_optimized.sql
@@ -8,20 +8,20 @@ FROM (
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_10.metric_time__month AS metric_time__month
+ subq_12.metric_time__month AS metric_time__month
, SUM(bookings_monthly_source_src_16000.bookings_monthly) AS bookings_last_month
FROM (
-- Time Spine
SELECT
DATE_TRUNC('month', ds) AS metric_time__month
- FROM ***************************.mf_time_spine subq_11
+ FROM ***************************.mf_time_spine subq_13
GROUP BY
DATE_TRUNC('month', ds)
- ) subq_10
+ ) subq_12
INNER JOIN
***************************.fct_bookings_extended_monthly bookings_monthly_source_src_16000
ON
- subq_10.metric_time__month - INTERVAL 1 month = DATE_TRUNC('month', bookings_monthly_source_src_16000.ds)
+ subq_12.metric_time__month - INTERVAL 1 month = DATE_TRUNC('month', bookings_monthly_source_src_16000.ds)
GROUP BY
- subq_10.metric_time__month
-) subq_15
+ subq_12.metric_time__month
+) subq_17
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_to_grain__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_to_grain__plan0.sql
index 7128b81a47..05bcafad18 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_to_grain__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_to_grain__plan0.sql
@@ -1,545 +1,545 @@
-- Compute Metrics via Expressions
SELECT
- subq_13.metric_time__day
+ subq_22.metric_time__day
, bookings - bookings_at_start_of_month AS bookings_growth_since_start_of_month
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_4.metric_time__day, subq_12.metric_time__day) AS metric_time__day
- , MAX(subq_4.bookings) AS bookings
- , MAX(subq_12.bookings_at_start_of_month) AS bookings_at_start_of_month
+ COALESCE(subq_13.metric_time__day, subq_21.metric_time__day) AS metric_time__day
+ , MAX(subq_13.bookings) AS bookings
+ , MAX(subq_21.bookings_at_start_of_month) AS bookings_at_start_of_month
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_3.metric_time__day
- , subq_3.bookings
+ subq_12.metric_time__day
+ , subq_12.bookings
FROM (
-- Aggregate Measures
SELECT
- subq_2.metric_time__day
- , SUM(subq_2.bookings) AS bookings
+ subq_11.metric_time__day
+ , SUM(subq_11.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__day']
SELECT
- subq_1.metric_time__day
- , subq_1.bookings
+ subq_10.metric_time__day
+ , subq_10.bookings
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
- ) subq_2
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
GROUP BY
- subq_2.metric_time__day
- ) subq_3
- ) subq_4
+ subq_11.metric_time__day
+ ) subq_12
+ ) subq_13
FULL OUTER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_11.metric_time__day
- , subq_11.bookings AS bookings_at_start_of_month
+ subq_20.metric_time__day
+ , subq_20.bookings AS bookings_at_start_of_month
FROM (
-- Aggregate Measures
SELECT
- subq_10.metric_time__day
- , SUM(subq_10.bookings) AS bookings
+ subq_19.metric_time__day
+ , SUM(subq_19.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__day']
SELECT
- subq_9.metric_time__day
- , subq_9.bookings
+ subq_18.metric_time__day
+ , subq_18.bookings
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_7.metric_time__day AS metric_time__day
- , subq_6.ds__day AS ds__day
- , subq_6.ds__week AS ds__week
- , subq_6.ds__month AS ds__month
- , subq_6.ds__quarter AS ds__quarter
- , subq_6.ds__year AS ds__year
- , subq_6.ds__extract_year AS ds__extract_year
- , subq_6.ds__extract_quarter AS ds__extract_quarter
- , subq_6.ds__extract_month AS ds__extract_month
- , subq_6.ds__extract_day AS ds__extract_day
- , subq_6.ds__extract_dow AS ds__extract_dow
- , subq_6.ds__extract_doy AS ds__extract_doy
- , subq_6.ds_partitioned__day AS ds_partitioned__day
- , subq_6.ds_partitioned__week AS ds_partitioned__week
- , subq_6.ds_partitioned__month AS ds_partitioned__month
- , subq_6.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_6.ds_partitioned__year AS ds_partitioned__year
- , subq_6.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_6.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_6.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_6.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_6.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_6.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_6.paid_at__day AS paid_at__day
- , subq_6.paid_at__week AS paid_at__week
- , subq_6.paid_at__month AS paid_at__month
- , subq_6.paid_at__quarter AS paid_at__quarter
- , subq_6.paid_at__year AS paid_at__year
- , subq_6.paid_at__extract_year AS paid_at__extract_year
- , subq_6.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_6.paid_at__extract_month AS paid_at__extract_month
- , subq_6.paid_at__extract_day AS paid_at__extract_day
- , subq_6.paid_at__extract_dow AS paid_at__extract_dow
- , subq_6.paid_at__extract_doy AS paid_at__extract_doy
- , subq_6.booking__ds__day AS booking__ds__day
- , subq_6.booking__ds__week AS booking__ds__week
- , subq_6.booking__ds__month AS booking__ds__month
- , subq_6.booking__ds__quarter AS booking__ds__quarter
- , subq_6.booking__ds__year AS booking__ds__year
- , subq_6.booking__ds__extract_year AS booking__ds__extract_year
- , subq_6.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_6.booking__ds__extract_month AS booking__ds__extract_month
- , subq_6.booking__ds__extract_day AS booking__ds__extract_day
- , subq_6.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_6.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_6.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_6.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_6.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_6.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_6.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_6.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_6.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_6.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_6.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_6.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_6.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_6.booking__paid_at__day AS booking__paid_at__day
- , subq_6.booking__paid_at__week AS booking__paid_at__week
- , subq_6.booking__paid_at__month AS booking__paid_at__month
- , subq_6.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_6.booking__paid_at__year AS booking__paid_at__year
- , subq_6.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_6.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_6.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_6.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_6.listing AS listing
- , subq_6.guest AS guest
- , subq_6.host AS host
- , subq_6.booking__listing AS booking__listing
- , subq_6.booking__guest AS booking__guest
- , subq_6.booking__host AS booking__host
- , subq_6.is_instant AS is_instant
- , subq_6.booking__is_instant AS booking__is_instant
- , subq_6.bookings AS bookings
- , subq_6.instant_bookings AS instant_bookings
- , subq_6.booking_value AS booking_value
- , subq_6.max_booking_value AS max_booking_value
- , subq_6.min_booking_value AS min_booking_value
- , subq_6.bookers AS bookers
- , subq_6.average_booking_value AS average_booking_value
- , subq_6.referred_bookings AS referred_bookings
- , subq_6.median_booking_value AS median_booking_value
- , subq_6.booking_value_p99 AS booking_value_p99
- , subq_6.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_6.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_6.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ subq_16.metric_time__day AS metric_time__day
+ , subq_15.ds__day AS ds__day
+ , subq_15.ds__week AS ds__week
+ , subq_15.ds__month AS ds__month
+ , subq_15.ds__quarter AS ds__quarter
+ , subq_15.ds__year AS ds__year
+ , subq_15.ds__extract_year AS ds__extract_year
+ , subq_15.ds__extract_quarter AS ds__extract_quarter
+ , subq_15.ds__extract_month AS ds__extract_month
+ , subq_15.ds__extract_day AS ds__extract_day
+ , subq_15.ds__extract_dow AS ds__extract_dow
+ , subq_15.ds__extract_doy AS ds__extract_doy
+ , subq_15.ds_partitioned__day AS ds_partitioned__day
+ , subq_15.ds_partitioned__week AS ds_partitioned__week
+ , subq_15.ds_partitioned__month AS ds_partitioned__month
+ , subq_15.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_15.ds_partitioned__year AS ds_partitioned__year
+ , subq_15.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_15.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_15.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_15.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_15.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_15.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_15.paid_at__day AS paid_at__day
+ , subq_15.paid_at__week AS paid_at__week
+ , subq_15.paid_at__month AS paid_at__month
+ , subq_15.paid_at__quarter AS paid_at__quarter
+ , subq_15.paid_at__year AS paid_at__year
+ , subq_15.paid_at__extract_year AS paid_at__extract_year
+ , subq_15.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_15.paid_at__extract_month AS paid_at__extract_month
+ , subq_15.paid_at__extract_day AS paid_at__extract_day
+ , subq_15.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_15.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_15.booking__ds__day AS booking__ds__day
+ , subq_15.booking__ds__week AS booking__ds__week
+ , subq_15.booking__ds__month AS booking__ds__month
+ , subq_15.booking__ds__quarter AS booking__ds__quarter
+ , subq_15.booking__ds__year AS booking__ds__year
+ , subq_15.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_15.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_15.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_15.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_15.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_15.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_15.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_15.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_15.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_15.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_15.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_15.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_15.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_15.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_15.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_15.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_15.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_15.booking__paid_at__day AS booking__paid_at__day
+ , subq_15.booking__paid_at__week AS booking__paid_at__week
+ , subq_15.booking__paid_at__month AS booking__paid_at__month
+ , subq_15.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_15.booking__paid_at__year AS booking__paid_at__year
+ , subq_15.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_15.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_15.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_15.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_15.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_15.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_15.listing AS listing
+ , subq_15.guest AS guest
+ , subq_15.host AS host
+ , subq_15.booking__listing AS booking__listing
+ , subq_15.booking__guest AS booking__guest
+ , subq_15.booking__host AS booking__host
+ , subq_15.is_instant AS is_instant
+ , subq_15.booking__is_instant AS booking__is_instant
+ , subq_15.bookings AS bookings
+ , subq_15.instant_bookings AS instant_bookings
+ , subq_15.booking_value AS booking_value
+ , subq_15.max_booking_value AS max_booking_value
+ , subq_15.min_booking_value AS min_booking_value
+ , subq_15.bookers AS bookers
+ , subq_15.average_booking_value AS average_booking_value
+ , subq_15.referred_bookings AS referred_bookings
+ , subq_15.median_booking_value AS median_booking_value
+ , subq_15.booking_value_p99 AS booking_value_p99
+ , subq_15.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_15.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_15.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_8.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_8
- ) subq_7
+ subq_17.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_17
+ ) subq_16
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_5.ds__day
- , subq_5.ds__week
- , subq_5.ds__month
- , subq_5.ds__quarter
- , subq_5.ds__year
- , subq_5.ds__extract_year
- , subq_5.ds__extract_quarter
- , subq_5.ds__extract_month
- , subq_5.ds__extract_day
- , subq_5.ds__extract_dow
- , subq_5.ds__extract_doy
- , subq_5.ds_partitioned__day
- , subq_5.ds_partitioned__week
- , subq_5.ds_partitioned__month
- , subq_5.ds_partitioned__quarter
- , subq_5.ds_partitioned__year
- , subq_5.ds_partitioned__extract_year
- , subq_5.ds_partitioned__extract_quarter
- , subq_5.ds_partitioned__extract_month
- , subq_5.ds_partitioned__extract_day
- , subq_5.ds_partitioned__extract_dow
- , subq_5.ds_partitioned__extract_doy
- , subq_5.paid_at__day
- , subq_5.paid_at__week
- , subq_5.paid_at__month
- , subq_5.paid_at__quarter
- , subq_5.paid_at__year
- , subq_5.paid_at__extract_year
- , subq_5.paid_at__extract_quarter
- , subq_5.paid_at__extract_month
- , subq_5.paid_at__extract_day
- , subq_5.paid_at__extract_dow
- , subq_5.paid_at__extract_doy
- , subq_5.booking__ds__day
- , subq_5.booking__ds__week
- , subq_5.booking__ds__month
- , subq_5.booking__ds__quarter
- , subq_5.booking__ds__year
- , subq_5.booking__ds__extract_year
- , subq_5.booking__ds__extract_quarter
- , subq_5.booking__ds__extract_month
- , subq_5.booking__ds__extract_day
- , subq_5.booking__ds__extract_dow
- , subq_5.booking__ds__extract_doy
- , subq_5.booking__ds_partitioned__day
- , subq_5.booking__ds_partitioned__week
- , subq_5.booking__ds_partitioned__month
- , subq_5.booking__ds_partitioned__quarter
- , subq_5.booking__ds_partitioned__year
- , subq_5.booking__ds_partitioned__extract_year
- , subq_5.booking__ds_partitioned__extract_quarter
- , subq_5.booking__ds_partitioned__extract_month
- , subq_5.booking__ds_partitioned__extract_day
- , subq_5.booking__ds_partitioned__extract_dow
- , subq_5.booking__ds_partitioned__extract_doy
- , subq_5.booking__paid_at__day
- , subq_5.booking__paid_at__week
- , subq_5.booking__paid_at__month
- , subq_5.booking__paid_at__quarter
- , subq_5.booking__paid_at__year
- , subq_5.booking__paid_at__extract_year
- , subq_5.booking__paid_at__extract_quarter
- , subq_5.booking__paid_at__extract_month
- , subq_5.booking__paid_at__extract_day
- , subq_5.booking__paid_at__extract_dow
- , subq_5.booking__paid_at__extract_doy
- , subq_5.ds__day AS metric_time__day
- , subq_5.ds__week AS metric_time__week
- , subq_5.ds__month AS metric_time__month
- , subq_5.ds__quarter AS metric_time__quarter
- , subq_5.ds__year AS metric_time__year
- , subq_5.ds__extract_year AS metric_time__extract_year
- , subq_5.ds__extract_quarter AS metric_time__extract_quarter
- , subq_5.ds__extract_month AS metric_time__extract_month
- , subq_5.ds__extract_day AS metric_time__extract_day
- , subq_5.ds__extract_dow AS metric_time__extract_dow
- , subq_5.ds__extract_doy AS metric_time__extract_doy
- , subq_5.listing
- , subq_5.guest
- , subq_5.host
- , subq_5.booking__listing
- , subq_5.booking__guest
- , subq_5.booking__host
- , subq_5.is_instant
- , subq_5.booking__is_instant
- , subq_5.bookings
- , subq_5.instant_bookings
- , subq_5.booking_value
- , subq_5.max_booking_value
- , subq_5.min_booking_value
- , subq_5.bookers
- , subq_5.average_booking_value
- , subq_5.referred_bookings
- , subq_5.median_booking_value
- , subq_5.booking_value_p99
- , subq_5.discrete_booking_value_p99
- , subq_5.approximate_continuous_booking_value_p99
- , subq_5.approximate_discrete_booking_value_p99
+ subq_14.ds__day
+ , subq_14.ds__week
+ , subq_14.ds__month
+ , subq_14.ds__quarter
+ , subq_14.ds__year
+ , subq_14.ds__extract_year
+ , subq_14.ds__extract_quarter
+ , subq_14.ds__extract_month
+ , subq_14.ds__extract_day
+ , subq_14.ds__extract_dow
+ , subq_14.ds__extract_doy
+ , subq_14.ds_partitioned__day
+ , subq_14.ds_partitioned__week
+ , subq_14.ds_partitioned__month
+ , subq_14.ds_partitioned__quarter
+ , subq_14.ds_partitioned__year
+ , subq_14.ds_partitioned__extract_year
+ , subq_14.ds_partitioned__extract_quarter
+ , subq_14.ds_partitioned__extract_month
+ , subq_14.ds_partitioned__extract_day
+ , subq_14.ds_partitioned__extract_dow
+ , subq_14.ds_partitioned__extract_doy
+ , subq_14.paid_at__day
+ , subq_14.paid_at__week
+ , subq_14.paid_at__month
+ , subq_14.paid_at__quarter
+ , subq_14.paid_at__year
+ , subq_14.paid_at__extract_year
+ , subq_14.paid_at__extract_quarter
+ , subq_14.paid_at__extract_month
+ , subq_14.paid_at__extract_day
+ , subq_14.paid_at__extract_dow
+ , subq_14.paid_at__extract_doy
+ , subq_14.booking__ds__day
+ , subq_14.booking__ds__week
+ , subq_14.booking__ds__month
+ , subq_14.booking__ds__quarter
+ , subq_14.booking__ds__year
+ , subq_14.booking__ds__extract_year
+ , subq_14.booking__ds__extract_quarter
+ , subq_14.booking__ds__extract_month
+ , subq_14.booking__ds__extract_day
+ , subq_14.booking__ds__extract_dow
+ , subq_14.booking__ds__extract_doy
+ , subq_14.booking__ds_partitioned__day
+ , subq_14.booking__ds_partitioned__week
+ , subq_14.booking__ds_partitioned__month
+ , subq_14.booking__ds_partitioned__quarter
+ , subq_14.booking__ds_partitioned__year
+ , subq_14.booking__ds_partitioned__extract_year
+ , subq_14.booking__ds_partitioned__extract_quarter
+ , subq_14.booking__ds_partitioned__extract_month
+ , subq_14.booking__ds_partitioned__extract_day
+ , subq_14.booking__ds_partitioned__extract_dow
+ , subq_14.booking__ds_partitioned__extract_doy
+ , subq_14.booking__paid_at__day
+ , subq_14.booking__paid_at__week
+ , subq_14.booking__paid_at__month
+ , subq_14.booking__paid_at__quarter
+ , subq_14.booking__paid_at__year
+ , subq_14.booking__paid_at__extract_year
+ , subq_14.booking__paid_at__extract_quarter
+ , subq_14.booking__paid_at__extract_month
+ , subq_14.booking__paid_at__extract_day
+ , subq_14.booking__paid_at__extract_dow
+ , subq_14.booking__paid_at__extract_doy
+ , subq_14.ds__day AS metric_time__day
+ , subq_14.ds__week AS metric_time__week
+ , subq_14.ds__month AS metric_time__month
+ , subq_14.ds__quarter AS metric_time__quarter
+ , subq_14.ds__year AS metric_time__year
+ , subq_14.ds__extract_year AS metric_time__extract_year
+ , subq_14.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_14.ds__extract_month AS metric_time__extract_month
+ , subq_14.ds__extract_day AS metric_time__extract_day
+ , subq_14.ds__extract_dow AS metric_time__extract_dow
+ , subq_14.ds__extract_doy AS metric_time__extract_doy
+ , subq_14.listing
+ , subq_14.guest
+ , subq_14.host
+ , subq_14.booking__listing
+ , subq_14.booking__guest
+ , subq_14.booking__host
+ , subq_14.is_instant
+ , subq_14.booking__is_instant
+ , subq_14.bookings
+ , subq_14.instant_bookings
+ , subq_14.booking_value
+ , subq_14.max_booking_value
+ , subq_14.min_booking_value
+ , subq_14.bookers
+ , subq_14.average_booking_value
+ , subq_14.referred_bookings
+ , subq_14.median_booking_value
+ , subq_14.booking_value_p99
+ , subq_14.discrete_booking_value_p99
+ , subq_14.approximate_continuous_booking_value_p99
+ , subq_14.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_5
- ) subq_6
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_14
+ ) subq_15
ON
- DATE_TRUNC('month', subq_7.metric_time__day) = subq_6.metric_time__day
- ) subq_9
- ) subq_10
+ DATE_TRUNC('month', subq_16.metric_time__day) = subq_15.metric_time__day
+ ) subq_18
+ ) subq_19
GROUP BY
- subq_10.metric_time__day
- ) subq_11
- ) subq_12
+ subq_19.metric_time__day
+ ) subq_20
+ ) subq_21
ON
- subq_4.metric_time__day = subq_12.metric_time__day
+ subq_13.metric_time__day = subq_21.metric_time__day
GROUP BY
- COALESCE(subq_4.metric_time__day, subq_12.metric_time__day)
-) subq_13
+ COALESCE(subq_13.metric_time__day, subq_21.metric_time__day)
+) subq_22
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_to_grain__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_to_grain__plan0_optimized.sql
index 5138fe8ae6..2061be23cf 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_to_grain__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_to_grain__plan0_optimized.sql
@@ -5,9 +5,9 @@ SELECT
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_18.metric_time__day, subq_26.metric_time__day) AS metric_time__day
- , MAX(subq_18.bookings) AS bookings
- , MAX(subq_26.bookings_at_start_of_month) AS bookings_at_start_of_month
+ COALESCE(subq_27.metric_time__day, subq_35.metric_time__day) AS metric_time__day
+ , MAX(subq_27.bookings) AS bookings
+ , MAX(subq_35.bookings_at_start_of_month) AS bookings_at_start_of_month
FROM (
-- Aggregate Measures
-- Compute Metrics via Expressions
@@ -21,35 +21,35 @@ FROM (
SELECT
DATE_TRUNC('day', ds) AS metric_time__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_16
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_25
GROUP BY
metric_time__day
- ) subq_18
+ ) subq_27
FULL OUTER JOIN (
-- Join to Time Spine Dataset
-- Pass Only Elements: ['bookings', 'metric_time__day']
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_22.ds AS metric_time__day
- , SUM(subq_20.bookings) AS bookings_at_start_of_month
- FROM ***************************.mf_time_spine subq_22
+ subq_31.ds AS metric_time__day
+ , SUM(subq_29.bookings) AS bookings_at_start_of_month
+ FROM ***************************.mf_time_spine subq_31
INNER JOIN (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
SELECT
DATE_TRUNC('day', ds) AS metric_time__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_20
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_29
ON
- DATE_TRUNC('month', subq_22.ds) = subq_20.metric_time__day
+ DATE_TRUNC('month', subq_31.ds) = subq_29.metric_time__day
GROUP BY
- subq_22.ds
- ) subq_26
+ subq_31.ds
+ ) subq_35
ON
- subq_18.metric_time__day = subq_26.metric_time__day
+ subq_27.metric_time__day = subq_35.metric_time__day
GROUP BY
- COALESCE(subq_18.metric_time__day, subq_26.metric_time__day)
-) subq_27
+ COALESCE(subq_27.metric_time__day, subq_35.metric_time__day)
+) subq_36
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql
index a18f1a3e30..a8b56fb822 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql
@@ -1,546 +1,546 @@
-- Compute Metrics via Expressions
SELECT
- subq_13.metric_time__week
+ subq_22.metric_time__week
, bookings - bookings_at_start_of_month AS bookings_growth_since_start_of_month
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_4.metric_time__week, subq_12.metric_time__week) AS metric_time__week
- , MAX(subq_4.bookings) AS bookings
- , MAX(subq_12.bookings_at_start_of_month) AS bookings_at_start_of_month
+ COALESCE(subq_13.metric_time__week, subq_21.metric_time__week) AS metric_time__week
+ , MAX(subq_13.bookings) AS bookings
+ , MAX(subq_21.bookings_at_start_of_month) AS bookings_at_start_of_month
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_3.metric_time__week
- , subq_3.bookings
+ subq_12.metric_time__week
+ , subq_12.bookings
FROM (
-- Aggregate Measures
SELECT
- subq_2.metric_time__week
- , SUM(subq_2.bookings) AS bookings
+ subq_11.metric_time__week
+ , SUM(subq_11.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__week']
SELECT
- subq_1.metric_time__week
- , subq_1.bookings
+ subq_10.metric_time__week
+ , subq_10.bookings
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
- ) subq_2
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
GROUP BY
- subq_2.metric_time__week
- ) subq_3
- ) subq_4
+ subq_11.metric_time__week
+ ) subq_12
+ ) subq_13
FULL OUTER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_11.metric_time__week
- , subq_11.bookings AS bookings_at_start_of_month
+ subq_20.metric_time__week
+ , subq_20.bookings AS bookings_at_start_of_month
FROM (
-- Aggregate Measures
SELECT
- subq_10.metric_time__week
- , SUM(subq_10.bookings) AS bookings
+ subq_19.metric_time__week
+ , SUM(subq_19.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__week']
SELECT
- subq_9.metric_time__week
- , subq_9.bookings
+ subq_18.metric_time__week
+ , subq_18.bookings
FROM (
-- Join to Time Spine Dataset
SELECT
- DATE_TRUNC('week', subq_7.metric_time__day) AS metric_time__week
- , subq_6.ds__day AS ds__day
- , subq_6.ds__week AS ds__week
- , subq_6.ds__month AS ds__month
- , subq_6.ds__quarter AS ds__quarter
- , subq_6.ds__year AS ds__year
- , subq_6.ds__extract_year AS ds__extract_year
- , subq_6.ds__extract_quarter AS ds__extract_quarter
- , subq_6.ds__extract_month AS ds__extract_month
- , subq_6.ds__extract_day AS ds__extract_day
- , subq_6.ds__extract_dow AS ds__extract_dow
- , subq_6.ds__extract_doy AS ds__extract_doy
- , subq_6.ds_partitioned__day AS ds_partitioned__day
- , subq_6.ds_partitioned__week AS ds_partitioned__week
- , subq_6.ds_partitioned__month AS ds_partitioned__month
- , subq_6.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_6.ds_partitioned__year AS ds_partitioned__year
- , subq_6.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_6.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_6.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_6.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_6.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_6.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_6.paid_at__day AS paid_at__day
- , subq_6.paid_at__week AS paid_at__week
- , subq_6.paid_at__month AS paid_at__month
- , subq_6.paid_at__quarter AS paid_at__quarter
- , subq_6.paid_at__year AS paid_at__year
- , subq_6.paid_at__extract_year AS paid_at__extract_year
- , subq_6.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_6.paid_at__extract_month AS paid_at__extract_month
- , subq_6.paid_at__extract_day AS paid_at__extract_day
- , subq_6.paid_at__extract_dow AS paid_at__extract_dow
- , subq_6.paid_at__extract_doy AS paid_at__extract_doy
- , subq_6.booking__ds__day AS booking__ds__day
- , subq_6.booking__ds__week AS booking__ds__week
- , subq_6.booking__ds__month AS booking__ds__month
- , subq_6.booking__ds__quarter AS booking__ds__quarter
- , subq_6.booking__ds__year AS booking__ds__year
- , subq_6.booking__ds__extract_year AS booking__ds__extract_year
- , subq_6.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_6.booking__ds__extract_month AS booking__ds__extract_month
- , subq_6.booking__ds__extract_day AS booking__ds__extract_day
- , subq_6.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_6.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_6.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_6.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_6.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_6.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_6.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_6.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_6.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_6.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_6.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_6.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_6.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_6.booking__paid_at__day AS booking__paid_at__day
- , subq_6.booking__paid_at__week AS booking__paid_at__week
- , subq_6.booking__paid_at__month AS booking__paid_at__month
- , subq_6.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_6.booking__paid_at__year AS booking__paid_at__year
- , subq_6.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_6.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_6.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_6.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_6.listing AS listing
- , subq_6.guest AS guest
- , subq_6.host AS host
- , subq_6.booking__listing AS booking__listing
- , subq_6.booking__guest AS booking__guest
- , subq_6.booking__host AS booking__host
- , subq_6.is_instant AS is_instant
- , subq_6.booking__is_instant AS booking__is_instant
- , subq_6.bookings AS bookings
- , subq_6.instant_bookings AS instant_bookings
- , subq_6.booking_value AS booking_value
- , subq_6.max_booking_value AS max_booking_value
- , subq_6.min_booking_value AS min_booking_value
- , subq_6.bookers AS bookers
- , subq_6.average_booking_value AS average_booking_value
- , subq_6.referred_bookings AS referred_bookings
- , subq_6.median_booking_value AS median_booking_value
- , subq_6.booking_value_p99 AS booking_value_p99
- , subq_6.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_6.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_6.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ DATE_TRUNC('week', subq_16.metric_time__day) AS metric_time__week
+ , subq_15.ds__day AS ds__day
+ , subq_15.ds__week AS ds__week
+ , subq_15.ds__month AS ds__month
+ , subq_15.ds__quarter AS ds__quarter
+ , subq_15.ds__year AS ds__year
+ , subq_15.ds__extract_year AS ds__extract_year
+ , subq_15.ds__extract_quarter AS ds__extract_quarter
+ , subq_15.ds__extract_month AS ds__extract_month
+ , subq_15.ds__extract_day AS ds__extract_day
+ , subq_15.ds__extract_dow AS ds__extract_dow
+ , subq_15.ds__extract_doy AS ds__extract_doy
+ , subq_15.ds_partitioned__day AS ds_partitioned__day
+ , subq_15.ds_partitioned__week AS ds_partitioned__week
+ , subq_15.ds_partitioned__month AS ds_partitioned__month
+ , subq_15.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_15.ds_partitioned__year AS ds_partitioned__year
+ , subq_15.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_15.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_15.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_15.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_15.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_15.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_15.paid_at__day AS paid_at__day
+ , subq_15.paid_at__week AS paid_at__week
+ , subq_15.paid_at__month AS paid_at__month
+ , subq_15.paid_at__quarter AS paid_at__quarter
+ , subq_15.paid_at__year AS paid_at__year
+ , subq_15.paid_at__extract_year AS paid_at__extract_year
+ , subq_15.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_15.paid_at__extract_month AS paid_at__extract_month
+ , subq_15.paid_at__extract_day AS paid_at__extract_day
+ , subq_15.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_15.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_15.booking__ds__day AS booking__ds__day
+ , subq_15.booking__ds__week AS booking__ds__week
+ , subq_15.booking__ds__month AS booking__ds__month
+ , subq_15.booking__ds__quarter AS booking__ds__quarter
+ , subq_15.booking__ds__year AS booking__ds__year
+ , subq_15.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_15.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_15.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_15.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_15.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_15.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_15.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_15.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_15.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_15.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_15.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_15.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_15.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_15.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_15.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_15.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_15.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_15.booking__paid_at__day AS booking__paid_at__day
+ , subq_15.booking__paid_at__week AS booking__paid_at__week
+ , subq_15.booking__paid_at__month AS booking__paid_at__month
+ , subq_15.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_15.booking__paid_at__year AS booking__paid_at__year
+ , subq_15.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_15.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_15.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_15.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_15.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_15.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_15.listing AS listing
+ , subq_15.guest AS guest
+ , subq_15.host AS host
+ , subq_15.booking__listing AS booking__listing
+ , subq_15.booking__guest AS booking__guest
+ , subq_15.booking__host AS booking__host
+ , subq_15.is_instant AS is_instant
+ , subq_15.booking__is_instant AS booking__is_instant
+ , subq_15.bookings AS bookings
+ , subq_15.instant_bookings AS instant_bookings
+ , subq_15.booking_value AS booking_value
+ , subq_15.max_booking_value AS max_booking_value
+ , subq_15.min_booking_value AS min_booking_value
+ , subq_15.bookers AS bookers
+ , subq_15.average_booking_value AS average_booking_value
+ , subq_15.referred_bookings AS referred_bookings
+ , subq_15.median_booking_value AS median_booking_value
+ , subq_15.booking_value_p99 AS booking_value_p99
+ , subq_15.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_15.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_15.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_8.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_8
- ) subq_7
+ subq_17.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_17
+ ) subq_16
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_5.ds__day
- , subq_5.ds__week
- , subq_5.ds__month
- , subq_5.ds__quarter
- , subq_5.ds__year
- , subq_5.ds__extract_year
- , subq_5.ds__extract_quarter
- , subq_5.ds__extract_month
- , subq_5.ds__extract_day
- , subq_5.ds__extract_dow
- , subq_5.ds__extract_doy
- , subq_5.ds_partitioned__day
- , subq_5.ds_partitioned__week
- , subq_5.ds_partitioned__month
- , subq_5.ds_partitioned__quarter
- , subq_5.ds_partitioned__year
- , subq_5.ds_partitioned__extract_year
- , subq_5.ds_partitioned__extract_quarter
- , subq_5.ds_partitioned__extract_month
- , subq_5.ds_partitioned__extract_day
- , subq_5.ds_partitioned__extract_dow
- , subq_5.ds_partitioned__extract_doy
- , subq_5.paid_at__day
- , subq_5.paid_at__week
- , subq_5.paid_at__month
- , subq_5.paid_at__quarter
- , subq_5.paid_at__year
- , subq_5.paid_at__extract_year
- , subq_5.paid_at__extract_quarter
- , subq_5.paid_at__extract_month
- , subq_5.paid_at__extract_day
- , subq_5.paid_at__extract_dow
- , subq_5.paid_at__extract_doy
- , subq_5.booking__ds__day
- , subq_5.booking__ds__week
- , subq_5.booking__ds__month
- , subq_5.booking__ds__quarter
- , subq_5.booking__ds__year
- , subq_5.booking__ds__extract_year
- , subq_5.booking__ds__extract_quarter
- , subq_5.booking__ds__extract_month
- , subq_5.booking__ds__extract_day
- , subq_5.booking__ds__extract_dow
- , subq_5.booking__ds__extract_doy
- , subq_5.booking__ds_partitioned__day
- , subq_5.booking__ds_partitioned__week
- , subq_5.booking__ds_partitioned__month
- , subq_5.booking__ds_partitioned__quarter
- , subq_5.booking__ds_partitioned__year
- , subq_5.booking__ds_partitioned__extract_year
- , subq_5.booking__ds_partitioned__extract_quarter
- , subq_5.booking__ds_partitioned__extract_month
- , subq_5.booking__ds_partitioned__extract_day
- , subq_5.booking__ds_partitioned__extract_dow
- , subq_5.booking__ds_partitioned__extract_doy
- , subq_5.booking__paid_at__day
- , subq_5.booking__paid_at__week
- , subq_5.booking__paid_at__month
- , subq_5.booking__paid_at__quarter
- , subq_5.booking__paid_at__year
- , subq_5.booking__paid_at__extract_year
- , subq_5.booking__paid_at__extract_quarter
- , subq_5.booking__paid_at__extract_month
- , subq_5.booking__paid_at__extract_day
- , subq_5.booking__paid_at__extract_dow
- , subq_5.booking__paid_at__extract_doy
- , subq_5.ds__day AS metric_time__day
- , subq_5.ds__week AS metric_time__week
- , subq_5.ds__month AS metric_time__month
- , subq_5.ds__quarter AS metric_time__quarter
- , subq_5.ds__year AS metric_time__year
- , subq_5.ds__extract_year AS metric_time__extract_year
- , subq_5.ds__extract_quarter AS metric_time__extract_quarter
- , subq_5.ds__extract_month AS metric_time__extract_month
- , subq_5.ds__extract_day AS metric_time__extract_day
- , subq_5.ds__extract_dow AS metric_time__extract_dow
- , subq_5.ds__extract_doy AS metric_time__extract_doy
- , subq_5.listing
- , subq_5.guest
- , subq_5.host
- , subq_5.booking__listing
- , subq_5.booking__guest
- , subq_5.booking__host
- , subq_5.is_instant
- , subq_5.booking__is_instant
- , subq_5.bookings
- , subq_5.instant_bookings
- , subq_5.booking_value
- , subq_5.max_booking_value
- , subq_5.min_booking_value
- , subq_5.bookers
- , subq_5.average_booking_value
- , subq_5.referred_bookings
- , subq_5.median_booking_value
- , subq_5.booking_value_p99
- , subq_5.discrete_booking_value_p99
- , subq_5.approximate_continuous_booking_value_p99
- , subq_5.approximate_discrete_booking_value_p99
+ subq_14.ds__day
+ , subq_14.ds__week
+ , subq_14.ds__month
+ , subq_14.ds__quarter
+ , subq_14.ds__year
+ , subq_14.ds__extract_year
+ , subq_14.ds__extract_quarter
+ , subq_14.ds__extract_month
+ , subq_14.ds__extract_day
+ , subq_14.ds__extract_dow
+ , subq_14.ds__extract_doy
+ , subq_14.ds_partitioned__day
+ , subq_14.ds_partitioned__week
+ , subq_14.ds_partitioned__month
+ , subq_14.ds_partitioned__quarter
+ , subq_14.ds_partitioned__year
+ , subq_14.ds_partitioned__extract_year
+ , subq_14.ds_partitioned__extract_quarter
+ , subq_14.ds_partitioned__extract_month
+ , subq_14.ds_partitioned__extract_day
+ , subq_14.ds_partitioned__extract_dow
+ , subq_14.ds_partitioned__extract_doy
+ , subq_14.paid_at__day
+ , subq_14.paid_at__week
+ , subq_14.paid_at__month
+ , subq_14.paid_at__quarter
+ , subq_14.paid_at__year
+ , subq_14.paid_at__extract_year
+ , subq_14.paid_at__extract_quarter
+ , subq_14.paid_at__extract_month
+ , subq_14.paid_at__extract_day
+ , subq_14.paid_at__extract_dow
+ , subq_14.paid_at__extract_doy
+ , subq_14.booking__ds__day
+ , subq_14.booking__ds__week
+ , subq_14.booking__ds__month
+ , subq_14.booking__ds__quarter
+ , subq_14.booking__ds__year
+ , subq_14.booking__ds__extract_year
+ , subq_14.booking__ds__extract_quarter
+ , subq_14.booking__ds__extract_month
+ , subq_14.booking__ds__extract_day
+ , subq_14.booking__ds__extract_dow
+ , subq_14.booking__ds__extract_doy
+ , subq_14.booking__ds_partitioned__day
+ , subq_14.booking__ds_partitioned__week
+ , subq_14.booking__ds_partitioned__month
+ , subq_14.booking__ds_partitioned__quarter
+ , subq_14.booking__ds_partitioned__year
+ , subq_14.booking__ds_partitioned__extract_year
+ , subq_14.booking__ds_partitioned__extract_quarter
+ , subq_14.booking__ds_partitioned__extract_month
+ , subq_14.booking__ds_partitioned__extract_day
+ , subq_14.booking__ds_partitioned__extract_dow
+ , subq_14.booking__ds_partitioned__extract_doy
+ , subq_14.booking__paid_at__day
+ , subq_14.booking__paid_at__week
+ , subq_14.booking__paid_at__month
+ , subq_14.booking__paid_at__quarter
+ , subq_14.booking__paid_at__year
+ , subq_14.booking__paid_at__extract_year
+ , subq_14.booking__paid_at__extract_quarter
+ , subq_14.booking__paid_at__extract_month
+ , subq_14.booking__paid_at__extract_day
+ , subq_14.booking__paid_at__extract_dow
+ , subq_14.booking__paid_at__extract_doy
+ , subq_14.ds__day AS metric_time__day
+ , subq_14.ds__week AS metric_time__week
+ , subq_14.ds__month AS metric_time__month
+ , subq_14.ds__quarter AS metric_time__quarter
+ , subq_14.ds__year AS metric_time__year
+ , subq_14.ds__extract_year AS metric_time__extract_year
+ , subq_14.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_14.ds__extract_month AS metric_time__extract_month
+ , subq_14.ds__extract_day AS metric_time__extract_day
+ , subq_14.ds__extract_dow AS metric_time__extract_dow
+ , subq_14.ds__extract_doy AS metric_time__extract_doy
+ , subq_14.listing
+ , subq_14.guest
+ , subq_14.host
+ , subq_14.booking__listing
+ , subq_14.booking__guest
+ , subq_14.booking__host
+ , subq_14.is_instant
+ , subq_14.booking__is_instant
+ , subq_14.bookings
+ , subq_14.instant_bookings
+ , subq_14.booking_value
+ , subq_14.max_booking_value
+ , subq_14.min_booking_value
+ , subq_14.bookers
+ , subq_14.average_booking_value
+ , subq_14.referred_bookings
+ , subq_14.median_booking_value
+ , subq_14.booking_value_p99
+ , subq_14.discrete_booking_value_p99
+ , subq_14.approximate_continuous_booking_value_p99
+ , subq_14.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_5
- ) subq_6
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_14
+ ) subq_15
ON
- DATE_TRUNC('month', subq_7.metric_time__day) = subq_6.metric_time__day
- WHERE DATE_TRUNC('week', subq_7.metric_time__day) = subq_7.metric_time__day
- ) subq_9
- ) subq_10
+ DATE_TRUNC('month', subq_16.metric_time__day) = subq_15.metric_time__day
+ WHERE DATE_TRUNC('week', subq_16.metric_time__day) = subq_16.metric_time__day
+ ) subq_18
+ ) subq_19
GROUP BY
- subq_10.metric_time__week
- ) subq_11
- ) subq_12
+ subq_19.metric_time__week
+ ) subq_20
+ ) subq_21
ON
- subq_4.metric_time__week = subq_12.metric_time__week
+ subq_13.metric_time__week = subq_21.metric_time__week
GROUP BY
- COALESCE(subq_4.metric_time__week, subq_12.metric_time__week)
-) subq_13
+ COALESCE(subq_13.metric_time__week, subq_21.metric_time__week)
+) subq_22
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_to_grain_and_granularity__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_to_grain_and_granularity__plan0_optimized.sql
index b9e4162413..65cf132abd 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_to_grain_and_granularity__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_to_grain_and_granularity__plan0_optimized.sql
@@ -5,9 +5,9 @@ SELECT
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_18.metric_time__week, subq_26.metric_time__week) AS metric_time__week
- , MAX(subq_18.bookings) AS bookings
- , MAX(subq_26.bookings_at_start_of_month) AS bookings_at_start_of_month
+ COALESCE(subq_27.metric_time__week, subq_35.metric_time__week) AS metric_time__week
+ , MAX(subq_27.bookings) AS bookings
+ , MAX(subq_35.bookings_at_start_of_month) AS bookings_at_start_of_month
FROM (
-- Aggregate Measures
-- Compute Metrics via Expressions
@@ -21,36 +21,36 @@ FROM (
SELECT
DATE_TRUNC('week', ds) AS metric_time__week
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_16
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_25
GROUP BY
metric_time__week
- ) subq_18
+ ) subq_27
FULL OUTER JOIN (
-- Join to Time Spine Dataset
-- Pass Only Elements: ['bookings', 'metric_time__week']
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- DATE_TRUNC('week', subq_22.ds) AS metric_time__week
- , SUM(subq_20.bookings) AS bookings_at_start_of_month
- FROM ***************************.mf_time_spine subq_22
+ DATE_TRUNC('week', subq_31.ds) AS metric_time__week
+ , SUM(subq_29.bookings) AS bookings_at_start_of_month
+ FROM ***************************.mf_time_spine subq_31
INNER JOIN (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
SELECT
DATE_TRUNC('day', ds) AS metric_time__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_20
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_29
ON
- DATE_TRUNC('month', subq_22.ds) = subq_20.metric_time__day
- WHERE DATE_TRUNC('week', subq_22.ds) = subq_22.ds
+ DATE_TRUNC('month', subq_31.ds) = subq_29.metric_time__day
+ WHERE DATE_TRUNC('week', subq_31.ds) = subq_31.ds
GROUP BY
- DATE_TRUNC('week', subq_22.ds)
- ) subq_26
+ DATE_TRUNC('week', subq_31.ds)
+ ) subq_35
ON
- subq_18.metric_time__week = subq_26.metric_time__week
+ subq_27.metric_time__week = subq_35.metric_time__week
GROUP BY
- COALESCE(subq_18.metric_time__week, subq_26.metric_time__week)
-) subq_27
+ COALESCE(subq_27.metric_time__week, subq_35.metric_time__week)
+) subq_36
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window__plan0.sql
index c04aa961af..60c82383cd 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window__plan0.sql
@@ -1,545 +1,545 @@
-- Compute Metrics via Expressions
SELECT
- subq_13.metric_time__day
+ subq_22.metric_time__day
, bookings - bookings_2_weeks_ago AS bookings_growth_2_weeks
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_4.metric_time__day, subq_12.metric_time__day) AS metric_time__day
- , MAX(subq_4.bookings) AS bookings
- , MAX(subq_12.bookings_2_weeks_ago) AS bookings_2_weeks_ago
+ COALESCE(subq_13.metric_time__day, subq_21.metric_time__day) AS metric_time__day
+ , MAX(subq_13.bookings) AS bookings
+ , MAX(subq_21.bookings_2_weeks_ago) AS bookings_2_weeks_ago
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_3.metric_time__day
- , subq_3.bookings
+ subq_12.metric_time__day
+ , subq_12.bookings
FROM (
-- Aggregate Measures
SELECT
- subq_2.metric_time__day
- , SUM(subq_2.bookings) AS bookings
+ subq_11.metric_time__day
+ , SUM(subq_11.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__day']
SELECT
- subq_1.metric_time__day
- , subq_1.bookings
+ subq_10.metric_time__day
+ , subq_10.bookings
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
- ) subq_2
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
GROUP BY
- subq_2.metric_time__day
- ) subq_3
- ) subq_4
+ subq_11.metric_time__day
+ ) subq_12
+ ) subq_13
FULL OUTER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_11.metric_time__day
- , subq_11.bookings AS bookings_2_weeks_ago
+ subq_20.metric_time__day
+ , subq_20.bookings AS bookings_2_weeks_ago
FROM (
-- Aggregate Measures
SELECT
- subq_10.metric_time__day
- , SUM(subq_10.bookings) AS bookings
+ subq_19.metric_time__day
+ , SUM(subq_19.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__day']
SELECT
- subq_9.metric_time__day
- , subq_9.bookings
+ subq_18.metric_time__day
+ , subq_18.bookings
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_7.metric_time__day AS metric_time__day
- , subq_6.ds__day AS ds__day
- , subq_6.ds__week AS ds__week
- , subq_6.ds__month AS ds__month
- , subq_6.ds__quarter AS ds__quarter
- , subq_6.ds__year AS ds__year
- , subq_6.ds__extract_year AS ds__extract_year
- , subq_6.ds__extract_quarter AS ds__extract_quarter
- , subq_6.ds__extract_month AS ds__extract_month
- , subq_6.ds__extract_day AS ds__extract_day
- , subq_6.ds__extract_dow AS ds__extract_dow
- , subq_6.ds__extract_doy AS ds__extract_doy
- , subq_6.ds_partitioned__day AS ds_partitioned__day
- , subq_6.ds_partitioned__week AS ds_partitioned__week
- , subq_6.ds_partitioned__month AS ds_partitioned__month
- , subq_6.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_6.ds_partitioned__year AS ds_partitioned__year
- , subq_6.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_6.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_6.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_6.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_6.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_6.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_6.paid_at__day AS paid_at__day
- , subq_6.paid_at__week AS paid_at__week
- , subq_6.paid_at__month AS paid_at__month
- , subq_6.paid_at__quarter AS paid_at__quarter
- , subq_6.paid_at__year AS paid_at__year
- , subq_6.paid_at__extract_year AS paid_at__extract_year
- , subq_6.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_6.paid_at__extract_month AS paid_at__extract_month
- , subq_6.paid_at__extract_day AS paid_at__extract_day
- , subq_6.paid_at__extract_dow AS paid_at__extract_dow
- , subq_6.paid_at__extract_doy AS paid_at__extract_doy
- , subq_6.booking__ds__day AS booking__ds__day
- , subq_6.booking__ds__week AS booking__ds__week
- , subq_6.booking__ds__month AS booking__ds__month
- , subq_6.booking__ds__quarter AS booking__ds__quarter
- , subq_6.booking__ds__year AS booking__ds__year
- , subq_6.booking__ds__extract_year AS booking__ds__extract_year
- , subq_6.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_6.booking__ds__extract_month AS booking__ds__extract_month
- , subq_6.booking__ds__extract_day AS booking__ds__extract_day
- , subq_6.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_6.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_6.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_6.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_6.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_6.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_6.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_6.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_6.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_6.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_6.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_6.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_6.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_6.booking__paid_at__day AS booking__paid_at__day
- , subq_6.booking__paid_at__week AS booking__paid_at__week
- , subq_6.booking__paid_at__month AS booking__paid_at__month
- , subq_6.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_6.booking__paid_at__year AS booking__paid_at__year
- , subq_6.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_6.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_6.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_6.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_6.listing AS listing
- , subq_6.guest AS guest
- , subq_6.host AS host
- , subq_6.booking__listing AS booking__listing
- , subq_6.booking__guest AS booking__guest
- , subq_6.booking__host AS booking__host
- , subq_6.is_instant AS is_instant
- , subq_6.booking__is_instant AS booking__is_instant
- , subq_6.bookings AS bookings
- , subq_6.instant_bookings AS instant_bookings
- , subq_6.booking_value AS booking_value
- , subq_6.max_booking_value AS max_booking_value
- , subq_6.min_booking_value AS min_booking_value
- , subq_6.bookers AS bookers
- , subq_6.average_booking_value AS average_booking_value
- , subq_6.referred_bookings AS referred_bookings
- , subq_6.median_booking_value AS median_booking_value
- , subq_6.booking_value_p99 AS booking_value_p99
- , subq_6.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_6.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_6.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ subq_16.metric_time__day AS metric_time__day
+ , subq_15.ds__day AS ds__day
+ , subq_15.ds__week AS ds__week
+ , subq_15.ds__month AS ds__month
+ , subq_15.ds__quarter AS ds__quarter
+ , subq_15.ds__year AS ds__year
+ , subq_15.ds__extract_year AS ds__extract_year
+ , subq_15.ds__extract_quarter AS ds__extract_quarter
+ , subq_15.ds__extract_month AS ds__extract_month
+ , subq_15.ds__extract_day AS ds__extract_day
+ , subq_15.ds__extract_dow AS ds__extract_dow
+ , subq_15.ds__extract_doy AS ds__extract_doy
+ , subq_15.ds_partitioned__day AS ds_partitioned__day
+ , subq_15.ds_partitioned__week AS ds_partitioned__week
+ , subq_15.ds_partitioned__month AS ds_partitioned__month
+ , subq_15.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_15.ds_partitioned__year AS ds_partitioned__year
+ , subq_15.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_15.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_15.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_15.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_15.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_15.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_15.paid_at__day AS paid_at__day
+ , subq_15.paid_at__week AS paid_at__week
+ , subq_15.paid_at__month AS paid_at__month
+ , subq_15.paid_at__quarter AS paid_at__quarter
+ , subq_15.paid_at__year AS paid_at__year
+ , subq_15.paid_at__extract_year AS paid_at__extract_year
+ , subq_15.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_15.paid_at__extract_month AS paid_at__extract_month
+ , subq_15.paid_at__extract_day AS paid_at__extract_day
+ , subq_15.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_15.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_15.booking__ds__day AS booking__ds__day
+ , subq_15.booking__ds__week AS booking__ds__week
+ , subq_15.booking__ds__month AS booking__ds__month
+ , subq_15.booking__ds__quarter AS booking__ds__quarter
+ , subq_15.booking__ds__year AS booking__ds__year
+ , subq_15.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_15.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_15.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_15.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_15.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_15.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_15.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_15.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_15.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_15.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_15.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_15.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_15.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_15.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_15.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_15.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_15.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_15.booking__paid_at__day AS booking__paid_at__day
+ , subq_15.booking__paid_at__week AS booking__paid_at__week
+ , subq_15.booking__paid_at__month AS booking__paid_at__month
+ , subq_15.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_15.booking__paid_at__year AS booking__paid_at__year
+ , subq_15.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_15.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_15.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_15.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_15.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_15.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_15.listing AS listing
+ , subq_15.guest AS guest
+ , subq_15.host AS host
+ , subq_15.booking__listing AS booking__listing
+ , subq_15.booking__guest AS booking__guest
+ , subq_15.booking__host AS booking__host
+ , subq_15.is_instant AS is_instant
+ , subq_15.booking__is_instant AS booking__is_instant
+ , subq_15.bookings AS bookings
+ , subq_15.instant_bookings AS instant_bookings
+ , subq_15.booking_value AS booking_value
+ , subq_15.max_booking_value AS max_booking_value
+ , subq_15.min_booking_value AS min_booking_value
+ , subq_15.bookers AS bookers
+ , subq_15.average_booking_value AS average_booking_value
+ , subq_15.referred_bookings AS referred_bookings
+ , subq_15.median_booking_value AS median_booking_value
+ , subq_15.booking_value_p99 AS booking_value_p99
+ , subq_15.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_15.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_15.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_8.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_8
- ) subq_7
+ subq_17.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_17
+ ) subq_16
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_5.ds__day
- , subq_5.ds__week
- , subq_5.ds__month
- , subq_5.ds__quarter
- , subq_5.ds__year
- , subq_5.ds__extract_year
- , subq_5.ds__extract_quarter
- , subq_5.ds__extract_month
- , subq_5.ds__extract_day
- , subq_5.ds__extract_dow
- , subq_5.ds__extract_doy
- , subq_5.ds_partitioned__day
- , subq_5.ds_partitioned__week
- , subq_5.ds_partitioned__month
- , subq_5.ds_partitioned__quarter
- , subq_5.ds_partitioned__year
- , subq_5.ds_partitioned__extract_year
- , subq_5.ds_partitioned__extract_quarter
- , subq_5.ds_partitioned__extract_month
- , subq_5.ds_partitioned__extract_day
- , subq_5.ds_partitioned__extract_dow
- , subq_5.ds_partitioned__extract_doy
- , subq_5.paid_at__day
- , subq_5.paid_at__week
- , subq_5.paid_at__month
- , subq_5.paid_at__quarter
- , subq_5.paid_at__year
- , subq_5.paid_at__extract_year
- , subq_5.paid_at__extract_quarter
- , subq_5.paid_at__extract_month
- , subq_5.paid_at__extract_day
- , subq_5.paid_at__extract_dow
- , subq_5.paid_at__extract_doy
- , subq_5.booking__ds__day
- , subq_5.booking__ds__week
- , subq_5.booking__ds__month
- , subq_5.booking__ds__quarter
- , subq_5.booking__ds__year
- , subq_5.booking__ds__extract_year
- , subq_5.booking__ds__extract_quarter
- , subq_5.booking__ds__extract_month
- , subq_5.booking__ds__extract_day
- , subq_5.booking__ds__extract_dow
- , subq_5.booking__ds__extract_doy
- , subq_5.booking__ds_partitioned__day
- , subq_5.booking__ds_partitioned__week
- , subq_5.booking__ds_partitioned__month
- , subq_5.booking__ds_partitioned__quarter
- , subq_5.booking__ds_partitioned__year
- , subq_5.booking__ds_partitioned__extract_year
- , subq_5.booking__ds_partitioned__extract_quarter
- , subq_5.booking__ds_partitioned__extract_month
- , subq_5.booking__ds_partitioned__extract_day
- , subq_5.booking__ds_partitioned__extract_dow
- , subq_5.booking__ds_partitioned__extract_doy
- , subq_5.booking__paid_at__day
- , subq_5.booking__paid_at__week
- , subq_5.booking__paid_at__month
- , subq_5.booking__paid_at__quarter
- , subq_5.booking__paid_at__year
- , subq_5.booking__paid_at__extract_year
- , subq_5.booking__paid_at__extract_quarter
- , subq_5.booking__paid_at__extract_month
- , subq_5.booking__paid_at__extract_day
- , subq_5.booking__paid_at__extract_dow
- , subq_5.booking__paid_at__extract_doy
- , subq_5.ds__day AS metric_time__day
- , subq_5.ds__week AS metric_time__week
- , subq_5.ds__month AS metric_time__month
- , subq_5.ds__quarter AS metric_time__quarter
- , subq_5.ds__year AS metric_time__year
- , subq_5.ds__extract_year AS metric_time__extract_year
- , subq_5.ds__extract_quarter AS metric_time__extract_quarter
- , subq_5.ds__extract_month AS metric_time__extract_month
- , subq_5.ds__extract_day AS metric_time__extract_day
- , subq_5.ds__extract_dow AS metric_time__extract_dow
- , subq_5.ds__extract_doy AS metric_time__extract_doy
- , subq_5.listing
- , subq_5.guest
- , subq_5.host
- , subq_5.booking__listing
- , subq_5.booking__guest
- , subq_5.booking__host
- , subq_5.is_instant
- , subq_5.booking__is_instant
- , subq_5.bookings
- , subq_5.instant_bookings
- , subq_5.booking_value
- , subq_5.max_booking_value
- , subq_5.min_booking_value
- , subq_5.bookers
- , subq_5.average_booking_value
- , subq_5.referred_bookings
- , subq_5.median_booking_value
- , subq_5.booking_value_p99
- , subq_5.discrete_booking_value_p99
- , subq_5.approximate_continuous_booking_value_p99
- , subq_5.approximate_discrete_booking_value_p99
+ subq_14.ds__day
+ , subq_14.ds__week
+ , subq_14.ds__month
+ , subq_14.ds__quarter
+ , subq_14.ds__year
+ , subq_14.ds__extract_year
+ , subq_14.ds__extract_quarter
+ , subq_14.ds__extract_month
+ , subq_14.ds__extract_day
+ , subq_14.ds__extract_dow
+ , subq_14.ds__extract_doy
+ , subq_14.ds_partitioned__day
+ , subq_14.ds_partitioned__week
+ , subq_14.ds_partitioned__month
+ , subq_14.ds_partitioned__quarter
+ , subq_14.ds_partitioned__year
+ , subq_14.ds_partitioned__extract_year
+ , subq_14.ds_partitioned__extract_quarter
+ , subq_14.ds_partitioned__extract_month
+ , subq_14.ds_partitioned__extract_day
+ , subq_14.ds_partitioned__extract_dow
+ , subq_14.ds_partitioned__extract_doy
+ , subq_14.paid_at__day
+ , subq_14.paid_at__week
+ , subq_14.paid_at__month
+ , subq_14.paid_at__quarter
+ , subq_14.paid_at__year
+ , subq_14.paid_at__extract_year
+ , subq_14.paid_at__extract_quarter
+ , subq_14.paid_at__extract_month
+ , subq_14.paid_at__extract_day
+ , subq_14.paid_at__extract_dow
+ , subq_14.paid_at__extract_doy
+ , subq_14.booking__ds__day
+ , subq_14.booking__ds__week
+ , subq_14.booking__ds__month
+ , subq_14.booking__ds__quarter
+ , subq_14.booking__ds__year
+ , subq_14.booking__ds__extract_year
+ , subq_14.booking__ds__extract_quarter
+ , subq_14.booking__ds__extract_month
+ , subq_14.booking__ds__extract_day
+ , subq_14.booking__ds__extract_dow
+ , subq_14.booking__ds__extract_doy
+ , subq_14.booking__ds_partitioned__day
+ , subq_14.booking__ds_partitioned__week
+ , subq_14.booking__ds_partitioned__month
+ , subq_14.booking__ds_partitioned__quarter
+ , subq_14.booking__ds_partitioned__year
+ , subq_14.booking__ds_partitioned__extract_year
+ , subq_14.booking__ds_partitioned__extract_quarter
+ , subq_14.booking__ds_partitioned__extract_month
+ , subq_14.booking__ds_partitioned__extract_day
+ , subq_14.booking__ds_partitioned__extract_dow
+ , subq_14.booking__ds_partitioned__extract_doy
+ , subq_14.booking__paid_at__day
+ , subq_14.booking__paid_at__week
+ , subq_14.booking__paid_at__month
+ , subq_14.booking__paid_at__quarter
+ , subq_14.booking__paid_at__year
+ , subq_14.booking__paid_at__extract_year
+ , subq_14.booking__paid_at__extract_quarter
+ , subq_14.booking__paid_at__extract_month
+ , subq_14.booking__paid_at__extract_day
+ , subq_14.booking__paid_at__extract_dow
+ , subq_14.booking__paid_at__extract_doy
+ , subq_14.ds__day AS metric_time__day
+ , subq_14.ds__week AS metric_time__week
+ , subq_14.ds__month AS metric_time__month
+ , subq_14.ds__quarter AS metric_time__quarter
+ , subq_14.ds__year AS metric_time__year
+ , subq_14.ds__extract_year AS metric_time__extract_year
+ , subq_14.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_14.ds__extract_month AS metric_time__extract_month
+ , subq_14.ds__extract_day AS metric_time__extract_day
+ , subq_14.ds__extract_dow AS metric_time__extract_dow
+ , subq_14.ds__extract_doy AS metric_time__extract_doy
+ , subq_14.listing
+ , subq_14.guest
+ , subq_14.host
+ , subq_14.booking__listing
+ , subq_14.booking__guest
+ , subq_14.booking__host
+ , subq_14.is_instant
+ , subq_14.booking__is_instant
+ , subq_14.bookings
+ , subq_14.instant_bookings
+ , subq_14.booking_value
+ , subq_14.max_booking_value
+ , subq_14.min_booking_value
+ , subq_14.bookers
+ , subq_14.average_booking_value
+ , subq_14.referred_bookings
+ , subq_14.median_booking_value
+ , subq_14.booking_value_p99
+ , subq_14.discrete_booking_value_p99
+ , subq_14.approximate_continuous_booking_value_p99
+ , subq_14.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_5
- ) subq_6
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_14
+ ) subq_15
ON
- subq_7.metric_time__day - INTERVAL 14 day = subq_6.metric_time__day
- ) subq_9
- ) subq_10
+ subq_16.metric_time__day - INTERVAL 14 day = subq_15.metric_time__day
+ ) subq_18
+ ) subq_19
GROUP BY
- subq_10.metric_time__day
- ) subq_11
- ) subq_12
+ subq_19.metric_time__day
+ ) subq_20
+ ) subq_21
ON
- subq_4.metric_time__day = subq_12.metric_time__day
+ subq_13.metric_time__day = subq_21.metric_time__day
GROUP BY
- COALESCE(subq_4.metric_time__day, subq_12.metric_time__day)
-) subq_13
+ COALESCE(subq_13.metric_time__day, subq_21.metric_time__day)
+) subq_22
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window__plan0_optimized.sql
index b92618b957..08216bb7af 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window__plan0_optimized.sql
@@ -5,9 +5,9 @@ SELECT
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_18.metric_time__day, subq_26.metric_time__day) AS metric_time__day
- , MAX(subq_18.bookings) AS bookings
- , MAX(subq_26.bookings_2_weeks_ago) AS bookings_2_weeks_ago
+ COALESCE(subq_27.metric_time__day, subq_35.metric_time__day) AS metric_time__day
+ , MAX(subq_27.bookings) AS bookings
+ , MAX(subq_35.bookings_2_weeks_ago) AS bookings_2_weeks_ago
FROM (
-- Aggregate Measures
-- Compute Metrics via Expressions
@@ -21,35 +21,35 @@ FROM (
SELECT
DATE_TRUNC('day', ds) AS metric_time__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_16
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_25
GROUP BY
metric_time__day
- ) subq_18
+ ) subq_27
FULL OUTER JOIN (
-- Join to Time Spine Dataset
-- Pass Only Elements: ['bookings', 'metric_time__day']
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_22.ds AS metric_time__day
- , SUM(subq_20.bookings) AS bookings_2_weeks_ago
- FROM ***************************.mf_time_spine subq_22
+ subq_31.ds AS metric_time__day
+ , SUM(subq_29.bookings) AS bookings_2_weeks_ago
+ FROM ***************************.mf_time_spine subq_31
INNER JOIN (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
SELECT
DATE_TRUNC('day', ds) AS metric_time__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_20
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_29
ON
- subq_22.ds - INTERVAL 14 day = subq_20.metric_time__day
+ subq_31.ds - INTERVAL 14 day = subq_29.metric_time__day
GROUP BY
- subq_22.ds
- ) subq_26
+ subq_31.ds
+ ) subq_35
ON
- subq_18.metric_time__day = subq_26.metric_time__day
+ subq_27.metric_time__day = subq_35.metric_time__day
GROUP BY
- COALESCE(subq_18.metric_time__day, subq_26.metric_time__day)
-) subq_27
+ COALESCE(subq_27.metric_time__day, subq_35.metric_time__day)
+) subq_36
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window_and_granularity__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window_and_granularity__plan0.sql
index bd5832637c..26f7f0dad2 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window_and_granularity__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window_and_granularity__plan0.sql
@@ -1,545 +1,545 @@
-- Compute Metrics via Expressions
SELECT
- subq_13.metric_time__quarter
+ subq_22.metric_time__quarter
, bookings - bookings_2_weeks_ago AS bookings_growth_2_weeks
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_4.metric_time__quarter, subq_12.metric_time__quarter) AS metric_time__quarter
- , MAX(subq_4.bookings) AS bookings
- , MAX(subq_12.bookings_2_weeks_ago) AS bookings_2_weeks_ago
+ COALESCE(subq_13.metric_time__quarter, subq_21.metric_time__quarter) AS metric_time__quarter
+ , MAX(subq_13.bookings) AS bookings
+ , MAX(subq_21.bookings_2_weeks_ago) AS bookings_2_weeks_ago
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_3.metric_time__quarter
- , subq_3.bookings
+ subq_12.metric_time__quarter
+ , subq_12.bookings
FROM (
-- Aggregate Measures
SELECT
- subq_2.metric_time__quarter
- , SUM(subq_2.bookings) AS bookings
+ subq_11.metric_time__quarter
+ , SUM(subq_11.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__quarter']
SELECT
- subq_1.metric_time__quarter
- , subq_1.bookings
+ subq_10.metric_time__quarter
+ , subq_10.bookings
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
- ) subq_2
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
GROUP BY
- subq_2.metric_time__quarter
- ) subq_3
- ) subq_4
+ subq_11.metric_time__quarter
+ ) subq_12
+ ) subq_13
FULL OUTER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_11.metric_time__quarter
- , subq_11.bookings AS bookings_2_weeks_ago
+ subq_20.metric_time__quarter
+ , subq_20.bookings AS bookings_2_weeks_ago
FROM (
-- Aggregate Measures
SELECT
- subq_10.metric_time__quarter
- , SUM(subq_10.bookings) AS bookings
+ subq_19.metric_time__quarter
+ , SUM(subq_19.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__quarter']
SELECT
- subq_9.metric_time__quarter
- , subq_9.bookings
+ subq_18.metric_time__quarter
+ , subq_18.bookings
FROM (
-- Join to Time Spine Dataset
SELECT
- DATE_TRUNC('quarter', subq_7.metric_time__day) AS metric_time__quarter
- , subq_6.ds__day AS ds__day
- , subq_6.ds__week AS ds__week
- , subq_6.ds__month AS ds__month
- , subq_6.ds__quarter AS ds__quarter
- , subq_6.ds__year AS ds__year
- , subq_6.ds__extract_year AS ds__extract_year
- , subq_6.ds__extract_quarter AS ds__extract_quarter
- , subq_6.ds__extract_month AS ds__extract_month
- , subq_6.ds__extract_day AS ds__extract_day
- , subq_6.ds__extract_dow AS ds__extract_dow
- , subq_6.ds__extract_doy AS ds__extract_doy
- , subq_6.ds_partitioned__day AS ds_partitioned__day
- , subq_6.ds_partitioned__week AS ds_partitioned__week
- , subq_6.ds_partitioned__month AS ds_partitioned__month
- , subq_6.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_6.ds_partitioned__year AS ds_partitioned__year
- , subq_6.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_6.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_6.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_6.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_6.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_6.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_6.paid_at__day AS paid_at__day
- , subq_6.paid_at__week AS paid_at__week
- , subq_6.paid_at__month AS paid_at__month
- , subq_6.paid_at__quarter AS paid_at__quarter
- , subq_6.paid_at__year AS paid_at__year
- , subq_6.paid_at__extract_year AS paid_at__extract_year
- , subq_6.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_6.paid_at__extract_month AS paid_at__extract_month
- , subq_6.paid_at__extract_day AS paid_at__extract_day
- , subq_6.paid_at__extract_dow AS paid_at__extract_dow
- , subq_6.paid_at__extract_doy AS paid_at__extract_doy
- , subq_6.booking__ds__day AS booking__ds__day
- , subq_6.booking__ds__week AS booking__ds__week
- , subq_6.booking__ds__month AS booking__ds__month
- , subq_6.booking__ds__quarter AS booking__ds__quarter
- , subq_6.booking__ds__year AS booking__ds__year
- , subq_6.booking__ds__extract_year AS booking__ds__extract_year
- , subq_6.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_6.booking__ds__extract_month AS booking__ds__extract_month
- , subq_6.booking__ds__extract_day AS booking__ds__extract_day
- , subq_6.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_6.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_6.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_6.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_6.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_6.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_6.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_6.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_6.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_6.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_6.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_6.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_6.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_6.booking__paid_at__day AS booking__paid_at__day
- , subq_6.booking__paid_at__week AS booking__paid_at__week
- , subq_6.booking__paid_at__month AS booking__paid_at__month
- , subq_6.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_6.booking__paid_at__year AS booking__paid_at__year
- , subq_6.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_6.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_6.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_6.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_6.listing AS listing
- , subq_6.guest AS guest
- , subq_6.host AS host
- , subq_6.booking__listing AS booking__listing
- , subq_6.booking__guest AS booking__guest
- , subq_6.booking__host AS booking__host
- , subq_6.is_instant AS is_instant
- , subq_6.booking__is_instant AS booking__is_instant
- , subq_6.bookings AS bookings
- , subq_6.instant_bookings AS instant_bookings
- , subq_6.booking_value AS booking_value
- , subq_6.max_booking_value AS max_booking_value
- , subq_6.min_booking_value AS min_booking_value
- , subq_6.bookers AS bookers
- , subq_6.average_booking_value AS average_booking_value
- , subq_6.referred_bookings AS referred_bookings
- , subq_6.median_booking_value AS median_booking_value
- , subq_6.booking_value_p99 AS booking_value_p99
- , subq_6.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_6.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_6.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ DATE_TRUNC('quarter', subq_16.metric_time__day) AS metric_time__quarter
+ , subq_15.ds__day AS ds__day
+ , subq_15.ds__week AS ds__week
+ , subq_15.ds__month AS ds__month
+ , subq_15.ds__quarter AS ds__quarter
+ , subq_15.ds__year AS ds__year
+ , subq_15.ds__extract_year AS ds__extract_year
+ , subq_15.ds__extract_quarter AS ds__extract_quarter
+ , subq_15.ds__extract_month AS ds__extract_month
+ , subq_15.ds__extract_day AS ds__extract_day
+ , subq_15.ds__extract_dow AS ds__extract_dow
+ , subq_15.ds__extract_doy AS ds__extract_doy
+ , subq_15.ds_partitioned__day AS ds_partitioned__day
+ , subq_15.ds_partitioned__week AS ds_partitioned__week
+ , subq_15.ds_partitioned__month AS ds_partitioned__month
+ , subq_15.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_15.ds_partitioned__year AS ds_partitioned__year
+ , subq_15.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_15.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_15.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_15.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_15.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_15.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_15.paid_at__day AS paid_at__day
+ , subq_15.paid_at__week AS paid_at__week
+ , subq_15.paid_at__month AS paid_at__month
+ , subq_15.paid_at__quarter AS paid_at__quarter
+ , subq_15.paid_at__year AS paid_at__year
+ , subq_15.paid_at__extract_year AS paid_at__extract_year
+ , subq_15.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_15.paid_at__extract_month AS paid_at__extract_month
+ , subq_15.paid_at__extract_day AS paid_at__extract_day
+ , subq_15.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_15.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_15.booking__ds__day AS booking__ds__day
+ , subq_15.booking__ds__week AS booking__ds__week
+ , subq_15.booking__ds__month AS booking__ds__month
+ , subq_15.booking__ds__quarter AS booking__ds__quarter
+ , subq_15.booking__ds__year AS booking__ds__year
+ , subq_15.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_15.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_15.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_15.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_15.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_15.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_15.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_15.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_15.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_15.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_15.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_15.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_15.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_15.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_15.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_15.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_15.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_15.booking__paid_at__day AS booking__paid_at__day
+ , subq_15.booking__paid_at__week AS booking__paid_at__week
+ , subq_15.booking__paid_at__month AS booking__paid_at__month
+ , subq_15.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_15.booking__paid_at__year AS booking__paid_at__year
+ , subq_15.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_15.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_15.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_15.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_15.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_15.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_15.listing AS listing
+ , subq_15.guest AS guest
+ , subq_15.host AS host
+ , subq_15.booking__listing AS booking__listing
+ , subq_15.booking__guest AS booking__guest
+ , subq_15.booking__host AS booking__host
+ , subq_15.is_instant AS is_instant
+ , subq_15.booking__is_instant AS booking__is_instant
+ , subq_15.bookings AS bookings
+ , subq_15.instant_bookings AS instant_bookings
+ , subq_15.booking_value AS booking_value
+ , subq_15.max_booking_value AS max_booking_value
+ , subq_15.min_booking_value AS min_booking_value
+ , subq_15.bookers AS bookers
+ , subq_15.average_booking_value AS average_booking_value
+ , subq_15.referred_bookings AS referred_bookings
+ , subq_15.median_booking_value AS median_booking_value
+ , subq_15.booking_value_p99 AS booking_value_p99
+ , subq_15.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_15.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_15.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_8.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_8
- ) subq_7
+ subq_17.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_17
+ ) subq_16
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_5.ds__day
- , subq_5.ds__week
- , subq_5.ds__month
- , subq_5.ds__quarter
- , subq_5.ds__year
- , subq_5.ds__extract_year
- , subq_5.ds__extract_quarter
- , subq_5.ds__extract_month
- , subq_5.ds__extract_day
- , subq_5.ds__extract_dow
- , subq_5.ds__extract_doy
- , subq_5.ds_partitioned__day
- , subq_5.ds_partitioned__week
- , subq_5.ds_partitioned__month
- , subq_5.ds_partitioned__quarter
- , subq_5.ds_partitioned__year
- , subq_5.ds_partitioned__extract_year
- , subq_5.ds_partitioned__extract_quarter
- , subq_5.ds_partitioned__extract_month
- , subq_5.ds_partitioned__extract_day
- , subq_5.ds_partitioned__extract_dow
- , subq_5.ds_partitioned__extract_doy
- , subq_5.paid_at__day
- , subq_5.paid_at__week
- , subq_5.paid_at__month
- , subq_5.paid_at__quarter
- , subq_5.paid_at__year
- , subq_5.paid_at__extract_year
- , subq_5.paid_at__extract_quarter
- , subq_5.paid_at__extract_month
- , subq_5.paid_at__extract_day
- , subq_5.paid_at__extract_dow
- , subq_5.paid_at__extract_doy
- , subq_5.booking__ds__day
- , subq_5.booking__ds__week
- , subq_5.booking__ds__month
- , subq_5.booking__ds__quarter
- , subq_5.booking__ds__year
- , subq_5.booking__ds__extract_year
- , subq_5.booking__ds__extract_quarter
- , subq_5.booking__ds__extract_month
- , subq_5.booking__ds__extract_day
- , subq_5.booking__ds__extract_dow
- , subq_5.booking__ds__extract_doy
- , subq_5.booking__ds_partitioned__day
- , subq_5.booking__ds_partitioned__week
- , subq_5.booking__ds_partitioned__month
- , subq_5.booking__ds_partitioned__quarter
- , subq_5.booking__ds_partitioned__year
- , subq_5.booking__ds_partitioned__extract_year
- , subq_5.booking__ds_partitioned__extract_quarter
- , subq_5.booking__ds_partitioned__extract_month
- , subq_5.booking__ds_partitioned__extract_day
- , subq_5.booking__ds_partitioned__extract_dow
- , subq_5.booking__ds_partitioned__extract_doy
- , subq_5.booking__paid_at__day
- , subq_5.booking__paid_at__week
- , subq_5.booking__paid_at__month
- , subq_5.booking__paid_at__quarter
- , subq_5.booking__paid_at__year
- , subq_5.booking__paid_at__extract_year
- , subq_5.booking__paid_at__extract_quarter
- , subq_5.booking__paid_at__extract_month
- , subq_5.booking__paid_at__extract_day
- , subq_5.booking__paid_at__extract_dow
- , subq_5.booking__paid_at__extract_doy
- , subq_5.ds__day AS metric_time__day
- , subq_5.ds__week AS metric_time__week
- , subq_5.ds__month AS metric_time__month
- , subq_5.ds__quarter AS metric_time__quarter
- , subq_5.ds__year AS metric_time__year
- , subq_5.ds__extract_year AS metric_time__extract_year
- , subq_5.ds__extract_quarter AS metric_time__extract_quarter
- , subq_5.ds__extract_month AS metric_time__extract_month
- , subq_5.ds__extract_day AS metric_time__extract_day
- , subq_5.ds__extract_dow AS metric_time__extract_dow
- , subq_5.ds__extract_doy AS metric_time__extract_doy
- , subq_5.listing
- , subq_5.guest
- , subq_5.host
- , subq_5.booking__listing
- , subq_5.booking__guest
- , subq_5.booking__host
- , subq_5.is_instant
- , subq_5.booking__is_instant
- , subq_5.bookings
- , subq_5.instant_bookings
- , subq_5.booking_value
- , subq_5.max_booking_value
- , subq_5.min_booking_value
- , subq_5.bookers
- , subq_5.average_booking_value
- , subq_5.referred_bookings
- , subq_5.median_booking_value
- , subq_5.booking_value_p99
- , subq_5.discrete_booking_value_p99
- , subq_5.approximate_continuous_booking_value_p99
- , subq_5.approximate_discrete_booking_value_p99
+ subq_14.ds__day
+ , subq_14.ds__week
+ , subq_14.ds__month
+ , subq_14.ds__quarter
+ , subq_14.ds__year
+ , subq_14.ds__extract_year
+ , subq_14.ds__extract_quarter
+ , subq_14.ds__extract_month
+ , subq_14.ds__extract_day
+ , subq_14.ds__extract_dow
+ , subq_14.ds__extract_doy
+ , subq_14.ds_partitioned__day
+ , subq_14.ds_partitioned__week
+ , subq_14.ds_partitioned__month
+ , subq_14.ds_partitioned__quarter
+ , subq_14.ds_partitioned__year
+ , subq_14.ds_partitioned__extract_year
+ , subq_14.ds_partitioned__extract_quarter
+ , subq_14.ds_partitioned__extract_month
+ , subq_14.ds_partitioned__extract_day
+ , subq_14.ds_partitioned__extract_dow
+ , subq_14.ds_partitioned__extract_doy
+ , subq_14.paid_at__day
+ , subq_14.paid_at__week
+ , subq_14.paid_at__month
+ , subq_14.paid_at__quarter
+ , subq_14.paid_at__year
+ , subq_14.paid_at__extract_year
+ , subq_14.paid_at__extract_quarter
+ , subq_14.paid_at__extract_month
+ , subq_14.paid_at__extract_day
+ , subq_14.paid_at__extract_dow
+ , subq_14.paid_at__extract_doy
+ , subq_14.booking__ds__day
+ , subq_14.booking__ds__week
+ , subq_14.booking__ds__month
+ , subq_14.booking__ds__quarter
+ , subq_14.booking__ds__year
+ , subq_14.booking__ds__extract_year
+ , subq_14.booking__ds__extract_quarter
+ , subq_14.booking__ds__extract_month
+ , subq_14.booking__ds__extract_day
+ , subq_14.booking__ds__extract_dow
+ , subq_14.booking__ds__extract_doy
+ , subq_14.booking__ds_partitioned__day
+ , subq_14.booking__ds_partitioned__week
+ , subq_14.booking__ds_partitioned__month
+ , subq_14.booking__ds_partitioned__quarter
+ , subq_14.booking__ds_partitioned__year
+ , subq_14.booking__ds_partitioned__extract_year
+ , subq_14.booking__ds_partitioned__extract_quarter
+ , subq_14.booking__ds_partitioned__extract_month
+ , subq_14.booking__ds_partitioned__extract_day
+ , subq_14.booking__ds_partitioned__extract_dow
+ , subq_14.booking__ds_partitioned__extract_doy
+ , subq_14.booking__paid_at__day
+ , subq_14.booking__paid_at__week
+ , subq_14.booking__paid_at__month
+ , subq_14.booking__paid_at__quarter
+ , subq_14.booking__paid_at__year
+ , subq_14.booking__paid_at__extract_year
+ , subq_14.booking__paid_at__extract_quarter
+ , subq_14.booking__paid_at__extract_month
+ , subq_14.booking__paid_at__extract_day
+ , subq_14.booking__paid_at__extract_dow
+ , subq_14.booking__paid_at__extract_doy
+ , subq_14.ds__day AS metric_time__day
+ , subq_14.ds__week AS metric_time__week
+ , subq_14.ds__month AS metric_time__month
+ , subq_14.ds__quarter AS metric_time__quarter
+ , subq_14.ds__year AS metric_time__year
+ , subq_14.ds__extract_year AS metric_time__extract_year
+ , subq_14.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_14.ds__extract_month AS metric_time__extract_month
+ , subq_14.ds__extract_day AS metric_time__extract_day
+ , subq_14.ds__extract_dow AS metric_time__extract_dow
+ , subq_14.ds__extract_doy AS metric_time__extract_doy
+ , subq_14.listing
+ , subq_14.guest
+ , subq_14.host
+ , subq_14.booking__listing
+ , subq_14.booking__guest
+ , subq_14.booking__host
+ , subq_14.is_instant
+ , subq_14.booking__is_instant
+ , subq_14.bookings
+ , subq_14.instant_bookings
+ , subq_14.booking_value
+ , subq_14.max_booking_value
+ , subq_14.min_booking_value
+ , subq_14.bookers
+ , subq_14.average_booking_value
+ , subq_14.referred_bookings
+ , subq_14.median_booking_value
+ , subq_14.booking_value_p99
+ , subq_14.discrete_booking_value_p99
+ , subq_14.approximate_continuous_booking_value_p99
+ , subq_14.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_5
- ) subq_6
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_14
+ ) subq_15
ON
- subq_7.metric_time__day - INTERVAL 14 day = subq_6.metric_time__day
- ) subq_9
- ) subq_10
+ subq_16.metric_time__day - INTERVAL 14 day = subq_15.metric_time__day
+ ) subq_18
+ ) subq_19
GROUP BY
- subq_10.metric_time__quarter
- ) subq_11
- ) subq_12
+ subq_19.metric_time__quarter
+ ) subq_20
+ ) subq_21
ON
- subq_4.metric_time__quarter = subq_12.metric_time__quarter
+ subq_13.metric_time__quarter = subq_21.metric_time__quarter
GROUP BY
- COALESCE(subq_4.metric_time__quarter, subq_12.metric_time__quarter)
-) subq_13
+ COALESCE(subq_13.metric_time__quarter, subq_21.metric_time__quarter)
+) subq_22
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window_and_granularity__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window_and_granularity__plan0_optimized.sql
index 02b4702e42..58825b9649 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window_and_granularity__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window_and_granularity__plan0_optimized.sql
@@ -5,9 +5,9 @@ SELECT
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_18.metric_time__quarter, subq_26.metric_time__quarter) AS metric_time__quarter
- , MAX(subq_18.bookings) AS bookings
- , MAX(subq_26.bookings_2_weeks_ago) AS bookings_2_weeks_ago
+ COALESCE(subq_27.metric_time__quarter, subq_35.metric_time__quarter) AS metric_time__quarter
+ , MAX(subq_27.bookings) AS bookings
+ , MAX(subq_35.bookings_2_weeks_ago) AS bookings_2_weeks_ago
FROM (
-- Aggregate Measures
-- Compute Metrics via Expressions
@@ -21,35 +21,35 @@ FROM (
SELECT
DATE_TRUNC('quarter', ds) AS metric_time__quarter
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_16
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_25
GROUP BY
metric_time__quarter
- ) subq_18
+ ) subq_27
FULL OUTER JOIN (
-- Join to Time Spine Dataset
-- Pass Only Elements: ['bookings', 'metric_time__quarter']
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- DATE_TRUNC('quarter', subq_22.ds) AS metric_time__quarter
- , SUM(subq_20.bookings) AS bookings_2_weeks_ago
- FROM ***************************.mf_time_spine subq_22
+ DATE_TRUNC('quarter', subq_31.ds) AS metric_time__quarter
+ , SUM(subq_29.bookings) AS bookings_2_weeks_ago
+ FROM ***************************.mf_time_spine subq_31
INNER JOIN (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
SELECT
DATE_TRUNC('day', ds) AS metric_time__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_20
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_29
ON
- subq_22.ds - INTERVAL 14 day = subq_20.metric_time__day
+ subq_31.ds - INTERVAL 14 day = subq_29.metric_time__day
GROUP BY
- DATE_TRUNC('quarter', subq_22.ds)
- ) subq_26
+ DATE_TRUNC('quarter', subq_31.ds)
+ ) subq_35
ON
- subq_18.metric_time__quarter = subq_26.metric_time__quarter
+ subq_27.metric_time__quarter = subq_35.metric_time__quarter
GROUP BY
- COALESCE(subq_18.metric_time__quarter, subq_26.metric_time__quarter)
-) subq_27
+ COALESCE(subq_27.metric_time__quarter, subq_35.metric_time__quarter)
+) subq_36
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql
index 22d0da11b5..d5fa59df6b 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql
@@ -1,645 +1,645 @@
-- Compute Metrics via Expressions
SELECT
- subq_16.metric_time__day
+ subq_25.metric_time__day
, month_start_bookings - bookings_1_month_ago AS bookings_month_start_compared_to_1_month_prior
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_7.metric_time__day, subq_15.metric_time__day) AS metric_time__day
- , MAX(subq_7.month_start_bookings) AS month_start_bookings
- , MAX(subq_15.bookings_1_month_ago) AS bookings_1_month_ago
+ COALESCE(subq_16.metric_time__day, subq_24.metric_time__day) AS metric_time__day
+ , MAX(subq_16.month_start_bookings) AS month_start_bookings
+ , MAX(subq_24.bookings_1_month_ago) AS bookings_1_month_ago
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_6.metric_time__day
- , subq_6.bookings AS month_start_bookings
+ subq_15.metric_time__day
+ , subq_15.bookings AS month_start_bookings
FROM (
-- Aggregate Measures
SELECT
- subq_5.metric_time__day
- , SUM(subq_5.bookings) AS bookings
+ subq_14.metric_time__day
+ , SUM(subq_14.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__day']
SELECT
- subq_4.metric_time__day
- , subq_4.bookings
+ subq_13.metric_time__day
+ , subq_13.bookings
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_2.metric_time__day AS metric_time__day
- , subq_1.ds__day AS ds__day
- , subq_1.ds__week AS ds__week
- , subq_1.ds__month AS ds__month
- , subq_1.ds__quarter AS ds__quarter
- , subq_1.ds__year AS ds__year
- , subq_1.ds__extract_year AS ds__extract_year
- , subq_1.ds__extract_quarter AS ds__extract_quarter
- , subq_1.ds__extract_month AS ds__extract_month
- , subq_1.ds__extract_day AS ds__extract_day
- , subq_1.ds__extract_dow AS ds__extract_dow
- , subq_1.ds__extract_doy AS ds__extract_doy
- , subq_1.ds_partitioned__day AS ds_partitioned__day
- , subq_1.ds_partitioned__week AS ds_partitioned__week
- , subq_1.ds_partitioned__month AS ds_partitioned__month
- , subq_1.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_1.ds_partitioned__year AS ds_partitioned__year
- , subq_1.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_1.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_1.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_1.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_1.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_1.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_1.paid_at__day AS paid_at__day
- , subq_1.paid_at__week AS paid_at__week
- , subq_1.paid_at__month AS paid_at__month
- , subq_1.paid_at__quarter AS paid_at__quarter
- , subq_1.paid_at__year AS paid_at__year
- , subq_1.paid_at__extract_year AS paid_at__extract_year
- , subq_1.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_1.paid_at__extract_month AS paid_at__extract_month
- , subq_1.paid_at__extract_day AS paid_at__extract_day
- , subq_1.paid_at__extract_dow AS paid_at__extract_dow
- , subq_1.paid_at__extract_doy AS paid_at__extract_doy
- , subq_1.booking__ds__day AS booking__ds__day
- , subq_1.booking__ds__week AS booking__ds__week
- , subq_1.booking__ds__month AS booking__ds__month
- , subq_1.booking__ds__quarter AS booking__ds__quarter
- , subq_1.booking__ds__year AS booking__ds__year
- , subq_1.booking__ds__extract_year AS booking__ds__extract_year
- , subq_1.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_1.booking__ds__extract_month AS booking__ds__extract_month
- , subq_1.booking__ds__extract_day AS booking__ds__extract_day
- , subq_1.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_1.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_1.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_1.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_1.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_1.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_1.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_1.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_1.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_1.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_1.booking__paid_at__day AS booking__paid_at__day
- , subq_1.booking__paid_at__week AS booking__paid_at__week
- , subq_1.booking__paid_at__month AS booking__paid_at__month
- , subq_1.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_1.booking__paid_at__year AS booking__paid_at__year
- , subq_1.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_1.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_1.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_1.listing AS listing
- , subq_1.guest AS guest
- , subq_1.host AS host
- , subq_1.booking__listing AS booking__listing
- , subq_1.booking__guest AS booking__guest
- , subq_1.booking__host AS booking__host
- , subq_1.is_instant AS is_instant
- , subq_1.booking__is_instant AS booking__is_instant
- , subq_1.bookings AS bookings
- , subq_1.instant_bookings AS instant_bookings
- , subq_1.booking_value AS booking_value
- , subq_1.max_booking_value AS max_booking_value
- , subq_1.min_booking_value AS min_booking_value
- , subq_1.bookers AS bookers
- , subq_1.average_booking_value AS average_booking_value
- , subq_1.referred_bookings AS referred_bookings
- , subq_1.median_booking_value AS median_booking_value
- , subq_1.booking_value_p99 AS booking_value_p99
- , subq_1.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_1.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_1.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ subq_11.metric_time__day AS metric_time__day
+ , subq_10.ds__day AS ds__day
+ , subq_10.ds__week AS ds__week
+ , subq_10.ds__month AS ds__month
+ , subq_10.ds__quarter AS ds__quarter
+ , subq_10.ds__year AS ds__year
+ , subq_10.ds__extract_year AS ds__extract_year
+ , subq_10.ds__extract_quarter AS ds__extract_quarter
+ , subq_10.ds__extract_month AS ds__extract_month
+ , subq_10.ds__extract_day AS ds__extract_day
+ , subq_10.ds__extract_dow AS ds__extract_dow
+ , subq_10.ds__extract_doy AS ds__extract_doy
+ , subq_10.ds_partitioned__day AS ds_partitioned__day
+ , subq_10.ds_partitioned__week AS ds_partitioned__week
+ , subq_10.ds_partitioned__month AS ds_partitioned__month
+ , subq_10.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_10.ds_partitioned__year AS ds_partitioned__year
+ , subq_10.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_10.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_10.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_10.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_10.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_10.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_10.paid_at__day AS paid_at__day
+ , subq_10.paid_at__week AS paid_at__week
+ , subq_10.paid_at__month AS paid_at__month
+ , subq_10.paid_at__quarter AS paid_at__quarter
+ , subq_10.paid_at__year AS paid_at__year
+ , subq_10.paid_at__extract_year AS paid_at__extract_year
+ , subq_10.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_10.paid_at__extract_month AS paid_at__extract_month
+ , subq_10.paid_at__extract_day AS paid_at__extract_day
+ , subq_10.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_10.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_10.booking__ds__day AS booking__ds__day
+ , subq_10.booking__ds__week AS booking__ds__week
+ , subq_10.booking__ds__month AS booking__ds__month
+ , subq_10.booking__ds__quarter AS booking__ds__quarter
+ , subq_10.booking__ds__year AS booking__ds__year
+ , subq_10.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_10.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_10.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_10.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_10.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_10.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_10.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_10.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_10.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_10.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_10.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_10.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_10.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_10.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_10.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_10.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_10.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_10.booking__paid_at__day AS booking__paid_at__day
+ , subq_10.booking__paid_at__week AS booking__paid_at__week
+ , subq_10.booking__paid_at__month AS booking__paid_at__month
+ , subq_10.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_10.booking__paid_at__year AS booking__paid_at__year
+ , subq_10.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_10.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_10.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_10.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_10.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_10.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_10.listing AS listing
+ , subq_10.guest AS guest
+ , subq_10.host AS host
+ , subq_10.booking__listing AS booking__listing
+ , subq_10.booking__guest AS booking__guest
+ , subq_10.booking__host AS booking__host
+ , subq_10.is_instant AS is_instant
+ , subq_10.booking__is_instant AS booking__is_instant
+ , subq_10.bookings AS bookings
+ , subq_10.instant_bookings AS instant_bookings
+ , subq_10.booking_value AS booking_value
+ , subq_10.max_booking_value AS max_booking_value
+ , subq_10.min_booking_value AS min_booking_value
+ , subq_10.bookers AS bookers
+ , subq_10.average_booking_value AS average_booking_value
+ , subq_10.referred_bookings AS referred_bookings
+ , subq_10.median_booking_value AS median_booking_value
+ , subq_10.booking_value_p99 AS booking_value_p99
+ , subq_10.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_10.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_10.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_3.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_3
- ) subq_2
+ subq_12.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_12
+ ) subq_11
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
ON
- DATE_TRUNC('month', subq_2.metric_time__day) = subq_1.metric_time__day
- ) subq_4
- ) subq_5
+ DATE_TRUNC('month', subq_11.metric_time__day) = subq_10.metric_time__day
+ ) subq_13
+ ) subq_14
GROUP BY
- subq_5.metric_time__day
- ) subq_6
- ) subq_7
+ subq_14.metric_time__day
+ ) subq_15
+ ) subq_16
FULL OUTER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_14.metric_time__day
- , subq_14.bookings AS bookings_1_month_ago
+ subq_23.metric_time__day
+ , subq_23.bookings AS bookings_1_month_ago
FROM (
-- Aggregate Measures
SELECT
- subq_13.metric_time__day
- , SUM(subq_13.bookings) AS bookings
+ subq_22.metric_time__day
+ , SUM(subq_22.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__day']
SELECT
- subq_12.metric_time__day
- , subq_12.bookings
+ subq_21.metric_time__day
+ , subq_21.bookings
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_10.metric_time__day AS metric_time__day
- , subq_9.ds__day AS ds__day
- , subq_9.ds__week AS ds__week
- , subq_9.ds__month AS ds__month
- , subq_9.ds__quarter AS ds__quarter
- , subq_9.ds__year AS ds__year
- , subq_9.ds__extract_year AS ds__extract_year
- , subq_9.ds__extract_quarter AS ds__extract_quarter
- , subq_9.ds__extract_month AS ds__extract_month
- , subq_9.ds__extract_day AS ds__extract_day
- , subq_9.ds__extract_dow AS ds__extract_dow
- , subq_9.ds__extract_doy AS ds__extract_doy
- , subq_9.ds_partitioned__day AS ds_partitioned__day
- , subq_9.ds_partitioned__week AS ds_partitioned__week
- , subq_9.ds_partitioned__month AS ds_partitioned__month
- , subq_9.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_9.ds_partitioned__year AS ds_partitioned__year
- , subq_9.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_9.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_9.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_9.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_9.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_9.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_9.paid_at__day AS paid_at__day
- , subq_9.paid_at__week AS paid_at__week
- , subq_9.paid_at__month AS paid_at__month
- , subq_9.paid_at__quarter AS paid_at__quarter
- , subq_9.paid_at__year AS paid_at__year
- , subq_9.paid_at__extract_year AS paid_at__extract_year
- , subq_9.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_9.paid_at__extract_month AS paid_at__extract_month
- , subq_9.paid_at__extract_day AS paid_at__extract_day
- , subq_9.paid_at__extract_dow AS paid_at__extract_dow
- , subq_9.paid_at__extract_doy AS paid_at__extract_doy
- , subq_9.booking__ds__day AS booking__ds__day
- , subq_9.booking__ds__week AS booking__ds__week
- , subq_9.booking__ds__month AS booking__ds__month
- , subq_9.booking__ds__quarter AS booking__ds__quarter
- , subq_9.booking__ds__year AS booking__ds__year
- , subq_9.booking__ds__extract_year AS booking__ds__extract_year
- , subq_9.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_9.booking__ds__extract_month AS booking__ds__extract_month
- , subq_9.booking__ds__extract_day AS booking__ds__extract_day
- , subq_9.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_9.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_9.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_9.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_9.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_9.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_9.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_9.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_9.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_9.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_9.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_9.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_9.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_9.booking__paid_at__day AS booking__paid_at__day
- , subq_9.booking__paid_at__week AS booking__paid_at__week
- , subq_9.booking__paid_at__month AS booking__paid_at__month
- , subq_9.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_9.booking__paid_at__year AS booking__paid_at__year
- , subq_9.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_9.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_9.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_9.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_9.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_9.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_9.listing AS listing
- , subq_9.guest AS guest
- , subq_9.host AS host
- , subq_9.booking__listing AS booking__listing
- , subq_9.booking__guest AS booking__guest
- , subq_9.booking__host AS booking__host
- , subq_9.is_instant AS is_instant
- , subq_9.booking__is_instant AS booking__is_instant
- , subq_9.bookings AS bookings
- , subq_9.instant_bookings AS instant_bookings
- , subq_9.booking_value AS booking_value
- , subq_9.max_booking_value AS max_booking_value
- , subq_9.min_booking_value AS min_booking_value
- , subq_9.bookers AS bookers
- , subq_9.average_booking_value AS average_booking_value
- , subq_9.referred_bookings AS referred_bookings
- , subq_9.median_booking_value AS median_booking_value
- , subq_9.booking_value_p99 AS booking_value_p99
- , subq_9.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_9.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_9.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ subq_19.metric_time__day AS metric_time__day
+ , subq_18.ds__day AS ds__day
+ , subq_18.ds__week AS ds__week
+ , subq_18.ds__month AS ds__month
+ , subq_18.ds__quarter AS ds__quarter
+ , subq_18.ds__year AS ds__year
+ , subq_18.ds__extract_year AS ds__extract_year
+ , subq_18.ds__extract_quarter AS ds__extract_quarter
+ , subq_18.ds__extract_month AS ds__extract_month
+ , subq_18.ds__extract_day AS ds__extract_day
+ , subq_18.ds__extract_dow AS ds__extract_dow
+ , subq_18.ds__extract_doy AS ds__extract_doy
+ , subq_18.ds_partitioned__day AS ds_partitioned__day
+ , subq_18.ds_partitioned__week AS ds_partitioned__week
+ , subq_18.ds_partitioned__month AS ds_partitioned__month
+ , subq_18.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_18.ds_partitioned__year AS ds_partitioned__year
+ , subq_18.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_18.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_18.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_18.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_18.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_18.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_18.paid_at__day AS paid_at__day
+ , subq_18.paid_at__week AS paid_at__week
+ , subq_18.paid_at__month AS paid_at__month
+ , subq_18.paid_at__quarter AS paid_at__quarter
+ , subq_18.paid_at__year AS paid_at__year
+ , subq_18.paid_at__extract_year AS paid_at__extract_year
+ , subq_18.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_18.paid_at__extract_month AS paid_at__extract_month
+ , subq_18.paid_at__extract_day AS paid_at__extract_day
+ , subq_18.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_18.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_18.booking__ds__day AS booking__ds__day
+ , subq_18.booking__ds__week AS booking__ds__week
+ , subq_18.booking__ds__month AS booking__ds__month
+ , subq_18.booking__ds__quarter AS booking__ds__quarter
+ , subq_18.booking__ds__year AS booking__ds__year
+ , subq_18.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_18.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_18.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_18.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_18.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_18.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_18.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_18.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_18.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_18.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_18.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_18.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_18.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_18.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_18.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_18.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_18.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_18.booking__paid_at__day AS booking__paid_at__day
+ , subq_18.booking__paid_at__week AS booking__paid_at__week
+ , subq_18.booking__paid_at__month AS booking__paid_at__month
+ , subq_18.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_18.booking__paid_at__year AS booking__paid_at__year
+ , subq_18.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_18.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_18.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_18.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_18.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_18.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_18.listing AS listing
+ , subq_18.guest AS guest
+ , subq_18.host AS host
+ , subq_18.booking__listing AS booking__listing
+ , subq_18.booking__guest AS booking__guest
+ , subq_18.booking__host AS booking__host
+ , subq_18.is_instant AS is_instant
+ , subq_18.booking__is_instant AS booking__is_instant
+ , subq_18.bookings AS bookings
+ , subq_18.instant_bookings AS instant_bookings
+ , subq_18.booking_value AS booking_value
+ , subq_18.max_booking_value AS max_booking_value
+ , subq_18.min_booking_value AS min_booking_value
+ , subq_18.bookers AS bookers
+ , subq_18.average_booking_value AS average_booking_value
+ , subq_18.referred_bookings AS referred_bookings
+ , subq_18.median_booking_value AS median_booking_value
+ , subq_18.booking_value_p99 AS booking_value_p99
+ , subq_18.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_18.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_18.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_11.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_11
- ) subq_10
+ subq_20.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_20
+ ) subq_19
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_8.ds__day
- , subq_8.ds__week
- , subq_8.ds__month
- , subq_8.ds__quarter
- , subq_8.ds__year
- , subq_8.ds__extract_year
- , subq_8.ds__extract_quarter
- , subq_8.ds__extract_month
- , subq_8.ds__extract_day
- , subq_8.ds__extract_dow
- , subq_8.ds__extract_doy
- , subq_8.ds_partitioned__day
- , subq_8.ds_partitioned__week
- , subq_8.ds_partitioned__month
- , subq_8.ds_partitioned__quarter
- , subq_8.ds_partitioned__year
- , subq_8.ds_partitioned__extract_year
- , subq_8.ds_partitioned__extract_quarter
- , subq_8.ds_partitioned__extract_month
- , subq_8.ds_partitioned__extract_day
- , subq_8.ds_partitioned__extract_dow
- , subq_8.ds_partitioned__extract_doy
- , subq_8.paid_at__day
- , subq_8.paid_at__week
- , subq_8.paid_at__month
- , subq_8.paid_at__quarter
- , subq_8.paid_at__year
- , subq_8.paid_at__extract_year
- , subq_8.paid_at__extract_quarter
- , subq_8.paid_at__extract_month
- , subq_8.paid_at__extract_day
- , subq_8.paid_at__extract_dow
- , subq_8.paid_at__extract_doy
- , subq_8.booking__ds__day
- , subq_8.booking__ds__week
- , subq_8.booking__ds__month
- , subq_8.booking__ds__quarter
- , subq_8.booking__ds__year
- , subq_8.booking__ds__extract_year
- , subq_8.booking__ds__extract_quarter
- , subq_8.booking__ds__extract_month
- , subq_8.booking__ds__extract_day
- , subq_8.booking__ds__extract_dow
- , subq_8.booking__ds__extract_doy
- , subq_8.booking__ds_partitioned__day
- , subq_8.booking__ds_partitioned__week
- , subq_8.booking__ds_partitioned__month
- , subq_8.booking__ds_partitioned__quarter
- , subq_8.booking__ds_partitioned__year
- , subq_8.booking__ds_partitioned__extract_year
- , subq_8.booking__ds_partitioned__extract_quarter
- , subq_8.booking__ds_partitioned__extract_month
- , subq_8.booking__ds_partitioned__extract_day
- , subq_8.booking__ds_partitioned__extract_dow
- , subq_8.booking__ds_partitioned__extract_doy
- , subq_8.booking__paid_at__day
- , subq_8.booking__paid_at__week
- , subq_8.booking__paid_at__month
- , subq_8.booking__paid_at__quarter
- , subq_8.booking__paid_at__year
- , subq_8.booking__paid_at__extract_year
- , subq_8.booking__paid_at__extract_quarter
- , subq_8.booking__paid_at__extract_month
- , subq_8.booking__paid_at__extract_day
- , subq_8.booking__paid_at__extract_dow
- , subq_8.booking__paid_at__extract_doy
- , subq_8.ds__day AS metric_time__day
- , subq_8.ds__week AS metric_time__week
- , subq_8.ds__month AS metric_time__month
- , subq_8.ds__quarter AS metric_time__quarter
- , subq_8.ds__year AS metric_time__year
- , subq_8.ds__extract_year AS metric_time__extract_year
- , subq_8.ds__extract_quarter AS metric_time__extract_quarter
- , subq_8.ds__extract_month AS metric_time__extract_month
- , subq_8.ds__extract_day AS metric_time__extract_day
- , subq_8.ds__extract_dow AS metric_time__extract_dow
- , subq_8.ds__extract_doy AS metric_time__extract_doy
- , subq_8.listing
- , subq_8.guest
- , subq_8.host
- , subq_8.booking__listing
- , subq_8.booking__guest
- , subq_8.booking__host
- , subq_8.is_instant
- , subq_8.booking__is_instant
- , subq_8.bookings
- , subq_8.instant_bookings
- , subq_8.booking_value
- , subq_8.max_booking_value
- , subq_8.min_booking_value
- , subq_8.bookers
- , subq_8.average_booking_value
- , subq_8.referred_bookings
- , subq_8.median_booking_value
- , subq_8.booking_value_p99
- , subq_8.discrete_booking_value_p99
- , subq_8.approximate_continuous_booking_value_p99
- , subq_8.approximate_discrete_booking_value_p99
+ subq_17.ds__day
+ , subq_17.ds__week
+ , subq_17.ds__month
+ , subq_17.ds__quarter
+ , subq_17.ds__year
+ , subq_17.ds__extract_year
+ , subq_17.ds__extract_quarter
+ , subq_17.ds__extract_month
+ , subq_17.ds__extract_day
+ , subq_17.ds__extract_dow
+ , subq_17.ds__extract_doy
+ , subq_17.ds_partitioned__day
+ , subq_17.ds_partitioned__week
+ , subq_17.ds_partitioned__month
+ , subq_17.ds_partitioned__quarter
+ , subq_17.ds_partitioned__year
+ , subq_17.ds_partitioned__extract_year
+ , subq_17.ds_partitioned__extract_quarter
+ , subq_17.ds_partitioned__extract_month
+ , subq_17.ds_partitioned__extract_day
+ , subq_17.ds_partitioned__extract_dow
+ , subq_17.ds_partitioned__extract_doy
+ , subq_17.paid_at__day
+ , subq_17.paid_at__week
+ , subq_17.paid_at__month
+ , subq_17.paid_at__quarter
+ , subq_17.paid_at__year
+ , subq_17.paid_at__extract_year
+ , subq_17.paid_at__extract_quarter
+ , subq_17.paid_at__extract_month
+ , subq_17.paid_at__extract_day
+ , subq_17.paid_at__extract_dow
+ , subq_17.paid_at__extract_doy
+ , subq_17.booking__ds__day
+ , subq_17.booking__ds__week
+ , subq_17.booking__ds__month
+ , subq_17.booking__ds__quarter
+ , subq_17.booking__ds__year
+ , subq_17.booking__ds__extract_year
+ , subq_17.booking__ds__extract_quarter
+ , subq_17.booking__ds__extract_month
+ , subq_17.booking__ds__extract_day
+ , subq_17.booking__ds__extract_dow
+ , subq_17.booking__ds__extract_doy
+ , subq_17.booking__ds_partitioned__day
+ , subq_17.booking__ds_partitioned__week
+ , subq_17.booking__ds_partitioned__month
+ , subq_17.booking__ds_partitioned__quarter
+ , subq_17.booking__ds_partitioned__year
+ , subq_17.booking__ds_partitioned__extract_year
+ , subq_17.booking__ds_partitioned__extract_quarter
+ , subq_17.booking__ds_partitioned__extract_month
+ , subq_17.booking__ds_partitioned__extract_day
+ , subq_17.booking__ds_partitioned__extract_dow
+ , subq_17.booking__ds_partitioned__extract_doy
+ , subq_17.booking__paid_at__day
+ , subq_17.booking__paid_at__week
+ , subq_17.booking__paid_at__month
+ , subq_17.booking__paid_at__quarter
+ , subq_17.booking__paid_at__year
+ , subq_17.booking__paid_at__extract_year
+ , subq_17.booking__paid_at__extract_quarter
+ , subq_17.booking__paid_at__extract_month
+ , subq_17.booking__paid_at__extract_day
+ , subq_17.booking__paid_at__extract_dow
+ , subq_17.booking__paid_at__extract_doy
+ , subq_17.ds__day AS metric_time__day
+ , subq_17.ds__week AS metric_time__week
+ , subq_17.ds__month AS metric_time__month
+ , subq_17.ds__quarter AS metric_time__quarter
+ , subq_17.ds__year AS metric_time__year
+ , subq_17.ds__extract_year AS metric_time__extract_year
+ , subq_17.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_17.ds__extract_month AS metric_time__extract_month
+ , subq_17.ds__extract_day AS metric_time__extract_day
+ , subq_17.ds__extract_dow AS metric_time__extract_dow
+ , subq_17.ds__extract_doy AS metric_time__extract_doy
+ , subq_17.listing
+ , subq_17.guest
+ , subq_17.host
+ , subq_17.booking__listing
+ , subq_17.booking__guest
+ , subq_17.booking__host
+ , subq_17.is_instant
+ , subq_17.booking__is_instant
+ , subq_17.bookings
+ , subq_17.instant_bookings
+ , subq_17.booking_value
+ , subq_17.max_booking_value
+ , subq_17.min_booking_value
+ , subq_17.bookers
+ , subq_17.average_booking_value
+ , subq_17.referred_bookings
+ , subq_17.median_booking_value
+ , subq_17.booking_value_p99
+ , subq_17.discrete_booking_value_p99
+ , subq_17.approximate_continuous_booking_value_p99
+ , subq_17.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_8
- ) subq_9
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_17
+ ) subq_18
ON
- subq_10.metric_time__day - INTERVAL 1 month = subq_9.metric_time__day
- ) subq_12
- ) subq_13
+ subq_19.metric_time__day - INTERVAL 1 month = subq_18.metric_time__day
+ ) subq_21
+ ) subq_22
GROUP BY
- subq_13.metric_time__day
- ) subq_14
- ) subq_15
+ subq_22.metric_time__day
+ ) subq_23
+ ) subq_24
ON
- subq_7.metric_time__day = subq_15.metric_time__day
+ subq_16.metric_time__day = subq_24.metric_time__day
GROUP BY
- COALESCE(subq_7.metric_time__day, subq_15.metric_time__day)
-) subq_16
+ COALESCE(subq_16.metric_time__day, subq_24.metric_time__day)
+) subq_25
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window_and_offset_to_grain__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window_and_offset_to_grain__plan0_optimized.sql
index d93f426343..7e4f903640 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window_and_offset_to_grain__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window_and_offset_to_grain__plan0_optimized.sql
@@ -5,55 +5,55 @@ SELECT
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_24.metric_time__day, subq_32.metric_time__day) AS metric_time__day
- , MAX(subq_24.month_start_bookings) AS month_start_bookings
- , MAX(subq_32.bookings_1_month_ago) AS bookings_1_month_ago
+ COALESCE(subq_33.metric_time__day, subq_41.metric_time__day) AS metric_time__day
+ , MAX(subq_33.month_start_bookings) AS month_start_bookings
+ , MAX(subq_41.bookings_1_month_ago) AS bookings_1_month_ago
FROM (
-- Join to Time Spine Dataset
-- Pass Only Elements: ['bookings', 'metric_time__day']
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_20.ds AS metric_time__day
- , SUM(subq_18.bookings) AS month_start_bookings
- FROM ***************************.mf_time_spine subq_20
+ subq_29.ds AS metric_time__day
+ , SUM(subq_27.bookings) AS month_start_bookings
+ FROM ***************************.mf_time_spine subq_29
INNER JOIN (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
SELECT
DATE_TRUNC('day', ds) AS metric_time__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_18
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_27
ON
- DATE_TRUNC('month', subq_20.ds) = subq_18.metric_time__day
+ DATE_TRUNC('month', subq_29.ds) = subq_27.metric_time__day
GROUP BY
- subq_20.ds
- ) subq_24
+ subq_29.ds
+ ) subq_33
FULL OUTER JOIN (
-- Join to Time Spine Dataset
-- Pass Only Elements: ['bookings', 'metric_time__day']
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_28.ds AS metric_time__day
- , SUM(subq_26.bookings) AS bookings_1_month_ago
- FROM ***************************.mf_time_spine subq_28
+ subq_37.ds AS metric_time__day
+ , SUM(subq_35.bookings) AS bookings_1_month_ago
+ FROM ***************************.mf_time_spine subq_37
INNER JOIN (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
SELECT
DATE_TRUNC('day', ds) AS metric_time__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_26
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_35
ON
- subq_28.ds - INTERVAL 1 month = subq_26.metric_time__day
+ subq_37.ds - INTERVAL 1 month = subq_35.metric_time__day
GROUP BY
- subq_28.ds
- ) subq_32
+ subq_37.ds
+ ) subq_41
ON
- subq_24.metric_time__day = subq_32.metric_time__day
+ subq_33.metric_time__day = subq_41.metric_time__day
GROUP BY
- COALESCE(subq_24.metric_time__day, subq_32.metric_time__day)
-) subq_33
+ COALESCE(subq_33.metric_time__day, subq_41.metric_time__day)
+) subq_42
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql
index 5cb9811632..60d78ffb7c 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql
@@ -1,646 +1,646 @@
-- Compute Metrics via Expressions
SELECT
- subq_16.metric_time__year
+ subq_25.metric_time__year
, month_start_bookings - bookings_1_month_ago AS bookings_month_start_compared_to_1_month_prior
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_7.metric_time__year, subq_15.metric_time__year) AS metric_time__year
- , MAX(subq_7.month_start_bookings) AS month_start_bookings
- , MAX(subq_15.bookings_1_month_ago) AS bookings_1_month_ago
+ COALESCE(subq_16.metric_time__year, subq_24.metric_time__year) AS metric_time__year
+ , MAX(subq_16.month_start_bookings) AS month_start_bookings
+ , MAX(subq_24.bookings_1_month_ago) AS bookings_1_month_ago
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_6.metric_time__year
- , subq_6.bookings AS month_start_bookings
+ subq_15.metric_time__year
+ , subq_15.bookings AS month_start_bookings
FROM (
-- Aggregate Measures
SELECT
- subq_5.metric_time__year
- , SUM(subq_5.bookings) AS bookings
+ subq_14.metric_time__year
+ , SUM(subq_14.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__year']
SELECT
- subq_4.metric_time__year
- , subq_4.bookings
+ subq_13.metric_time__year
+ , subq_13.bookings
FROM (
-- Join to Time Spine Dataset
SELECT
- DATE_TRUNC('year', subq_2.metric_time__day) AS metric_time__year
- , subq_1.ds__day AS ds__day
- , subq_1.ds__week AS ds__week
- , subq_1.ds__month AS ds__month
- , subq_1.ds__quarter AS ds__quarter
- , subq_1.ds__year AS ds__year
- , subq_1.ds__extract_year AS ds__extract_year
- , subq_1.ds__extract_quarter AS ds__extract_quarter
- , subq_1.ds__extract_month AS ds__extract_month
- , subq_1.ds__extract_day AS ds__extract_day
- , subq_1.ds__extract_dow AS ds__extract_dow
- , subq_1.ds__extract_doy AS ds__extract_doy
- , subq_1.ds_partitioned__day AS ds_partitioned__day
- , subq_1.ds_partitioned__week AS ds_partitioned__week
- , subq_1.ds_partitioned__month AS ds_partitioned__month
- , subq_1.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_1.ds_partitioned__year AS ds_partitioned__year
- , subq_1.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_1.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_1.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_1.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_1.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_1.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_1.paid_at__day AS paid_at__day
- , subq_1.paid_at__week AS paid_at__week
- , subq_1.paid_at__month AS paid_at__month
- , subq_1.paid_at__quarter AS paid_at__quarter
- , subq_1.paid_at__year AS paid_at__year
- , subq_1.paid_at__extract_year AS paid_at__extract_year
- , subq_1.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_1.paid_at__extract_month AS paid_at__extract_month
- , subq_1.paid_at__extract_day AS paid_at__extract_day
- , subq_1.paid_at__extract_dow AS paid_at__extract_dow
- , subq_1.paid_at__extract_doy AS paid_at__extract_doy
- , subq_1.booking__ds__day AS booking__ds__day
- , subq_1.booking__ds__week AS booking__ds__week
- , subq_1.booking__ds__month AS booking__ds__month
- , subq_1.booking__ds__quarter AS booking__ds__quarter
- , subq_1.booking__ds__year AS booking__ds__year
- , subq_1.booking__ds__extract_year AS booking__ds__extract_year
- , subq_1.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_1.booking__ds__extract_month AS booking__ds__extract_month
- , subq_1.booking__ds__extract_day AS booking__ds__extract_day
- , subq_1.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_1.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_1.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_1.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_1.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_1.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_1.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_1.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_1.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_1.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_1.booking__paid_at__day AS booking__paid_at__day
- , subq_1.booking__paid_at__week AS booking__paid_at__week
- , subq_1.booking__paid_at__month AS booking__paid_at__month
- , subq_1.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_1.booking__paid_at__year AS booking__paid_at__year
- , subq_1.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_1.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_1.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_1.listing AS listing
- , subq_1.guest AS guest
- , subq_1.host AS host
- , subq_1.booking__listing AS booking__listing
- , subq_1.booking__guest AS booking__guest
- , subq_1.booking__host AS booking__host
- , subq_1.is_instant AS is_instant
- , subq_1.booking__is_instant AS booking__is_instant
- , subq_1.bookings AS bookings
- , subq_1.instant_bookings AS instant_bookings
- , subq_1.booking_value AS booking_value
- , subq_1.max_booking_value AS max_booking_value
- , subq_1.min_booking_value AS min_booking_value
- , subq_1.bookers AS bookers
- , subq_1.average_booking_value AS average_booking_value
- , subq_1.referred_bookings AS referred_bookings
- , subq_1.median_booking_value AS median_booking_value
- , subq_1.booking_value_p99 AS booking_value_p99
- , subq_1.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_1.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_1.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ DATE_TRUNC('year', subq_11.metric_time__day) AS metric_time__year
+ , subq_10.ds__day AS ds__day
+ , subq_10.ds__week AS ds__week
+ , subq_10.ds__month AS ds__month
+ , subq_10.ds__quarter AS ds__quarter
+ , subq_10.ds__year AS ds__year
+ , subq_10.ds__extract_year AS ds__extract_year
+ , subq_10.ds__extract_quarter AS ds__extract_quarter
+ , subq_10.ds__extract_month AS ds__extract_month
+ , subq_10.ds__extract_day AS ds__extract_day
+ , subq_10.ds__extract_dow AS ds__extract_dow
+ , subq_10.ds__extract_doy AS ds__extract_doy
+ , subq_10.ds_partitioned__day AS ds_partitioned__day
+ , subq_10.ds_partitioned__week AS ds_partitioned__week
+ , subq_10.ds_partitioned__month AS ds_partitioned__month
+ , subq_10.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_10.ds_partitioned__year AS ds_partitioned__year
+ , subq_10.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_10.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_10.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_10.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_10.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_10.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_10.paid_at__day AS paid_at__day
+ , subq_10.paid_at__week AS paid_at__week
+ , subq_10.paid_at__month AS paid_at__month
+ , subq_10.paid_at__quarter AS paid_at__quarter
+ , subq_10.paid_at__year AS paid_at__year
+ , subq_10.paid_at__extract_year AS paid_at__extract_year
+ , subq_10.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_10.paid_at__extract_month AS paid_at__extract_month
+ , subq_10.paid_at__extract_day AS paid_at__extract_day
+ , subq_10.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_10.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_10.booking__ds__day AS booking__ds__day
+ , subq_10.booking__ds__week AS booking__ds__week
+ , subq_10.booking__ds__month AS booking__ds__month
+ , subq_10.booking__ds__quarter AS booking__ds__quarter
+ , subq_10.booking__ds__year AS booking__ds__year
+ , subq_10.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_10.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_10.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_10.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_10.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_10.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_10.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_10.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_10.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_10.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_10.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_10.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_10.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_10.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_10.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_10.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_10.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_10.booking__paid_at__day AS booking__paid_at__day
+ , subq_10.booking__paid_at__week AS booking__paid_at__week
+ , subq_10.booking__paid_at__month AS booking__paid_at__month
+ , subq_10.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_10.booking__paid_at__year AS booking__paid_at__year
+ , subq_10.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_10.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_10.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_10.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_10.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_10.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_10.listing AS listing
+ , subq_10.guest AS guest
+ , subq_10.host AS host
+ , subq_10.booking__listing AS booking__listing
+ , subq_10.booking__guest AS booking__guest
+ , subq_10.booking__host AS booking__host
+ , subq_10.is_instant AS is_instant
+ , subq_10.booking__is_instant AS booking__is_instant
+ , subq_10.bookings AS bookings
+ , subq_10.instant_bookings AS instant_bookings
+ , subq_10.booking_value AS booking_value
+ , subq_10.max_booking_value AS max_booking_value
+ , subq_10.min_booking_value AS min_booking_value
+ , subq_10.bookers AS bookers
+ , subq_10.average_booking_value AS average_booking_value
+ , subq_10.referred_bookings AS referred_bookings
+ , subq_10.median_booking_value AS median_booking_value
+ , subq_10.booking_value_p99 AS booking_value_p99
+ , subq_10.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_10.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_10.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_3.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_3
- ) subq_2
+ subq_12.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_12
+ ) subq_11
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
ON
- DATE_TRUNC('month', subq_2.metric_time__day) = subq_1.metric_time__day
- WHERE DATE_TRUNC('year', subq_2.metric_time__day) = subq_2.metric_time__day
- ) subq_4
- ) subq_5
+ DATE_TRUNC('month', subq_11.metric_time__day) = subq_10.metric_time__day
+ WHERE DATE_TRUNC('year', subq_11.metric_time__day) = subq_11.metric_time__day
+ ) subq_13
+ ) subq_14
GROUP BY
- subq_5.metric_time__year
- ) subq_6
- ) subq_7
+ subq_14.metric_time__year
+ ) subq_15
+ ) subq_16
FULL OUTER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_14.metric_time__year
- , subq_14.bookings AS bookings_1_month_ago
+ subq_23.metric_time__year
+ , subq_23.bookings AS bookings_1_month_ago
FROM (
-- Aggregate Measures
SELECT
- subq_13.metric_time__year
- , SUM(subq_13.bookings) AS bookings
+ subq_22.metric_time__year
+ , SUM(subq_22.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__year']
SELECT
- subq_12.metric_time__year
- , subq_12.bookings
+ subq_21.metric_time__year
+ , subq_21.bookings
FROM (
-- Join to Time Spine Dataset
SELECT
- DATE_TRUNC('year', subq_10.metric_time__day) AS metric_time__year
- , subq_9.ds__day AS ds__day
- , subq_9.ds__week AS ds__week
- , subq_9.ds__month AS ds__month
- , subq_9.ds__quarter AS ds__quarter
- , subq_9.ds__year AS ds__year
- , subq_9.ds__extract_year AS ds__extract_year
- , subq_9.ds__extract_quarter AS ds__extract_quarter
- , subq_9.ds__extract_month AS ds__extract_month
- , subq_9.ds__extract_day AS ds__extract_day
- , subq_9.ds__extract_dow AS ds__extract_dow
- , subq_9.ds__extract_doy AS ds__extract_doy
- , subq_9.ds_partitioned__day AS ds_partitioned__day
- , subq_9.ds_partitioned__week AS ds_partitioned__week
- , subq_9.ds_partitioned__month AS ds_partitioned__month
- , subq_9.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_9.ds_partitioned__year AS ds_partitioned__year
- , subq_9.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_9.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_9.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_9.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_9.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_9.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_9.paid_at__day AS paid_at__day
- , subq_9.paid_at__week AS paid_at__week
- , subq_9.paid_at__month AS paid_at__month
- , subq_9.paid_at__quarter AS paid_at__quarter
- , subq_9.paid_at__year AS paid_at__year
- , subq_9.paid_at__extract_year AS paid_at__extract_year
- , subq_9.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_9.paid_at__extract_month AS paid_at__extract_month
- , subq_9.paid_at__extract_day AS paid_at__extract_day
- , subq_9.paid_at__extract_dow AS paid_at__extract_dow
- , subq_9.paid_at__extract_doy AS paid_at__extract_doy
- , subq_9.booking__ds__day AS booking__ds__day
- , subq_9.booking__ds__week AS booking__ds__week
- , subq_9.booking__ds__month AS booking__ds__month
- , subq_9.booking__ds__quarter AS booking__ds__quarter
- , subq_9.booking__ds__year AS booking__ds__year
- , subq_9.booking__ds__extract_year AS booking__ds__extract_year
- , subq_9.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_9.booking__ds__extract_month AS booking__ds__extract_month
- , subq_9.booking__ds__extract_day AS booking__ds__extract_day
- , subq_9.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_9.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_9.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_9.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_9.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_9.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_9.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_9.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_9.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_9.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_9.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_9.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_9.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_9.booking__paid_at__day AS booking__paid_at__day
- , subq_9.booking__paid_at__week AS booking__paid_at__week
- , subq_9.booking__paid_at__month AS booking__paid_at__month
- , subq_9.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_9.booking__paid_at__year AS booking__paid_at__year
- , subq_9.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_9.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_9.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_9.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_9.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_9.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_9.listing AS listing
- , subq_9.guest AS guest
- , subq_9.host AS host
- , subq_9.booking__listing AS booking__listing
- , subq_9.booking__guest AS booking__guest
- , subq_9.booking__host AS booking__host
- , subq_9.is_instant AS is_instant
- , subq_9.booking__is_instant AS booking__is_instant
- , subq_9.bookings AS bookings
- , subq_9.instant_bookings AS instant_bookings
- , subq_9.booking_value AS booking_value
- , subq_9.max_booking_value AS max_booking_value
- , subq_9.min_booking_value AS min_booking_value
- , subq_9.bookers AS bookers
- , subq_9.average_booking_value AS average_booking_value
- , subq_9.referred_bookings AS referred_bookings
- , subq_9.median_booking_value AS median_booking_value
- , subq_9.booking_value_p99 AS booking_value_p99
- , subq_9.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_9.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_9.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ DATE_TRUNC('year', subq_19.metric_time__day) AS metric_time__year
+ , subq_18.ds__day AS ds__day
+ , subq_18.ds__week AS ds__week
+ , subq_18.ds__month AS ds__month
+ , subq_18.ds__quarter AS ds__quarter
+ , subq_18.ds__year AS ds__year
+ , subq_18.ds__extract_year AS ds__extract_year
+ , subq_18.ds__extract_quarter AS ds__extract_quarter
+ , subq_18.ds__extract_month AS ds__extract_month
+ , subq_18.ds__extract_day AS ds__extract_day
+ , subq_18.ds__extract_dow AS ds__extract_dow
+ , subq_18.ds__extract_doy AS ds__extract_doy
+ , subq_18.ds_partitioned__day AS ds_partitioned__day
+ , subq_18.ds_partitioned__week AS ds_partitioned__week
+ , subq_18.ds_partitioned__month AS ds_partitioned__month
+ , subq_18.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_18.ds_partitioned__year AS ds_partitioned__year
+ , subq_18.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_18.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_18.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_18.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_18.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_18.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_18.paid_at__day AS paid_at__day
+ , subq_18.paid_at__week AS paid_at__week
+ , subq_18.paid_at__month AS paid_at__month
+ , subq_18.paid_at__quarter AS paid_at__quarter
+ , subq_18.paid_at__year AS paid_at__year
+ , subq_18.paid_at__extract_year AS paid_at__extract_year
+ , subq_18.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_18.paid_at__extract_month AS paid_at__extract_month
+ , subq_18.paid_at__extract_day AS paid_at__extract_day
+ , subq_18.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_18.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_18.booking__ds__day AS booking__ds__day
+ , subq_18.booking__ds__week AS booking__ds__week
+ , subq_18.booking__ds__month AS booking__ds__month
+ , subq_18.booking__ds__quarter AS booking__ds__quarter
+ , subq_18.booking__ds__year AS booking__ds__year
+ , subq_18.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_18.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_18.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_18.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_18.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_18.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_18.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_18.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_18.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_18.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_18.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_18.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_18.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_18.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_18.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_18.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_18.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_18.booking__paid_at__day AS booking__paid_at__day
+ , subq_18.booking__paid_at__week AS booking__paid_at__week
+ , subq_18.booking__paid_at__month AS booking__paid_at__month
+ , subq_18.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_18.booking__paid_at__year AS booking__paid_at__year
+ , subq_18.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_18.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_18.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_18.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_18.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_18.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_18.listing AS listing
+ , subq_18.guest AS guest
+ , subq_18.host AS host
+ , subq_18.booking__listing AS booking__listing
+ , subq_18.booking__guest AS booking__guest
+ , subq_18.booking__host AS booking__host
+ , subq_18.is_instant AS is_instant
+ , subq_18.booking__is_instant AS booking__is_instant
+ , subq_18.bookings AS bookings
+ , subq_18.instant_bookings AS instant_bookings
+ , subq_18.booking_value AS booking_value
+ , subq_18.max_booking_value AS max_booking_value
+ , subq_18.min_booking_value AS min_booking_value
+ , subq_18.bookers AS bookers
+ , subq_18.average_booking_value AS average_booking_value
+ , subq_18.referred_bookings AS referred_bookings
+ , subq_18.median_booking_value AS median_booking_value
+ , subq_18.booking_value_p99 AS booking_value_p99
+ , subq_18.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_18.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_18.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_11.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_11
- ) subq_10
+ subq_20.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_20
+ ) subq_19
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_8.ds__day
- , subq_8.ds__week
- , subq_8.ds__month
- , subq_8.ds__quarter
- , subq_8.ds__year
- , subq_8.ds__extract_year
- , subq_8.ds__extract_quarter
- , subq_8.ds__extract_month
- , subq_8.ds__extract_day
- , subq_8.ds__extract_dow
- , subq_8.ds__extract_doy
- , subq_8.ds_partitioned__day
- , subq_8.ds_partitioned__week
- , subq_8.ds_partitioned__month
- , subq_8.ds_partitioned__quarter
- , subq_8.ds_partitioned__year
- , subq_8.ds_partitioned__extract_year
- , subq_8.ds_partitioned__extract_quarter
- , subq_8.ds_partitioned__extract_month
- , subq_8.ds_partitioned__extract_day
- , subq_8.ds_partitioned__extract_dow
- , subq_8.ds_partitioned__extract_doy
- , subq_8.paid_at__day
- , subq_8.paid_at__week
- , subq_8.paid_at__month
- , subq_8.paid_at__quarter
- , subq_8.paid_at__year
- , subq_8.paid_at__extract_year
- , subq_8.paid_at__extract_quarter
- , subq_8.paid_at__extract_month
- , subq_8.paid_at__extract_day
- , subq_8.paid_at__extract_dow
- , subq_8.paid_at__extract_doy
- , subq_8.booking__ds__day
- , subq_8.booking__ds__week
- , subq_8.booking__ds__month
- , subq_8.booking__ds__quarter
- , subq_8.booking__ds__year
- , subq_8.booking__ds__extract_year
- , subq_8.booking__ds__extract_quarter
- , subq_8.booking__ds__extract_month
- , subq_8.booking__ds__extract_day
- , subq_8.booking__ds__extract_dow
- , subq_8.booking__ds__extract_doy
- , subq_8.booking__ds_partitioned__day
- , subq_8.booking__ds_partitioned__week
- , subq_8.booking__ds_partitioned__month
- , subq_8.booking__ds_partitioned__quarter
- , subq_8.booking__ds_partitioned__year
- , subq_8.booking__ds_partitioned__extract_year
- , subq_8.booking__ds_partitioned__extract_quarter
- , subq_8.booking__ds_partitioned__extract_month
- , subq_8.booking__ds_partitioned__extract_day
- , subq_8.booking__ds_partitioned__extract_dow
- , subq_8.booking__ds_partitioned__extract_doy
- , subq_8.booking__paid_at__day
- , subq_8.booking__paid_at__week
- , subq_8.booking__paid_at__month
- , subq_8.booking__paid_at__quarter
- , subq_8.booking__paid_at__year
- , subq_8.booking__paid_at__extract_year
- , subq_8.booking__paid_at__extract_quarter
- , subq_8.booking__paid_at__extract_month
- , subq_8.booking__paid_at__extract_day
- , subq_8.booking__paid_at__extract_dow
- , subq_8.booking__paid_at__extract_doy
- , subq_8.ds__day AS metric_time__day
- , subq_8.ds__week AS metric_time__week
- , subq_8.ds__month AS metric_time__month
- , subq_8.ds__quarter AS metric_time__quarter
- , subq_8.ds__year AS metric_time__year
- , subq_8.ds__extract_year AS metric_time__extract_year
- , subq_8.ds__extract_quarter AS metric_time__extract_quarter
- , subq_8.ds__extract_month AS metric_time__extract_month
- , subq_8.ds__extract_day AS metric_time__extract_day
- , subq_8.ds__extract_dow AS metric_time__extract_dow
- , subq_8.ds__extract_doy AS metric_time__extract_doy
- , subq_8.listing
- , subq_8.guest
- , subq_8.host
- , subq_8.booking__listing
- , subq_8.booking__guest
- , subq_8.booking__host
- , subq_8.is_instant
- , subq_8.booking__is_instant
- , subq_8.bookings
- , subq_8.instant_bookings
- , subq_8.booking_value
- , subq_8.max_booking_value
- , subq_8.min_booking_value
- , subq_8.bookers
- , subq_8.average_booking_value
- , subq_8.referred_bookings
- , subq_8.median_booking_value
- , subq_8.booking_value_p99
- , subq_8.discrete_booking_value_p99
- , subq_8.approximate_continuous_booking_value_p99
- , subq_8.approximate_discrete_booking_value_p99
+ subq_17.ds__day
+ , subq_17.ds__week
+ , subq_17.ds__month
+ , subq_17.ds__quarter
+ , subq_17.ds__year
+ , subq_17.ds__extract_year
+ , subq_17.ds__extract_quarter
+ , subq_17.ds__extract_month
+ , subq_17.ds__extract_day
+ , subq_17.ds__extract_dow
+ , subq_17.ds__extract_doy
+ , subq_17.ds_partitioned__day
+ , subq_17.ds_partitioned__week
+ , subq_17.ds_partitioned__month
+ , subq_17.ds_partitioned__quarter
+ , subq_17.ds_partitioned__year
+ , subq_17.ds_partitioned__extract_year
+ , subq_17.ds_partitioned__extract_quarter
+ , subq_17.ds_partitioned__extract_month
+ , subq_17.ds_partitioned__extract_day
+ , subq_17.ds_partitioned__extract_dow
+ , subq_17.ds_partitioned__extract_doy
+ , subq_17.paid_at__day
+ , subq_17.paid_at__week
+ , subq_17.paid_at__month
+ , subq_17.paid_at__quarter
+ , subq_17.paid_at__year
+ , subq_17.paid_at__extract_year
+ , subq_17.paid_at__extract_quarter
+ , subq_17.paid_at__extract_month
+ , subq_17.paid_at__extract_day
+ , subq_17.paid_at__extract_dow
+ , subq_17.paid_at__extract_doy
+ , subq_17.booking__ds__day
+ , subq_17.booking__ds__week
+ , subq_17.booking__ds__month
+ , subq_17.booking__ds__quarter
+ , subq_17.booking__ds__year
+ , subq_17.booking__ds__extract_year
+ , subq_17.booking__ds__extract_quarter
+ , subq_17.booking__ds__extract_month
+ , subq_17.booking__ds__extract_day
+ , subq_17.booking__ds__extract_dow
+ , subq_17.booking__ds__extract_doy
+ , subq_17.booking__ds_partitioned__day
+ , subq_17.booking__ds_partitioned__week
+ , subq_17.booking__ds_partitioned__month
+ , subq_17.booking__ds_partitioned__quarter
+ , subq_17.booking__ds_partitioned__year
+ , subq_17.booking__ds_partitioned__extract_year
+ , subq_17.booking__ds_partitioned__extract_quarter
+ , subq_17.booking__ds_partitioned__extract_month
+ , subq_17.booking__ds_partitioned__extract_day
+ , subq_17.booking__ds_partitioned__extract_dow
+ , subq_17.booking__ds_partitioned__extract_doy
+ , subq_17.booking__paid_at__day
+ , subq_17.booking__paid_at__week
+ , subq_17.booking__paid_at__month
+ , subq_17.booking__paid_at__quarter
+ , subq_17.booking__paid_at__year
+ , subq_17.booking__paid_at__extract_year
+ , subq_17.booking__paid_at__extract_quarter
+ , subq_17.booking__paid_at__extract_month
+ , subq_17.booking__paid_at__extract_day
+ , subq_17.booking__paid_at__extract_dow
+ , subq_17.booking__paid_at__extract_doy
+ , subq_17.ds__day AS metric_time__day
+ , subq_17.ds__week AS metric_time__week
+ , subq_17.ds__month AS metric_time__month
+ , subq_17.ds__quarter AS metric_time__quarter
+ , subq_17.ds__year AS metric_time__year
+ , subq_17.ds__extract_year AS metric_time__extract_year
+ , subq_17.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_17.ds__extract_month AS metric_time__extract_month
+ , subq_17.ds__extract_day AS metric_time__extract_day
+ , subq_17.ds__extract_dow AS metric_time__extract_dow
+ , subq_17.ds__extract_doy AS metric_time__extract_doy
+ , subq_17.listing
+ , subq_17.guest
+ , subq_17.host
+ , subq_17.booking__listing
+ , subq_17.booking__guest
+ , subq_17.booking__host
+ , subq_17.is_instant
+ , subq_17.booking__is_instant
+ , subq_17.bookings
+ , subq_17.instant_bookings
+ , subq_17.booking_value
+ , subq_17.max_booking_value
+ , subq_17.min_booking_value
+ , subq_17.bookers
+ , subq_17.average_booking_value
+ , subq_17.referred_bookings
+ , subq_17.median_booking_value
+ , subq_17.booking_value_p99
+ , subq_17.discrete_booking_value_p99
+ , subq_17.approximate_continuous_booking_value_p99
+ , subq_17.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_8
- ) subq_9
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_17
+ ) subq_18
ON
- subq_10.metric_time__day - INTERVAL 1 month = subq_9.metric_time__day
- ) subq_12
- ) subq_13
+ subq_19.metric_time__day - INTERVAL 1 month = subq_18.metric_time__day
+ ) subq_21
+ ) subq_22
GROUP BY
- subq_13.metric_time__year
- ) subq_14
- ) subq_15
+ subq_22.metric_time__year
+ ) subq_23
+ ) subq_24
ON
- subq_7.metric_time__year = subq_15.metric_time__year
+ subq_16.metric_time__year = subq_24.metric_time__year
GROUP BY
- COALESCE(subq_7.metric_time__year, subq_15.metric_time__year)
-) subq_16
+ COALESCE(subq_16.metric_time__year, subq_24.metric_time__year)
+) subq_25
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0_optimized.sql
index b302d98946..cc8d63e4bc 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0_optimized.sql
@@ -5,56 +5,56 @@ SELECT
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_24.metric_time__year, subq_32.metric_time__year) AS metric_time__year
- , MAX(subq_24.month_start_bookings) AS month_start_bookings
- , MAX(subq_32.bookings_1_month_ago) AS bookings_1_month_ago
+ COALESCE(subq_33.metric_time__year, subq_41.metric_time__year) AS metric_time__year
+ , MAX(subq_33.month_start_bookings) AS month_start_bookings
+ , MAX(subq_41.bookings_1_month_ago) AS bookings_1_month_ago
FROM (
-- Join to Time Spine Dataset
-- Pass Only Elements: ['bookings', 'metric_time__year']
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- DATE_TRUNC('year', subq_20.ds) AS metric_time__year
- , SUM(subq_18.bookings) AS month_start_bookings
- FROM ***************************.mf_time_spine subq_20
+ DATE_TRUNC('year', subq_29.ds) AS metric_time__year
+ , SUM(subq_27.bookings) AS month_start_bookings
+ FROM ***************************.mf_time_spine subq_29
INNER JOIN (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
SELECT
DATE_TRUNC('day', ds) AS metric_time__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_18
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_27
ON
- DATE_TRUNC('month', subq_20.ds) = subq_18.metric_time__day
- WHERE DATE_TRUNC('year', subq_20.ds) = subq_20.ds
+ DATE_TRUNC('month', subq_29.ds) = subq_27.metric_time__day
+ WHERE DATE_TRUNC('year', subq_29.ds) = subq_29.ds
GROUP BY
- DATE_TRUNC('year', subq_20.ds)
- ) subq_24
+ DATE_TRUNC('year', subq_29.ds)
+ ) subq_33
FULL OUTER JOIN (
-- Join to Time Spine Dataset
-- Pass Only Elements: ['bookings', 'metric_time__year']
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- DATE_TRUNC('year', subq_28.ds) AS metric_time__year
- , SUM(subq_26.bookings) AS bookings_1_month_ago
- FROM ***************************.mf_time_spine subq_28
+ DATE_TRUNC('year', subq_37.ds) AS metric_time__year
+ , SUM(subq_35.bookings) AS bookings_1_month_ago
+ FROM ***************************.mf_time_spine subq_37
INNER JOIN (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
SELECT
DATE_TRUNC('day', ds) AS metric_time__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_26
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_35
ON
- subq_28.ds - INTERVAL 1 month = subq_26.metric_time__day
+ subq_37.ds - INTERVAL 1 month = subq_35.metric_time__day
GROUP BY
- DATE_TRUNC('year', subq_28.ds)
- ) subq_32
+ DATE_TRUNC('year', subq_37.ds)
+ ) subq_41
ON
- subq_24.metric_time__year = subq_32.metric_time__year
+ subq_33.metric_time__year = subq_41.metric_time__year
GROUP BY
- COALESCE(subq_24.metric_time__year, subq_32.metric_time__year)
-) subq_33
+ COALESCE(subq_33.metric_time__year, subq_41.metric_time__year)
+) subq_42
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window_and_time_filter__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window_and_time_filter__plan0.sql
index 75b7558130..3d4f5e0b6a 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window_and_time_filter__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window_and_time_filter__plan0.sql
@@ -1,559 +1,559 @@
-- Compute Metrics via Expressions
SELECT
- subq_15.metric_time__day
+ subq_24.metric_time__day
, bookings - bookings_2_weeks_ago AS bookings_growth_2_weeks
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_5.metric_time__day, subq_14.metric_time__day) AS metric_time__day
- , MAX(subq_5.bookings) AS bookings
- , MAX(subq_14.bookings_2_weeks_ago) AS bookings_2_weeks_ago
+ COALESCE(subq_14.metric_time__day, subq_23.metric_time__day) AS metric_time__day
+ , MAX(subq_14.bookings) AS bookings
+ , MAX(subq_23.bookings_2_weeks_ago) AS bookings_2_weeks_ago
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_4.metric_time__day
- , subq_4.bookings
+ subq_13.metric_time__day
+ , subq_13.bookings
FROM (
-- Aggregate Measures
SELECT
- subq_3.metric_time__day
- , SUM(subq_3.bookings) AS bookings
+ subq_12.metric_time__day
+ , SUM(subq_12.bookings) AS bookings
FROM (
-- Constrain Output with WHERE
SELECT
- subq_2.metric_time__day
- , subq_2.bookings
+ subq_11.metric_time__day
+ , subq_11.bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__day']
SELECT
- subq_1.metric_time__day
- , subq_1.bookings
+ subq_10.metric_time__day
+ , subq_10.bookings
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
- ) subq_2
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
WHERE metric_time__day = '2020-01-01' or metric_time__day = '2020-01-14'
- ) subq_3
+ ) subq_12
GROUP BY
- subq_3.metric_time__day
- ) subq_4
- ) subq_5
+ subq_12.metric_time__day
+ ) subq_13
+ ) subq_14
FULL OUTER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_13.metric_time__day
- , subq_13.bookings AS bookings_2_weeks_ago
+ subq_22.metric_time__day
+ , subq_22.bookings AS bookings_2_weeks_ago
FROM (
-- Aggregate Measures
SELECT
- subq_12.metric_time__day
- , SUM(subq_12.bookings) AS bookings
+ subq_21.metric_time__day
+ , SUM(subq_21.bookings) AS bookings
FROM (
-- Constrain Output with WHERE
SELECT
- subq_11.metric_time__day
- , subq_11.bookings
+ subq_20.metric_time__day
+ , subq_20.bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__day']
SELECT
- subq_10.metric_time__day
- , subq_10.bookings
+ subq_19.metric_time__day
+ , subq_19.bookings
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_8.metric_time__day AS metric_time__day
- , subq_7.ds__day AS ds__day
- , subq_7.ds__week AS ds__week
- , subq_7.ds__month AS ds__month
- , subq_7.ds__quarter AS ds__quarter
- , subq_7.ds__year AS ds__year
- , subq_7.ds__extract_year AS ds__extract_year
- , subq_7.ds__extract_quarter AS ds__extract_quarter
- , subq_7.ds__extract_month AS ds__extract_month
- , subq_7.ds__extract_day AS ds__extract_day
- , subq_7.ds__extract_dow AS ds__extract_dow
- , subq_7.ds__extract_doy AS ds__extract_doy
- , subq_7.ds_partitioned__day AS ds_partitioned__day
- , subq_7.ds_partitioned__week AS ds_partitioned__week
- , subq_7.ds_partitioned__month AS ds_partitioned__month
- , subq_7.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_7.ds_partitioned__year AS ds_partitioned__year
- , subq_7.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_7.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_7.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_7.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_7.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_7.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_7.paid_at__day AS paid_at__day
- , subq_7.paid_at__week AS paid_at__week
- , subq_7.paid_at__month AS paid_at__month
- , subq_7.paid_at__quarter AS paid_at__quarter
- , subq_7.paid_at__year AS paid_at__year
- , subq_7.paid_at__extract_year AS paid_at__extract_year
- , subq_7.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_7.paid_at__extract_month AS paid_at__extract_month
- , subq_7.paid_at__extract_day AS paid_at__extract_day
- , subq_7.paid_at__extract_dow AS paid_at__extract_dow
- , subq_7.paid_at__extract_doy AS paid_at__extract_doy
- , subq_7.booking__ds__day AS booking__ds__day
- , subq_7.booking__ds__week AS booking__ds__week
- , subq_7.booking__ds__month AS booking__ds__month
- , subq_7.booking__ds__quarter AS booking__ds__quarter
- , subq_7.booking__ds__year AS booking__ds__year
- , subq_7.booking__ds__extract_year AS booking__ds__extract_year
- , subq_7.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_7.booking__ds__extract_month AS booking__ds__extract_month
- , subq_7.booking__ds__extract_day AS booking__ds__extract_day
- , subq_7.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_7.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_7.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_7.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_7.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_7.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_7.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_7.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_7.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_7.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_7.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_7.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_7.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_7.booking__paid_at__day AS booking__paid_at__day
- , subq_7.booking__paid_at__week AS booking__paid_at__week
- , subq_7.booking__paid_at__month AS booking__paid_at__month
- , subq_7.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_7.booking__paid_at__year AS booking__paid_at__year
- , subq_7.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_7.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_7.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_7.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_7.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_7.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_7.listing AS listing
- , subq_7.guest AS guest
- , subq_7.host AS host
- , subq_7.booking__listing AS booking__listing
- , subq_7.booking__guest AS booking__guest
- , subq_7.booking__host AS booking__host
- , subq_7.is_instant AS is_instant
- , subq_7.booking__is_instant AS booking__is_instant
- , subq_7.bookings AS bookings
- , subq_7.instant_bookings AS instant_bookings
- , subq_7.booking_value AS booking_value
- , subq_7.max_booking_value AS max_booking_value
- , subq_7.min_booking_value AS min_booking_value
- , subq_7.bookers AS bookers
- , subq_7.average_booking_value AS average_booking_value
- , subq_7.referred_bookings AS referred_bookings
- , subq_7.median_booking_value AS median_booking_value
- , subq_7.booking_value_p99 AS booking_value_p99
- , subq_7.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_7.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_7.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ subq_17.metric_time__day AS metric_time__day
+ , subq_16.ds__day AS ds__day
+ , subq_16.ds__week AS ds__week
+ , subq_16.ds__month AS ds__month
+ , subq_16.ds__quarter AS ds__quarter
+ , subq_16.ds__year AS ds__year
+ , subq_16.ds__extract_year AS ds__extract_year
+ , subq_16.ds__extract_quarter AS ds__extract_quarter
+ , subq_16.ds__extract_month AS ds__extract_month
+ , subq_16.ds__extract_day AS ds__extract_day
+ , subq_16.ds__extract_dow AS ds__extract_dow
+ , subq_16.ds__extract_doy AS ds__extract_doy
+ , subq_16.ds_partitioned__day AS ds_partitioned__day
+ , subq_16.ds_partitioned__week AS ds_partitioned__week
+ , subq_16.ds_partitioned__month AS ds_partitioned__month
+ , subq_16.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_16.ds_partitioned__year AS ds_partitioned__year
+ , subq_16.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_16.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_16.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_16.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_16.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_16.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_16.paid_at__day AS paid_at__day
+ , subq_16.paid_at__week AS paid_at__week
+ , subq_16.paid_at__month AS paid_at__month
+ , subq_16.paid_at__quarter AS paid_at__quarter
+ , subq_16.paid_at__year AS paid_at__year
+ , subq_16.paid_at__extract_year AS paid_at__extract_year
+ , subq_16.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_16.paid_at__extract_month AS paid_at__extract_month
+ , subq_16.paid_at__extract_day AS paid_at__extract_day
+ , subq_16.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_16.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_16.booking__ds__day AS booking__ds__day
+ , subq_16.booking__ds__week AS booking__ds__week
+ , subq_16.booking__ds__month AS booking__ds__month
+ , subq_16.booking__ds__quarter AS booking__ds__quarter
+ , subq_16.booking__ds__year AS booking__ds__year
+ , subq_16.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_16.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_16.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_16.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_16.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_16.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_16.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_16.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_16.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_16.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_16.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_16.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_16.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_16.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_16.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_16.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_16.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_16.booking__paid_at__day AS booking__paid_at__day
+ , subq_16.booking__paid_at__week AS booking__paid_at__week
+ , subq_16.booking__paid_at__month AS booking__paid_at__month
+ , subq_16.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_16.booking__paid_at__year AS booking__paid_at__year
+ , subq_16.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_16.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_16.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_16.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_16.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_16.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_16.listing AS listing
+ , subq_16.guest AS guest
+ , subq_16.host AS host
+ , subq_16.booking__listing AS booking__listing
+ , subq_16.booking__guest AS booking__guest
+ , subq_16.booking__host AS booking__host
+ , subq_16.is_instant AS is_instant
+ , subq_16.booking__is_instant AS booking__is_instant
+ , subq_16.bookings AS bookings
+ , subq_16.instant_bookings AS instant_bookings
+ , subq_16.booking_value AS booking_value
+ , subq_16.max_booking_value AS max_booking_value
+ , subq_16.min_booking_value AS min_booking_value
+ , subq_16.bookers AS bookers
+ , subq_16.average_booking_value AS average_booking_value
+ , subq_16.referred_bookings AS referred_bookings
+ , subq_16.median_booking_value AS median_booking_value
+ , subq_16.booking_value_p99 AS booking_value_p99
+ , subq_16.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_16.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_16.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_9.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_9
- ) subq_8
+ subq_18.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_18
+ ) subq_17
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_6.ds__day
- , subq_6.ds__week
- , subq_6.ds__month
- , subq_6.ds__quarter
- , subq_6.ds__year
- , subq_6.ds__extract_year
- , subq_6.ds__extract_quarter
- , subq_6.ds__extract_month
- , subq_6.ds__extract_day
- , subq_6.ds__extract_dow
- , subq_6.ds__extract_doy
- , subq_6.ds_partitioned__day
- , subq_6.ds_partitioned__week
- , subq_6.ds_partitioned__month
- , subq_6.ds_partitioned__quarter
- , subq_6.ds_partitioned__year
- , subq_6.ds_partitioned__extract_year
- , subq_6.ds_partitioned__extract_quarter
- , subq_6.ds_partitioned__extract_month
- , subq_6.ds_partitioned__extract_day
- , subq_6.ds_partitioned__extract_dow
- , subq_6.ds_partitioned__extract_doy
- , subq_6.paid_at__day
- , subq_6.paid_at__week
- , subq_6.paid_at__month
- , subq_6.paid_at__quarter
- , subq_6.paid_at__year
- , subq_6.paid_at__extract_year
- , subq_6.paid_at__extract_quarter
- , subq_6.paid_at__extract_month
- , subq_6.paid_at__extract_day
- , subq_6.paid_at__extract_dow
- , subq_6.paid_at__extract_doy
- , subq_6.booking__ds__day
- , subq_6.booking__ds__week
- , subq_6.booking__ds__month
- , subq_6.booking__ds__quarter
- , subq_6.booking__ds__year
- , subq_6.booking__ds__extract_year
- , subq_6.booking__ds__extract_quarter
- , subq_6.booking__ds__extract_month
- , subq_6.booking__ds__extract_day
- , subq_6.booking__ds__extract_dow
- , subq_6.booking__ds__extract_doy
- , subq_6.booking__ds_partitioned__day
- , subq_6.booking__ds_partitioned__week
- , subq_6.booking__ds_partitioned__month
- , subq_6.booking__ds_partitioned__quarter
- , subq_6.booking__ds_partitioned__year
- , subq_6.booking__ds_partitioned__extract_year
- , subq_6.booking__ds_partitioned__extract_quarter
- , subq_6.booking__ds_partitioned__extract_month
- , subq_6.booking__ds_partitioned__extract_day
- , subq_6.booking__ds_partitioned__extract_dow
- , subq_6.booking__ds_partitioned__extract_doy
- , subq_6.booking__paid_at__day
- , subq_6.booking__paid_at__week
- , subq_6.booking__paid_at__month
- , subq_6.booking__paid_at__quarter
- , subq_6.booking__paid_at__year
- , subq_6.booking__paid_at__extract_year
- , subq_6.booking__paid_at__extract_quarter
- , subq_6.booking__paid_at__extract_month
- , subq_6.booking__paid_at__extract_day
- , subq_6.booking__paid_at__extract_dow
- , subq_6.booking__paid_at__extract_doy
- , subq_6.ds__day AS metric_time__day
- , subq_6.ds__week AS metric_time__week
- , subq_6.ds__month AS metric_time__month
- , subq_6.ds__quarter AS metric_time__quarter
- , subq_6.ds__year AS metric_time__year
- , subq_6.ds__extract_year AS metric_time__extract_year
- , subq_6.ds__extract_quarter AS metric_time__extract_quarter
- , subq_6.ds__extract_month AS metric_time__extract_month
- , subq_6.ds__extract_day AS metric_time__extract_day
- , subq_6.ds__extract_dow AS metric_time__extract_dow
- , subq_6.ds__extract_doy AS metric_time__extract_doy
- , subq_6.listing
- , subq_6.guest
- , subq_6.host
- , subq_6.booking__listing
- , subq_6.booking__guest
- , subq_6.booking__host
- , subq_6.is_instant
- , subq_6.booking__is_instant
- , subq_6.bookings
- , subq_6.instant_bookings
- , subq_6.booking_value
- , subq_6.max_booking_value
- , subq_6.min_booking_value
- , subq_6.bookers
- , subq_6.average_booking_value
- , subq_6.referred_bookings
- , subq_6.median_booking_value
- , subq_6.booking_value_p99
- , subq_6.discrete_booking_value_p99
- , subq_6.approximate_continuous_booking_value_p99
- , subq_6.approximate_discrete_booking_value_p99
+ subq_15.ds__day
+ , subq_15.ds__week
+ , subq_15.ds__month
+ , subq_15.ds__quarter
+ , subq_15.ds__year
+ , subq_15.ds__extract_year
+ , subq_15.ds__extract_quarter
+ , subq_15.ds__extract_month
+ , subq_15.ds__extract_day
+ , subq_15.ds__extract_dow
+ , subq_15.ds__extract_doy
+ , subq_15.ds_partitioned__day
+ , subq_15.ds_partitioned__week
+ , subq_15.ds_partitioned__month
+ , subq_15.ds_partitioned__quarter
+ , subq_15.ds_partitioned__year
+ , subq_15.ds_partitioned__extract_year
+ , subq_15.ds_partitioned__extract_quarter
+ , subq_15.ds_partitioned__extract_month
+ , subq_15.ds_partitioned__extract_day
+ , subq_15.ds_partitioned__extract_dow
+ , subq_15.ds_partitioned__extract_doy
+ , subq_15.paid_at__day
+ , subq_15.paid_at__week
+ , subq_15.paid_at__month
+ , subq_15.paid_at__quarter
+ , subq_15.paid_at__year
+ , subq_15.paid_at__extract_year
+ , subq_15.paid_at__extract_quarter
+ , subq_15.paid_at__extract_month
+ , subq_15.paid_at__extract_day
+ , subq_15.paid_at__extract_dow
+ , subq_15.paid_at__extract_doy
+ , subq_15.booking__ds__day
+ , subq_15.booking__ds__week
+ , subq_15.booking__ds__month
+ , subq_15.booking__ds__quarter
+ , subq_15.booking__ds__year
+ , subq_15.booking__ds__extract_year
+ , subq_15.booking__ds__extract_quarter
+ , subq_15.booking__ds__extract_month
+ , subq_15.booking__ds__extract_day
+ , subq_15.booking__ds__extract_dow
+ , subq_15.booking__ds__extract_doy
+ , subq_15.booking__ds_partitioned__day
+ , subq_15.booking__ds_partitioned__week
+ , subq_15.booking__ds_partitioned__month
+ , subq_15.booking__ds_partitioned__quarter
+ , subq_15.booking__ds_partitioned__year
+ , subq_15.booking__ds_partitioned__extract_year
+ , subq_15.booking__ds_partitioned__extract_quarter
+ , subq_15.booking__ds_partitioned__extract_month
+ , subq_15.booking__ds_partitioned__extract_day
+ , subq_15.booking__ds_partitioned__extract_dow
+ , subq_15.booking__ds_partitioned__extract_doy
+ , subq_15.booking__paid_at__day
+ , subq_15.booking__paid_at__week
+ , subq_15.booking__paid_at__month
+ , subq_15.booking__paid_at__quarter
+ , subq_15.booking__paid_at__year
+ , subq_15.booking__paid_at__extract_year
+ , subq_15.booking__paid_at__extract_quarter
+ , subq_15.booking__paid_at__extract_month
+ , subq_15.booking__paid_at__extract_day
+ , subq_15.booking__paid_at__extract_dow
+ , subq_15.booking__paid_at__extract_doy
+ , subq_15.ds__day AS metric_time__day
+ , subq_15.ds__week AS metric_time__week
+ , subq_15.ds__month AS metric_time__month
+ , subq_15.ds__quarter AS metric_time__quarter
+ , subq_15.ds__year AS metric_time__year
+ , subq_15.ds__extract_year AS metric_time__extract_year
+ , subq_15.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_15.ds__extract_month AS metric_time__extract_month
+ , subq_15.ds__extract_day AS metric_time__extract_day
+ , subq_15.ds__extract_dow AS metric_time__extract_dow
+ , subq_15.ds__extract_doy AS metric_time__extract_doy
+ , subq_15.listing
+ , subq_15.guest
+ , subq_15.host
+ , subq_15.booking__listing
+ , subq_15.booking__guest
+ , subq_15.booking__host
+ , subq_15.is_instant
+ , subq_15.booking__is_instant
+ , subq_15.bookings
+ , subq_15.instant_bookings
+ , subq_15.booking_value
+ , subq_15.max_booking_value
+ , subq_15.min_booking_value
+ , subq_15.bookers
+ , subq_15.average_booking_value
+ , subq_15.referred_bookings
+ , subq_15.median_booking_value
+ , subq_15.booking_value_p99
+ , subq_15.discrete_booking_value_p99
+ , subq_15.approximate_continuous_booking_value_p99
+ , subq_15.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_6
- ) subq_7
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_15
+ ) subq_16
ON
- subq_8.metric_time__day - INTERVAL 14 day = subq_7.metric_time__day
- ) subq_10
- ) subq_11
+ subq_17.metric_time__day - INTERVAL 14 day = subq_16.metric_time__day
+ ) subq_19
+ ) subq_20
WHERE metric_time__day = '2020-01-01' or metric_time__day = '2020-01-14'
- ) subq_12
+ ) subq_21
GROUP BY
- subq_12.metric_time__day
- ) subq_13
- ) subq_14
+ subq_21.metric_time__day
+ ) subq_22
+ ) subq_23
ON
- subq_5.metric_time__day = subq_14.metric_time__day
+ subq_14.metric_time__day = subq_23.metric_time__day
GROUP BY
- COALESCE(subq_5.metric_time__day, subq_14.metric_time__day)
-) subq_15
+ COALESCE(subq_14.metric_time__day, subq_23.metric_time__day)
+) subq_24
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window_and_time_filter__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window_and_time_filter__plan0_optimized.sql
index 4cb0fa5704..f05040d692 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window_and_time_filter__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_metric_with_offset_window_and_time_filter__plan0_optimized.sql
@@ -5,9 +5,9 @@ SELECT
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_21.metric_time__day, subq_30.metric_time__day) AS metric_time__day
- , MAX(subq_21.bookings) AS bookings
- , MAX(subq_30.bookings_2_weeks_ago) AS bookings_2_weeks_ago
+ COALESCE(subq_30.metric_time__day, subq_39.metric_time__day) AS metric_time__day
+ , MAX(subq_30.bookings) AS bookings
+ , MAX(subq_39.bookings_2_weeks_ago) AS bookings_2_weeks_ago
FROM (
-- Constrain Output with WHERE
-- Aggregate Measures
@@ -22,12 +22,12 @@ FROM (
SELECT
DATE_TRUNC('day', ds) AS metric_time__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_18
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_27
WHERE metric_time__day = '2020-01-01' or metric_time__day = '2020-01-14'
GROUP BY
metric_time__day
- ) subq_21
+ ) subq_30
FULL OUTER JOIN (
-- Constrain Output with WHERE
-- Aggregate Measures
@@ -39,26 +39,26 @@ FROM (
-- Join to Time Spine Dataset
-- Pass Only Elements: ['bookings', 'metric_time__day']
SELECT
- subq_25.ds AS metric_time__day
- , subq_23.bookings AS bookings
- FROM ***************************.mf_time_spine subq_25
+ subq_34.ds AS metric_time__day
+ , subq_32.bookings AS bookings
+ FROM ***************************.mf_time_spine subq_34
INNER JOIN (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
SELECT
DATE_TRUNC('day', ds) AS metric_time__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_23
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_32
ON
- subq_25.ds - INTERVAL 14 day = subq_23.metric_time__day
- ) subq_27
+ subq_34.ds - INTERVAL 14 day = subq_32.metric_time__day
+ ) subq_36
WHERE metric_time__day = '2020-01-01' or metric_time__day = '2020-01-14'
GROUP BY
metric_time__day
- ) subq_30
+ ) subq_39
ON
- subq_21.metric_time__day = subq_30.metric_time__day
+ subq_30.metric_time__day = subq_39.metric_time__day
GROUP BY
- COALESCE(subq_21.metric_time__day, subq_30.metric_time__day)
-) subq_31
+ COALESCE(subq_30.metric_time__day, subq_39.metric_time__day)
+) subq_40
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_offset_cumulative_metric__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_offset_cumulative_metric__plan0.sql
index 5af1f633e1..08bbc28c5c 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_offset_cumulative_metric__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_offset_cumulative_metric__plan0.sql
@@ -1,433 +1,433 @@
-- Compute Metrics via Expressions
SELECT
- subq_10.metric_time__day
+ subq_19.metric_time__day
, every_2_days_bookers_2_days_ago AS every_2_days_bookers_2_days_ago
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_9.metric_time__day
- , subq_9.bookers AS every_2_days_bookers_2_days_ago
+ subq_18.metric_time__day
+ , subq_18.bookers AS every_2_days_bookers_2_days_ago
FROM (
-- Aggregate Measures
SELECT
- subq_8.metric_time__day
- , COUNT(DISTINCT subq_8.bookers) AS bookers
+ subq_17.metric_time__day
+ , COUNT(DISTINCT subq_17.bookers) AS bookers
FROM (
-- Pass Only Elements: ['bookers', 'metric_time__day']
SELECT
- subq_7.metric_time__day
- , subq_7.bookers
+ subq_16.metric_time__day
+ , subq_16.bookers
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_5.metric_time__day AS metric_time__day
- , subq_4.ds__day AS ds__day
- , subq_4.ds__week AS ds__week
- , subq_4.ds__month AS ds__month
- , subq_4.ds__quarter AS ds__quarter
- , subq_4.ds__year AS ds__year
- , subq_4.ds__extract_year AS ds__extract_year
- , subq_4.ds__extract_quarter AS ds__extract_quarter
- , subq_4.ds__extract_month AS ds__extract_month
- , subq_4.ds__extract_day AS ds__extract_day
- , subq_4.ds__extract_dow AS ds__extract_dow
- , subq_4.ds__extract_doy AS ds__extract_doy
- , subq_4.ds_partitioned__day AS ds_partitioned__day
- , subq_4.ds_partitioned__week AS ds_partitioned__week
- , subq_4.ds_partitioned__month AS ds_partitioned__month
- , subq_4.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_4.ds_partitioned__year AS ds_partitioned__year
- , subq_4.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_4.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_4.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_4.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_4.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_4.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_4.paid_at__day AS paid_at__day
- , subq_4.paid_at__week AS paid_at__week
- , subq_4.paid_at__month AS paid_at__month
- , subq_4.paid_at__quarter AS paid_at__quarter
- , subq_4.paid_at__year AS paid_at__year
- , subq_4.paid_at__extract_year AS paid_at__extract_year
- , subq_4.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_4.paid_at__extract_month AS paid_at__extract_month
- , subq_4.paid_at__extract_day AS paid_at__extract_day
- , subq_4.paid_at__extract_dow AS paid_at__extract_dow
- , subq_4.paid_at__extract_doy AS paid_at__extract_doy
- , subq_4.booking__ds__day AS booking__ds__day
- , subq_4.booking__ds__week AS booking__ds__week
- , subq_4.booking__ds__month AS booking__ds__month
- , subq_4.booking__ds__quarter AS booking__ds__quarter
- , subq_4.booking__ds__year AS booking__ds__year
- , subq_4.booking__ds__extract_year AS booking__ds__extract_year
- , subq_4.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_4.booking__ds__extract_month AS booking__ds__extract_month
- , subq_4.booking__ds__extract_day AS booking__ds__extract_day
- , subq_4.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_4.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_4.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_4.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_4.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_4.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_4.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_4.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_4.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_4.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_4.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_4.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_4.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_4.booking__paid_at__day AS booking__paid_at__day
- , subq_4.booking__paid_at__week AS booking__paid_at__week
- , subq_4.booking__paid_at__month AS booking__paid_at__month
- , subq_4.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_4.booking__paid_at__year AS booking__paid_at__year
- , subq_4.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_4.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_4.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_4.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_4.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_4.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_4.listing AS listing
- , subq_4.guest AS guest
- , subq_4.host AS host
- , subq_4.booking__listing AS booking__listing
- , subq_4.booking__guest AS booking__guest
- , subq_4.booking__host AS booking__host
- , subq_4.is_instant AS is_instant
- , subq_4.booking__is_instant AS booking__is_instant
- , subq_4.bookings AS bookings
- , subq_4.instant_bookings AS instant_bookings
- , subq_4.booking_value AS booking_value
- , subq_4.max_booking_value AS max_booking_value
- , subq_4.min_booking_value AS min_booking_value
- , subq_4.bookers AS bookers
- , subq_4.average_booking_value AS average_booking_value
- , subq_4.referred_bookings AS referred_bookings
- , subq_4.median_booking_value AS median_booking_value
- , subq_4.booking_value_p99 AS booking_value_p99
- , subq_4.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_4.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_4.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ subq_14.metric_time__day AS metric_time__day
+ , subq_13.ds__day AS ds__day
+ , subq_13.ds__week AS ds__week
+ , subq_13.ds__month AS ds__month
+ , subq_13.ds__quarter AS ds__quarter
+ , subq_13.ds__year AS ds__year
+ , subq_13.ds__extract_year AS ds__extract_year
+ , subq_13.ds__extract_quarter AS ds__extract_quarter
+ , subq_13.ds__extract_month AS ds__extract_month
+ , subq_13.ds__extract_day AS ds__extract_day
+ , subq_13.ds__extract_dow AS ds__extract_dow
+ , subq_13.ds__extract_doy AS ds__extract_doy
+ , subq_13.ds_partitioned__day AS ds_partitioned__day
+ , subq_13.ds_partitioned__week AS ds_partitioned__week
+ , subq_13.ds_partitioned__month AS ds_partitioned__month
+ , subq_13.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_13.ds_partitioned__year AS ds_partitioned__year
+ , subq_13.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_13.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_13.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_13.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_13.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_13.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_13.paid_at__day AS paid_at__day
+ , subq_13.paid_at__week AS paid_at__week
+ , subq_13.paid_at__month AS paid_at__month
+ , subq_13.paid_at__quarter AS paid_at__quarter
+ , subq_13.paid_at__year AS paid_at__year
+ , subq_13.paid_at__extract_year AS paid_at__extract_year
+ , subq_13.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_13.paid_at__extract_month AS paid_at__extract_month
+ , subq_13.paid_at__extract_day AS paid_at__extract_day
+ , subq_13.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_13.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_13.booking__ds__day AS booking__ds__day
+ , subq_13.booking__ds__week AS booking__ds__week
+ , subq_13.booking__ds__month AS booking__ds__month
+ , subq_13.booking__ds__quarter AS booking__ds__quarter
+ , subq_13.booking__ds__year AS booking__ds__year
+ , subq_13.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_13.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_13.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_13.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_13.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_13.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_13.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_13.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_13.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_13.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_13.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_13.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_13.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_13.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_13.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_13.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_13.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_13.booking__paid_at__day AS booking__paid_at__day
+ , subq_13.booking__paid_at__week AS booking__paid_at__week
+ , subq_13.booking__paid_at__month AS booking__paid_at__month
+ , subq_13.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_13.booking__paid_at__year AS booking__paid_at__year
+ , subq_13.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_13.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_13.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_13.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_13.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_13.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_13.listing AS listing
+ , subq_13.guest AS guest
+ , subq_13.host AS host
+ , subq_13.booking__listing AS booking__listing
+ , subq_13.booking__guest AS booking__guest
+ , subq_13.booking__host AS booking__host
+ , subq_13.is_instant AS is_instant
+ , subq_13.booking__is_instant AS booking__is_instant
+ , subq_13.bookings AS bookings
+ , subq_13.instant_bookings AS instant_bookings
+ , subq_13.booking_value AS booking_value
+ , subq_13.max_booking_value AS max_booking_value
+ , subq_13.min_booking_value AS min_booking_value
+ , subq_13.bookers AS bookers
+ , subq_13.average_booking_value AS average_booking_value
+ , subq_13.referred_bookings AS referred_bookings
+ , subq_13.median_booking_value AS median_booking_value
+ , subq_13.booking_value_p99 AS booking_value_p99
+ , subq_13.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_13.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_13.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_6.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_6
- ) subq_5
+ subq_15.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_15
+ ) subq_14
INNER JOIN (
-- Join Self Over Time Range
SELECT
- subq_2.metric_time__day AS metric_time__day
- , subq_1.ds__day AS ds__day
- , subq_1.ds__week AS ds__week
- , subq_1.ds__month AS ds__month
- , subq_1.ds__quarter AS ds__quarter
- , subq_1.ds__year AS ds__year
- , subq_1.ds__extract_year AS ds__extract_year
- , subq_1.ds__extract_quarter AS ds__extract_quarter
- , subq_1.ds__extract_month AS ds__extract_month
- , subq_1.ds__extract_day AS ds__extract_day
- , subq_1.ds__extract_dow AS ds__extract_dow
- , subq_1.ds__extract_doy AS ds__extract_doy
- , subq_1.ds_partitioned__day AS ds_partitioned__day
- , subq_1.ds_partitioned__week AS ds_partitioned__week
- , subq_1.ds_partitioned__month AS ds_partitioned__month
- , subq_1.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_1.ds_partitioned__year AS ds_partitioned__year
- , subq_1.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_1.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_1.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_1.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_1.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_1.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_1.paid_at__day AS paid_at__day
- , subq_1.paid_at__week AS paid_at__week
- , subq_1.paid_at__month AS paid_at__month
- , subq_1.paid_at__quarter AS paid_at__quarter
- , subq_1.paid_at__year AS paid_at__year
- , subq_1.paid_at__extract_year AS paid_at__extract_year
- , subq_1.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_1.paid_at__extract_month AS paid_at__extract_month
- , subq_1.paid_at__extract_day AS paid_at__extract_day
- , subq_1.paid_at__extract_dow AS paid_at__extract_dow
- , subq_1.paid_at__extract_doy AS paid_at__extract_doy
- , subq_1.booking__ds__day AS booking__ds__day
- , subq_1.booking__ds__week AS booking__ds__week
- , subq_1.booking__ds__month AS booking__ds__month
- , subq_1.booking__ds__quarter AS booking__ds__quarter
- , subq_1.booking__ds__year AS booking__ds__year
- , subq_1.booking__ds__extract_year AS booking__ds__extract_year
- , subq_1.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_1.booking__ds__extract_month AS booking__ds__extract_month
- , subq_1.booking__ds__extract_day AS booking__ds__extract_day
- , subq_1.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_1.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_1.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_1.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_1.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_1.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_1.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_1.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_1.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_1.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_1.booking__paid_at__day AS booking__paid_at__day
- , subq_1.booking__paid_at__week AS booking__paid_at__week
- , subq_1.booking__paid_at__month AS booking__paid_at__month
- , subq_1.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_1.booking__paid_at__year AS booking__paid_at__year
- , subq_1.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_1.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_1.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_1.metric_time__week AS metric_time__week
- , subq_1.metric_time__month AS metric_time__month
- , subq_1.metric_time__quarter AS metric_time__quarter
- , subq_1.metric_time__year AS metric_time__year
- , subq_1.metric_time__extract_year AS metric_time__extract_year
- , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter
- , subq_1.metric_time__extract_month AS metric_time__extract_month
- , subq_1.metric_time__extract_day AS metric_time__extract_day
- , subq_1.metric_time__extract_dow AS metric_time__extract_dow
- , subq_1.metric_time__extract_doy AS metric_time__extract_doy
- , subq_1.listing AS listing
- , subq_1.guest AS guest
- , subq_1.host AS host
- , subq_1.booking__listing AS booking__listing
- , subq_1.booking__guest AS booking__guest
- , subq_1.booking__host AS booking__host
- , subq_1.is_instant AS is_instant
- , subq_1.booking__is_instant AS booking__is_instant
- , subq_1.bookings AS bookings
- , subq_1.instant_bookings AS instant_bookings
- , subq_1.booking_value AS booking_value
- , subq_1.max_booking_value AS max_booking_value
- , subq_1.min_booking_value AS min_booking_value
- , subq_1.bookers AS bookers
- , subq_1.average_booking_value AS average_booking_value
- , subq_1.referred_bookings AS referred_bookings
- , subq_1.median_booking_value AS median_booking_value
- , subq_1.booking_value_p99 AS booking_value_p99
- , subq_1.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_1.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_1.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ subq_11.metric_time__day AS metric_time__day
+ , subq_10.ds__day AS ds__day
+ , subq_10.ds__week AS ds__week
+ , subq_10.ds__month AS ds__month
+ , subq_10.ds__quarter AS ds__quarter
+ , subq_10.ds__year AS ds__year
+ , subq_10.ds__extract_year AS ds__extract_year
+ , subq_10.ds__extract_quarter AS ds__extract_quarter
+ , subq_10.ds__extract_month AS ds__extract_month
+ , subq_10.ds__extract_day AS ds__extract_day
+ , subq_10.ds__extract_dow AS ds__extract_dow
+ , subq_10.ds__extract_doy AS ds__extract_doy
+ , subq_10.ds_partitioned__day AS ds_partitioned__day
+ , subq_10.ds_partitioned__week AS ds_partitioned__week
+ , subq_10.ds_partitioned__month AS ds_partitioned__month
+ , subq_10.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_10.ds_partitioned__year AS ds_partitioned__year
+ , subq_10.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_10.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_10.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_10.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_10.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_10.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_10.paid_at__day AS paid_at__day
+ , subq_10.paid_at__week AS paid_at__week
+ , subq_10.paid_at__month AS paid_at__month
+ , subq_10.paid_at__quarter AS paid_at__quarter
+ , subq_10.paid_at__year AS paid_at__year
+ , subq_10.paid_at__extract_year AS paid_at__extract_year
+ , subq_10.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_10.paid_at__extract_month AS paid_at__extract_month
+ , subq_10.paid_at__extract_day AS paid_at__extract_day
+ , subq_10.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_10.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_10.booking__ds__day AS booking__ds__day
+ , subq_10.booking__ds__week AS booking__ds__week
+ , subq_10.booking__ds__month AS booking__ds__month
+ , subq_10.booking__ds__quarter AS booking__ds__quarter
+ , subq_10.booking__ds__year AS booking__ds__year
+ , subq_10.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_10.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_10.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_10.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_10.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_10.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_10.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_10.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_10.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_10.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_10.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_10.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_10.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_10.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_10.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_10.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_10.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_10.booking__paid_at__day AS booking__paid_at__day
+ , subq_10.booking__paid_at__week AS booking__paid_at__week
+ , subq_10.booking__paid_at__month AS booking__paid_at__month
+ , subq_10.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_10.booking__paid_at__year AS booking__paid_at__year
+ , subq_10.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_10.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_10.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_10.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_10.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_10.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_10.metric_time__week AS metric_time__week
+ , subq_10.metric_time__month AS metric_time__month
+ , subq_10.metric_time__quarter AS metric_time__quarter
+ , subq_10.metric_time__year AS metric_time__year
+ , subq_10.metric_time__extract_year AS metric_time__extract_year
+ , subq_10.metric_time__extract_quarter AS metric_time__extract_quarter
+ , subq_10.metric_time__extract_month AS metric_time__extract_month
+ , subq_10.metric_time__extract_day AS metric_time__extract_day
+ , subq_10.metric_time__extract_dow AS metric_time__extract_dow
+ , subq_10.metric_time__extract_doy AS metric_time__extract_doy
+ , subq_10.listing AS listing
+ , subq_10.guest AS guest
+ , subq_10.host AS host
+ , subq_10.booking__listing AS booking__listing
+ , subq_10.booking__guest AS booking__guest
+ , subq_10.booking__host AS booking__host
+ , subq_10.is_instant AS is_instant
+ , subq_10.booking__is_instant AS booking__is_instant
+ , subq_10.bookings AS bookings
+ , subq_10.instant_bookings AS instant_bookings
+ , subq_10.booking_value AS booking_value
+ , subq_10.max_booking_value AS max_booking_value
+ , subq_10.min_booking_value AS min_booking_value
+ , subq_10.bookers AS bookers
+ , subq_10.average_booking_value AS average_booking_value
+ , subq_10.referred_bookings AS referred_bookings
+ , subq_10.median_booking_value AS median_booking_value
+ , subq_10.booking_value_p99 AS booking_value_p99
+ , subq_10.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_10.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_10.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_3.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_3
- ) subq_2
+ subq_12.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_12
+ ) subq_11
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
ON
(
- subq_1.metric_time__day <= subq_2.metric_time__day
+ subq_10.metric_time__day <= subq_11.metric_time__day
) AND (
- subq_1.metric_time__day > subq_2.metric_time__day - INTERVAL 2 day
+ subq_10.metric_time__day > subq_11.metric_time__day - INTERVAL 2 day
)
- ) subq_4
+ ) subq_13
ON
- subq_5.metric_time__day - INTERVAL 2 day = subq_4.metric_time__day
- ) subq_7
- ) subq_8
+ subq_14.metric_time__day - INTERVAL 2 day = subq_13.metric_time__day
+ ) subq_16
+ ) subq_17
GROUP BY
- subq_8.metric_time__day
- ) subq_9
-) subq_10
+ subq_17.metric_time__day
+ ) subq_18
+) subq_19
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_offset_cumulative_metric__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_offset_cumulative_metric__plan0_optimized.sql
index e2ce4906a7..9570b597eb 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_offset_cumulative_metric__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_offset_cumulative_metric__plan0_optimized.sql
@@ -8,26 +8,26 @@ FROM (
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_17.ds AS metric_time__day
- , COUNT(DISTINCT subq_15.bookers) AS every_2_days_bookers_2_days_ago
- FROM ***************************.mf_time_spine subq_17
+ subq_26.ds AS metric_time__day
+ , COUNT(DISTINCT subq_24.bookers) AS every_2_days_bookers_2_days_ago
+ FROM ***************************.mf_time_spine subq_26
INNER JOIN (
-- Join Self Over Time Range
SELECT
- subq_14.ds AS metric_time__day
- , bookings_source_src_28001.guest_id AS bookers
- FROM ***************************.mf_time_spine subq_14
+ subq_23.ds AS metric_time__day
+ , bookings_source_src_28000.guest_id AS bookers
+ FROM ***************************.mf_time_spine subq_23
INNER JOIN
- ***************************.fct_bookings bookings_source_src_28001
+ ***************************.fct_bookings bookings_source_src_28000
ON
(
- DATE_TRUNC('day', bookings_source_src_28001.ds) <= subq_14.ds
+ DATE_TRUNC('day', bookings_source_src_28000.ds) <= subq_23.ds
) AND (
- DATE_TRUNC('day', bookings_source_src_28001.ds) > subq_14.ds - INTERVAL 2 day
+ DATE_TRUNC('day', bookings_source_src_28000.ds) > subq_23.ds - INTERVAL 2 day
)
- ) subq_15
+ ) subq_24
ON
- subq_17.ds - INTERVAL 2 day = subq_15.metric_time__day
+ subq_26.ds - INTERVAL 2 day = subq_24.metric_time__day
GROUP BY
- subq_17.ds
-) subq_21
+ subq_26.ds
+) subq_30
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_offset_metric_with_agg_time_dim__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_offset_metric_with_agg_time_dim__plan0.sql
index 7ba9d4567b..ee3f39c019 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_offset_metric_with_agg_time_dim__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_offset_metric_with_agg_time_dim__plan0.sql
@@ -1,545 +1,545 @@
-- Compute Metrics via Expressions
SELECT
- subq_13.booking__ds__day
+ subq_22.booking__ds__day
, booking_value * 0.05 / bookers AS booking_fees_last_week_per_booker_this_week
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_7.booking__ds__day, subq_12.booking__ds__day) AS booking__ds__day
- , MAX(subq_7.booking_value) AS booking_value
- , MAX(subq_12.bookers) AS bookers
+ COALESCE(subq_16.booking__ds__day, subq_21.booking__ds__day) AS booking__ds__day
+ , MAX(subq_16.booking_value) AS booking_value
+ , MAX(subq_21.bookers) AS bookers
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_6.booking__ds__day
- , subq_6.booking_value
+ subq_15.booking__ds__day
+ , subq_15.booking_value
FROM (
-- Aggregate Measures
SELECT
- subq_5.booking__ds__day
- , SUM(subq_5.booking_value) AS booking_value
+ subq_14.booking__ds__day
+ , SUM(subq_14.booking_value) AS booking_value
FROM (
-- Pass Only Elements: ['booking_value', 'booking__ds__day']
SELECT
- subq_4.booking__ds__day
- , subq_4.booking_value
+ subq_13.booking__ds__day
+ , subq_13.booking_value
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_2.booking__ds__day AS booking__ds__day
- , subq_1.ds__day AS ds__day
- , subq_1.ds__week AS ds__week
- , subq_1.ds__month AS ds__month
- , subq_1.ds__quarter AS ds__quarter
- , subq_1.ds__year AS ds__year
- , subq_1.ds__extract_year AS ds__extract_year
- , subq_1.ds__extract_quarter AS ds__extract_quarter
- , subq_1.ds__extract_month AS ds__extract_month
- , subq_1.ds__extract_day AS ds__extract_day
- , subq_1.ds__extract_dow AS ds__extract_dow
- , subq_1.ds__extract_doy AS ds__extract_doy
- , subq_1.ds_partitioned__day AS ds_partitioned__day
- , subq_1.ds_partitioned__week AS ds_partitioned__week
- , subq_1.ds_partitioned__month AS ds_partitioned__month
- , subq_1.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_1.ds_partitioned__year AS ds_partitioned__year
- , subq_1.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_1.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_1.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_1.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_1.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_1.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_1.paid_at__day AS paid_at__day
- , subq_1.paid_at__week AS paid_at__week
- , subq_1.paid_at__month AS paid_at__month
- , subq_1.paid_at__quarter AS paid_at__quarter
- , subq_1.paid_at__year AS paid_at__year
- , subq_1.paid_at__extract_year AS paid_at__extract_year
- , subq_1.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_1.paid_at__extract_month AS paid_at__extract_month
- , subq_1.paid_at__extract_day AS paid_at__extract_day
- , subq_1.paid_at__extract_dow AS paid_at__extract_dow
- , subq_1.paid_at__extract_doy AS paid_at__extract_doy
- , subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_1.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_1.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_1.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_1.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_1.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_1.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_1.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_1.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_1.booking__paid_at__day AS booking__paid_at__day
- , subq_1.booking__paid_at__week AS booking__paid_at__week
- , subq_1.booking__paid_at__month AS booking__paid_at__month
- , subq_1.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_1.booking__paid_at__year AS booking__paid_at__year
- , subq_1.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_1.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_1.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_1.metric_time__day AS metric_time__day
- , subq_1.metric_time__week AS metric_time__week
- , subq_1.metric_time__month AS metric_time__month
- , subq_1.metric_time__quarter AS metric_time__quarter
- , subq_1.metric_time__year AS metric_time__year
- , subq_1.metric_time__extract_year AS metric_time__extract_year
- , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter
- , subq_1.metric_time__extract_month AS metric_time__extract_month
- , subq_1.metric_time__extract_day AS metric_time__extract_day
- , subq_1.metric_time__extract_dow AS metric_time__extract_dow
- , subq_1.metric_time__extract_doy AS metric_time__extract_doy
- , subq_1.listing AS listing
- , subq_1.guest AS guest
- , subq_1.host AS host
- , subq_1.booking__listing AS booking__listing
- , subq_1.booking__guest AS booking__guest
- , subq_1.booking__host AS booking__host
- , subq_1.is_instant AS is_instant
- , subq_1.booking__is_instant AS booking__is_instant
- , subq_1.bookings AS bookings
- , subq_1.instant_bookings AS instant_bookings
- , subq_1.booking_value AS booking_value
- , subq_1.max_booking_value AS max_booking_value
- , subq_1.min_booking_value AS min_booking_value
- , subq_1.bookers AS bookers
- , subq_1.average_booking_value AS average_booking_value
- , subq_1.referred_bookings AS referred_bookings
- , subq_1.median_booking_value AS median_booking_value
- , subq_1.booking_value_p99 AS booking_value_p99
- , subq_1.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_1.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_1.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ subq_11.booking__ds__day AS booking__ds__day
+ , subq_10.ds__day AS ds__day
+ , subq_10.ds__week AS ds__week
+ , subq_10.ds__month AS ds__month
+ , subq_10.ds__quarter AS ds__quarter
+ , subq_10.ds__year AS ds__year
+ , subq_10.ds__extract_year AS ds__extract_year
+ , subq_10.ds__extract_quarter AS ds__extract_quarter
+ , subq_10.ds__extract_month AS ds__extract_month
+ , subq_10.ds__extract_day AS ds__extract_day
+ , subq_10.ds__extract_dow AS ds__extract_dow
+ , subq_10.ds__extract_doy AS ds__extract_doy
+ , subq_10.ds_partitioned__day AS ds_partitioned__day
+ , subq_10.ds_partitioned__week AS ds_partitioned__week
+ , subq_10.ds_partitioned__month AS ds_partitioned__month
+ , subq_10.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_10.ds_partitioned__year AS ds_partitioned__year
+ , subq_10.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_10.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_10.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_10.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_10.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_10.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_10.paid_at__day AS paid_at__day
+ , subq_10.paid_at__week AS paid_at__week
+ , subq_10.paid_at__month AS paid_at__month
+ , subq_10.paid_at__quarter AS paid_at__quarter
+ , subq_10.paid_at__year AS paid_at__year
+ , subq_10.paid_at__extract_year AS paid_at__extract_year
+ , subq_10.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_10.paid_at__extract_month AS paid_at__extract_month
+ , subq_10.paid_at__extract_day AS paid_at__extract_day
+ , subq_10.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_10.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_10.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_10.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_10.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_10.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_10.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_10.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_10.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_10.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_10.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_10.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_10.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_10.booking__paid_at__day AS booking__paid_at__day
+ , subq_10.booking__paid_at__week AS booking__paid_at__week
+ , subq_10.booking__paid_at__month AS booking__paid_at__month
+ , subq_10.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_10.booking__paid_at__year AS booking__paid_at__year
+ , subq_10.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_10.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_10.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_10.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_10.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_10.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_10.metric_time__day AS metric_time__day
+ , subq_10.metric_time__week AS metric_time__week
+ , subq_10.metric_time__month AS metric_time__month
+ , subq_10.metric_time__quarter AS metric_time__quarter
+ , subq_10.metric_time__year AS metric_time__year
+ , subq_10.metric_time__extract_year AS metric_time__extract_year
+ , subq_10.metric_time__extract_quarter AS metric_time__extract_quarter
+ , subq_10.metric_time__extract_month AS metric_time__extract_month
+ , subq_10.metric_time__extract_day AS metric_time__extract_day
+ , subq_10.metric_time__extract_dow AS metric_time__extract_dow
+ , subq_10.metric_time__extract_doy AS metric_time__extract_doy
+ , subq_10.listing AS listing
+ , subq_10.guest AS guest
+ , subq_10.host AS host
+ , subq_10.booking__listing AS booking__listing
+ , subq_10.booking__guest AS booking__guest
+ , subq_10.booking__host AS booking__host
+ , subq_10.is_instant AS is_instant
+ , subq_10.booking__is_instant AS booking__is_instant
+ , subq_10.bookings AS bookings
+ , subq_10.instant_bookings AS instant_bookings
+ , subq_10.booking_value AS booking_value
+ , subq_10.max_booking_value AS max_booking_value
+ , subq_10.min_booking_value AS min_booking_value
+ , subq_10.bookers AS bookers
+ , subq_10.average_booking_value AS average_booking_value
+ , subq_10.referred_bookings AS referred_bookings
+ , subq_10.median_booking_value AS median_booking_value
+ , subq_10.booking_value_p99 AS booking_value_p99
+ , subq_10.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_10.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_10.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_3.ds AS booking__ds__day
- FROM ***************************.mf_time_spine subq_3
- ) subq_2
+ subq_12.ds AS booking__ds__day
+ FROM ***************************.mf_time_spine subq_12
+ ) subq_11
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
ON
- subq_2.booking__ds__day - INTERVAL 1 week = subq_1.booking__ds__day
- ) subq_4
- ) subq_5
+ subq_11.booking__ds__day - INTERVAL 1 week = subq_10.booking__ds__day
+ ) subq_13
+ ) subq_14
GROUP BY
- subq_5.booking__ds__day
- ) subq_6
- ) subq_7
+ subq_14.booking__ds__day
+ ) subq_15
+ ) subq_16
FULL OUTER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_11.booking__ds__day
- , subq_11.bookers
+ subq_20.booking__ds__day
+ , subq_20.bookers
FROM (
-- Aggregate Measures
SELECT
- subq_10.booking__ds__day
- , COUNT(DISTINCT subq_10.bookers) AS bookers
+ subq_19.booking__ds__day
+ , COUNT(DISTINCT subq_19.bookers) AS bookers
FROM (
-- Pass Only Elements: ['bookers', 'booking__ds__day']
SELECT
- subq_9.booking__ds__day
- , subq_9.bookers
+ subq_18.booking__ds__day
+ , subq_18.bookers
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_8.ds__day
- , subq_8.ds__week
- , subq_8.ds__month
- , subq_8.ds__quarter
- , subq_8.ds__year
- , subq_8.ds__extract_year
- , subq_8.ds__extract_quarter
- , subq_8.ds__extract_month
- , subq_8.ds__extract_day
- , subq_8.ds__extract_dow
- , subq_8.ds__extract_doy
- , subq_8.ds_partitioned__day
- , subq_8.ds_partitioned__week
- , subq_8.ds_partitioned__month
- , subq_8.ds_partitioned__quarter
- , subq_8.ds_partitioned__year
- , subq_8.ds_partitioned__extract_year
- , subq_8.ds_partitioned__extract_quarter
- , subq_8.ds_partitioned__extract_month
- , subq_8.ds_partitioned__extract_day
- , subq_8.ds_partitioned__extract_dow
- , subq_8.ds_partitioned__extract_doy
- , subq_8.paid_at__day
- , subq_8.paid_at__week
- , subq_8.paid_at__month
- , subq_8.paid_at__quarter
- , subq_8.paid_at__year
- , subq_8.paid_at__extract_year
- , subq_8.paid_at__extract_quarter
- , subq_8.paid_at__extract_month
- , subq_8.paid_at__extract_day
- , subq_8.paid_at__extract_dow
- , subq_8.paid_at__extract_doy
- , subq_8.booking__ds__day
- , subq_8.booking__ds__week
- , subq_8.booking__ds__month
- , subq_8.booking__ds__quarter
- , subq_8.booking__ds__year
- , subq_8.booking__ds__extract_year
- , subq_8.booking__ds__extract_quarter
- , subq_8.booking__ds__extract_month
- , subq_8.booking__ds__extract_day
- , subq_8.booking__ds__extract_dow
- , subq_8.booking__ds__extract_doy
- , subq_8.booking__ds_partitioned__day
- , subq_8.booking__ds_partitioned__week
- , subq_8.booking__ds_partitioned__month
- , subq_8.booking__ds_partitioned__quarter
- , subq_8.booking__ds_partitioned__year
- , subq_8.booking__ds_partitioned__extract_year
- , subq_8.booking__ds_partitioned__extract_quarter
- , subq_8.booking__ds_partitioned__extract_month
- , subq_8.booking__ds_partitioned__extract_day
- , subq_8.booking__ds_partitioned__extract_dow
- , subq_8.booking__ds_partitioned__extract_doy
- , subq_8.booking__paid_at__day
- , subq_8.booking__paid_at__week
- , subq_8.booking__paid_at__month
- , subq_8.booking__paid_at__quarter
- , subq_8.booking__paid_at__year
- , subq_8.booking__paid_at__extract_year
- , subq_8.booking__paid_at__extract_quarter
- , subq_8.booking__paid_at__extract_month
- , subq_8.booking__paid_at__extract_day
- , subq_8.booking__paid_at__extract_dow
- , subq_8.booking__paid_at__extract_doy
- , subq_8.ds__day AS metric_time__day
- , subq_8.ds__week AS metric_time__week
- , subq_8.ds__month AS metric_time__month
- , subq_8.ds__quarter AS metric_time__quarter
- , subq_8.ds__year AS metric_time__year
- , subq_8.ds__extract_year AS metric_time__extract_year
- , subq_8.ds__extract_quarter AS metric_time__extract_quarter
- , subq_8.ds__extract_month AS metric_time__extract_month
- , subq_8.ds__extract_day AS metric_time__extract_day
- , subq_8.ds__extract_dow AS metric_time__extract_dow
- , subq_8.ds__extract_doy AS metric_time__extract_doy
- , subq_8.listing
- , subq_8.guest
- , subq_8.host
- , subq_8.booking__listing
- , subq_8.booking__guest
- , subq_8.booking__host
- , subq_8.is_instant
- , subq_8.booking__is_instant
- , subq_8.bookings
- , subq_8.instant_bookings
- , subq_8.booking_value
- , subq_8.max_booking_value
- , subq_8.min_booking_value
- , subq_8.bookers
- , subq_8.average_booking_value
- , subq_8.referred_bookings
- , subq_8.median_booking_value
- , subq_8.booking_value_p99
- , subq_8.discrete_booking_value_p99
- , subq_8.approximate_continuous_booking_value_p99
- , subq_8.approximate_discrete_booking_value_p99
+ subq_17.ds__day
+ , subq_17.ds__week
+ , subq_17.ds__month
+ , subq_17.ds__quarter
+ , subq_17.ds__year
+ , subq_17.ds__extract_year
+ , subq_17.ds__extract_quarter
+ , subq_17.ds__extract_month
+ , subq_17.ds__extract_day
+ , subq_17.ds__extract_dow
+ , subq_17.ds__extract_doy
+ , subq_17.ds_partitioned__day
+ , subq_17.ds_partitioned__week
+ , subq_17.ds_partitioned__month
+ , subq_17.ds_partitioned__quarter
+ , subq_17.ds_partitioned__year
+ , subq_17.ds_partitioned__extract_year
+ , subq_17.ds_partitioned__extract_quarter
+ , subq_17.ds_partitioned__extract_month
+ , subq_17.ds_partitioned__extract_day
+ , subq_17.ds_partitioned__extract_dow
+ , subq_17.ds_partitioned__extract_doy
+ , subq_17.paid_at__day
+ , subq_17.paid_at__week
+ , subq_17.paid_at__month
+ , subq_17.paid_at__quarter
+ , subq_17.paid_at__year
+ , subq_17.paid_at__extract_year
+ , subq_17.paid_at__extract_quarter
+ , subq_17.paid_at__extract_month
+ , subq_17.paid_at__extract_day
+ , subq_17.paid_at__extract_dow
+ , subq_17.paid_at__extract_doy
+ , subq_17.booking__ds__day
+ , subq_17.booking__ds__week
+ , subq_17.booking__ds__month
+ , subq_17.booking__ds__quarter
+ , subq_17.booking__ds__year
+ , subq_17.booking__ds__extract_year
+ , subq_17.booking__ds__extract_quarter
+ , subq_17.booking__ds__extract_month
+ , subq_17.booking__ds__extract_day
+ , subq_17.booking__ds__extract_dow
+ , subq_17.booking__ds__extract_doy
+ , subq_17.booking__ds_partitioned__day
+ , subq_17.booking__ds_partitioned__week
+ , subq_17.booking__ds_partitioned__month
+ , subq_17.booking__ds_partitioned__quarter
+ , subq_17.booking__ds_partitioned__year
+ , subq_17.booking__ds_partitioned__extract_year
+ , subq_17.booking__ds_partitioned__extract_quarter
+ , subq_17.booking__ds_partitioned__extract_month
+ , subq_17.booking__ds_partitioned__extract_day
+ , subq_17.booking__ds_partitioned__extract_dow
+ , subq_17.booking__ds_partitioned__extract_doy
+ , subq_17.booking__paid_at__day
+ , subq_17.booking__paid_at__week
+ , subq_17.booking__paid_at__month
+ , subq_17.booking__paid_at__quarter
+ , subq_17.booking__paid_at__year
+ , subq_17.booking__paid_at__extract_year
+ , subq_17.booking__paid_at__extract_quarter
+ , subq_17.booking__paid_at__extract_month
+ , subq_17.booking__paid_at__extract_day
+ , subq_17.booking__paid_at__extract_dow
+ , subq_17.booking__paid_at__extract_doy
+ , subq_17.ds__day AS metric_time__day
+ , subq_17.ds__week AS metric_time__week
+ , subq_17.ds__month AS metric_time__month
+ , subq_17.ds__quarter AS metric_time__quarter
+ , subq_17.ds__year AS metric_time__year
+ , subq_17.ds__extract_year AS metric_time__extract_year
+ , subq_17.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_17.ds__extract_month AS metric_time__extract_month
+ , subq_17.ds__extract_day AS metric_time__extract_day
+ , subq_17.ds__extract_dow AS metric_time__extract_dow
+ , subq_17.ds__extract_doy AS metric_time__extract_doy
+ , subq_17.listing
+ , subq_17.guest
+ , subq_17.host
+ , subq_17.booking__listing
+ , subq_17.booking__guest
+ , subq_17.booking__host
+ , subq_17.is_instant
+ , subq_17.booking__is_instant
+ , subq_17.bookings
+ , subq_17.instant_bookings
+ , subq_17.booking_value
+ , subq_17.max_booking_value
+ , subq_17.min_booking_value
+ , subq_17.bookers
+ , subq_17.average_booking_value
+ , subq_17.referred_bookings
+ , subq_17.median_booking_value
+ , subq_17.booking_value_p99
+ , subq_17.discrete_booking_value_p99
+ , subq_17.approximate_continuous_booking_value_p99
+ , subq_17.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_8
- ) subq_9
- ) subq_10
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_17
+ ) subq_18
+ ) subq_19
GROUP BY
- subq_10.booking__ds__day
- ) subq_11
- ) subq_12
+ subq_19.booking__ds__day
+ ) subq_20
+ ) subq_21
ON
- subq_7.booking__ds__day = subq_12.booking__ds__day
+ subq_16.booking__ds__day = subq_21.booking__ds__day
GROUP BY
- COALESCE(subq_7.booking__ds__day, subq_12.booking__ds__day)
-) subq_13
+ COALESCE(subq_16.booking__ds__day, subq_21.booking__ds__day)
+) subq_22
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_offset_metric_with_agg_time_dim__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_offset_metric_with_agg_time_dim__plan0_optimized.sql
index 61c03608e8..7c864f3209 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_offset_metric_with_agg_time_dim__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_offset_metric_with_agg_time_dim__plan0_optimized.sql
@@ -5,25 +5,25 @@ SELECT
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_21.booking__ds__day, subq_26.booking__ds__day) AS booking__ds__day
- , MAX(subq_21.booking_value) AS booking_value
- , MAX(subq_26.bookers) AS bookers
+ COALESCE(subq_30.booking__ds__day, subq_35.booking__ds__day) AS booking__ds__day
+ , MAX(subq_30.booking_value) AS booking_value
+ , MAX(subq_35.bookers) AS bookers
FROM (
-- Join to Time Spine Dataset
-- Pass Only Elements: ['booking_value', 'booking__ds__day']
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_17.ds AS booking__ds__day
- , SUM(bookings_source_src_28001.booking_value) AS booking_value
- FROM ***************************.mf_time_spine subq_17
+ subq_26.ds AS booking__ds__day
+ , SUM(bookings_source_src_28000.booking_value) AS booking_value
+ FROM ***************************.mf_time_spine subq_26
INNER JOIN
- ***************************.fct_bookings bookings_source_src_28001
+ ***************************.fct_bookings bookings_source_src_28000
ON
- subq_17.ds - INTERVAL 1 week = DATE_TRUNC('day', bookings_source_src_28001.ds)
+ subq_26.ds - INTERVAL 1 week = DATE_TRUNC('day', bookings_source_src_28000.ds)
GROUP BY
- subq_17.ds
- ) subq_21
+ subq_26.ds
+ ) subq_30
FULL OUTER JOIN (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
@@ -33,12 +33,12 @@ FROM (
SELECT
DATE_TRUNC('day', ds) AS booking__ds__day
, COUNT(DISTINCT guest_id) AS bookers
- FROM ***************************.fct_bookings bookings_source_src_28001
+ FROM ***************************.fct_bookings bookings_source_src_28000
GROUP BY
DATE_TRUNC('day', ds)
- ) subq_26
+ ) subq_35
ON
- subq_21.booking__ds__day = subq_26.booking__ds__day
+ subq_30.booking__ds__day = subq_35.booking__ds__day
GROUP BY
- COALESCE(subq_21.booking__ds__day, subq_26.booking__ds__day)
-) subq_27
+ COALESCE(subq_30.booking__ds__day, subq_35.booking__ds__day)
+) subq_36
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_offset_metric_with_one_input_metric__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_offset_metric_with_one_input_metric__plan0.sql
index fbba0c8a66..3db62ba55d 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_offset_metric_with_one_input_metric__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_offset_metric_with_one_input_metric__plan0.sql
@@ -1,319 +1,319 @@
-- Compute Metrics via Expressions
SELECT
- subq_7.metric_time__day
+ subq_16.metric_time__day
, bookings_5_days_ago AS bookings_5_day_lag
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_6.metric_time__day
- , subq_6.bookings AS bookings_5_days_ago
+ subq_15.metric_time__day
+ , subq_15.bookings AS bookings_5_days_ago
FROM (
-- Aggregate Measures
SELECT
- subq_5.metric_time__day
- , SUM(subq_5.bookings) AS bookings
+ subq_14.metric_time__day
+ , SUM(subq_14.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__day']
SELECT
- subq_4.metric_time__day
- , subq_4.bookings
+ subq_13.metric_time__day
+ , subq_13.bookings
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_2.metric_time__day AS metric_time__day
- , subq_1.ds__day AS ds__day
- , subq_1.ds__week AS ds__week
- , subq_1.ds__month AS ds__month
- , subq_1.ds__quarter AS ds__quarter
- , subq_1.ds__year AS ds__year
- , subq_1.ds__extract_year AS ds__extract_year
- , subq_1.ds__extract_quarter AS ds__extract_quarter
- , subq_1.ds__extract_month AS ds__extract_month
- , subq_1.ds__extract_day AS ds__extract_day
- , subq_1.ds__extract_dow AS ds__extract_dow
- , subq_1.ds__extract_doy AS ds__extract_doy
- , subq_1.ds_partitioned__day AS ds_partitioned__day
- , subq_1.ds_partitioned__week AS ds_partitioned__week
- , subq_1.ds_partitioned__month AS ds_partitioned__month
- , subq_1.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_1.ds_partitioned__year AS ds_partitioned__year
- , subq_1.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_1.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_1.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_1.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_1.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_1.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_1.paid_at__day AS paid_at__day
- , subq_1.paid_at__week AS paid_at__week
- , subq_1.paid_at__month AS paid_at__month
- , subq_1.paid_at__quarter AS paid_at__quarter
- , subq_1.paid_at__year AS paid_at__year
- , subq_1.paid_at__extract_year AS paid_at__extract_year
- , subq_1.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_1.paid_at__extract_month AS paid_at__extract_month
- , subq_1.paid_at__extract_day AS paid_at__extract_day
- , subq_1.paid_at__extract_dow AS paid_at__extract_dow
- , subq_1.paid_at__extract_doy AS paid_at__extract_doy
- , subq_1.booking__ds__day AS booking__ds__day
- , subq_1.booking__ds__week AS booking__ds__week
- , subq_1.booking__ds__month AS booking__ds__month
- , subq_1.booking__ds__quarter AS booking__ds__quarter
- , subq_1.booking__ds__year AS booking__ds__year
- , subq_1.booking__ds__extract_year AS booking__ds__extract_year
- , subq_1.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_1.booking__ds__extract_month AS booking__ds__extract_month
- , subq_1.booking__ds__extract_day AS booking__ds__extract_day
- , subq_1.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_1.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_1.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_1.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_1.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_1.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_1.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_1.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_1.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_1.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_1.booking__paid_at__day AS booking__paid_at__day
- , subq_1.booking__paid_at__week AS booking__paid_at__week
- , subq_1.booking__paid_at__month AS booking__paid_at__month
- , subq_1.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_1.booking__paid_at__year AS booking__paid_at__year
- , subq_1.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_1.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_1.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_1.listing AS listing
- , subq_1.guest AS guest
- , subq_1.host AS host
- , subq_1.booking__listing AS booking__listing
- , subq_1.booking__guest AS booking__guest
- , subq_1.booking__host AS booking__host
- , subq_1.is_instant AS is_instant
- , subq_1.booking__is_instant AS booking__is_instant
- , subq_1.bookings AS bookings
- , subq_1.instant_bookings AS instant_bookings
- , subq_1.booking_value AS booking_value
- , subq_1.max_booking_value AS max_booking_value
- , subq_1.min_booking_value AS min_booking_value
- , subq_1.bookers AS bookers
- , subq_1.average_booking_value AS average_booking_value
- , subq_1.referred_bookings AS referred_bookings
- , subq_1.median_booking_value AS median_booking_value
- , subq_1.booking_value_p99 AS booking_value_p99
- , subq_1.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_1.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_1.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ subq_11.metric_time__day AS metric_time__day
+ , subq_10.ds__day AS ds__day
+ , subq_10.ds__week AS ds__week
+ , subq_10.ds__month AS ds__month
+ , subq_10.ds__quarter AS ds__quarter
+ , subq_10.ds__year AS ds__year
+ , subq_10.ds__extract_year AS ds__extract_year
+ , subq_10.ds__extract_quarter AS ds__extract_quarter
+ , subq_10.ds__extract_month AS ds__extract_month
+ , subq_10.ds__extract_day AS ds__extract_day
+ , subq_10.ds__extract_dow AS ds__extract_dow
+ , subq_10.ds__extract_doy AS ds__extract_doy
+ , subq_10.ds_partitioned__day AS ds_partitioned__day
+ , subq_10.ds_partitioned__week AS ds_partitioned__week
+ , subq_10.ds_partitioned__month AS ds_partitioned__month
+ , subq_10.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_10.ds_partitioned__year AS ds_partitioned__year
+ , subq_10.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_10.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_10.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_10.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_10.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_10.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_10.paid_at__day AS paid_at__day
+ , subq_10.paid_at__week AS paid_at__week
+ , subq_10.paid_at__month AS paid_at__month
+ , subq_10.paid_at__quarter AS paid_at__quarter
+ , subq_10.paid_at__year AS paid_at__year
+ , subq_10.paid_at__extract_year AS paid_at__extract_year
+ , subq_10.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_10.paid_at__extract_month AS paid_at__extract_month
+ , subq_10.paid_at__extract_day AS paid_at__extract_day
+ , subq_10.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_10.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_10.booking__ds__day AS booking__ds__day
+ , subq_10.booking__ds__week AS booking__ds__week
+ , subq_10.booking__ds__month AS booking__ds__month
+ , subq_10.booking__ds__quarter AS booking__ds__quarter
+ , subq_10.booking__ds__year AS booking__ds__year
+ , subq_10.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_10.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_10.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_10.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_10.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_10.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_10.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_10.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_10.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_10.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_10.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_10.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_10.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_10.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_10.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_10.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_10.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_10.booking__paid_at__day AS booking__paid_at__day
+ , subq_10.booking__paid_at__week AS booking__paid_at__week
+ , subq_10.booking__paid_at__month AS booking__paid_at__month
+ , subq_10.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_10.booking__paid_at__year AS booking__paid_at__year
+ , subq_10.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_10.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_10.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_10.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_10.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_10.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_10.listing AS listing
+ , subq_10.guest AS guest
+ , subq_10.host AS host
+ , subq_10.booking__listing AS booking__listing
+ , subq_10.booking__guest AS booking__guest
+ , subq_10.booking__host AS booking__host
+ , subq_10.is_instant AS is_instant
+ , subq_10.booking__is_instant AS booking__is_instant
+ , subq_10.bookings AS bookings
+ , subq_10.instant_bookings AS instant_bookings
+ , subq_10.booking_value AS booking_value
+ , subq_10.max_booking_value AS max_booking_value
+ , subq_10.min_booking_value AS min_booking_value
+ , subq_10.bookers AS bookers
+ , subq_10.average_booking_value AS average_booking_value
+ , subq_10.referred_bookings AS referred_bookings
+ , subq_10.median_booking_value AS median_booking_value
+ , subq_10.booking_value_p99 AS booking_value_p99
+ , subq_10.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_10.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_10.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_3.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_3
- ) subq_2
+ subq_12.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_12
+ ) subq_11
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
ON
- subq_2.metric_time__day - INTERVAL 5 day = subq_1.metric_time__day
- ) subq_4
- ) subq_5
+ subq_11.metric_time__day - INTERVAL 5 day = subq_10.metric_time__day
+ ) subq_13
+ ) subq_14
GROUP BY
- subq_5.metric_time__day
- ) subq_6
-) subq_7
+ subq_14.metric_time__day
+ ) subq_15
+) subq_16
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_offset_metric_with_one_input_metric__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_offset_metric_with_one_input_metric__plan0_optimized.sql
index c2a635c12c..d073016d0d 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_offset_metric_with_one_input_metric__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_derived_offset_metric_with_one_input_metric__plan0_optimized.sql
@@ -8,19 +8,19 @@ FROM (
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_11.ds AS metric_time__day
- , SUM(subq_9.bookings) AS bookings_5_days_ago
- FROM ***************************.mf_time_spine subq_11
+ subq_20.ds AS metric_time__day
+ , SUM(subq_18.bookings) AS bookings_5_days_ago
+ FROM ***************************.mf_time_spine subq_20
INNER JOIN (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
SELECT
DATE_TRUNC('day', ds) AS metric_time__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_9
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_18
ON
- subq_11.ds - INTERVAL 5 day = subq_9.metric_time__day
+ subq_20.ds - INTERVAL 5 day = subq_18.metric_time__day
GROUP BY
- subq_11.ds
-) subq_15
+ subq_20.ds
+) subq_24
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_derived_metric__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_derived_metric__plan0.sql
index 2d28d5feb7..7918ef7e73 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_derived_metric__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_derived_metric__plan0.sql
@@ -1,895 +1,895 @@
-- Compute Metrics via Expressions
SELECT
- subq_22.metric_time__day
+ subq_31.metric_time__day
, non_referred + (instant * 1.0 / bookings) AS instant_plus_non_referred_bookings_pct
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_11.metric_time__day, subq_16.metric_time__day, subq_21.metric_time__day) AS metric_time__day
- , MAX(subq_11.non_referred) AS non_referred
- , MAX(subq_16.instant) AS instant
- , MAX(subq_21.bookings) AS bookings
+ COALESCE(subq_20.metric_time__day, subq_25.metric_time__day, subq_30.metric_time__day) AS metric_time__day
+ , MAX(subq_20.non_referred) AS non_referred
+ , MAX(subq_25.instant) AS instant
+ , MAX(subq_30.bookings) AS bookings
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_10.metric_time__day
+ subq_19.metric_time__day
, (bookings - ref_bookings) * 1.0 / bookings AS non_referred
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_4.metric_time__day, subq_9.metric_time__day) AS metric_time__day
- , MAX(subq_4.ref_bookings) AS ref_bookings
- , MAX(subq_9.bookings) AS bookings
+ COALESCE(subq_13.metric_time__day, subq_18.metric_time__day) AS metric_time__day
+ , MAX(subq_13.ref_bookings) AS ref_bookings
+ , MAX(subq_18.bookings) AS bookings
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_3.metric_time__day
- , subq_3.referred_bookings AS ref_bookings
+ subq_12.metric_time__day
+ , subq_12.referred_bookings AS ref_bookings
FROM (
-- Aggregate Measures
SELECT
- subq_2.metric_time__day
- , SUM(subq_2.referred_bookings) AS referred_bookings
+ subq_11.metric_time__day
+ , SUM(subq_11.referred_bookings) AS referred_bookings
FROM (
-- Pass Only Elements: ['referred_bookings', 'metric_time__day']
SELECT
- subq_1.metric_time__day
- , subq_1.referred_bookings
+ subq_10.metric_time__day
+ , subq_10.referred_bookings
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
- ) subq_2
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
GROUP BY
- subq_2.metric_time__day
- ) subq_3
- ) subq_4
+ subq_11.metric_time__day
+ ) subq_12
+ ) subq_13
FULL OUTER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_8.metric_time__day
- , subq_8.bookings
+ subq_17.metric_time__day
+ , subq_17.bookings
FROM (
-- Aggregate Measures
SELECT
- subq_7.metric_time__day
- , SUM(subq_7.bookings) AS bookings
+ subq_16.metric_time__day
+ , SUM(subq_16.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__day']
SELECT
- subq_6.metric_time__day
- , subq_6.bookings
+ subq_15.metric_time__day
+ , subq_15.bookings
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_5.ds__day
- , subq_5.ds__week
- , subq_5.ds__month
- , subq_5.ds__quarter
- , subq_5.ds__year
- , subq_5.ds__extract_year
- , subq_5.ds__extract_quarter
- , subq_5.ds__extract_month
- , subq_5.ds__extract_day
- , subq_5.ds__extract_dow
- , subq_5.ds__extract_doy
- , subq_5.ds_partitioned__day
- , subq_5.ds_partitioned__week
- , subq_5.ds_partitioned__month
- , subq_5.ds_partitioned__quarter
- , subq_5.ds_partitioned__year
- , subq_5.ds_partitioned__extract_year
- , subq_5.ds_partitioned__extract_quarter
- , subq_5.ds_partitioned__extract_month
- , subq_5.ds_partitioned__extract_day
- , subq_5.ds_partitioned__extract_dow
- , subq_5.ds_partitioned__extract_doy
- , subq_5.paid_at__day
- , subq_5.paid_at__week
- , subq_5.paid_at__month
- , subq_5.paid_at__quarter
- , subq_5.paid_at__year
- , subq_5.paid_at__extract_year
- , subq_5.paid_at__extract_quarter
- , subq_5.paid_at__extract_month
- , subq_5.paid_at__extract_day
- , subq_5.paid_at__extract_dow
- , subq_5.paid_at__extract_doy
- , subq_5.booking__ds__day
- , subq_5.booking__ds__week
- , subq_5.booking__ds__month
- , subq_5.booking__ds__quarter
- , subq_5.booking__ds__year
- , subq_5.booking__ds__extract_year
- , subq_5.booking__ds__extract_quarter
- , subq_5.booking__ds__extract_month
- , subq_5.booking__ds__extract_day
- , subq_5.booking__ds__extract_dow
- , subq_5.booking__ds__extract_doy
- , subq_5.booking__ds_partitioned__day
- , subq_5.booking__ds_partitioned__week
- , subq_5.booking__ds_partitioned__month
- , subq_5.booking__ds_partitioned__quarter
- , subq_5.booking__ds_partitioned__year
- , subq_5.booking__ds_partitioned__extract_year
- , subq_5.booking__ds_partitioned__extract_quarter
- , subq_5.booking__ds_partitioned__extract_month
- , subq_5.booking__ds_partitioned__extract_day
- , subq_5.booking__ds_partitioned__extract_dow
- , subq_5.booking__ds_partitioned__extract_doy
- , subq_5.booking__paid_at__day
- , subq_5.booking__paid_at__week
- , subq_5.booking__paid_at__month
- , subq_5.booking__paid_at__quarter
- , subq_5.booking__paid_at__year
- , subq_5.booking__paid_at__extract_year
- , subq_5.booking__paid_at__extract_quarter
- , subq_5.booking__paid_at__extract_month
- , subq_5.booking__paid_at__extract_day
- , subq_5.booking__paid_at__extract_dow
- , subq_5.booking__paid_at__extract_doy
- , subq_5.ds__day AS metric_time__day
- , subq_5.ds__week AS metric_time__week
- , subq_5.ds__month AS metric_time__month
- , subq_5.ds__quarter AS metric_time__quarter
- , subq_5.ds__year AS metric_time__year
- , subq_5.ds__extract_year AS metric_time__extract_year
- , subq_5.ds__extract_quarter AS metric_time__extract_quarter
- , subq_5.ds__extract_month AS metric_time__extract_month
- , subq_5.ds__extract_day AS metric_time__extract_day
- , subq_5.ds__extract_dow AS metric_time__extract_dow
- , subq_5.ds__extract_doy AS metric_time__extract_doy
- , subq_5.listing
- , subq_5.guest
- , subq_5.host
- , subq_5.booking__listing
- , subq_5.booking__guest
- , subq_5.booking__host
- , subq_5.is_instant
- , subq_5.booking__is_instant
- , subq_5.bookings
- , subq_5.instant_bookings
- , subq_5.booking_value
- , subq_5.max_booking_value
- , subq_5.min_booking_value
- , subq_5.bookers
- , subq_5.average_booking_value
- , subq_5.referred_bookings
- , subq_5.median_booking_value
- , subq_5.booking_value_p99
- , subq_5.discrete_booking_value_p99
- , subq_5.approximate_continuous_booking_value_p99
- , subq_5.approximate_discrete_booking_value_p99
+ subq_14.ds__day
+ , subq_14.ds__week
+ , subq_14.ds__month
+ , subq_14.ds__quarter
+ , subq_14.ds__year
+ , subq_14.ds__extract_year
+ , subq_14.ds__extract_quarter
+ , subq_14.ds__extract_month
+ , subq_14.ds__extract_day
+ , subq_14.ds__extract_dow
+ , subq_14.ds__extract_doy
+ , subq_14.ds_partitioned__day
+ , subq_14.ds_partitioned__week
+ , subq_14.ds_partitioned__month
+ , subq_14.ds_partitioned__quarter
+ , subq_14.ds_partitioned__year
+ , subq_14.ds_partitioned__extract_year
+ , subq_14.ds_partitioned__extract_quarter
+ , subq_14.ds_partitioned__extract_month
+ , subq_14.ds_partitioned__extract_day
+ , subq_14.ds_partitioned__extract_dow
+ , subq_14.ds_partitioned__extract_doy
+ , subq_14.paid_at__day
+ , subq_14.paid_at__week
+ , subq_14.paid_at__month
+ , subq_14.paid_at__quarter
+ , subq_14.paid_at__year
+ , subq_14.paid_at__extract_year
+ , subq_14.paid_at__extract_quarter
+ , subq_14.paid_at__extract_month
+ , subq_14.paid_at__extract_day
+ , subq_14.paid_at__extract_dow
+ , subq_14.paid_at__extract_doy
+ , subq_14.booking__ds__day
+ , subq_14.booking__ds__week
+ , subq_14.booking__ds__month
+ , subq_14.booking__ds__quarter
+ , subq_14.booking__ds__year
+ , subq_14.booking__ds__extract_year
+ , subq_14.booking__ds__extract_quarter
+ , subq_14.booking__ds__extract_month
+ , subq_14.booking__ds__extract_day
+ , subq_14.booking__ds__extract_dow
+ , subq_14.booking__ds__extract_doy
+ , subq_14.booking__ds_partitioned__day
+ , subq_14.booking__ds_partitioned__week
+ , subq_14.booking__ds_partitioned__month
+ , subq_14.booking__ds_partitioned__quarter
+ , subq_14.booking__ds_partitioned__year
+ , subq_14.booking__ds_partitioned__extract_year
+ , subq_14.booking__ds_partitioned__extract_quarter
+ , subq_14.booking__ds_partitioned__extract_month
+ , subq_14.booking__ds_partitioned__extract_day
+ , subq_14.booking__ds_partitioned__extract_dow
+ , subq_14.booking__ds_partitioned__extract_doy
+ , subq_14.booking__paid_at__day
+ , subq_14.booking__paid_at__week
+ , subq_14.booking__paid_at__month
+ , subq_14.booking__paid_at__quarter
+ , subq_14.booking__paid_at__year
+ , subq_14.booking__paid_at__extract_year
+ , subq_14.booking__paid_at__extract_quarter
+ , subq_14.booking__paid_at__extract_month
+ , subq_14.booking__paid_at__extract_day
+ , subq_14.booking__paid_at__extract_dow
+ , subq_14.booking__paid_at__extract_doy
+ , subq_14.ds__day AS metric_time__day
+ , subq_14.ds__week AS metric_time__week
+ , subq_14.ds__month AS metric_time__month
+ , subq_14.ds__quarter AS metric_time__quarter
+ , subq_14.ds__year AS metric_time__year
+ , subq_14.ds__extract_year AS metric_time__extract_year
+ , subq_14.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_14.ds__extract_month AS metric_time__extract_month
+ , subq_14.ds__extract_day AS metric_time__extract_day
+ , subq_14.ds__extract_dow AS metric_time__extract_dow
+ , subq_14.ds__extract_doy AS metric_time__extract_doy
+ , subq_14.listing
+ , subq_14.guest
+ , subq_14.host
+ , subq_14.booking__listing
+ , subq_14.booking__guest
+ , subq_14.booking__host
+ , subq_14.is_instant
+ , subq_14.booking__is_instant
+ , subq_14.bookings
+ , subq_14.instant_bookings
+ , subq_14.booking_value
+ , subq_14.max_booking_value
+ , subq_14.min_booking_value
+ , subq_14.bookers
+ , subq_14.average_booking_value
+ , subq_14.referred_bookings
+ , subq_14.median_booking_value
+ , subq_14.booking_value_p99
+ , subq_14.discrete_booking_value_p99
+ , subq_14.approximate_continuous_booking_value_p99
+ , subq_14.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_5
- ) subq_6
- ) subq_7
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_14
+ ) subq_15
+ ) subq_16
GROUP BY
- subq_7.metric_time__day
- ) subq_8
- ) subq_9
+ subq_16.metric_time__day
+ ) subq_17
+ ) subq_18
ON
- subq_4.metric_time__day = subq_9.metric_time__day
+ subq_13.metric_time__day = subq_18.metric_time__day
GROUP BY
- COALESCE(subq_4.metric_time__day, subq_9.metric_time__day)
- ) subq_10
- ) subq_11
+ COALESCE(subq_13.metric_time__day, subq_18.metric_time__day)
+ ) subq_19
+ ) subq_20
FULL OUTER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_15.metric_time__day
- , subq_15.instant_bookings AS instant
+ subq_24.metric_time__day
+ , subq_24.instant_bookings AS instant
FROM (
-- Aggregate Measures
SELECT
- subq_14.metric_time__day
- , SUM(subq_14.instant_bookings) AS instant_bookings
+ subq_23.metric_time__day
+ , SUM(subq_23.instant_bookings) AS instant_bookings
FROM (
-- Pass Only Elements: ['instant_bookings', 'metric_time__day']
SELECT
- subq_13.metric_time__day
- , subq_13.instant_bookings
+ subq_22.metric_time__day
+ , subq_22.instant_bookings
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_12.ds__day
- , subq_12.ds__week
- , subq_12.ds__month
- , subq_12.ds__quarter
- , subq_12.ds__year
- , subq_12.ds__extract_year
- , subq_12.ds__extract_quarter
- , subq_12.ds__extract_month
- , subq_12.ds__extract_day
- , subq_12.ds__extract_dow
- , subq_12.ds__extract_doy
- , subq_12.ds_partitioned__day
- , subq_12.ds_partitioned__week
- , subq_12.ds_partitioned__month
- , subq_12.ds_partitioned__quarter
- , subq_12.ds_partitioned__year
- , subq_12.ds_partitioned__extract_year
- , subq_12.ds_partitioned__extract_quarter
- , subq_12.ds_partitioned__extract_month
- , subq_12.ds_partitioned__extract_day
- , subq_12.ds_partitioned__extract_dow
- , subq_12.ds_partitioned__extract_doy
- , subq_12.paid_at__day
- , subq_12.paid_at__week
- , subq_12.paid_at__month
- , subq_12.paid_at__quarter
- , subq_12.paid_at__year
- , subq_12.paid_at__extract_year
- , subq_12.paid_at__extract_quarter
- , subq_12.paid_at__extract_month
- , subq_12.paid_at__extract_day
- , subq_12.paid_at__extract_dow
- , subq_12.paid_at__extract_doy
- , subq_12.booking__ds__day
- , subq_12.booking__ds__week
- , subq_12.booking__ds__month
- , subq_12.booking__ds__quarter
- , subq_12.booking__ds__year
- , subq_12.booking__ds__extract_year
- , subq_12.booking__ds__extract_quarter
- , subq_12.booking__ds__extract_month
- , subq_12.booking__ds__extract_day
- , subq_12.booking__ds__extract_dow
- , subq_12.booking__ds__extract_doy
- , subq_12.booking__ds_partitioned__day
- , subq_12.booking__ds_partitioned__week
- , subq_12.booking__ds_partitioned__month
- , subq_12.booking__ds_partitioned__quarter
- , subq_12.booking__ds_partitioned__year
- , subq_12.booking__ds_partitioned__extract_year
- , subq_12.booking__ds_partitioned__extract_quarter
- , subq_12.booking__ds_partitioned__extract_month
- , subq_12.booking__ds_partitioned__extract_day
- , subq_12.booking__ds_partitioned__extract_dow
- , subq_12.booking__ds_partitioned__extract_doy
- , subq_12.booking__paid_at__day
- , subq_12.booking__paid_at__week
- , subq_12.booking__paid_at__month
- , subq_12.booking__paid_at__quarter
- , subq_12.booking__paid_at__year
- , subq_12.booking__paid_at__extract_year
- , subq_12.booking__paid_at__extract_quarter
- , subq_12.booking__paid_at__extract_month
- , subq_12.booking__paid_at__extract_day
- , subq_12.booking__paid_at__extract_dow
- , subq_12.booking__paid_at__extract_doy
- , subq_12.ds__day AS metric_time__day
- , subq_12.ds__week AS metric_time__week
- , subq_12.ds__month AS metric_time__month
- , subq_12.ds__quarter AS metric_time__quarter
- , subq_12.ds__year AS metric_time__year
- , subq_12.ds__extract_year AS metric_time__extract_year
- , subq_12.ds__extract_quarter AS metric_time__extract_quarter
- , subq_12.ds__extract_month AS metric_time__extract_month
- , subq_12.ds__extract_day AS metric_time__extract_day
- , subq_12.ds__extract_dow AS metric_time__extract_dow
- , subq_12.ds__extract_doy AS metric_time__extract_doy
- , subq_12.listing
- , subq_12.guest
- , subq_12.host
- , subq_12.booking__listing
- , subq_12.booking__guest
- , subq_12.booking__host
- , subq_12.is_instant
- , subq_12.booking__is_instant
- , subq_12.bookings
- , subq_12.instant_bookings
- , subq_12.booking_value
- , subq_12.max_booking_value
- , subq_12.min_booking_value
- , subq_12.bookers
- , subq_12.average_booking_value
- , subq_12.referred_bookings
- , subq_12.median_booking_value
- , subq_12.booking_value_p99
- , subq_12.discrete_booking_value_p99
- , subq_12.approximate_continuous_booking_value_p99
- , subq_12.approximate_discrete_booking_value_p99
+ subq_21.ds__day
+ , subq_21.ds__week
+ , subq_21.ds__month
+ , subq_21.ds__quarter
+ , subq_21.ds__year
+ , subq_21.ds__extract_year
+ , subq_21.ds__extract_quarter
+ , subq_21.ds__extract_month
+ , subq_21.ds__extract_day
+ , subq_21.ds__extract_dow
+ , subq_21.ds__extract_doy
+ , subq_21.ds_partitioned__day
+ , subq_21.ds_partitioned__week
+ , subq_21.ds_partitioned__month
+ , subq_21.ds_partitioned__quarter
+ , subq_21.ds_partitioned__year
+ , subq_21.ds_partitioned__extract_year
+ , subq_21.ds_partitioned__extract_quarter
+ , subq_21.ds_partitioned__extract_month
+ , subq_21.ds_partitioned__extract_day
+ , subq_21.ds_partitioned__extract_dow
+ , subq_21.ds_partitioned__extract_doy
+ , subq_21.paid_at__day
+ , subq_21.paid_at__week
+ , subq_21.paid_at__month
+ , subq_21.paid_at__quarter
+ , subq_21.paid_at__year
+ , subq_21.paid_at__extract_year
+ , subq_21.paid_at__extract_quarter
+ , subq_21.paid_at__extract_month
+ , subq_21.paid_at__extract_day
+ , subq_21.paid_at__extract_dow
+ , subq_21.paid_at__extract_doy
+ , subq_21.booking__ds__day
+ , subq_21.booking__ds__week
+ , subq_21.booking__ds__month
+ , subq_21.booking__ds__quarter
+ , subq_21.booking__ds__year
+ , subq_21.booking__ds__extract_year
+ , subq_21.booking__ds__extract_quarter
+ , subq_21.booking__ds__extract_month
+ , subq_21.booking__ds__extract_day
+ , subq_21.booking__ds__extract_dow
+ , subq_21.booking__ds__extract_doy
+ , subq_21.booking__ds_partitioned__day
+ , subq_21.booking__ds_partitioned__week
+ , subq_21.booking__ds_partitioned__month
+ , subq_21.booking__ds_partitioned__quarter
+ , subq_21.booking__ds_partitioned__year
+ , subq_21.booking__ds_partitioned__extract_year
+ , subq_21.booking__ds_partitioned__extract_quarter
+ , subq_21.booking__ds_partitioned__extract_month
+ , subq_21.booking__ds_partitioned__extract_day
+ , subq_21.booking__ds_partitioned__extract_dow
+ , subq_21.booking__ds_partitioned__extract_doy
+ , subq_21.booking__paid_at__day
+ , subq_21.booking__paid_at__week
+ , subq_21.booking__paid_at__month
+ , subq_21.booking__paid_at__quarter
+ , subq_21.booking__paid_at__year
+ , subq_21.booking__paid_at__extract_year
+ , subq_21.booking__paid_at__extract_quarter
+ , subq_21.booking__paid_at__extract_month
+ , subq_21.booking__paid_at__extract_day
+ , subq_21.booking__paid_at__extract_dow
+ , subq_21.booking__paid_at__extract_doy
+ , subq_21.ds__day AS metric_time__day
+ , subq_21.ds__week AS metric_time__week
+ , subq_21.ds__month AS metric_time__month
+ , subq_21.ds__quarter AS metric_time__quarter
+ , subq_21.ds__year AS metric_time__year
+ , subq_21.ds__extract_year AS metric_time__extract_year
+ , subq_21.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_21.ds__extract_month AS metric_time__extract_month
+ , subq_21.ds__extract_day AS metric_time__extract_day
+ , subq_21.ds__extract_dow AS metric_time__extract_dow
+ , subq_21.ds__extract_doy AS metric_time__extract_doy
+ , subq_21.listing
+ , subq_21.guest
+ , subq_21.host
+ , subq_21.booking__listing
+ , subq_21.booking__guest
+ , subq_21.booking__host
+ , subq_21.is_instant
+ , subq_21.booking__is_instant
+ , subq_21.bookings
+ , subq_21.instant_bookings
+ , subq_21.booking_value
+ , subq_21.max_booking_value
+ , subq_21.min_booking_value
+ , subq_21.bookers
+ , subq_21.average_booking_value
+ , subq_21.referred_bookings
+ , subq_21.median_booking_value
+ , subq_21.booking_value_p99
+ , subq_21.discrete_booking_value_p99
+ , subq_21.approximate_continuous_booking_value_p99
+ , subq_21.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_12
- ) subq_13
- ) subq_14
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_21
+ ) subq_22
+ ) subq_23
GROUP BY
- subq_14.metric_time__day
- ) subq_15
- ) subq_16
+ subq_23.metric_time__day
+ ) subq_24
+ ) subq_25
ON
- subq_11.metric_time__day = subq_16.metric_time__day
+ subq_20.metric_time__day = subq_25.metric_time__day
FULL OUTER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_20.metric_time__day
- , subq_20.bookings
+ subq_29.metric_time__day
+ , subq_29.bookings
FROM (
-- Aggregate Measures
SELECT
- subq_19.metric_time__day
- , SUM(subq_19.bookings) AS bookings
+ subq_28.metric_time__day
+ , SUM(subq_28.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__day']
SELECT
- subq_18.metric_time__day
- , subq_18.bookings
+ subq_27.metric_time__day
+ , subq_27.bookings
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_17.ds__day
- , subq_17.ds__week
- , subq_17.ds__month
- , subq_17.ds__quarter
- , subq_17.ds__year
- , subq_17.ds__extract_year
- , subq_17.ds__extract_quarter
- , subq_17.ds__extract_month
- , subq_17.ds__extract_day
- , subq_17.ds__extract_dow
- , subq_17.ds__extract_doy
- , subq_17.ds_partitioned__day
- , subq_17.ds_partitioned__week
- , subq_17.ds_partitioned__month
- , subq_17.ds_partitioned__quarter
- , subq_17.ds_partitioned__year
- , subq_17.ds_partitioned__extract_year
- , subq_17.ds_partitioned__extract_quarter
- , subq_17.ds_partitioned__extract_month
- , subq_17.ds_partitioned__extract_day
- , subq_17.ds_partitioned__extract_dow
- , subq_17.ds_partitioned__extract_doy
- , subq_17.paid_at__day
- , subq_17.paid_at__week
- , subq_17.paid_at__month
- , subq_17.paid_at__quarter
- , subq_17.paid_at__year
- , subq_17.paid_at__extract_year
- , subq_17.paid_at__extract_quarter
- , subq_17.paid_at__extract_month
- , subq_17.paid_at__extract_day
- , subq_17.paid_at__extract_dow
- , subq_17.paid_at__extract_doy
- , subq_17.booking__ds__day
- , subq_17.booking__ds__week
- , subq_17.booking__ds__month
- , subq_17.booking__ds__quarter
- , subq_17.booking__ds__year
- , subq_17.booking__ds__extract_year
- , subq_17.booking__ds__extract_quarter
- , subq_17.booking__ds__extract_month
- , subq_17.booking__ds__extract_day
- , subq_17.booking__ds__extract_dow
- , subq_17.booking__ds__extract_doy
- , subq_17.booking__ds_partitioned__day
- , subq_17.booking__ds_partitioned__week
- , subq_17.booking__ds_partitioned__month
- , subq_17.booking__ds_partitioned__quarter
- , subq_17.booking__ds_partitioned__year
- , subq_17.booking__ds_partitioned__extract_year
- , subq_17.booking__ds_partitioned__extract_quarter
- , subq_17.booking__ds_partitioned__extract_month
- , subq_17.booking__ds_partitioned__extract_day
- , subq_17.booking__ds_partitioned__extract_dow
- , subq_17.booking__ds_partitioned__extract_doy
- , subq_17.booking__paid_at__day
- , subq_17.booking__paid_at__week
- , subq_17.booking__paid_at__month
- , subq_17.booking__paid_at__quarter
- , subq_17.booking__paid_at__year
- , subq_17.booking__paid_at__extract_year
- , subq_17.booking__paid_at__extract_quarter
- , subq_17.booking__paid_at__extract_month
- , subq_17.booking__paid_at__extract_day
- , subq_17.booking__paid_at__extract_dow
- , subq_17.booking__paid_at__extract_doy
- , subq_17.ds__day AS metric_time__day
- , subq_17.ds__week AS metric_time__week
- , subq_17.ds__month AS metric_time__month
- , subq_17.ds__quarter AS metric_time__quarter
- , subq_17.ds__year AS metric_time__year
- , subq_17.ds__extract_year AS metric_time__extract_year
- , subq_17.ds__extract_quarter AS metric_time__extract_quarter
- , subq_17.ds__extract_month AS metric_time__extract_month
- , subq_17.ds__extract_day AS metric_time__extract_day
- , subq_17.ds__extract_dow AS metric_time__extract_dow
- , subq_17.ds__extract_doy AS metric_time__extract_doy
- , subq_17.listing
- , subq_17.guest
- , subq_17.host
- , subq_17.booking__listing
- , subq_17.booking__guest
- , subq_17.booking__host
- , subq_17.is_instant
- , subq_17.booking__is_instant
- , subq_17.bookings
- , subq_17.instant_bookings
- , subq_17.booking_value
- , subq_17.max_booking_value
- , subq_17.min_booking_value
- , subq_17.bookers
- , subq_17.average_booking_value
- , subq_17.referred_bookings
- , subq_17.median_booking_value
- , subq_17.booking_value_p99
- , subq_17.discrete_booking_value_p99
- , subq_17.approximate_continuous_booking_value_p99
- , subq_17.approximate_discrete_booking_value_p99
+ subq_26.ds__day
+ , subq_26.ds__week
+ , subq_26.ds__month
+ , subq_26.ds__quarter
+ , subq_26.ds__year
+ , subq_26.ds__extract_year
+ , subq_26.ds__extract_quarter
+ , subq_26.ds__extract_month
+ , subq_26.ds__extract_day
+ , subq_26.ds__extract_dow
+ , subq_26.ds__extract_doy
+ , subq_26.ds_partitioned__day
+ , subq_26.ds_partitioned__week
+ , subq_26.ds_partitioned__month
+ , subq_26.ds_partitioned__quarter
+ , subq_26.ds_partitioned__year
+ , subq_26.ds_partitioned__extract_year
+ , subq_26.ds_partitioned__extract_quarter
+ , subq_26.ds_partitioned__extract_month
+ , subq_26.ds_partitioned__extract_day
+ , subq_26.ds_partitioned__extract_dow
+ , subq_26.ds_partitioned__extract_doy
+ , subq_26.paid_at__day
+ , subq_26.paid_at__week
+ , subq_26.paid_at__month
+ , subq_26.paid_at__quarter
+ , subq_26.paid_at__year
+ , subq_26.paid_at__extract_year
+ , subq_26.paid_at__extract_quarter
+ , subq_26.paid_at__extract_month
+ , subq_26.paid_at__extract_day
+ , subq_26.paid_at__extract_dow
+ , subq_26.paid_at__extract_doy
+ , subq_26.booking__ds__day
+ , subq_26.booking__ds__week
+ , subq_26.booking__ds__month
+ , subq_26.booking__ds__quarter
+ , subq_26.booking__ds__year
+ , subq_26.booking__ds__extract_year
+ , subq_26.booking__ds__extract_quarter
+ , subq_26.booking__ds__extract_month
+ , subq_26.booking__ds__extract_day
+ , subq_26.booking__ds__extract_dow
+ , subq_26.booking__ds__extract_doy
+ , subq_26.booking__ds_partitioned__day
+ , subq_26.booking__ds_partitioned__week
+ , subq_26.booking__ds_partitioned__month
+ , subq_26.booking__ds_partitioned__quarter
+ , subq_26.booking__ds_partitioned__year
+ , subq_26.booking__ds_partitioned__extract_year
+ , subq_26.booking__ds_partitioned__extract_quarter
+ , subq_26.booking__ds_partitioned__extract_month
+ , subq_26.booking__ds_partitioned__extract_day
+ , subq_26.booking__ds_partitioned__extract_dow
+ , subq_26.booking__ds_partitioned__extract_doy
+ , subq_26.booking__paid_at__day
+ , subq_26.booking__paid_at__week
+ , subq_26.booking__paid_at__month
+ , subq_26.booking__paid_at__quarter
+ , subq_26.booking__paid_at__year
+ , subq_26.booking__paid_at__extract_year
+ , subq_26.booking__paid_at__extract_quarter
+ , subq_26.booking__paid_at__extract_month
+ , subq_26.booking__paid_at__extract_day
+ , subq_26.booking__paid_at__extract_dow
+ , subq_26.booking__paid_at__extract_doy
+ , subq_26.ds__day AS metric_time__day
+ , subq_26.ds__week AS metric_time__week
+ , subq_26.ds__month AS metric_time__month
+ , subq_26.ds__quarter AS metric_time__quarter
+ , subq_26.ds__year AS metric_time__year
+ , subq_26.ds__extract_year AS metric_time__extract_year
+ , subq_26.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_26.ds__extract_month AS metric_time__extract_month
+ , subq_26.ds__extract_day AS metric_time__extract_day
+ , subq_26.ds__extract_dow AS metric_time__extract_dow
+ , subq_26.ds__extract_doy AS metric_time__extract_doy
+ , subq_26.listing
+ , subq_26.guest
+ , subq_26.host
+ , subq_26.booking__listing
+ , subq_26.booking__guest
+ , subq_26.booking__host
+ , subq_26.is_instant
+ , subq_26.booking__is_instant
+ , subq_26.bookings
+ , subq_26.instant_bookings
+ , subq_26.booking_value
+ , subq_26.max_booking_value
+ , subq_26.min_booking_value
+ , subq_26.bookers
+ , subq_26.average_booking_value
+ , subq_26.referred_bookings
+ , subq_26.median_booking_value
+ , subq_26.booking_value_p99
+ , subq_26.discrete_booking_value_p99
+ , subq_26.approximate_continuous_booking_value_p99
+ , subq_26.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_17
- ) subq_18
- ) subq_19
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_26
+ ) subq_27
+ ) subq_28
GROUP BY
- subq_19.metric_time__day
- ) subq_20
- ) subq_21
+ subq_28.metric_time__day
+ ) subq_29
+ ) subq_30
ON
- COALESCE(subq_11.metric_time__day, subq_16.metric_time__day) = subq_21.metric_time__day
+ COALESCE(subq_20.metric_time__day, subq_25.metric_time__day) = subq_30.metric_time__day
GROUP BY
- COALESCE(subq_11.metric_time__day, subq_16.metric_time__day, subq_21.metric_time__day)
-) subq_22
+ COALESCE(subq_20.metric_time__day, subq_25.metric_time__day, subq_30.metric_time__day)
+) subq_31
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_derived_metric__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_derived_metric__plan0_optimized.sql
index 78837fdd96..da1e9fdd5a 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_derived_metric__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_derived_metric__plan0_optimized.sql
@@ -5,10 +5,10 @@ SELECT
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_34.metric_time__day, subq_39.metric_time__day, subq_44.metric_time__day) AS metric_time__day
- , MAX(subq_34.non_referred) AS non_referred
- , MAX(subq_39.instant) AS instant
- , MAX(subq_44.bookings) AS bookings
+ COALESCE(subq_43.metric_time__day, subq_48.metric_time__day, subq_53.metric_time__day) AS metric_time__day
+ , MAX(subq_43.non_referred) AS non_referred
+ , MAX(subq_48.instant) AS instant
+ , MAX(subq_53.bookings) AS bookings
FROM (
-- Compute Metrics via Expressions
SELECT
@@ -17,9 +17,9 @@ FROM (
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_27.metric_time__day, subq_32.metric_time__day) AS metric_time__day
- , MAX(subq_27.ref_bookings) AS ref_bookings
- , MAX(subq_32.bookings) AS bookings
+ COALESCE(subq_36.metric_time__day, subq_41.metric_time__day) AS metric_time__day
+ , MAX(subq_36.ref_bookings) AS ref_bookings
+ , MAX(subq_41.bookings) AS bookings
FROM (
-- Aggregate Measures
-- Compute Metrics via Expressions
@@ -33,11 +33,11 @@ FROM (
SELECT
DATE_TRUNC('day', ds) 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_28001
- ) subq_25
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_34
GROUP BY
metric_time__day
- ) subq_27
+ ) subq_36
FULL OUTER JOIN (
-- Aggregate Measures
-- Compute Metrics via Expressions
@@ -51,17 +51,17 @@ FROM (
SELECT
DATE_TRUNC('day', ds) AS metric_time__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_30
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_39
GROUP BY
metric_time__day
- ) subq_32
+ ) subq_41
ON
- subq_27.metric_time__day = subq_32.metric_time__day
+ subq_36.metric_time__day = subq_41.metric_time__day
GROUP BY
- COALESCE(subq_27.metric_time__day, subq_32.metric_time__day)
- ) subq_33
- ) subq_34
+ COALESCE(subq_36.metric_time__day, subq_41.metric_time__day)
+ ) subq_42
+ ) subq_43
FULL OUTER JOIN (
-- Aggregate Measures
-- Compute Metrics via Expressions
@@ -75,13 +75,13 @@ FROM (
SELECT
DATE_TRUNC('day', ds) AS metric_time__day
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_37
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_46
GROUP BY
metric_time__day
- ) subq_39
+ ) subq_48
ON
- subq_34.metric_time__day = subq_39.metric_time__day
+ subq_43.metric_time__day = subq_48.metric_time__day
FULL OUTER JOIN (
-- Aggregate Measures
-- Compute Metrics via Expressions
@@ -95,13 +95,13 @@ FROM (
SELECT
DATE_TRUNC('day', ds) AS metric_time__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_42
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_51
GROUP BY
metric_time__day
- ) subq_44
+ ) subq_53
ON
- COALESCE(subq_34.metric_time__day, subq_39.metric_time__day) = subq_44.metric_time__day
+ COALESCE(subq_43.metric_time__day, subq_48.metric_time__day) = subq_53.metric_time__day
GROUP BY
- COALESCE(subq_34.metric_time__day, subq_39.metric_time__day, subq_44.metric_time__day)
-) subq_45
+ COALESCE(subq_43.metric_time__day, subq_48.metric_time__day, subq_53.metric_time__day)
+) subq_54
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0.sql
index 8393f42f8f..c8deeee7b2 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0.sql
@@ -1,359 +1,359 @@
-- Compute Metrics via Expressions
SELECT
- subq_13.metric_time__day
+ subq_22.metric_time__day
, 2 * bookings_offset_once AS bookings_offset_twice
FROM (
-- Pass Only Elements: ['metric_time__day', 'bookings_offset_once']
SELECT
- subq_12.metric_time__day
- , subq_12.bookings_offset_once
+ subq_21.metric_time__day
+ , subq_21.bookings_offset_once
FROM (
-- Constrain Output with WHERE
SELECT
- subq_11.metric_time__day
- , subq_11.booking__is_instant
- , subq_11.bookings_offset_once
+ subq_20.metric_time__day
+ , subq_20.booking__is_instant
+ , subq_20.bookings_offset_once
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_9.metric_time__day AS metric_time__day
- , subq_8.booking__is_instant AS booking__is_instant
- , subq_8.bookings_offset_once AS bookings_offset_once
+ subq_18.metric_time__day AS metric_time__day
+ , subq_17.booking__is_instant AS booking__is_instant
+ , subq_17.bookings_offset_once AS bookings_offset_once
FROM (
-- Time Spine
SELECT
- subq_10.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_10
- ) subq_9
+ subq_19.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_19
+ ) subq_18
INNER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_7.metric_time__day
- , subq_7.booking__is_instant
+ subq_16.metric_time__day
+ , subq_16.booking__is_instant
, 2 * bookings AS bookings_offset_once
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_6.metric_time__day
- , subq_6.booking__is_instant
- , subq_6.bookings
+ subq_15.metric_time__day
+ , subq_15.booking__is_instant
+ , subq_15.bookings
FROM (
-- Aggregate Measures
SELECT
- subq_5.metric_time__day
- , subq_5.booking__is_instant
- , SUM(subq_5.bookings) AS bookings
+ subq_14.metric_time__day
+ , subq_14.booking__is_instant
+ , SUM(subq_14.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day']
SELECT
- subq_4.metric_time__day
- , subq_4.booking__is_instant
- , subq_4.bookings
+ subq_13.metric_time__day
+ , subq_13.booking__is_instant
+ , subq_13.bookings
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_2.metric_time__day AS metric_time__day
- , subq_1.ds__day AS ds__day
- , subq_1.ds__week AS ds__week
- , subq_1.ds__month AS ds__month
- , subq_1.ds__quarter AS ds__quarter
- , subq_1.ds__year AS ds__year
- , subq_1.ds__extract_year AS ds__extract_year
- , subq_1.ds__extract_quarter AS ds__extract_quarter
- , subq_1.ds__extract_month AS ds__extract_month
- , subq_1.ds__extract_day AS ds__extract_day
- , subq_1.ds__extract_dow AS ds__extract_dow
- , subq_1.ds__extract_doy AS ds__extract_doy
- , subq_1.ds_partitioned__day AS ds_partitioned__day
- , subq_1.ds_partitioned__week AS ds_partitioned__week
- , subq_1.ds_partitioned__month AS ds_partitioned__month
- , subq_1.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_1.ds_partitioned__year AS ds_partitioned__year
- , subq_1.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_1.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_1.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_1.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_1.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_1.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_1.paid_at__day AS paid_at__day
- , subq_1.paid_at__week AS paid_at__week
- , subq_1.paid_at__month AS paid_at__month
- , subq_1.paid_at__quarter AS paid_at__quarter
- , subq_1.paid_at__year AS paid_at__year
- , subq_1.paid_at__extract_year AS paid_at__extract_year
- , subq_1.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_1.paid_at__extract_month AS paid_at__extract_month
- , subq_1.paid_at__extract_day AS paid_at__extract_day
- , subq_1.paid_at__extract_dow AS paid_at__extract_dow
- , subq_1.paid_at__extract_doy AS paid_at__extract_doy
- , subq_1.booking__ds__day AS booking__ds__day
- , subq_1.booking__ds__week AS booking__ds__week
- , subq_1.booking__ds__month AS booking__ds__month
- , subq_1.booking__ds__quarter AS booking__ds__quarter
- , subq_1.booking__ds__year AS booking__ds__year
- , subq_1.booking__ds__extract_year AS booking__ds__extract_year
- , subq_1.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_1.booking__ds__extract_month AS booking__ds__extract_month
- , subq_1.booking__ds__extract_day AS booking__ds__extract_day
- , subq_1.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_1.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_1.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_1.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_1.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_1.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_1.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_1.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_1.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_1.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_1.booking__paid_at__day AS booking__paid_at__day
- , subq_1.booking__paid_at__week AS booking__paid_at__week
- , subq_1.booking__paid_at__month AS booking__paid_at__month
- , subq_1.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_1.booking__paid_at__year AS booking__paid_at__year
- , subq_1.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_1.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_1.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_1.listing AS listing
- , subq_1.guest AS guest
- , subq_1.host AS host
- , subq_1.booking__listing AS booking__listing
- , subq_1.booking__guest AS booking__guest
- , subq_1.booking__host AS booking__host
- , subq_1.is_instant AS is_instant
- , subq_1.booking__is_instant AS booking__is_instant
- , subq_1.bookings AS bookings
- , subq_1.instant_bookings AS instant_bookings
- , subq_1.booking_value AS booking_value
- , subq_1.max_booking_value AS max_booking_value
- , subq_1.min_booking_value AS min_booking_value
- , subq_1.bookers AS bookers
- , subq_1.average_booking_value AS average_booking_value
- , subq_1.referred_bookings AS referred_bookings
- , subq_1.median_booking_value AS median_booking_value
- , subq_1.booking_value_p99 AS booking_value_p99
- , subq_1.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_1.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_1.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ subq_11.metric_time__day AS metric_time__day
+ , subq_10.ds__day AS ds__day
+ , subq_10.ds__week AS ds__week
+ , subq_10.ds__month AS ds__month
+ , subq_10.ds__quarter AS ds__quarter
+ , subq_10.ds__year AS ds__year
+ , subq_10.ds__extract_year AS ds__extract_year
+ , subq_10.ds__extract_quarter AS ds__extract_quarter
+ , subq_10.ds__extract_month AS ds__extract_month
+ , subq_10.ds__extract_day AS ds__extract_day
+ , subq_10.ds__extract_dow AS ds__extract_dow
+ , subq_10.ds__extract_doy AS ds__extract_doy
+ , subq_10.ds_partitioned__day AS ds_partitioned__day
+ , subq_10.ds_partitioned__week AS ds_partitioned__week
+ , subq_10.ds_partitioned__month AS ds_partitioned__month
+ , subq_10.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_10.ds_partitioned__year AS ds_partitioned__year
+ , subq_10.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_10.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_10.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_10.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_10.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_10.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_10.paid_at__day AS paid_at__day
+ , subq_10.paid_at__week AS paid_at__week
+ , subq_10.paid_at__month AS paid_at__month
+ , subq_10.paid_at__quarter AS paid_at__quarter
+ , subq_10.paid_at__year AS paid_at__year
+ , subq_10.paid_at__extract_year AS paid_at__extract_year
+ , subq_10.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_10.paid_at__extract_month AS paid_at__extract_month
+ , subq_10.paid_at__extract_day AS paid_at__extract_day
+ , subq_10.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_10.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_10.booking__ds__day AS booking__ds__day
+ , subq_10.booking__ds__week AS booking__ds__week
+ , subq_10.booking__ds__month AS booking__ds__month
+ , subq_10.booking__ds__quarter AS booking__ds__quarter
+ , subq_10.booking__ds__year AS booking__ds__year
+ , subq_10.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_10.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_10.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_10.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_10.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_10.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_10.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_10.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_10.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_10.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_10.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_10.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_10.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_10.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_10.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_10.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_10.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_10.booking__paid_at__day AS booking__paid_at__day
+ , subq_10.booking__paid_at__week AS booking__paid_at__week
+ , subq_10.booking__paid_at__month AS booking__paid_at__month
+ , subq_10.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_10.booking__paid_at__year AS booking__paid_at__year
+ , subq_10.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_10.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_10.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_10.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_10.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_10.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_10.listing AS listing
+ , subq_10.guest AS guest
+ , subq_10.host AS host
+ , subq_10.booking__listing AS booking__listing
+ , subq_10.booking__guest AS booking__guest
+ , subq_10.booking__host AS booking__host
+ , subq_10.is_instant AS is_instant
+ , subq_10.booking__is_instant AS booking__is_instant
+ , subq_10.bookings AS bookings
+ , subq_10.instant_bookings AS instant_bookings
+ , subq_10.booking_value AS booking_value
+ , subq_10.max_booking_value AS max_booking_value
+ , subq_10.min_booking_value AS min_booking_value
+ , subq_10.bookers AS bookers
+ , subq_10.average_booking_value AS average_booking_value
+ , subq_10.referred_bookings AS referred_bookings
+ , subq_10.median_booking_value AS median_booking_value
+ , subq_10.booking_value_p99 AS booking_value_p99
+ , subq_10.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_10.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_10.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_3.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_3
- ) subq_2
+ subq_12.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_12
+ ) subq_11
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
ON
- subq_2.metric_time__day - INTERVAL 5 day = subq_1.metric_time__day
- ) subq_4
- ) subq_5
+ subq_11.metric_time__day - INTERVAL 5 day = subq_10.metric_time__day
+ ) subq_13
+ ) subq_14
GROUP BY
- subq_5.metric_time__day
- , subq_5.booking__is_instant
- ) subq_6
- ) subq_7
- ) subq_8
+ subq_14.metric_time__day
+ , subq_14.booking__is_instant
+ ) subq_15
+ ) subq_16
+ ) subq_17
ON
- subq_9.metric_time__day - INTERVAL 2 day = subq_8.metric_time__day
- ) subq_11
+ subq_18.metric_time__day - INTERVAL 2 day = subq_17.metric_time__day
+ ) subq_20
WHERE booking__is_instant
- ) subq_12
-) subq_13
+ ) subq_21
+) subq_22
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0_optimized.sql
index 4cf7ae57ba..30c2b67772 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0_optimized.sql
@@ -11,10 +11,10 @@ FROM (
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_24.ds AS metric_time__day
- , subq_22.booking__is_instant AS booking__is_instant
- , subq_22.bookings_offset_once AS bookings_offset_once
- FROM ***************************.mf_time_spine subq_24
+ subq_33.ds AS metric_time__day
+ , subq_31.booking__is_instant AS booking__is_instant
+ , subq_31.bookings_offset_once AS bookings_offset_once
+ FROM ***************************.mf_time_spine subq_33
INNER JOIN (
-- Compute Metrics via Expressions
SELECT
@@ -27,10 +27,10 @@ FROM (
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_17.ds AS metric_time__day
- , subq_15.booking__is_instant AS booking__is_instant
- , SUM(subq_15.bookings) AS bookings
- FROM ***************************.mf_time_spine subq_17
+ subq_26.ds AS metric_time__day
+ , subq_24.booking__is_instant AS booking__is_instant
+ , SUM(subq_24.bookings) AS bookings
+ FROM ***************************.mf_time_spine subq_26
INNER JOIN (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
@@ -38,17 +38,17 @@ FROM (
DATE_TRUNC('day', ds) AS metric_time__day
, is_instant AS booking__is_instant
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_15
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_24
ON
- subq_17.ds - INTERVAL 5 day = subq_15.metric_time__day
+ subq_26.ds - INTERVAL 5 day = subq_24.metric_time__day
GROUP BY
- subq_17.ds
- , subq_15.booking__is_instant
- ) subq_21
- ) subq_22
+ subq_26.ds
+ , subq_24.booking__is_instant
+ ) subq_30
+ ) subq_31
ON
- subq_24.ds - INTERVAL 2 day = subq_22.metric_time__day
- ) subq_25
+ subq_33.ds - INTERVAL 2 day = subq_31.metric_time__day
+ ) subq_34
WHERE booking__is_instant
-) subq_27
+) subq_36
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0.sql
index b6024d9277..36d9bb6cd4 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0.sql
@@ -1,471 +1,471 @@
-- Compute Metrics via Expressions
SELECT
- subq_15.metric_time__day
+ subq_24.metric_time__day
, booking_fees - booking_fees_start_of_month AS booking_fees_since_start_of_month
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_8.metric_time__day, subq_14.metric_time__day) AS metric_time__day
- , MAX(subq_8.booking_fees_start_of_month) AS booking_fees_start_of_month
- , MAX(subq_14.booking_fees) AS booking_fees
+ COALESCE(subq_17.metric_time__day, subq_23.metric_time__day) AS metric_time__day
+ , MAX(subq_17.booking_fees_start_of_month) AS booking_fees_start_of_month
+ , MAX(subq_23.booking_fees) AS booking_fees
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_6.metric_time__day AS metric_time__day
- , subq_5.booking_fees_start_of_month AS booking_fees_start_of_month
+ subq_15.metric_time__day AS metric_time__day
+ , subq_14.booking_fees_start_of_month AS booking_fees_start_of_month
FROM (
-- Time Spine
SELECT
- subq_7.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_7
- ) subq_6
+ subq_16.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_16
+ ) subq_15
INNER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_4.metric_time__day
+ subq_13.metric_time__day
, booking_value * 0.05 AS booking_fees_start_of_month
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_3.metric_time__day
- , subq_3.booking_value
+ subq_12.metric_time__day
+ , subq_12.booking_value
FROM (
-- Aggregate Measures
SELECT
- subq_2.metric_time__day
- , SUM(subq_2.booking_value) AS booking_value
+ subq_11.metric_time__day
+ , SUM(subq_11.booking_value) AS booking_value
FROM (
-- Pass Only Elements: ['booking_value', 'metric_time__day']
SELECT
- subq_1.metric_time__day
- , subq_1.booking_value
+ subq_10.metric_time__day
+ , subq_10.booking_value
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
- ) subq_2
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
GROUP BY
- subq_2.metric_time__day
- ) subq_3
- ) subq_4
- ) subq_5
+ subq_11.metric_time__day
+ ) subq_12
+ ) subq_13
+ ) subq_14
ON
- DATE_TRUNC('month', subq_6.metric_time__day) = subq_5.metric_time__day
- ) subq_8
+ DATE_TRUNC('month', subq_15.metric_time__day) = subq_14.metric_time__day
+ ) subq_17
FULL OUTER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_13.metric_time__day
+ subq_22.metric_time__day
, booking_value * 0.05 AS booking_fees
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_12.metric_time__day
- , subq_12.booking_value
+ subq_21.metric_time__day
+ , subq_21.booking_value
FROM (
-- Aggregate Measures
SELECT
- subq_11.metric_time__day
- , SUM(subq_11.booking_value) AS booking_value
+ subq_20.metric_time__day
+ , SUM(subq_20.booking_value) AS booking_value
FROM (
-- Pass Only Elements: ['booking_value', 'metric_time__day']
SELECT
- subq_10.metric_time__day
- , subq_10.booking_value
+ subq_19.metric_time__day
+ , subq_19.booking_value
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_9.ds__day
- , subq_9.ds__week
- , subq_9.ds__month
- , subq_9.ds__quarter
- , subq_9.ds__year
- , subq_9.ds__extract_year
- , subq_9.ds__extract_quarter
- , subq_9.ds__extract_month
- , subq_9.ds__extract_day
- , subq_9.ds__extract_dow
- , subq_9.ds__extract_doy
- , subq_9.ds_partitioned__day
- , subq_9.ds_partitioned__week
- , subq_9.ds_partitioned__month
- , subq_9.ds_partitioned__quarter
- , subq_9.ds_partitioned__year
- , subq_9.ds_partitioned__extract_year
- , subq_9.ds_partitioned__extract_quarter
- , subq_9.ds_partitioned__extract_month
- , subq_9.ds_partitioned__extract_day
- , subq_9.ds_partitioned__extract_dow
- , subq_9.ds_partitioned__extract_doy
- , subq_9.paid_at__day
- , subq_9.paid_at__week
- , subq_9.paid_at__month
- , subq_9.paid_at__quarter
- , subq_9.paid_at__year
- , subq_9.paid_at__extract_year
- , subq_9.paid_at__extract_quarter
- , subq_9.paid_at__extract_month
- , subq_9.paid_at__extract_day
- , subq_9.paid_at__extract_dow
- , subq_9.paid_at__extract_doy
- , subq_9.booking__ds__day
- , subq_9.booking__ds__week
- , subq_9.booking__ds__month
- , subq_9.booking__ds__quarter
- , subq_9.booking__ds__year
- , subq_9.booking__ds__extract_year
- , subq_9.booking__ds__extract_quarter
- , subq_9.booking__ds__extract_month
- , subq_9.booking__ds__extract_day
- , subq_9.booking__ds__extract_dow
- , subq_9.booking__ds__extract_doy
- , subq_9.booking__ds_partitioned__day
- , subq_9.booking__ds_partitioned__week
- , subq_9.booking__ds_partitioned__month
- , subq_9.booking__ds_partitioned__quarter
- , subq_9.booking__ds_partitioned__year
- , subq_9.booking__ds_partitioned__extract_year
- , subq_9.booking__ds_partitioned__extract_quarter
- , subq_9.booking__ds_partitioned__extract_month
- , subq_9.booking__ds_partitioned__extract_day
- , subq_9.booking__ds_partitioned__extract_dow
- , subq_9.booking__ds_partitioned__extract_doy
- , subq_9.booking__paid_at__day
- , subq_9.booking__paid_at__week
- , subq_9.booking__paid_at__month
- , subq_9.booking__paid_at__quarter
- , subq_9.booking__paid_at__year
- , subq_9.booking__paid_at__extract_year
- , subq_9.booking__paid_at__extract_quarter
- , subq_9.booking__paid_at__extract_month
- , subq_9.booking__paid_at__extract_day
- , subq_9.booking__paid_at__extract_dow
- , subq_9.booking__paid_at__extract_doy
- , subq_9.ds__day AS metric_time__day
- , subq_9.ds__week AS metric_time__week
- , subq_9.ds__month AS metric_time__month
- , subq_9.ds__quarter AS metric_time__quarter
- , subq_9.ds__year AS metric_time__year
- , subq_9.ds__extract_year AS metric_time__extract_year
- , subq_9.ds__extract_quarter AS metric_time__extract_quarter
- , subq_9.ds__extract_month AS metric_time__extract_month
- , subq_9.ds__extract_day AS metric_time__extract_day
- , subq_9.ds__extract_dow AS metric_time__extract_dow
- , subq_9.ds__extract_doy AS metric_time__extract_doy
- , subq_9.listing
- , subq_9.guest
- , subq_9.host
- , subq_9.booking__listing
- , subq_9.booking__guest
- , subq_9.booking__host
- , subq_9.is_instant
- , subq_9.booking__is_instant
- , subq_9.bookings
- , subq_9.instant_bookings
- , subq_9.booking_value
- , subq_9.max_booking_value
- , subq_9.min_booking_value
- , subq_9.bookers
- , subq_9.average_booking_value
- , subq_9.referred_bookings
- , subq_9.median_booking_value
- , subq_9.booking_value_p99
- , subq_9.discrete_booking_value_p99
- , subq_9.approximate_continuous_booking_value_p99
- , subq_9.approximate_discrete_booking_value_p99
+ subq_18.ds__day
+ , subq_18.ds__week
+ , subq_18.ds__month
+ , subq_18.ds__quarter
+ , subq_18.ds__year
+ , subq_18.ds__extract_year
+ , subq_18.ds__extract_quarter
+ , subq_18.ds__extract_month
+ , subq_18.ds__extract_day
+ , subq_18.ds__extract_dow
+ , subq_18.ds__extract_doy
+ , subq_18.ds_partitioned__day
+ , subq_18.ds_partitioned__week
+ , subq_18.ds_partitioned__month
+ , subq_18.ds_partitioned__quarter
+ , subq_18.ds_partitioned__year
+ , subq_18.ds_partitioned__extract_year
+ , subq_18.ds_partitioned__extract_quarter
+ , subq_18.ds_partitioned__extract_month
+ , subq_18.ds_partitioned__extract_day
+ , subq_18.ds_partitioned__extract_dow
+ , subq_18.ds_partitioned__extract_doy
+ , subq_18.paid_at__day
+ , subq_18.paid_at__week
+ , subq_18.paid_at__month
+ , subq_18.paid_at__quarter
+ , subq_18.paid_at__year
+ , subq_18.paid_at__extract_year
+ , subq_18.paid_at__extract_quarter
+ , subq_18.paid_at__extract_month
+ , subq_18.paid_at__extract_day
+ , subq_18.paid_at__extract_dow
+ , subq_18.paid_at__extract_doy
+ , subq_18.booking__ds__day
+ , subq_18.booking__ds__week
+ , subq_18.booking__ds__month
+ , subq_18.booking__ds__quarter
+ , subq_18.booking__ds__year
+ , subq_18.booking__ds__extract_year
+ , subq_18.booking__ds__extract_quarter
+ , subq_18.booking__ds__extract_month
+ , subq_18.booking__ds__extract_day
+ , subq_18.booking__ds__extract_dow
+ , subq_18.booking__ds__extract_doy
+ , subq_18.booking__ds_partitioned__day
+ , subq_18.booking__ds_partitioned__week
+ , subq_18.booking__ds_partitioned__month
+ , subq_18.booking__ds_partitioned__quarter
+ , subq_18.booking__ds_partitioned__year
+ , subq_18.booking__ds_partitioned__extract_year
+ , subq_18.booking__ds_partitioned__extract_quarter
+ , subq_18.booking__ds_partitioned__extract_month
+ , subq_18.booking__ds_partitioned__extract_day
+ , subq_18.booking__ds_partitioned__extract_dow
+ , subq_18.booking__ds_partitioned__extract_doy
+ , subq_18.booking__paid_at__day
+ , subq_18.booking__paid_at__week
+ , subq_18.booking__paid_at__month
+ , subq_18.booking__paid_at__quarter
+ , subq_18.booking__paid_at__year
+ , subq_18.booking__paid_at__extract_year
+ , subq_18.booking__paid_at__extract_quarter
+ , subq_18.booking__paid_at__extract_month
+ , subq_18.booking__paid_at__extract_day
+ , subq_18.booking__paid_at__extract_dow
+ , subq_18.booking__paid_at__extract_doy
+ , subq_18.ds__day AS metric_time__day
+ , subq_18.ds__week AS metric_time__week
+ , subq_18.ds__month AS metric_time__month
+ , subq_18.ds__quarter AS metric_time__quarter
+ , subq_18.ds__year AS metric_time__year
+ , subq_18.ds__extract_year AS metric_time__extract_year
+ , subq_18.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_18.ds__extract_month AS metric_time__extract_month
+ , subq_18.ds__extract_day AS metric_time__extract_day
+ , subq_18.ds__extract_dow AS metric_time__extract_dow
+ , subq_18.ds__extract_doy AS metric_time__extract_doy
+ , subq_18.listing
+ , subq_18.guest
+ , subq_18.host
+ , subq_18.booking__listing
+ , subq_18.booking__guest
+ , subq_18.booking__host
+ , subq_18.is_instant
+ , subq_18.booking__is_instant
+ , subq_18.bookings
+ , subq_18.instant_bookings
+ , subq_18.booking_value
+ , subq_18.max_booking_value
+ , subq_18.min_booking_value
+ , subq_18.bookers
+ , subq_18.average_booking_value
+ , subq_18.referred_bookings
+ , subq_18.median_booking_value
+ , subq_18.booking_value_p99
+ , subq_18.discrete_booking_value_p99
+ , subq_18.approximate_continuous_booking_value_p99
+ , subq_18.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_9
- ) subq_10
- ) subq_11
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_18
+ ) subq_19
+ ) subq_20
GROUP BY
- subq_11.metric_time__day
- ) subq_12
- ) subq_13
- ) subq_14
+ subq_20.metric_time__day
+ ) subq_21
+ ) subq_22
+ ) subq_23
ON
- subq_8.metric_time__day = subq_14.metric_time__day
+ subq_17.metric_time__day = subq_23.metric_time__day
GROUP BY
- COALESCE(subq_8.metric_time__day, subq_14.metric_time__day)
-) subq_15
+ COALESCE(subq_17.metric_time__day, subq_23.metric_time__day)
+) subq_24
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0_optimized.sql
index fc648c54b6..b28105f311 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0_optimized.sql
@@ -5,15 +5,15 @@ SELECT
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_24.metric_time__day, subq_30.metric_time__day) AS metric_time__day
- , MAX(subq_24.booking_fees_start_of_month) AS booking_fees_start_of_month
- , MAX(subq_30.booking_fees) AS booking_fees
+ COALESCE(subq_33.metric_time__day, subq_39.metric_time__day) AS metric_time__day
+ , MAX(subq_33.booking_fees_start_of_month) AS booking_fees_start_of_month
+ , MAX(subq_39.booking_fees) AS booking_fees
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_23.ds AS metric_time__day
- , subq_21.booking_fees_start_of_month AS booking_fees_start_of_month
- FROM ***************************.mf_time_spine subq_23
+ subq_32.ds AS metric_time__day
+ , subq_30.booking_fees_start_of_month AS booking_fees_start_of_month
+ FROM ***************************.mf_time_spine subq_32
INNER JOIN (
-- Compute Metrics via Expressions
SELECT
@@ -28,14 +28,14 @@ FROM (
SELECT
DATE_TRUNC('day', ds) AS metric_time__day
, SUM(booking_value) AS booking_value
- FROM ***************************.fct_bookings bookings_source_src_28001
+ FROM ***************************.fct_bookings bookings_source_src_28000
GROUP BY
DATE_TRUNC('day', ds)
- ) subq_20
- ) subq_21
+ ) subq_29
+ ) subq_30
ON
- DATE_TRUNC('month', subq_23.ds) = subq_21.metric_time__day
- ) subq_24
+ DATE_TRUNC('month', subq_32.ds) = subq_30.metric_time__day
+ ) subq_33
FULL OUTER JOIN (
-- Compute Metrics via Expressions
SELECT
@@ -50,13 +50,13 @@ FROM (
SELECT
DATE_TRUNC('day', ds) AS metric_time__day
, SUM(booking_value) AS booking_value
- FROM ***************************.fct_bookings bookings_source_src_28001
+ FROM ***************************.fct_bookings bookings_source_src_28000
GROUP BY
DATE_TRUNC('day', ds)
- ) subq_29
- ) subq_30
+ ) subq_38
+ ) subq_39
ON
- subq_24.metric_time__day = subq_30.metric_time__day
+ subq_33.metric_time__day = subq_39.metric_time__day
GROUP BY
- COALESCE(subq_24.metric_time__day, subq_30.metric_time__day)
-) subq_31
+ COALESCE(subq_33.metric_time__day, subq_39.metric_time__day)
+) subq_40
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_filters__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_filters__plan0.sql
index 25419e889e..dd594f7ee4 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_filters__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_filters__plan0.sql
@@ -8,991 +8,991 @@ FROM (
FROM (
-- Combine Aggregated Outputs
SELECT
- MAX(subq_11.average_booking_value) AS average_booking_value
- , MAX(subq_23.bookings) AS bookings
- , MAX(subq_30.booking_value) AS booking_value
+ MAX(subq_20.average_booking_value) AS average_booking_value
+ , MAX(subq_32.bookings) AS bookings
+ , MAX(subq_39.booking_value) AS booking_value
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_10.average_booking_value
+ subq_19.average_booking_value
FROM (
-- Aggregate Measures
SELECT
- AVG(subq_9.average_booking_value) AS average_booking_value
+ AVG(subq_18.average_booking_value) AS average_booking_value
FROM (
-- Pass Only Elements: ['average_booking_value',]
SELECT
- subq_8.average_booking_value
+ subq_17.average_booking_value
FROM (
-- Constrain Output with WHERE
SELECT
- subq_7.booking__is_instant
- , subq_7.listing__is_lux_latest
- , subq_7.average_booking_value
+ subq_16.booking__is_instant
+ , subq_16.listing__is_lux_latest
+ , subq_16.average_booking_value
FROM (
-- Pass Only Elements: ['average_booking_value', 'listing__is_lux_latest', 'booking__is_instant']
SELECT
- subq_6.booking__is_instant
- , subq_6.listing__is_lux_latest
- , subq_6.average_booking_value
+ subq_15.booking__is_instant
+ , subq_15.listing__is_lux_latest
+ , subq_15.average_booking_value
FROM (
-- Join Standard Outputs
SELECT
- subq_2.listing AS listing
- , subq_2.booking__is_instant AS booking__is_instant
- , subq_5.is_lux_latest AS listing__is_lux_latest
- , subq_2.average_booking_value AS average_booking_value
+ subq_11.listing AS listing
+ , subq_11.booking__is_instant AS booking__is_instant
+ , subq_14.is_lux_latest AS listing__is_lux_latest
+ , subq_11.average_booking_value AS average_booking_value
FROM (
-- Pass Only Elements: ['average_booking_value', 'booking__is_instant', 'listing']
SELECT
- subq_1.listing
- , subq_1.booking__is_instant
- , subq_1.average_booking_value
+ subq_10.listing
+ , subq_10.booking__is_instant
+ , subq_10.average_booking_value
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
- ) subq_2
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
LEFT OUTER JOIN (
-- Pass Only Elements: ['is_lux_latest', 'listing']
SELECT
- subq_4.listing
- , subq_4.is_lux_latest
+ subq_13.listing
+ , subq_13.is_lux_latest
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_3.ds__day
- , subq_3.ds__week
- , subq_3.ds__month
- , subq_3.ds__quarter
- , subq_3.ds__year
- , subq_3.ds__extract_year
- , subq_3.ds__extract_quarter
- , subq_3.ds__extract_month
- , subq_3.ds__extract_day
- , subq_3.ds__extract_dow
- , subq_3.ds__extract_doy
- , subq_3.created_at__day
- , subq_3.created_at__week
- , subq_3.created_at__month
- , subq_3.created_at__quarter
- , subq_3.created_at__year
- , subq_3.created_at__extract_year
- , subq_3.created_at__extract_quarter
- , subq_3.created_at__extract_month
- , subq_3.created_at__extract_day
- , subq_3.created_at__extract_dow
- , subq_3.created_at__extract_doy
- , subq_3.listing__ds__day
- , subq_3.listing__ds__week
- , subq_3.listing__ds__month
- , subq_3.listing__ds__quarter
- , subq_3.listing__ds__year
- , subq_3.listing__ds__extract_year
- , subq_3.listing__ds__extract_quarter
- , subq_3.listing__ds__extract_month
- , subq_3.listing__ds__extract_day
- , subq_3.listing__ds__extract_dow
- , subq_3.listing__ds__extract_doy
- , subq_3.listing__created_at__day
- , subq_3.listing__created_at__week
- , subq_3.listing__created_at__month
- , subq_3.listing__created_at__quarter
- , subq_3.listing__created_at__year
- , subq_3.listing__created_at__extract_year
- , subq_3.listing__created_at__extract_quarter
- , subq_3.listing__created_at__extract_month
- , subq_3.listing__created_at__extract_day
- , subq_3.listing__created_at__extract_dow
- , subq_3.listing__created_at__extract_doy
- , subq_3.ds__day AS metric_time__day
- , subq_3.ds__week AS metric_time__week
- , subq_3.ds__month AS metric_time__month
- , subq_3.ds__quarter AS metric_time__quarter
- , subq_3.ds__year AS metric_time__year
- , subq_3.ds__extract_year AS metric_time__extract_year
- , subq_3.ds__extract_quarter AS metric_time__extract_quarter
- , subq_3.ds__extract_month AS metric_time__extract_month
- , subq_3.ds__extract_day AS metric_time__extract_day
- , subq_3.ds__extract_dow AS metric_time__extract_dow
- , subq_3.ds__extract_doy AS metric_time__extract_doy
- , subq_3.listing
- , subq_3.user
- , subq_3.listing__user
- , subq_3.country_latest
- , subq_3.is_lux_latest
- , subq_3.capacity_latest
- , subq_3.listing__country_latest
- , subq_3.listing__is_lux_latest
- , subq_3.listing__capacity_latest
- , subq_3.listings
- , subq_3.largest_listing
- , subq_3.smallest_listing
+ subq_12.ds__day
+ , subq_12.ds__week
+ , subq_12.ds__month
+ , subq_12.ds__quarter
+ , subq_12.ds__year
+ , subq_12.ds__extract_year
+ , subq_12.ds__extract_quarter
+ , subq_12.ds__extract_month
+ , subq_12.ds__extract_day
+ , subq_12.ds__extract_dow
+ , subq_12.ds__extract_doy
+ , subq_12.created_at__day
+ , subq_12.created_at__week
+ , subq_12.created_at__month
+ , subq_12.created_at__quarter
+ , subq_12.created_at__year
+ , subq_12.created_at__extract_year
+ , subq_12.created_at__extract_quarter
+ , subq_12.created_at__extract_month
+ , subq_12.created_at__extract_day
+ , subq_12.created_at__extract_dow
+ , subq_12.created_at__extract_doy
+ , subq_12.listing__ds__day
+ , subq_12.listing__ds__week
+ , subq_12.listing__ds__month
+ , subq_12.listing__ds__quarter
+ , subq_12.listing__ds__year
+ , subq_12.listing__ds__extract_year
+ , subq_12.listing__ds__extract_quarter
+ , subq_12.listing__ds__extract_month
+ , subq_12.listing__ds__extract_day
+ , subq_12.listing__ds__extract_dow
+ , subq_12.listing__ds__extract_doy
+ , subq_12.listing__created_at__day
+ , subq_12.listing__created_at__week
+ , subq_12.listing__created_at__month
+ , subq_12.listing__created_at__quarter
+ , subq_12.listing__created_at__year
+ , subq_12.listing__created_at__extract_year
+ , subq_12.listing__created_at__extract_quarter
+ , subq_12.listing__created_at__extract_month
+ , subq_12.listing__created_at__extract_day
+ , subq_12.listing__created_at__extract_dow
+ , subq_12.listing__created_at__extract_doy
+ , subq_12.ds__day AS metric_time__day
+ , subq_12.ds__week AS metric_time__week
+ , subq_12.ds__month AS metric_time__month
+ , subq_12.ds__quarter AS metric_time__quarter
+ , subq_12.ds__year AS metric_time__year
+ , subq_12.ds__extract_year AS metric_time__extract_year
+ , subq_12.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_12.ds__extract_month AS metric_time__extract_month
+ , subq_12.ds__extract_day AS metric_time__extract_day
+ , subq_12.ds__extract_dow AS metric_time__extract_dow
+ , subq_12.ds__extract_doy AS metric_time__extract_doy
+ , subq_12.listing
+ , subq_12.user
+ , subq_12.listing__user
+ , subq_12.country_latest
+ , subq_12.is_lux_latest
+ , subq_12.capacity_latest
+ , subq_12.listing__country_latest
+ , subq_12.listing__is_lux_latest
+ , subq_12.listing__capacity_latest
+ , subq_12.listings
+ , subq_12.largest_listing
+ , subq_12.smallest_listing
FROM (
-- Read Elements From Semantic Model 'listings_latest'
SELECT
1 AS listings
- , listings_latest_src_28005.capacity AS largest_listing
- , listings_latest_src_28005.capacity AS smallest_listing
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy
- , listings_latest_src_28005.country AS country_latest
- , listings_latest_src_28005.is_lux AS is_lux_latest
- , listings_latest_src_28005.capacity AS capacity_latest
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy
- , listings_latest_src_28005.country AS listing__country_latest
- , listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , listings_latest_src_28005.capacity AS listing__capacity_latest
- , listings_latest_src_28005.listing_id AS listing
- , listings_latest_src_28005.user_id AS user
- , listings_latest_src_28005.user_id AS listing__user
- FROM ***************************.dim_listings_latest listings_latest_src_28005
- ) subq_3
- ) subq_4
- ) subq_5
+ , listings_latest_src_28000.capacity AS largest_listing
+ , listings_latest_src_28000.capacity AS smallest_listing
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS created_at__extract_day
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS created_at__extract_doy
+ , 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('day', listings_latest_src_28000.created_at) AS listing__ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS listing__ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS listing__created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_day
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_doy
+ , listings_latest_src_28000.country AS listing__country_latest
+ , listings_latest_src_28000.is_lux AS listing__is_lux_latest
+ , listings_latest_src_28000.capacity AS listing__capacity_latest
+ , listings_latest_src_28000.listing_id AS listing
+ , listings_latest_src_28000.user_id AS user
+ , listings_latest_src_28000.user_id AS listing__user
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
+ ) subq_12
+ ) subq_13
+ ) subq_14
ON
- subq_2.listing = subq_5.listing
- ) subq_6
- ) subq_7
+ subq_11.listing = subq_14.listing
+ ) subq_15
+ ) subq_16
WHERE (listing__is_lux_latest) AND (booking__is_instant)
- ) subq_8
- ) subq_9
- ) subq_10
- ) subq_11
+ ) subq_17
+ ) subq_18
+ ) subq_19
+ ) subq_20
CROSS JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_22.bookings
+ subq_31.bookings
FROM (
-- Aggregate Measures
SELECT
- SUM(subq_21.bookings) AS bookings
+ SUM(subq_30.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings',]
SELECT
- subq_20.bookings
+ subq_29.bookings
FROM (
-- Constrain Output with WHERE
SELECT
- subq_19.booking__is_instant
- , subq_19.listing__is_lux_latest
- , subq_19.bookings
+ subq_28.booking__is_instant
+ , subq_28.listing__is_lux_latest
+ , subq_28.bookings
FROM (
-- Pass Only Elements: ['bookings', 'listing__is_lux_latest', 'booking__is_instant']
SELECT
- subq_18.booking__is_instant
- , subq_18.listing__is_lux_latest
- , subq_18.bookings
+ subq_27.booking__is_instant
+ , subq_27.listing__is_lux_latest
+ , subq_27.bookings
FROM (
-- Join Standard Outputs
SELECT
- subq_14.listing AS listing
- , subq_14.booking__is_instant AS booking__is_instant
- , subq_17.is_lux_latest AS listing__is_lux_latest
- , subq_14.bookings AS bookings
+ subq_23.listing AS listing
+ , subq_23.booking__is_instant AS booking__is_instant
+ , subq_26.is_lux_latest AS listing__is_lux_latest
+ , subq_23.bookings AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'booking__is_instant', 'listing']
SELECT
- subq_13.listing
- , subq_13.booking__is_instant
- , subq_13.bookings
+ subq_22.listing
+ , subq_22.booking__is_instant
+ , subq_22.bookings
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_12.ds__day
- , subq_12.ds__week
- , subq_12.ds__month
- , subq_12.ds__quarter
- , subq_12.ds__year
- , subq_12.ds__extract_year
- , subq_12.ds__extract_quarter
- , subq_12.ds__extract_month
- , subq_12.ds__extract_day
- , subq_12.ds__extract_dow
- , subq_12.ds__extract_doy
- , subq_12.ds_partitioned__day
- , subq_12.ds_partitioned__week
- , subq_12.ds_partitioned__month
- , subq_12.ds_partitioned__quarter
- , subq_12.ds_partitioned__year
- , subq_12.ds_partitioned__extract_year
- , subq_12.ds_partitioned__extract_quarter
- , subq_12.ds_partitioned__extract_month
- , subq_12.ds_partitioned__extract_day
- , subq_12.ds_partitioned__extract_dow
- , subq_12.ds_partitioned__extract_doy
- , subq_12.paid_at__day
- , subq_12.paid_at__week
- , subq_12.paid_at__month
- , subq_12.paid_at__quarter
- , subq_12.paid_at__year
- , subq_12.paid_at__extract_year
- , subq_12.paid_at__extract_quarter
- , subq_12.paid_at__extract_month
- , subq_12.paid_at__extract_day
- , subq_12.paid_at__extract_dow
- , subq_12.paid_at__extract_doy
- , subq_12.booking__ds__day
- , subq_12.booking__ds__week
- , subq_12.booking__ds__month
- , subq_12.booking__ds__quarter
- , subq_12.booking__ds__year
- , subq_12.booking__ds__extract_year
- , subq_12.booking__ds__extract_quarter
- , subq_12.booking__ds__extract_month
- , subq_12.booking__ds__extract_day
- , subq_12.booking__ds__extract_dow
- , subq_12.booking__ds__extract_doy
- , subq_12.booking__ds_partitioned__day
- , subq_12.booking__ds_partitioned__week
- , subq_12.booking__ds_partitioned__month
- , subq_12.booking__ds_partitioned__quarter
- , subq_12.booking__ds_partitioned__year
- , subq_12.booking__ds_partitioned__extract_year
- , subq_12.booking__ds_partitioned__extract_quarter
- , subq_12.booking__ds_partitioned__extract_month
- , subq_12.booking__ds_partitioned__extract_day
- , subq_12.booking__ds_partitioned__extract_dow
- , subq_12.booking__ds_partitioned__extract_doy
- , subq_12.booking__paid_at__day
- , subq_12.booking__paid_at__week
- , subq_12.booking__paid_at__month
- , subq_12.booking__paid_at__quarter
- , subq_12.booking__paid_at__year
- , subq_12.booking__paid_at__extract_year
- , subq_12.booking__paid_at__extract_quarter
- , subq_12.booking__paid_at__extract_month
- , subq_12.booking__paid_at__extract_day
- , subq_12.booking__paid_at__extract_dow
- , subq_12.booking__paid_at__extract_doy
- , subq_12.ds__day AS metric_time__day
- , subq_12.ds__week AS metric_time__week
- , subq_12.ds__month AS metric_time__month
- , subq_12.ds__quarter AS metric_time__quarter
- , subq_12.ds__year AS metric_time__year
- , subq_12.ds__extract_year AS metric_time__extract_year
- , subq_12.ds__extract_quarter AS metric_time__extract_quarter
- , subq_12.ds__extract_month AS metric_time__extract_month
- , subq_12.ds__extract_day AS metric_time__extract_day
- , subq_12.ds__extract_dow AS metric_time__extract_dow
- , subq_12.ds__extract_doy AS metric_time__extract_doy
- , subq_12.listing
- , subq_12.guest
- , subq_12.host
- , subq_12.booking__listing
- , subq_12.booking__guest
- , subq_12.booking__host
- , subq_12.is_instant
- , subq_12.booking__is_instant
- , subq_12.bookings
- , subq_12.instant_bookings
- , subq_12.booking_value
- , subq_12.max_booking_value
- , subq_12.min_booking_value
- , subq_12.bookers
- , subq_12.average_booking_value
- , subq_12.referred_bookings
- , subq_12.median_booking_value
- , subq_12.booking_value_p99
- , subq_12.discrete_booking_value_p99
- , subq_12.approximate_continuous_booking_value_p99
- , subq_12.approximate_discrete_booking_value_p99
+ subq_21.ds__day
+ , subq_21.ds__week
+ , subq_21.ds__month
+ , subq_21.ds__quarter
+ , subq_21.ds__year
+ , subq_21.ds__extract_year
+ , subq_21.ds__extract_quarter
+ , subq_21.ds__extract_month
+ , subq_21.ds__extract_day
+ , subq_21.ds__extract_dow
+ , subq_21.ds__extract_doy
+ , subq_21.ds_partitioned__day
+ , subq_21.ds_partitioned__week
+ , subq_21.ds_partitioned__month
+ , subq_21.ds_partitioned__quarter
+ , subq_21.ds_partitioned__year
+ , subq_21.ds_partitioned__extract_year
+ , subq_21.ds_partitioned__extract_quarter
+ , subq_21.ds_partitioned__extract_month
+ , subq_21.ds_partitioned__extract_day
+ , subq_21.ds_partitioned__extract_dow
+ , subq_21.ds_partitioned__extract_doy
+ , subq_21.paid_at__day
+ , subq_21.paid_at__week
+ , subq_21.paid_at__month
+ , subq_21.paid_at__quarter
+ , subq_21.paid_at__year
+ , subq_21.paid_at__extract_year
+ , subq_21.paid_at__extract_quarter
+ , subq_21.paid_at__extract_month
+ , subq_21.paid_at__extract_day
+ , subq_21.paid_at__extract_dow
+ , subq_21.paid_at__extract_doy
+ , subq_21.booking__ds__day
+ , subq_21.booking__ds__week
+ , subq_21.booking__ds__month
+ , subq_21.booking__ds__quarter
+ , subq_21.booking__ds__year
+ , subq_21.booking__ds__extract_year
+ , subq_21.booking__ds__extract_quarter
+ , subq_21.booking__ds__extract_month
+ , subq_21.booking__ds__extract_day
+ , subq_21.booking__ds__extract_dow
+ , subq_21.booking__ds__extract_doy
+ , subq_21.booking__ds_partitioned__day
+ , subq_21.booking__ds_partitioned__week
+ , subq_21.booking__ds_partitioned__month
+ , subq_21.booking__ds_partitioned__quarter
+ , subq_21.booking__ds_partitioned__year
+ , subq_21.booking__ds_partitioned__extract_year
+ , subq_21.booking__ds_partitioned__extract_quarter
+ , subq_21.booking__ds_partitioned__extract_month
+ , subq_21.booking__ds_partitioned__extract_day
+ , subq_21.booking__ds_partitioned__extract_dow
+ , subq_21.booking__ds_partitioned__extract_doy
+ , subq_21.booking__paid_at__day
+ , subq_21.booking__paid_at__week
+ , subq_21.booking__paid_at__month
+ , subq_21.booking__paid_at__quarter
+ , subq_21.booking__paid_at__year
+ , subq_21.booking__paid_at__extract_year
+ , subq_21.booking__paid_at__extract_quarter
+ , subq_21.booking__paid_at__extract_month
+ , subq_21.booking__paid_at__extract_day
+ , subq_21.booking__paid_at__extract_dow
+ , subq_21.booking__paid_at__extract_doy
+ , subq_21.ds__day AS metric_time__day
+ , subq_21.ds__week AS metric_time__week
+ , subq_21.ds__month AS metric_time__month
+ , subq_21.ds__quarter AS metric_time__quarter
+ , subq_21.ds__year AS metric_time__year
+ , subq_21.ds__extract_year AS metric_time__extract_year
+ , subq_21.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_21.ds__extract_month AS metric_time__extract_month
+ , subq_21.ds__extract_day AS metric_time__extract_day
+ , subq_21.ds__extract_dow AS metric_time__extract_dow
+ , subq_21.ds__extract_doy AS metric_time__extract_doy
+ , subq_21.listing
+ , subq_21.guest
+ , subq_21.host
+ , subq_21.booking__listing
+ , subq_21.booking__guest
+ , subq_21.booking__host
+ , subq_21.is_instant
+ , subq_21.booking__is_instant
+ , subq_21.bookings
+ , subq_21.instant_bookings
+ , subq_21.booking_value
+ , subq_21.max_booking_value
+ , subq_21.min_booking_value
+ , subq_21.bookers
+ , subq_21.average_booking_value
+ , subq_21.referred_bookings
+ , subq_21.median_booking_value
+ , subq_21.booking_value_p99
+ , subq_21.discrete_booking_value_p99
+ , subq_21.approximate_continuous_booking_value_p99
+ , subq_21.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_12
- ) subq_13
- ) subq_14
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_21
+ ) subq_22
+ ) subq_23
LEFT OUTER JOIN (
-- Pass Only Elements: ['is_lux_latest', 'listing']
SELECT
- subq_16.listing
- , subq_16.is_lux_latest
+ subq_25.listing
+ , subq_25.is_lux_latest
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_15.ds__day
- , subq_15.ds__week
- , subq_15.ds__month
- , subq_15.ds__quarter
- , subq_15.ds__year
- , subq_15.ds__extract_year
- , subq_15.ds__extract_quarter
- , subq_15.ds__extract_month
- , subq_15.ds__extract_day
- , subq_15.ds__extract_dow
- , subq_15.ds__extract_doy
- , subq_15.created_at__day
- , subq_15.created_at__week
- , subq_15.created_at__month
- , subq_15.created_at__quarter
- , subq_15.created_at__year
- , subq_15.created_at__extract_year
- , subq_15.created_at__extract_quarter
- , subq_15.created_at__extract_month
- , subq_15.created_at__extract_day
- , subq_15.created_at__extract_dow
- , subq_15.created_at__extract_doy
- , subq_15.listing__ds__day
- , subq_15.listing__ds__week
- , subq_15.listing__ds__month
- , subq_15.listing__ds__quarter
- , subq_15.listing__ds__year
- , subq_15.listing__ds__extract_year
- , subq_15.listing__ds__extract_quarter
- , subq_15.listing__ds__extract_month
- , subq_15.listing__ds__extract_day
- , subq_15.listing__ds__extract_dow
- , subq_15.listing__ds__extract_doy
- , subq_15.listing__created_at__day
- , subq_15.listing__created_at__week
- , subq_15.listing__created_at__month
- , subq_15.listing__created_at__quarter
- , subq_15.listing__created_at__year
- , subq_15.listing__created_at__extract_year
- , subq_15.listing__created_at__extract_quarter
- , subq_15.listing__created_at__extract_month
- , subq_15.listing__created_at__extract_day
- , subq_15.listing__created_at__extract_dow
- , subq_15.listing__created_at__extract_doy
- , subq_15.ds__day AS metric_time__day
- , subq_15.ds__week AS metric_time__week
- , subq_15.ds__month AS metric_time__month
- , subq_15.ds__quarter AS metric_time__quarter
- , subq_15.ds__year AS metric_time__year
- , subq_15.ds__extract_year AS metric_time__extract_year
- , subq_15.ds__extract_quarter AS metric_time__extract_quarter
- , subq_15.ds__extract_month AS metric_time__extract_month
- , subq_15.ds__extract_day AS metric_time__extract_day
- , subq_15.ds__extract_dow AS metric_time__extract_dow
- , subq_15.ds__extract_doy AS metric_time__extract_doy
- , subq_15.listing
- , subq_15.user
- , subq_15.listing__user
- , subq_15.country_latest
- , subq_15.is_lux_latest
- , subq_15.capacity_latest
- , subq_15.listing__country_latest
- , subq_15.listing__is_lux_latest
- , subq_15.listing__capacity_latest
- , subq_15.listings
- , subq_15.largest_listing
- , subq_15.smallest_listing
+ subq_24.ds__day
+ , subq_24.ds__week
+ , subq_24.ds__month
+ , subq_24.ds__quarter
+ , subq_24.ds__year
+ , subq_24.ds__extract_year
+ , subq_24.ds__extract_quarter
+ , subq_24.ds__extract_month
+ , subq_24.ds__extract_day
+ , subq_24.ds__extract_dow
+ , subq_24.ds__extract_doy
+ , subq_24.created_at__day
+ , subq_24.created_at__week
+ , subq_24.created_at__month
+ , subq_24.created_at__quarter
+ , subq_24.created_at__year
+ , subq_24.created_at__extract_year
+ , subq_24.created_at__extract_quarter
+ , subq_24.created_at__extract_month
+ , subq_24.created_at__extract_day
+ , subq_24.created_at__extract_dow
+ , subq_24.created_at__extract_doy
+ , subq_24.listing__ds__day
+ , subq_24.listing__ds__week
+ , subq_24.listing__ds__month
+ , subq_24.listing__ds__quarter
+ , subq_24.listing__ds__year
+ , subq_24.listing__ds__extract_year
+ , subq_24.listing__ds__extract_quarter
+ , subq_24.listing__ds__extract_month
+ , subq_24.listing__ds__extract_day
+ , subq_24.listing__ds__extract_dow
+ , subq_24.listing__ds__extract_doy
+ , subq_24.listing__created_at__day
+ , subq_24.listing__created_at__week
+ , subq_24.listing__created_at__month
+ , subq_24.listing__created_at__quarter
+ , subq_24.listing__created_at__year
+ , subq_24.listing__created_at__extract_year
+ , subq_24.listing__created_at__extract_quarter
+ , subq_24.listing__created_at__extract_month
+ , subq_24.listing__created_at__extract_day
+ , subq_24.listing__created_at__extract_dow
+ , subq_24.listing__created_at__extract_doy
+ , subq_24.ds__day AS metric_time__day
+ , subq_24.ds__week AS metric_time__week
+ , subq_24.ds__month AS metric_time__month
+ , subq_24.ds__quarter AS metric_time__quarter
+ , subq_24.ds__year AS metric_time__year
+ , subq_24.ds__extract_year AS metric_time__extract_year
+ , subq_24.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_24.ds__extract_month AS metric_time__extract_month
+ , subq_24.ds__extract_day AS metric_time__extract_day
+ , subq_24.ds__extract_dow AS metric_time__extract_dow
+ , subq_24.ds__extract_doy AS metric_time__extract_doy
+ , subq_24.listing
+ , subq_24.user
+ , subq_24.listing__user
+ , subq_24.country_latest
+ , subq_24.is_lux_latest
+ , subq_24.capacity_latest
+ , subq_24.listing__country_latest
+ , subq_24.listing__is_lux_latest
+ , subq_24.listing__capacity_latest
+ , subq_24.listings
+ , subq_24.largest_listing
+ , subq_24.smallest_listing
FROM (
-- Read Elements From Semantic Model 'listings_latest'
SELECT
1 AS listings
- , listings_latest_src_28005.capacity AS largest_listing
- , listings_latest_src_28005.capacity AS smallest_listing
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy
- , listings_latest_src_28005.country AS country_latest
- , listings_latest_src_28005.is_lux AS is_lux_latest
- , listings_latest_src_28005.capacity AS capacity_latest
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy
- , listings_latest_src_28005.country AS listing__country_latest
- , listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , listings_latest_src_28005.capacity AS listing__capacity_latest
- , listings_latest_src_28005.listing_id AS listing
- , listings_latest_src_28005.user_id AS user
- , listings_latest_src_28005.user_id AS listing__user
- FROM ***************************.dim_listings_latest listings_latest_src_28005
- ) subq_15
- ) subq_16
- ) subq_17
+ , listings_latest_src_28000.capacity AS largest_listing
+ , listings_latest_src_28000.capacity AS smallest_listing
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS created_at__extract_day
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS created_at__extract_doy
+ , 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('day', listings_latest_src_28000.created_at) AS listing__ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS listing__ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS listing__created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_day
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_doy
+ , listings_latest_src_28000.country AS listing__country_latest
+ , listings_latest_src_28000.is_lux AS listing__is_lux_latest
+ , listings_latest_src_28000.capacity AS listing__capacity_latest
+ , listings_latest_src_28000.listing_id AS listing
+ , listings_latest_src_28000.user_id AS user
+ , listings_latest_src_28000.user_id AS listing__user
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
+ ) subq_24
+ ) subq_25
+ ) subq_26
ON
- subq_14.listing = subq_17.listing
- ) subq_18
- ) subq_19
+ subq_23.listing = subq_26.listing
+ ) subq_27
+ ) subq_28
WHERE (listing__is_lux_latest) AND (booking__is_instant)
- ) subq_20
- ) subq_21
- ) subq_22
- ) subq_23
+ ) subq_29
+ ) subq_30
+ ) subq_31
+ ) subq_32
CROSS JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_29.booking_value
+ subq_38.booking_value
FROM (
-- Aggregate Measures
SELECT
- SUM(subq_28.booking_value) AS booking_value
+ SUM(subq_37.booking_value) AS booking_value
FROM (
-- Pass Only Elements: ['booking_value',]
SELECT
- subq_27.booking_value
+ subq_36.booking_value
FROM (
-- Constrain Output with WHERE
SELECT
- subq_26.booking__is_instant
- , subq_26.booking_value
+ subq_35.booking__is_instant
+ , subq_35.booking_value
FROM (
-- Pass Only Elements: ['booking_value', 'booking__is_instant']
SELECT
- subq_25.booking__is_instant
- , subq_25.booking_value
+ subq_34.booking__is_instant
+ , subq_34.booking_value
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_24.ds__day
- , subq_24.ds__week
- , subq_24.ds__month
- , subq_24.ds__quarter
- , subq_24.ds__year
- , subq_24.ds__extract_year
- , subq_24.ds__extract_quarter
- , subq_24.ds__extract_month
- , subq_24.ds__extract_day
- , subq_24.ds__extract_dow
- , subq_24.ds__extract_doy
- , subq_24.ds_partitioned__day
- , subq_24.ds_partitioned__week
- , subq_24.ds_partitioned__month
- , subq_24.ds_partitioned__quarter
- , subq_24.ds_partitioned__year
- , subq_24.ds_partitioned__extract_year
- , subq_24.ds_partitioned__extract_quarter
- , subq_24.ds_partitioned__extract_month
- , subq_24.ds_partitioned__extract_day
- , subq_24.ds_partitioned__extract_dow
- , subq_24.ds_partitioned__extract_doy
- , subq_24.paid_at__day
- , subq_24.paid_at__week
- , subq_24.paid_at__month
- , subq_24.paid_at__quarter
- , subq_24.paid_at__year
- , subq_24.paid_at__extract_year
- , subq_24.paid_at__extract_quarter
- , subq_24.paid_at__extract_month
- , subq_24.paid_at__extract_day
- , subq_24.paid_at__extract_dow
- , subq_24.paid_at__extract_doy
- , subq_24.booking__ds__day
- , subq_24.booking__ds__week
- , subq_24.booking__ds__month
- , subq_24.booking__ds__quarter
- , subq_24.booking__ds__year
- , subq_24.booking__ds__extract_year
- , subq_24.booking__ds__extract_quarter
- , subq_24.booking__ds__extract_month
- , subq_24.booking__ds__extract_day
- , subq_24.booking__ds__extract_dow
- , subq_24.booking__ds__extract_doy
- , subq_24.booking__ds_partitioned__day
- , subq_24.booking__ds_partitioned__week
- , subq_24.booking__ds_partitioned__month
- , subq_24.booking__ds_partitioned__quarter
- , subq_24.booking__ds_partitioned__year
- , subq_24.booking__ds_partitioned__extract_year
- , subq_24.booking__ds_partitioned__extract_quarter
- , subq_24.booking__ds_partitioned__extract_month
- , subq_24.booking__ds_partitioned__extract_day
- , subq_24.booking__ds_partitioned__extract_dow
- , subq_24.booking__ds_partitioned__extract_doy
- , subq_24.booking__paid_at__day
- , subq_24.booking__paid_at__week
- , subq_24.booking__paid_at__month
- , subq_24.booking__paid_at__quarter
- , subq_24.booking__paid_at__year
- , subq_24.booking__paid_at__extract_year
- , subq_24.booking__paid_at__extract_quarter
- , subq_24.booking__paid_at__extract_month
- , subq_24.booking__paid_at__extract_day
- , subq_24.booking__paid_at__extract_dow
- , subq_24.booking__paid_at__extract_doy
- , subq_24.ds__day AS metric_time__day
- , subq_24.ds__week AS metric_time__week
- , subq_24.ds__month AS metric_time__month
- , subq_24.ds__quarter AS metric_time__quarter
- , subq_24.ds__year AS metric_time__year
- , subq_24.ds__extract_year AS metric_time__extract_year
- , subq_24.ds__extract_quarter AS metric_time__extract_quarter
- , subq_24.ds__extract_month AS metric_time__extract_month
- , subq_24.ds__extract_day AS metric_time__extract_day
- , subq_24.ds__extract_dow AS metric_time__extract_dow
- , subq_24.ds__extract_doy AS metric_time__extract_doy
- , subq_24.listing
- , subq_24.guest
- , subq_24.host
- , subq_24.booking__listing
- , subq_24.booking__guest
- , subq_24.booking__host
- , subq_24.is_instant
- , subq_24.booking__is_instant
- , subq_24.bookings
- , subq_24.instant_bookings
- , subq_24.booking_value
- , subq_24.max_booking_value
- , subq_24.min_booking_value
- , subq_24.bookers
- , subq_24.average_booking_value
- , subq_24.referred_bookings
- , subq_24.median_booking_value
- , subq_24.booking_value_p99
- , subq_24.discrete_booking_value_p99
- , subq_24.approximate_continuous_booking_value_p99
- , subq_24.approximate_discrete_booking_value_p99
+ subq_33.ds__day
+ , subq_33.ds__week
+ , subq_33.ds__month
+ , subq_33.ds__quarter
+ , subq_33.ds__year
+ , subq_33.ds__extract_year
+ , subq_33.ds__extract_quarter
+ , subq_33.ds__extract_month
+ , subq_33.ds__extract_day
+ , subq_33.ds__extract_dow
+ , subq_33.ds__extract_doy
+ , subq_33.ds_partitioned__day
+ , subq_33.ds_partitioned__week
+ , subq_33.ds_partitioned__month
+ , subq_33.ds_partitioned__quarter
+ , subq_33.ds_partitioned__year
+ , subq_33.ds_partitioned__extract_year
+ , subq_33.ds_partitioned__extract_quarter
+ , subq_33.ds_partitioned__extract_month
+ , subq_33.ds_partitioned__extract_day
+ , subq_33.ds_partitioned__extract_dow
+ , subq_33.ds_partitioned__extract_doy
+ , subq_33.paid_at__day
+ , subq_33.paid_at__week
+ , subq_33.paid_at__month
+ , subq_33.paid_at__quarter
+ , subq_33.paid_at__year
+ , subq_33.paid_at__extract_year
+ , subq_33.paid_at__extract_quarter
+ , subq_33.paid_at__extract_month
+ , subq_33.paid_at__extract_day
+ , subq_33.paid_at__extract_dow
+ , subq_33.paid_at__extract_doy
+ , subq_33.booking__ds__day
+ , subq_33.booking__ds__week
+ , subq_33.booking__ds__month
+ , subq_33.booking__ds__quarter
+ , subq_33.booking__ds__year
+ , subq_33.booking__ds__extract_year
+ , subq_33.booking__ds__extract_quarter
+ , subq_33.booking__ds__extract_month
+ , subq_33.booking__ds__extract_day
+ , subq_33.booking__ds__extract_dow
+ , subq_33.booking__ds__extract_doy
+ , subq_33.booking__ds_partitioned__day
+ , subq_33.booking__ds_partitioned__week
+ , subq_33.booking__ds_partitioned__month
+ , subq_33.booking__ds_partitioned__quarter
+ , subq_33.booking__ds_partitioned__year
+ , subq_33.booking__ds_partitioned__extract_year
+ , subq_33.booking__ds_partitioned__extract_quarter
+ , subq_33.booking__ds_partitioned__extract_month
+ , subq_33.booking__ds_partitioned__extract_day
+ , subq_33.booking__ds_partitioned__extract_dow
+ , subq_33.booking__ds_partitioned__extract_doy
+ , subq_33.booking__paid_at__day
+ , subq_33.booking__paid_at__week
+ , subq_33.booking__paid_at__month
+ , subq_33.booking__paid_at__quarter
+ , subq_33.booking__paid_at__year
+ , subq_33.booking__paid_at__extract_year
+ , subq_33.booking__paid_at__extract_quarter
+ , subq_33.booking__paid_at__extract_month
+ , subq_33.booking__paid_at__extract_day
+ , subq_33.booking__paid_at__extract_dow
+ , subq_33.booking__paid_at__extract_doy
+ , subq_33.ds__day AS metric_time__day
+ , subq_33.ds__week AS metric_time__week
+ , subq_33.ds__month AS metric_time__month
+ , subq_33.ds__quarter AS metric_time__quarter
+ , subq_33.ds__year AS metric_time__year
+ , subq_33.ds__extract_year AS metric_time__extract_year
+ , subq_33.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_33.ds__extract_month AS metric_time__extract_month
+ , subq_33.ds__extract_day AS metric_time__extract_day
+ , subq_33.ds__extract_dow AS metric_time__extract_dow
+ , subq_33.ds__extract_doy AS metric_time__extract_doy
+ , subq_33.listing
+ , subq_33.guest
+ , subq_33.host
+ , subq_33.booking__listing
+ , subq_33.booking__guest
+ , subq_33.booking__host
+ , subq_33.is_instant
+ , subq_33.booking__is_instant
+ , subq_33.bookings
+ , subq_33.instant_bookings
+ , subq_33.booking_value
+ , subq_33.max_booking_value
+ , subq_33.min_booking_value
+ , subq_33.bookers
+ , subq_33.average_booking_value
+ , subq_33.referred_bookings
+ , subq_33.median_booking_value
+ , subq_33.booking_value_p99
+ , subq_33.discrete_booking_value_p99
+ , subq_33.approximate_continuous_booking_value_p99
+ , subq_33.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_24
- ) subq_25
- ) subq_26
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_33
+ ) subq_34
+ ) subq_35
WHERE booking__is_instant
- ) subq_27
- ) subq_28
- ) subq_29
- ) subq_30
- ) subq_31
-) subq_32
+ ) subq_36
+ ) subq_37
+ ) subq_38
+ ) subq_39
+ ) subq_40
+) subq_41
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_filters__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_filters__plan0_optimized.sql
index 14649c62dd..35859d3713 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_filters__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_filters__plan0_optimized.sql
@@ -8,9 +8,9 @@ FROM (
FROM (
-- Combine Aggregated Outputs
SELECT
- MAX(subq_44.average_booking_value) AS average_booking_value
- , MAX(subq_56.bookings) AS bookings
- , MAX(subq_63.booking_value) AS booking_value
+ MAX(subq_53.average_booking_value) AS average_booking_value
+ , MAX(subq_65.bookings) AS bookings
+ , MAX(subq_72.booking_value) AS booking_value
FROM (
-- Constrain Output with WHERE
-- Pass Only Elements: ['average_booking_value',]
@@ -22,17 +22,17 @@ FROM (
-- Join Standard Outputs
-- Pass Only Elements: ['average_booking_value', 'listing__is_lux_latest', 'booking__is_instant']
SELECT
- bookings_source_src_28001.is_instant AS booking__is_instant
- , listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , bookings_source_src_28001.booking_value AS average_booking_value
- FROM ***************************.fct_bookings bookings_source_src_28001
+ bookings_source_src_28000.is_instant AS booking__is_instant
+ , 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
LEFT OUTER JOIN
- ***************************.dim_listings_latest listings_latest_src_28005
+ ***************************.dim_listings_latest listings_latest_src_28000
ON
- bookings_source_src_28001.listing_id = listings_latest_src_28005.listing_id
- ) subq_40
+ bookings_source_src_28000.listing_id = listings_latest_src_28000.listing_id
+ ) subq_49
WHERE (listing__is_lux_latest) AND (booking__is_instant)
- ) subq_44
+ ) subq_53
CROSS JOIN (
-- Constrain Output with WHERE
-- Pass Only Elements: ['bookings',]
@@ -44,9 +44,9 @@ FROM (
-- Join Standard Outputs
-- Pass Only Elements: ['bookings', 'listing__is_lux_latest', 'booking__is_instant']
SELECT
- subq_47.booking__is_instant AS booking__is_instant
- , listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , subq_47.bookings AS bookings
+ subq_56.booking__is_instant AS booking__is_instant
+ , listings_latest_src_28000.is_lux AS listing__is_lux_latest
+ , subq_56.bookings AS bookings
FROM (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
@@ -55,15 +55,15 @@ FROM (
listing_id AS listing
, is_instant AS booking__is_instant
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_47
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_56
LEFT OUTER JOIN
- ***************************.dim_listings_latest listings_latest_src_28005
+ ***************************.dim_listings_latest listings_latest_src_28000
ON
- subq_47.listing = listings_latest_src_28005.listing_id
- ) subq_52
+ subq_56.listing = listings_latest_src_28000.listing_id
+ ) subq_61
WHERE (listing__is_lux_latest) AND (booking__is_instant)
- ) subq_56
+ ) subq_65
CROSS JOIN (
-- Constrain Output with WHERE
-- Pass Only Elements: ['booking_value',]
@@ -78,9 +78,9 @@ FROM (
SELECT
is_instant AS booking__is_instant
, booking_value
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_59
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_68
WHERE booking__is_instant
- ) subq_63
- ) subq_64
-) subq_65
+ ) subq_72
+ ) subq_73
+) subq_74
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_offsets__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_offsets__plan0.sql
index 92db22a335..ac5c92fc90 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_offsets__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_offsets__plan0.sql
@@ -1,339 +1,339 @@
-- Compute Metrics via Expressions
SELECT
- subq_11.metric_time__day
+ subq_20.metric_time__day
, 2 * bookings_offset_once AS bookings_offset_twice
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_9.metric_time__day AS metric_time__day
- , subq_8.bookings_offset_once AS bookings_offset_once
+ subq_18.metric_time__day AS metric_time__day
+ , subq_17.bookings_offset_once AS bookings_offset_once
FROM (
-- Time Spine
SELECT
- subq_10.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_10
- ) subq_9
+ subq_19.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_19
+ ) subq_18
INNER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_7.metric_time__day
+ subq_16.metric_time__day
, 2 * bookings AS bookings_offset_once
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_6.metric_time__day
- , subq_6.bookings
+ subq_15.metric_time__day
+ , subq_15.bookings
FROM (
-- Aggregate Measures
SELECT
- subq_5.metric_time__day
- , SUM(subq_5.bookings) AS bookings
+ subq_14.metric_time__day
+ , SUM(subq_14.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__day']
SELECT
- subq_4.metric_time__day
- , subq_4.bookings
+ subq_13.metric_time__day
+ , subq_13.bookings
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_2.metric_time__day AS metric_time__day
- , subq_1.ds__day AS ds__day
- , subq_1.ds__week AS ds__week
- , subq_1.ds__month AS ds__month
- , subq_1.ds__quarter AS ds__quarter
- , subq_1.ds__year AS ds__year
- , subq_1.ds__extract_year AS ds__extract_year
- , subq_1.ds__extract_quarter AS ds__extract_quarter
- , subq_1.ds__extract_month AS ds__extract_month
- , subq_1.ds__extract_day AS ds__extract_day
- , subq_1.ds__extract_dow AS ds__extract_dow
- , subq_1.ds__extract_doy AS ds__extract_doy
- , subq_1.ds_partitioned__day AS ds_partitioned__day
- , subq_1.ds_partitioned__week AS ds_partitioned__week
- , subq_1.ds_partitioned__month AS ds_partitioned__month
- , subq_1.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_1.ds_partitioned__year AS ds_partitioned__year
- , subq_1.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_1.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_1.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_1.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_1.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_1.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_1.paid_at__day AS paid_at__day
- , subq_1.paid_at__week AS paid_at__week
- , subq_1.paid_at__month AS paid_at__month
- , subq_1.paid_at__quarter AS paid_at__quarter
- , subq_1.paid_at__year AS paid_at__year
- , subq_1.paid_at__extract_year AS paid_at__extract_year
- , subq_1.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_1.paid_at__extract_month AS paid_at__extract_month
- , subq_1.paid_at__extract_day AS paid_at__extract_day
- , subq_1.paid_at__extract_dow AS paid_at__extract_dow
- , subq_1.paid_at__extract_doy AS paid_at__extract_doy
- , subq_1.booking__ds__day AS booking__ds__day
- , subq_1.booking__ds__week AS booking__ds__week
- , subq_1.booking__ds__month AS booking__ds__month
- , subq_1.booking__ds__quarter AS booking__ds__quarter
- , subq_1.booking__ds__year AS booking__ds__year
- , subq_1.booking__ds__extract_year AS booking__ds__extract_year
- , subq_1.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_1.booking__ds__extract_month AS booking__ds__extract_month
- , subq_1.booking__ds__extract_day AS booking__ds__extract_day
- , subq_1.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_1.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_1.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_1.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_1.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_1.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_1.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_1.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_1.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_1.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_1.booking__paid_at__day AS booking__paid_at__day
- , subq_1.booking__paid_at__week AS booking__paid_at__week
- , subq_1.booking__paid_at__month AS booking__paid_at__month
- , subq_1.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_1.booking__paid_at__year AS booking__paid_at__year
- , subq_1.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_1.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_1.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_1.listing AS listing
- , subq_1.guest AS guest
- , subq_1.host AS host
- , subq_1.booking__listing AS booking__listing
- , subq_1.booking__guest AS booking__guest
- , subq_1.booking__host AS booking__host
- , subq_1.is_instant AS is_instant
- , subq_1.booking__is_instant AS booking__is_instant
- , subq_1.bookings AS bookings
- , subq_1.instant_bookings AS instant_bookings
- , subq_1.booking_value AS booking_value
- , subq_1.max_booking_value AS max_booking_value
- , subq_1.min_booking_value AS min_booking_value
- , subq_1.bookers AS bookers
- , subq_1.average_booking_value AS average_booking_value
- , subq_1.referred_bookings AS referred_bookings
- , subq_1.median_booking_value AS median_booking_value
- , subq_1.booking_value_p99 AS booking_value_p99
- , subq_1.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_1.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_1.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ subq_11.metric_time__day AS metric_time__day
+ , subq_10.ds__day AS ds__day
+ , subq_10.ds__week AS ds__week
+ , subq_10.ds__month AS ds__month
+ , subq_10.ds__quarter AS ds__quarter
+ , subq_10.ds__year AS ds__year
+ , subq_10.ds__extract_year AS ds__extract_year
+ , subq_10.ds__extract_quarter AS ds__extract_quarter
+ , subq_10.ds__extract_month AS ds__extract_month
+ , subq_10.ds__extract_day AS ds__extract_day
+ , subq_10.ds__extract_dow AS ds__extract_dow
+ , subq_10.ds__extract_doy AS ds__extract_doy
+ , subq_10.ds_partitioned__day AS ds_partitioned__day
+ , subq_10.ds_partitioned__week AS ds_partitioned__week
+ , subq_10.ds_partitioned__month AS ds_partitioned__month
+ , subq_10.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_10.ds_partitioned__year AS ds_partitioned__year
+ , subq_10.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_10.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_10.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_10.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_10.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_10.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_10.paid_at__day AS paid_at__day
+ , subq_10.paid_at__week AS paid_at__week
+ , subq_10.paid_at__month AS paid_at__month
+ , subq_10.paid_at__quarter AS paid_at__quarter
+ , subq_10.paid_at__year AS paid_at__year
+ , subq_10.paid_at__extract_year AS paid_at__extract_year
+ , subq_10.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_10.paid_at__extract_month AS paid_at__extract_month
+ , subq_10.paid_at__extract_day AS paid_at__extract_day
+ , subq_10.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_10.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_10.booking__ds__day AS booking__ds__day
+ , subq_10.booking__ds__week AS booking__ds__week
+ , subq_10.booking__ds__month AS booking__ds__month
+ , subq_10.booking__ds__quarter AS booking__ds__quarter
+ , subq_10.booking__ds__year AS booking__ds__year
+ , subq_10.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_10.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_10.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_10.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_10.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_10.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_10.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_10.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_10.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_10.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_10.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_10.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_10.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_10.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_10.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_10.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_10.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_10.booking__paid_at__day AS booking__paid_at__day
+ , subq_10.booking__paid_at__week AS booking__paid_at__week
+ , subq_10.booking__paid_at__month AS booking__paid_at__month
+ , subq_10.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_10.booking__paid_at__year AS booking__paid_at__year
+ , subq_10.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_10.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_10.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_10.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_10.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_10.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_10.listing AS listing
+ , subq_10.guest AS guest
+ , subq_10.host AS host
+ , subq_10.booking__listing AS booking__listing
+ , subq_10.booking__guest AS booking__guest
+ , subq_10.booking__host AS booking__host
+ , subq_10.is_instant AS is_instant
+ , subq_10.booking__is_instant AS booking__is_instant
+ , subq_10.bookings AS bookings
+ , subq_10.instant_bookings AS instant_bookings
+ , subq_10.booking_value AS booking_value
+ , subq_10.max_booking_value AS max_booking_value
+ , subq_10.min_booking_value AS min_booking_value
+ , subq_10.bookers AS bookers
+ , subq_10.average_booking_value AS average_booking_value
+ , subq_10.referred_bookings AS referred_bookings
+ , subq_10.median_booking_value AS median_booking_value
+ , subq_10.booking_value_p99 AS booking_value_p99
+ , subq_10.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_10.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_10.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_3.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_3
- ) subq_2
+ subq_12.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_12
+ ) subq_11
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
ON
- subq_2.metric_time__day - INTERVAL 5 day = subq_1.metric_time__day
- ) subq_4
- ) subq_5
+ subq_11.metric_time__day - INTERVAL 5 day = subq_10.metric_time__day
+ ) subq_13
+ ) subq_14
GROUP BY
- subq_5.metric_time__day
- ) subq_6
- ) subq_7
- ) subq_8
+ subq_14.metric_time__day
+ ) subq_15
+ ) subq_16
+ ) subq_17
ON
- subq_9.metric_time__day - INTERVAL 2 day = subq_8.metric_time__day
-) subq_11
+ subq_18.metric_time__day - INTERVAL 2 day = subq_17.metric_time__day
+) subq_20
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_offsets__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_offsets__plan0_optimized.sql
index 2cd763bf76..096c79bece 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_offsets__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_offsets__plan0_optimized.sql
@@ -5,9 +5,9 @@ SELECT
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_22.ds AS metric_time__day
- , subq_20.bookings_offset_once AS bookings_offset_once
- FROM ***************************.mf_time_spine subq_22
+ subq_31.ds AS metric_time__day
+ , subq_29.bookings_offset_once AS bookings_offset_once
+ FROM ***************************.mf_time_spine subq_31
INNER JOIN (
-- Compute Metrics via Expressions
SELECT
@@ -19,23 +19,23 @@ FROM (
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_15.ds AS metric_time__day
- , SUM(subq_13.bookings) AS bookings
- FROM ***************************.mf_time_spine subq_15
+ subq_24.ds AS metric_time__day
+ , SUM(subq_22.bookings) AS bookings
+ FROM ***************************.mf_time_spine subq_24
INNER JOIN (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
SELECT
DATE_TRUNC('day', ds) AS metric_time__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_13
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_22
ON
- subq_15.ds - INTERVAL 5 day = subq_13.metric_time__day
+ subq_24.ds - INTERVAL 5 day = subq_22.metric_time__day
GROUP BY
- subq_15.ds
- ) subq_19
- ) subq_20
+ subq_24.ds
+ ) subq_28
+ ) subq_29
ON
- subq_22.ds - INTERVAL 2 day = subq_20.metric_time__day
-) subq_23
+ subq_31.ds - INTERVAL 2 day = subq_29.metric_time__day
+) subq_32
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_offsets_with_time_constraint__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_offsets_with_time_constraint__plan0.sql
index 192e070ed7..af2064300c 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_offsets_with_time_constraint__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_offsets_with_time_constraint__plan0.sql
@@ -1,340 +1,340 @@
-- Compute Metrics via Expressions
SELECT
- subq_11.metric_time__day
+ subq_20.metric_time__day
, 2 * bookings_offset_once AS bookings_offset_twice
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_9.metric_time__day AS metric_time__day
- , subq_8.bookings_offset_once AS bookings_offset_once
+ subq_18.metric_time__day AS metric_time__day
+ , subq_17.bookings_offset_once AS bookings_offset_once
FROM (
-- Time Spine
SELECT
- subq_10.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_10
- WHERE subq_10.ds BETWEEN '2020-01-12' AND '2020-01-13'
- ) subq_9
+ subq_19.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_19
+ WHERE subq_19.ds BETWEEN '2020-01-12' AND '2020-01-13'
+ ) subq_18
INNER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_7.metric_time__day
+ subq_16.metric_time__day
, 2 * bookings AS bookings_offset_once
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_6.metric_time__day
- , subq_6.bookings
+ subq_15.metric_time__day
+ , subq_15.bookings
FROM (
-- Aggregate Measures
SELECT
- subq_5.metric_time__day
- , SUM(subq_5.bookings) AS bookings
+ subq_14.metric_time__day
+ , SUM(subq_14.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__day']
SELECT
- subq_4.metric_time__day
- , subq_4.bookings
+ subq_13.metric_time__day
+ , subq_13.bookings
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_2.metric_time__day AS metric_time__day
- , subq_1.ds__day AS ds__day
- , subq_1.ds__week AS ds__week
- , subq_1.ds__month AS ds__month
- , subq_1.ds__quarter AS ds__quarter
- , subq_1.ds__year AS ds__year
- , subq_1.ds__extract_year AS ds__extract_year
- , subq_1.ds__extract_quarter AS ds__extract_quarter
- , subq_1.ds__extract_month AS ds__extract_month
- , subq_1.ds__extract_day AS ds__extract_day
- , subq_1.ds__extract_dow AS ds__extract_dow
- , subq_1.ds__extract_doy AS ds__extract_doy
- , subq_1.ds_partitioned__day AS ds_partitioned__day
- , subq_1.ds_partitioned__week AS ds_partitioned__week
- , subq_1.ds_partitioned__month AS ds_partitioned__month
- , subq_1.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_1.ds_partitioned__year AS ds_partitioned__year
- , subq_1.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_1.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_1.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_1.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_1.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_1.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_1.paid_at__day AS paid_at__day
- , subq_1.paid_at__week AS paid_at__week
- , subq_1.paid_at__month AS paid_at__month
- , subq_1.paid_at__quarter AS paid_at__quarter
- , subq_1.paid_at__year AS paid_at__year
- , subq_1.paid_at__extract_year AS paid_at__extract_year
- , subq_1.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_1.paid_at__extract_month AS paid_at__extract_month
- , subq_1.paid_at__extract_day AS paid_at__extract_day
- , subq_1.paid_at__extract_dow AS paid_at__extract_dow
- , subq_1.paid_at__extract_doy AS paid_at__extract_doy
- , subq_1.booking__ds__day AS booking__ds__day
- , subq_1.booking__ds__week AS booking__ds__week
- , subq_1.booking__ds__month AS booking__ds__month
- , subq_1.booking__ds__quarter AS booking__ds__quarter
- , subq_1.booking__ds__year AS booking__ds__year
- , subq_1.booking__ds__extract_year AS booking__ds__extract_year
- , subq_1.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_1.booking__ds__extract_month AS booking__ds__extract_month
- , subq_1.booking__ds__extract_day AS booking__ds__extract_day
- , subq_1.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_1.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_1.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_1.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_1.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_1.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_1.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_1.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_1.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_1.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_1.booking__paid_at__day AS booking__paid_at__day
- , subq_1.booking__paid_at__week AS booking__paid_at__week
- , subq_1.booking__paid_at__month AS booking__paid_at__month
- , subq_1.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_1.booking__paid_at__year AS booking__paid_at__year
- , subq_1.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_1.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_1.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_1.listing AS listing
- , subq_1.guest AS guest
- , subq_1.host AS host
- , subq_1.booking__listing AS booking__listing
- , subq_1.booking__guest AS booking__guest
- , subq_1.booking__host AS booking__host
- , subq_1.is_instant AS is_instant
- , subq_1.booking__is_instant AS booking__is_instant
- , subq_1.bookings AS bookings
- , subq_1.instant_bookings AS instant_bookings
- , subq_1.booking_value AS booking_value
- , subq_1.max_booking_value AS max_booking_value
- , subq_1.min_booking_value AS min_booking_value
- , subq_1.bookers AS bookers
- , subq_1.average_booking_value AS average_booking_value
- , subq_1.referred_bookings AS referred_bookings
- , subq_1.median_booking_value AS median_booking_value
- , subq_1.booking_value_p99 AS booking_value_p99
- , subq_1.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_1.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_1.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ subq_11.metric_time__day AS metric_time__day
+ , subq_10.ds__day AS ds__day
+ , subq_10.ds__week AS ds__week
+ , subq_10.ds__month AS ds__month
+ , subq_10.ds__quarter AS ds__quarter
+ , subq_10.ds__year AS ds__year
+ , subq_10.ds__extract_year AS ds__extract_year
+ , subq_10.ds__extract_quarter AS ds__extract_quarter
+ , subq_10.ds__extract_month AS ds__extract_month
+ , subq_10.ds__extract_day AS ds__extract_day
+ , subq_10.ds__extract_dow AS ds__extract_dow
+ , subq_10.ds__extract_doy AS ds__extract_doy
+ , subq_10.ds_partitioned__day AS ds_partitioned__day
+ , subq_10.ds_partitioned__week AS ds_partitioned__week
+ , subq_10.ds_partitioned__month AS ds_partitioned__month
+ , subq_10.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_10.ds_partitioned__year AS ds_partitioned__year
+ , subq_10.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_10.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_10.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_10.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_10.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_10.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_10.paid_at__day AS paid_at__day
+ , subq_10.paid_at__week AS paid_at__week
+ , subq_10.paid_at__month AS paid_at__month
+ , subq_10.paid_at__quarter AS paid_at__quarter
+ , subq_10.paid_at__year AS paid_at__year
+ , subq_10.paid_at__extract_year AS paid_at__extract_year
+ , subq_10.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_10.paid_at__extract_month AS paid_at__extract_month
+ , subq_10.paid_at__extract_day AS paid_at__extract_day
+ , subq_10.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_10.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_10.booking__ds__day AS booking__ds__day
+ , subq_10.booking__ds__week AS booking__ds__week
+ , subq_10.booking__ds__month AS booking__ds__month
+ , subq_10.booking__ds__quarter AS booking__ds__quarter
+ , subq_10.booking__ds__year AS booking__ds__year
+ , subq_10.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_10.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_10.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_10.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_10.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_10.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_10.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_10.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_10.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_10.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_10.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_10.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_10.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_10.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_10.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_10.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_10.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_10.booking__paid_at__day AS booking__paid_at__day
+ , subq_10.booking__paid_at__week AS booking__paid_at__week
+ , subq_10.booking__paid_at__month AS booking__paid_at__month
+ , subq_10.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_10.booking__paid_at__year AS booking__paid_at__year
+ , subq_10.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_10.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_10.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_10.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_10.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_10.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_10.listing AS listing
+ , subq_10.guest AS guest
+ , subq_10.host AS host
+ , subq_10.booking__listing AS booking__listing
+ , subq_10.booking__guest AS booking__guest
+ , subq_10.booking__host AS booking__host
+ , subq_10.is_instant AS is_instant
+ , subq_10.booking__is_instant AS booking__is_instant
+ , subq_10.bookings AS bookings
+ , subq_10.instant_bookings AS instant_bookings
+ , subq_10.booking_value AS booking_value
+ , subq_10.max_booking_value AS max_booking_value
+ , subq_10.min_booking_value AS min_booking_value
+ , subq_10.bookers AS bookers
+ , subq_10.average_booking_value AS average_booking_value
+ , subq_10.referred_bookings AS referred_bookings
+ , subq_10.median_booking_value AS median_booking_value
+ , subq_10.booking_value_p99 AS booking_value_p99
+ , subq_10.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_10.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_10.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_3.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_3
- ) subq_2
+ subq_12.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_12
+ ) subq_11
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
ON
- subq_2.metric_time__day - INTERVAL 5 day = subq_1.metric_time__day
- ) subq_4
- ) subq_5
+ subq_11.metric_time__day - INTERVAL 5 day = subq_10.metric_time__day
+ ) subq_13
+ ) subq_14
GROUP BY
- subq_5.metric_time__day
- ) subq_6
- ) subq_7
- ) subq_8
+ subq_14.metric_time__day
+ ) subq_15
+ ) subq_16
+ ) subq_17
ON
- subq_9.metric_time__day - INTERVAL 2 day = subq_8.metric_time__day
-) subq_11
+ subq_18.metric_time__day - INTERVAL 2 day = subq_17.metric_time__day
+) subq_20
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_offsets_with_time_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_offsets_with_time_constraint__plan0_optimized.sql
index af16b573cd..c9d2e86e72 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_offsets_with_time_constraint__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_offsets_with_time_constraint__plan0_optimized.sql
@@ -5,15 +5,15 @@ SELECT
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_21.metric_time__day AS metric_time__day
- , subq_20.bookings_offset_once AS bookings_offset_once
+ subq_30.metric_time__day AS metric_time__day
+ , subq_29.bookings_offset_once AS bookings_offset_once
FROM (
-- Time Spine
SELECT
ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_22
+ FROM ***************************.mf_time_spine subq_31
WHERE ds BETWEEN '2020-01-12' AND '2020-01-13'
- ) subq_21
+ ) subq_30
INNER JOIN (
-- Compute Metrics via Expressions
SELECT
@@ -25,23 +25,23 @@ FROM (
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_15.ds AS metric_time__day
- , SUM(subq_13.bookings) AS bookings
- FROM ***************************.mf_time_spine subq_15
+ subq_24.ds AS metric_time__day
+ , SUM(subq_22.bookings) AS bookings
+ FROM ***************************.mf_time_spine subq_24
INNER JOIN (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
SELECT
DATE_TRUNC('day', ds) AS metric_time__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_13
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_22
ON
- subq_15.ds - INTERVAL 5 day = subq_13.metric_time__day
+ subq_24.ds - INTERVAL 5 day = subq_22.metric_time__day
GROUP BY
- subq_15.ds
- ) subq_19
- ) subq_20
+ subq_24.ds
+ ) subq_28
+ ) subq_29
ON
- subq_21.metric_time__day - INTERVAL 2 day = subq_20.metric_time__day
-) subq_23
+ subq_30.metric_time__day - INTERVAL 2 day = subq_29.metric_time__day
+) subq_32
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_offsets_with_where_constraint__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_offsets_with_where_constraint__plan0.sql
index 1a2ce986ce..bcf5b0cc96 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_offsets_with_where_constraint__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_offsets_with_where_constraint__plan0.sql
@@ -1,346 +1,346 @@
-- Compute Metrics via Expressions
SELECT
- subq_12.metric_time__day
+ subq_21.metric_time__day
, 2 * bookings_offset_once AS bookings_offset_twice
FROM (
-- Constrain Output with WHERE
SELECT
- subq_11.metric_time__day
- , subq_11.bookings_offset_once
+ subq_20.metric_time__day
+ , subq_20.bookings_offset_once
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_9.metric_time__day AS metric_time__day
- , subq_8.bookings_offset_once AS bookings_offset_once
+ subq_18.metric_time__day AS metric_time__day
+ , subq_17.bookings_offset_once AS bookings_offset_once
FROM (
-- Time Spine
SELECT
- subq_10.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_10
- ) subq_9
+ subq_19.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_19
+ ) subq_18
INNER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_7.metric_time__day
+ subq_16.metric_time__day
, 2 * bookings AS bookings_offset_once
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_6.metric_time__day
- , subq_6.bookings
+ subq_15.metric_time__day
+ , subq_15.bookings
FROM (
-- Aggregate Measures
SELECT
- subq_5.metric_time__day
- , SUM(subq_5.bookings) AS bookings
+ subq_14.metric_time__day
+ , SUM(subq_14.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__day']
SELECT
- subq_4.metric_time__day
- , subq_4.bookings
+ subq_13.metric_time__day
+ , subq_13.bookings
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_2.metric_time__day AS metric_time__day
- , subq_1.ds__day AS ds__day
- , subq_1.ds__week AS ds__week
- , subq_1.ds__month AS ds__month
- , subq_1.ds__quarter AS ds__quarter
- , subq_1.ds__year AS ds__year
- , subq_1.ds__extract_year AS ds__extract_year
- , subq_1.ds__extract_quarter AS ds__extract_quarter
- , subq_1.ds__extract_month AS ds__extract_month
- , subq_1.ds__extract_day AS ds__extract_day
- , subq_1.ds__extract_dow AS ds__extract_dow
- , subq_1.ds__extract_doy AS ds__extract_doy
- , subq_1.ds_partitioned__day AS ds_partitioned__day
- , subq_1.ds_partitioned__week AS ds_partitioned__week
- , subq_1.ds_partitioned__month AS ds_partitioned__month
- , subq_1.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_1.ds_partitioned__year AS ds_partitioned__year
- , subq_1.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_1.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_1.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_1.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_1.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_1.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_1.paid_at__day AS paid_at__day
- , subq_1.paid_at__week AS paid_at__week
- , subq_1.paid_at__month AS paid_at__month
- , subq_1.paid_at__quarter AS paid_at__quarter
- , subq_1.paid_at__year AS paid_at__year
- , subq_1.paid_at__extract_year AS paid_at__extract_year
- , subq_1.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_1.paid_at__extract_month AS paid_at__extract_month
- , subq_1.paid_at__extract_day AS paid_at__extract_day
- , subq_1.paid_at__extract_dow AS paid_at__extract_dow
- , subq_1.paid_at__extract_doy AS paid_at__extract_doy
- , subq_1.booking__ds__day AS booking__ds__day
- , subq_1.booking__ds__week AS booking__ds__week
- , subq_1.booking__ds__month AS booking__ds__month
- , subq_1.booking__ds__quarter AS booking__ds__quarter
- , subq_1.booking__ds__year AS booking__ds__year
- , subq_1.booking__ds__extract_year AS booking__ds__extract_year
- , subq_1.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_1.booking__ds__extract_month AS booking__ds__extract_month
- , subq_1.booking__ds__extract_day AS booking__ds__extract_day
- , subq_1.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_1.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_1.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_1.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_1.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_1.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_1.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_1.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_1.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_1.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_1.booking__paid_at__day AS booking__paid_at__day
- , subq_1.booking__paid_at__week AS booking__paid_at__week
- , subq_1.booking__paid_at__month AS booking__paid_at__month
- , subq_1.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_1.booking__paid_at__year AS booking__paid_at__year
- , subq_1.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_1.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_1.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_1.listing AS listing
- , subq_1.guest AS guest
- , subq_1.host AS host
- , subq_1.booking__listing AS booking__listing
- , subq_1.booking__guest AS booking__guest
- , subq_1.booking__host AS booking__host
- , subq_1.is_instant AS is_instant
- , subq_1.booking__is_instant AS booking__is_instant
- , subq_1.bookings AS bookings
- , subq_1.instant_bookings AS instant_bookings
- , subq_1.booking_value AS booking_value
- , subq_1.max_booking_value AS max_booking_value
- , subq_1.min_booking_value AS min_booking_value
- , subq_1.bookers AS bookers
- , subq_1.average_booking_value AS average_booking_value
- , subq_1.referred_bookings AS referred_bookings
- , subq_1.median_booking_value AS median_booking_value
- , subq_1.booking_value_p99 AS booking_value_p99
- , subq_1.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_1.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_1.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ subq_11.metric_time__day AS metric_time__day
+ , subq_10.ds__day AS ds__day
+ , subq_10.ds__week AS ds__week
+ , subq_10.ds__month AS ds__month
+ , subq_10.ds__quarter AS ds__quarter
+ , subq_10.ds__year AS ds__year
+ , subq_10.ds__extract_year AS ds__extract_year
+ , subq_10.ds__extract_quarter AS ds__extract_quarter
+ , subq_10.ds__extract_month AS ds__extract_month
+ , subq_10.ds__extract_day AS ds__extract_day
+ , subq_10.ds__extract_dow AS ds__extract_dow
+ , subq_10.ds__extract_doy AS ds__extract_doy
+ , subq_10.ds_partitioned__day AS ds_partitioned__day
+ , subq_10.ds_partitioned__week AS ds_partitioned__week
+ , subq_10.ds_partitioned__month AS ds_partitioned__month
+ , subq_10.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_10.ds_partitioned__year AS ds_partitioned__year
+ , subq_10.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_10.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_10.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_10.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_10.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_10.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_10.paid_at__day AS paid_at__day
+ , subq_10.paid_at__week AS paid_at__week
+ , subq_10.paid_at__month AS paid_at__month
+ , subq_10.paid_at__quarter AS paid_at__quarter
+ , subq_10.paid_at__year AS paid_at__year
+ , subq_10.paid_at__extract_year AS paid_at__extract_year
+ , subq_10.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_10.paid_at__extract_month AS paid_at__extract_month
+ , subq_10.paid_at__extract_day AS paid_at__extract_day
+ , subq_10.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_10.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_10.booking__ds__day AS booking__ds__day
+ , subq_10.booking__ds__week AS booking__ds__week
+ , subq_10.booking__ds__month AS booking__ds__month
+ , subq_10.booking__ds__quarter AS booking__ds__quarter
+ , subq_10.booking__ds__year AS booking__ds__year
+ , subq_10.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_10.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_10.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_10.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_10.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_10.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_10.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_10.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_10.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_10.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_10.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_10.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_10.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_10.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_10.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_10.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_10.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_10.booking__paid_at__day AS booking__paid_at__day
+ , subq_10.booking__paid_at__week AS booking__paid_at__week
+ , subq_10.booking__paid_at__month AS booking__paid_at__month
+ , subq_10.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_10.booking__paid_at__year AS booking__paid_at__year
+ , subq_10.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_10.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_10.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_10.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_10.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_10.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_10.listing AS listing
+ , subq_10.guest AS guest
+ , subq_10.host AS host
+ , subq_10.booking__listing AS booking__listing
+ , subq_10.booking__guest AS booking__guest
+ , subq_10.booking__host AS booking__host
+ , subq_10.is_instant AS is_instant
+ , subq_10.booking__is_instant AS booking__is_instant
+ , subq_10.bookings AS bookings
+ , subq_10.instant_bookings AS instant_bookings
+ , subq_10.booking_value AS booking_value
+ , subq_10.max_booking_value AS max_booking_value
+ , subq_10.min_booking_value AS min_booking_value
+ , subq_10.bookers AS bookers
+ , subq_10.average_booking_value AS average_booking_value
+ , subq_10.referred_bookings AS referred_bookings
+ , subq_10.median_booking_value AS median_booking_value
+ , subq_10.booking_value_p99 AS booking_value_p99
+ , subq_10.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_10.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_10.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_3.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_3
- ) subq_2
+ subq_12.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_12
+ ) subq_11
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
ON
- subq_2.metric_time__day - INTERVAL 5 day = subq_1.metric_time__day
- ) subq_4
- ) subq_5
+ subq_11.metric_time__day - INTERVAL 5 day = subq_10.metric_time__day
+ ) subq_13
+ ) subq_14
GROUP BY
- subq_5.metric_time__day
- ) subq_6
- ) subq_7
- ) subq_8
+ subq_14.metric_time__day
+ ) subq_15
+ ) subq_16
+ ) subq_17
ON
- subq_9.metric_time__day - INTERVAL 2 day = subq_8.metric_time__day
- ) subq_11
+ subq_18.metric_time__day - INTERVAL 2 day = subq_17.metric_time__day
+ ) subq_20
WHERE metric_time__day = '2020-01-12' or metric_time__day = '2020-01-13'
-) subq_12
+) subq_21
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_offsets_with_where_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_offsets_with_where_constraint__plan0_optimized.sql
index 7fe8fe2dc8..80de5e187c 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_offsets_with_where_constraint__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_nested_offsets_with_where_constraint__plan0_optimized.sql
@@ -10,9 +10,9 @@ FROM (
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_23.ds AS metric_time__day
- , subq_21.bookings_offset_once AS bookings_offset_once
- FROM ***************************.mf_time_spine subq_23
+ subq_32.ds AS metric_time__day
+ , subq_30.bookings_offset_once AS bookings_offset_once
+ FROM ***************************.mf_time_spine subq_32
INNER JOIN (
-- Compute Metrics via Expressions
SELECT
@@ -24,25 +24,25 @@ FROM (
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_16.ds AS metric_time__day
- , SUM(subq_14.bookings) AS bookings
- FROM ***************************.mf_time_spine subq_16
+ subq_25.ds AS metric_time__day
+ , SUM(subq_23.bookings) AS bookings
+ FROM ***************************.mf_time_spine subq_25
INNER JOIN (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
SELECT
DATE_TRUNC('day', ds) AS metric_time__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_14
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_23
ON
- subq_16.ds - INTERVAL 5 day = subq_14.metric_time__day
+ subq_25.ds - INTERVAL 5 day = subq_23.metric_time__day
GROUP BY
- subq_16.ds
- ) subq_20
- ) subq_21
+ subq_25.ds
+ ) subq_29
+ ) subq_30
ON
- subq_23.ds - INTERVAL 2 day = subq_21.metric_time__day
- ) subq_24
+ subq_32.ds - INTERVAL 2 day = subq_30.metric_time__day
+ ) subq_33
WHERE metric_time__day = '2020-01-12' or metric_time__day = '2020-01-13'
-) subq_25
+) subq_34
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_offset_to_grain_with_agg_time_dim__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_offset_to_grain_with_agg_time_dim__plan0.sql
index df42cd08d1..efe0218840 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_offset_to_grain_with_agg_time_dim__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_offset_to_grain_with_agg_time_dim__plan0.sql
@@ -1,545 +1,545 @@
-- Compute Metrics via Expressions
SELECT
- subq_13.booking__ds__day
+ subq_22.booking__ds__day
, bookings - bookings_at_start_of_month AS bookings_growth_since_start_of_month
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_4.booking__ds__day, subq_12.booking__ds__day) AS booking__ds__day
- , MAX(subq_4.bookings) AS bookings
- , MAX(subq_12.bookings_at_start_of_month) AS bookings_at_start_of_month
+ COALESCE(subq_13.booking__ds__day, subq_21.booking__ds__day) AS booking__ds__day
+ , MAX(subq_13.bookings) AS bookings
+ , MAX(subq_21.bookings_at_start_of_month) AS bookings_at_start_of_month
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_3.booking__ds__day
- , subq_3.bookings
+ subq_12.booking__ds__day
+ , subq_12.bookings
FROM (
-- Aggregate Measures
SELECT
- subq_2.booking__ds__day
- , SUM(subq_2.bookings) AS bookings
+ subq_11.booking__ds__day
+ , SUM(subq_11.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'booking__ds__day']
SELECT
- subq_1.booking__ds__day
- , subq_1.bookings
+ subq_10.booking__ds__day
+ , subq_10.bookings
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
- ) subq_2
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
GROUP BY
- subq_2.booking__ds__day
- ) subq_3
- ) subq_4
+ subq_11.booking__ds__day
+ ) subq_12
+ ) subq_13
FULL OUTER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_11.booking__ds__day
- , subq_11.bookings AS bookings_at_start_of_month
+ subq_20.booking__ds__day
+ , subq_20.bookings AS bookings_at_start_of_month
FROM (
-- Aggregate Measures
SELECT
- subq_10.booking__ds__day
- , SUM(subq_10.bookings) AS bookings
+ subq_19.booking__ds__day
+ , SUM(subq_19.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'booking__ds__day']
SELECT
- subq_9.booking__ds__day
- , subq_9.bookings
+ subq_18.booking__ds__day
+ , subq_18.bookings
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_7.booking__ds__day AS booking__ds__day
- , subq_6.ds__day AS ds__day
- , subq_6.ds__week AS ds__week
- , subq_6.ds__month AS ds__month
- , subq_6.ds__quarter AS ds__quarter
- , subq_6.ds__year AS ds__year
- , subq_6.ds__extract_year AS ds__extract_year
- , subq_6.ds__extract_quarter AS ds__extract_quarter
- , subq_6.ds__extract_month AS ds__extract_month
- , subq_6.ds__extract_day AS ds__extract_day
- , subq_6.ds__extract_dow AS ds__extract_dow
- , subq_6.ds__extract_doy AS ds__extract_doy
- , subq_6.ds_partitioned__day AS ds_partitioned__day
- , subq_6.ds_partitioned__week AS ds_partitioned__week
- , subq_6.ds_partitioned__month AS ds_partitioned__month
- , subq_6.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_6.ds_partitioned__year AS ds_partitioned__year
- , subq_6.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_6.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_6.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_6.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_6.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_6.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_6.paid_at__day AS paid_at__day
- , subq_6.paid_at__week AS paid_at__week
- , subq_6.paid_at__month AS paid_at__month
- , subq_6.paid_at__quarter AS paid_at__quarter
- , subq_6.paid_at__year AS paid_at__year
- , subq_6.paid_at__extract_year AS paid_at__extract_year
- , subq_6.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_6.paid_at__extract_month AS paid_at__extract_month
- , subq_6.paid_at__extract_day AS paid_at__extract_day
- , subq_6.paid_at__extract_dow AS paid_at__extract_dow
- , subq_6.paid_at__extract_doy AS paid_at__extract_doy
- , subq_6.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_6.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_6.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_6.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_6.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_6.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_6.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_6.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_6.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_6.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_6.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_6.booking__paid_at__day AS booking__paid_at__day
- , subq_6.booking__paid_at__week AS booking__paid_at__week
- , subq_6.booking__paid_at__month AS booking__paid_at__month
- , subq_6.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_6.booking__paid_at__year AS booking__paid_at__year
- , subq_6.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_6.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_6.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_6.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_6.metric_time__day AS metric_time__day
- , subq_6.metric_time__week AS metric_time__week
- , subq_6.metric_time__month AS metric_time__month
- , subq_6.metric_time__quarter AS metric_time__quarter
- , subq_6.metric_time__year AS metric_time__year
- , subq_6.metric_time__extract_year AS metric_time__extract_year
- , subq_6.metric_time__extract_quarter AS metric_time__extract_quarter
- , subq_6.metric_time__extract_month AS metric_time__extract_month
- , subq_6.metric_time__extract_day AS metric_time__extract_day
- , subq_6.metric_time__extract_dow AS metric_time__extract_dow
- , subq_6.metric_time__extract_doy AS metric_time__extract_doy
- , subq_6.listing AS listing
- , subq_6.guest AS guest
- , subq_6.host AS host
- , subq_6.booking__listing AS booking__listing
- , subq_6.booking__guest AS booking__guest
- , subq_6.booking__host AS booking__host
- , subq_6.is_instant AS is_instant
- , subq_6.booking__is_instant AS booking__is_instant
- , subq_6.bookings AS bookings
- , subq_6.instant_bookings AS instant_bookings
- , subq_6.booking_value AS booking_value
- , subq_6.max_booking_value AS max_booking_value
- , subq_6.min_booking_value AS min_booking_value
- , subq_6.bookers AS bookers
- , subq_6.average_booking_value AS average_booking_value
- , subq_6.referred_bookings AS referred_bookings
- , subq_6.median_booking_value AS median_booking_value
- , subq_6.booking_value_p99 AS booking_value_p99
- , subq_6.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_6.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_6.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ subq_16.booking__ds__day AS booking__ds__day
+ , subq_15.ds__day AS ds__day
+ , subq_15.ds__week AS ds__week
+ , subq_15.ds__month AS ds__month
+ , subq_15.ds__quarter AS ds__quarter
+ , subq_15.ds__year AS ds__year
+ , subq_15.ds__extract_year AS ds__extract_year
+ , subq_15.ds__extract_quarter AS ds__extract_quarter
+ , subq_15.ds__extract_month AS ds__extract_month
+ , subq_15.ds__extract_day AS ds__extract_day
+ , subq_15.ds__extract_dow AS ds__extract_dow
+ , subq_15.ds__extract_doy AS ds__extract_doy
+ , subq_15.ds_partitioned__day AS ds_partitioned__day
+ , subq_15.ds_partitioned__week AS ds_partitioned__week
+ , subq_15.ds_partitioned__month AS ds_partitioned__month
+ , subq_15.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_15.ds_partitioned__year AS ds_partitioned__year
+ , subq_15.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_15.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_15.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_15.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_15.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_15.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_15.paid_at__day AS paid_at__day
+ , subq_15.paid_at__week AS paid_at__week
+ , subq_15.paid_at__month AS paid_at__month
+ , subq_15.paid_at__quarter AS paid_at__quarter
+ , subq_15.paid_at__year AS paid_at__year
+ , subq_15.paid_at__extract_year AS paid_at__extract_year
+ , subq_15.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_15.paid_at__extract_month AS paid_at__extract_month
+ , subq_15.paid_at__extract_day AS paid_at__extract_day
+ , subq_15.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_15.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_15.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_15.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_15.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_15.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_15.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_15.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_15.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_15.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_15.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_15.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_15.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_15.booking__paid_at__day AS booking__paid_at__day
+ , subq_15.booking__paid_at__week AS booking__paid_at__week
+ , subq_15.booking__paid_at__month AS booking__paid_at__month
+ , subq_15.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_15.booking__paid_at__year AS booking__paid_at__year
+ , subq_15.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_15.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_15.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_15.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_15.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_15.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_15.metric_time__day AS metric_time__day
+ , subq_15.metric_time__week AS metric_time__week
+ , subq_15.metric_time__month AS metric_time__month
+ , subq_15.metric_time__quarter AS metric_time__quarter
+ , subq_15.metric_time__year AS metric_time__year
+ , subq_15.metric_time__extract_year AS metric_time__extract_year
+ , subq_15.metric_time__extract_quarter AS metric_time__extract_quarter
+ , subq_15.metric_time__extract_month AS metric_time__extract_month
+ , subq_15.metric_time__extract_day AS metric_time__extract_day
+ , subq_15.metric_time__extract_dow AS metric_time__extract_dow
+ , subq_15.metric_time__extract_doy AS metric_time__extract_doy
+ , subq_15.listing AS listing
+ , subq_15.guest AS guest
+ , subq_15.host AS host
+ , subq_15.booking__listing AS booking__listing
+ , subq_15.booking__guest AS booking__guest
+ , subq_15.booking__host AS booking__host
+ , subq_15.is_instant AS is_instant
+ , subq_15.booking__is_instant AS booking__is_instant
+ , subq_15.bookings AS bookings
+ , subq_15.instant_bookings AS instant_bookings
+ , subq_15.booking_value AS booking_value
+ , subq_15.max_booking_value AS max_booking_value
+ , subq_15.min_booking_value AS min_booking_value
+ , subq_15.bookers AS bookers
+ , subq_15.average_booking_value AS average_booking_value
+ , subq_15.referred_bookings AS referred_bookings
+ , subq_15.median_booking_value AS median_booking_value
+ , subq_15.booking_value_p99 AS booking_value_p99
+ , subq_15.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_15.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_15.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_8.ds AS booking__ds__day
- FROM ***************************.mf_time_spine subq_8
- ) subq_7
+ subq_17.ds AS booking__ds__day
+ FROM ***************************.mf_time_spine subq_17
+ ) subq_16
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_5.ds__day
- , subq_5.ds__week
- , subq_5.ds__month
- , subq_5.ds__quarter
- , subq_5.ds__year
- , subq_5.ds__extract_year
- , subq_5.ds__extract_quarter
- , subq_5.ds__extract_month
- , subq_5.ds__extract_day
- , subq_5.ds__extract_dow
- , subq_5.ds__extract_doy
- , subq_5.ds_partitioned__day
- , subq_5.ds_partitioned__week
- , subq_5.ds_partitioned__month
- , subq_5.ds_partitioned__quarter
- , subq_5.ds_partitioned__year
- , subq_5.ds_partitioned__extract_year
- , subq_5.ds_partitioned__extract_quarter
- , subq_5.ds_partitioned__extract_month
- , subq_5.ds_partitioned__extract_day
- , subq_5.ds_partitioned__extract_dow
- , subq_5.ds_partitioned__extract_doy
- , subq_5.paid_at__day
- , subq_5.paid_at__week
- , subq_5.paid_at__month
- , subq_5.paid_at__quarter
- , subq_5.paid_at__year
- , subq_5.paid_at__extract_year
- , subq_5.paid_at__extract_quarter
- , subq_5.paid_at__extract_month
- , subq_5.paid_at__extract_day
- , subq_5.paid_at__extract_dow
- , subq_5.paid_at__extract_doy
- , subq_5.booking__ds__day
- , subq_5.booking__ds__week
- , subq_5.booking__ds__month
- , subq_5.booking__ds__quarter
- , subq_5.booking__ds__year
- , subq_5.booking__ds__extract_year
- , subq_5.booking__ds__extract_quarter
- , subq_5.booking__ds__extract_month
- , subq_5.booking__ds__extract_day
- , subq_5.booking__ds__extract_dow
- , subq_5.booking__ds__extract_doy
- , subq_5.booking__ds_partitioned__day
- , subq_5.booking__ds_partitioned__week
- , subq_5.booking__ds_partitioned__month
- , subq_5.booking__ds_partitioned__quarter
- , subq_5.booking__ds_partitioned__year
- , subq_5.booking__ds_partitioned__extract_year
- , subq_5.booking__ds_partitioned__extract_quarter
- , subq_5.booking__ds_partitioned__extract_month
- , subq_5.booking__ds_partitioned__extract_day
- , subq_5.booking__ds_partitioned__extract_dow
- , subq_5.booking__ds_partitioned__extract_doy
- , subq_5.booking__paid_at__day
- , subq_5.booking__paid_at__week
- , subq_5.booking__paid_at__month
- , subq_5.booking__paid_at__quarter
- , subq_5.booking__paid_at__year
- , subq_5.booking__paid_at__extract_year
- , subq_5.booking__paid_at__extract_quarter
- , subq_5.booking__paid_at__extract_month
- , subq_5.booking__paid_at__extract_day
- , subq_5.booking__paid_at__extract_dow
- , subq_5.booking__paid_at__extract_doy
- , subq_5.ds__day AS metric_time__day
- , subq_5.ds__week AS metric_time__week
- , subq_5.ds__month AS metric_time__month
- , subq_5.ds__quarter AS metric_time__quarter
- , subq_5.ds__year AS metric_time__year
- , subq_5.ds__extract_year AS metric_time__extract_year
- , subq_5.ds__extract_quarter AS metric_time__extract_quarter
- , subq_5.ds__extract_month AS metric_time__extract_month
- , subq_5.ds__extract_day AS metric_time__extract_day
- , subq_5.ds__extract_dow AS metric_time__extract_dow
- , subq_5.ds__extract_doy AS metric_time__extract_doy
- , subq_5.listing
- , subq_5.guest
- , subq_5.host
- , subq_5.booking__listing
- , subq_5.booking__guest
- , subq_5.booking__host
- , subq_5.is_instant
- , subq_5.booking__is_instant
- , subq_5.bookings
- , subq_5.instant_bookings
- , subq_5.booking_value
- , subq_5.max_booking_value
- , subq_5.min_booking_value
- , subq_5.bookers
- , subq_5.average_booking_value
- , subq_5.referred_bookings
- , subq_5.median_booking_value
- , subq_5.booking_value_p99
- , subq_5.discrete_booking_value_p99
- , subq_5.approximate_continuous_booking_value_p99
- , subq_5.approximate_discrete_booking_value_p99
+ subq_14.ds__day
+ , subq_14.ds__week
+ , subq_14.ds__month
+ , subq_14.ds__quarter
+ , subq_14.ds__year
+ , subq_14.ds__extract_year
+ , subq_14.ds__extract_quarter
+ , subq_14.ds__extract_month
+ , subq_14.ds__extract_day
+ , subq_14.ds__extract_dow
+ , subq_14.ds__extract_doy
+ , subq_14.ds_partitioned__day
+ , subq_14.ds_partitioned__week
+ , subq_14.ds_partitioned__month
+ , subq_14.ds_partitioned__quarter
+ , subq_14.ds_partitioned__year
+ , subq_14.ds_partitioned__extract_year
+ , subq_14.ds_partitioned__extract_quarter
+ , subq_14.ds_partitioned__extract_month
+ , subq_14.ds_partitioned__extract_day
+ , subq_14.ds_partitioned__extract_dow
+ , subq_14.ds_partitioned__extract_doy
+ , subq_14.paid_at__day
+ , subq_14.paid_at__week
+ , subq_14.paid_at__month
+ , subq_14.paid_at__quarter
+ , subq_14.paid_at__year
+ , subq_14.paid_at__extract_year
+ , subq_14.paid_at__extract_quarter
+ , subq_14.paid_at__extract_month
+ , subq_14.paid_at__extract_day
+ , subq_14.paid_at__extract_dow
+ , subq_14.paid_at__extract_doy
+ , subq_14.booking__ds__day
+ , subq_14.booking__ds__week
+ , subq_14.booking__ds__month
+ , subq_14.booking__ds__quarter
+ , subq_14.booking__ds__year
+ , subq_14.booking__ds__extract_year
+ , subq_14.booking__ds__extract_quarter
+ , subq_14.booking__ds__extract_month
+ , subq_14.booking__ds__extract_day
+ , subq_14.booking__ds__extract_dow
+ , subq_14.booking__ds__extract_doy
+ , subq_14.booking__ds_partitioned__day
+ , subq_14.booking__ds_partitioned__week
+ , subq_14.booking__ds_partitioned__month
+ , subq_14.booking__ds_partitioned__quarter
+ , subq_14.booking__ds_partitioned__year
+ , subq_14.booking__ds_partitioned__extract_year
+ , subq_14.booking__ds_partitioned__extract_quarter
+ , subq_14.booking__ds_partitioned__extract_month
+ , subq_14.booking__ds_partitioned__extract_day
+ , subq_14.booking__ds_partitioned__extract_dow
+ , subq_14.booking__ds_partitioned__extract_doy
+ , subq_14.booking__paid_at__day
+ , subq_14.booking__paid_at__week
+ , subq_14.booking__paid_at__month
+ , subq_14.booking__paid_at__quarter
+ , subq_14.booking__paid_at__year
+ , subq_14.booking__paid_at__extract_year
+ , subq_14.booking__paid_at__extract_quarter
+ , subq_14.booking__paid_at__extract_month
+ , subq_14.booking__paid_at__extract_day
+ , subq_14.booking__paid_at__extract_dow
+ , subq_14.booking__paid_at__extract_doy
+ , subq_14.ds__day AS metric_time__day
+ , subq_14.ds__week AS metric_time__week
+ , subq_14.ds__month AS metric_time__month
+ , subq_14.ds__quarter AS metric_time__quarter
+ , subq_14.ds__year AS metric_time__year
+ , subq_14.ds__extract_year AS metric_time__extract_year
+ , subq_14.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_14.ds__extract_month AS metric_time__extract_month
+ , subq_14.ds__extract_day AS metric_time__extract_day
+ , subq_14.ds__extract_dow AS metric_time__extract_dow
+ , subq_14.ds__extract_doy AS metric_time__extract_doy
+ , subq_14.listing
+ , subq_14.guest
+ , subq_14.host
+ , subq_14.booking__listing
+ , subq_14.booking__guest
+ , subq_14.booking__host
+ , subq_14.is_instant
+ , subq_14.booking__is_instant
+ , subq_14.bookings
+ , subq_14.instant_bookings
+ , subq_14.booking_value
+ , subq_14.max_booking_value
+ , subq_14.min_booking_value
+ , subq_14.bookers
+ , subq_14.average_booking_value
+ , subq_14.referred_bookings
+ , subq_14.median_booking_value
+ , subq_14.booking_value_p99
+ , subq_14.discrete_booking_value_p99
+ , subq_14.approximate_continuous_booking_value_p99
+ , subq_14.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_5
- ) subq_6
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_14
+ ) subq_15
ON
- DATE_TRUNC('month', subq_7.booking__ds__day) = subq_6.booking__ds__day
- ) subq_9
- ) subq_10
+ DATE_TRUNC('month', subq_16.booking__ds__day) = subq_15.booking__ds__day
+ ) subq_18
+ ) subq_19
GROUP BY
- subq_10.booking__ds__day
- ) subq_11
- ) subq_12
+ subq_19.booking__ds__day
+ ) subq_20
+ ) subq_21
ON
- subq_4.booking__ds__day = subq_12.booking__ds__day
+ subq_13.booking__ds__day = subq_21.booking__ds__day
GROUP BY
- COALESCE(subq_4.booking__ds__day, subq_12.booking__ds__day)
-) subq_13
+ COALESCE(subq_13.booking__ds__day, subq_21.booking__ds__day)
+) subq_22
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_offset_to_grain_with_agg_time_dim__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_offset_to_grain_with_agg_time_dim__plan0_optimized.sql
index 1b7dbc4725..9f6d4b5769 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_offset_to_grain_with_agg_time_dim__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_offset_to_grain_with_agg_time_dim__plan0_optimized.sql
@@ -5,9 +5,9 @@ SELECT
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_18.booking__ds__day, subq_26.booking__ds__day) AS booking__ds__day
- , MAX(subq_18.bookings) AS bookings
- , MAX(subq_26.bookings_at_start_of_month) AS bookings_at_start_of_month
+ COALESCE(subq_27.booking__ds__day, subq_35.booking__ds__day) AS booking__ds__day
+ , MAX(subq_27.bookings) AS bookings
+ , MAX(subq_35.bookings_at_start_of_month) AS bookings_at_start_of_month
FROM (
-- Aggregate Measures
-- Compute Metrics via Expressions
@@ -21,35 +21,35 @@ FROM (
SELECT
DATE_TRUNC('day', ds) AS booking__ds__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_16
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_25
GROUP BY
booking__ds__day
- ) subq_18
+ ) subq_27
FULL OUTER JOIN (
-- Join to Time Spine Dataset
-- Pass Only Elements: ['bookings', 'booking__ds__day']
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_22.ds AS booking__ds__day
- , SUM(subq_20.bookings) AS bookings_at_start_of_month
- FROM ***************************.mf_time_spine subq_22
+ subq_31.ds AS booking__ds__day
+ , SUM(subq_29.bookings) AS bookings_at_start_of_month
+ FROM ***************************.mf_time_spine subq_31
INNER JOIN (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
SELECT
DATE_TRUNC('day', ds) AS booking__ds__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_20
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_29
ON
- DATE_TRUNC('month', subq_22.ds) = subq_20.booking__ds__day
+ DATE_TRUNC('month', subq_31.ds) = subq_29.booking__ds__day
GROUP BY
- subq_22.ds
- ) subq_26
+ subq_31.ds
+ ) subq_35
ON
- subq_18.booking__ds__day = subq_26.booking__ds__day
+ subq_27.booking__ds__day = subq_35.booking__ds__day
GROUP BY
- COALESCE(subq_18.booking__ds__day, subq_26.booking__ds__day)
-) subq_27
+ COALESCE(subq_27.booking__ds__day, subq_35.booking__ds__day)
+) subq_36
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_offset_window_with_agg_time_dim__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_offset_window_with_agg_time_dim__plan0.sql
index 692ba28311..3c4c17e800 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_offset_window_with_agg_time_dim__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_offset_window_with_agg_time_dim__plan0.sql
@@ -1,545 +1,545 @@
-- Compute Metrics via Expressions
SELECT
- subq_13.booking__ds__day
+ subq_22.booking__ds__day
, bookings - bookings_2_weeks_ago AS bookings_growth_2_weeks
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_4.booking__ds__day, subq_12.booking__ds__day) AS booking__ds__day
- , MAX(subq_4.bookings) AS bookings
- , MAX(subq_12.bookings_2_weeks_ago) AS bookings_2_weeks_ago
+ COALESCE(subq_13.booking__ds__day, subq_21.booking__ds__day) AS booking__ds__day
+ , MAX(subq_13.bookings) AS bookings
+ , MAX(subq_21.bookings_2_weeks_ago) AS bookings_2_weeks_ago
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_3.booking__ds__day
- , subq_3.bookings
+ subq_12.booking__ds__day
+ , subq_12.bookings
FROM (
-- Aggregate Measures
SELECT
- subq_2.booking__ds__day
- , SUM(subq_2.bookings) AS bookings
+ subq_11.booking__ds__day
+ , SUM(subq_11.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'booking__ds__day']
SELECT
- subq_1.booking__ds__day
- , subq_1.bookings
+ subq_10.booking__ds__day
+ , subq_10.bookings
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
- ) subq_2
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
GROUP BY
- subq_2.booking__ds__day
- ) subq_3
- ) subq_4
+ subq_11.booking__ds__day
+ ) subq_12
+ ) subq_13
FULL OUTER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_11.booking__ds__day
- , subq_11.bookings AS bookings_2_weeks_ago
+ subq_20.booking__ds__day
+ , subq_20.bookings AS bookings_2_weeks_ago
FROM (
-- Aggregate Measures
SELECT
- subq_10.booking__ds__day
- , SUM(subq_10.bookings) AS bookings
+ subq_19.booking__ds__day
+ , SUM(subq_19.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'booking__ds__day']
SELECT
- subq_9.booking__ds__day
- , subq_9.bookings
+ subq_18.booking__ds__day
+ , subq_18.bookings
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_7.booking__ds__day AS booking__ds__day
- , subq_6.ds__day AS ds__day
- , subq_6.ds__week AS ds__week
- , subq_6.ds__month AS ds__month
- , subq_6.ds__quarter AS ds__quarter
- , subq_6.ds__year AS ds__year
- , subq_6.ds__extract_year AS ds__extract_year
- , subq_6.ds__extract_quarter AS ds__extract_quarter
- , subq_6.ds__extract_month AS ds__extract_month
- , subq_6.ds__extract_day AS ds__extract_day
- , subq_6.ds__extract_dow AS ds__extract_dow
- , subq_6.ds__extract_doy AS ds__extract_doy
- , subq_6.ds_partitioned__day AS ds_partitioned__day
- , subq_6.ds_partitioned__week AS ds_partitioned__week
- , subq_6.ds_partitioned__month AS ds_partitioned__month
- , subq_6.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_6.ds_partitioned__year AS ds_partitioned__year
- , subq_6.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_6.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_6.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_6.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_6.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_6.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_6.paid_at__day AS paid_at__day
- , subq_6.paid_at__week AS paid_at__week
- , subq_6.paid_at__month AS paid_at__month
- , subq_6.paid_at__quarter AS paid_at__quarter
- , subq_6.paid_at__year AS paid_at__year
- , subq_6.paid_at__extract_year AS paid_at__extract_year
- , subq_6.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_6.paid_at__extract_month AS paid_at__extract_month
- , subq_6.paid_at__extract_day AS paid_at__extract_day
- , subq_6.paid_at__extract_dow AS paid_at__extract_dow
- , subq_6.paid_at__extract_doy AS paid_at__extract_doy
- , subq_6.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_6.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_6.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_6.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_6.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_6.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_6.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_6.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_6.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_6.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_6.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_6.booking__paid_at__day AS booking__paid_at__day
- , subq_6.booking__paid_at__week AS booking__paid_at__week
- , subq_6.booking__paid_at__month AS booking__paid_at__month
- , subq_6.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_6.booking__paid_at__year AS booking__paid_at__year
- , subq_6.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_6.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_6.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_6.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_6.metric_time__day AS metric_time__day
- , subq_6.metric_time__week AS metric_time__week
- , subq_6.metric_time__month AS metric_time__month
- , subq_6.metric_time__quarter AS metric_time__quarter
- , subq_6.metric_time__year AS metric_time__year
- , subq_6.metric_time__extract_year AS metric_time__extract_year
- , subq_6.metric_time__extract_quarter AS metric_time__extract_quarter
- , subq_6.metric_time__extract_month AS metric_time__extract_month
- , subq_6.metric_time__extract_day AS metric_time__extract_day
- , subq_6.metric_time__extract_dow AS metric_time__extract_dow
- , subq_6.metric_time__extract_doy AS metric_time__extract_doy
- , subq_6.listing AS listing
- , subq_6.guest AS guest
- , subq_6.host AS host
- , subq_6.booking__listing AS booking__listing
- , subq_6.booking__guest AS booking__guest
- , subq_6.booking__host AS booking__host
- , subq_6.is_instant AS is_instant
- , subq_6.booking__is_instant AS booking__is_instant
- , subq_6.bookings AS bookings
- , subq_6.instant_bookings AS instant_bookings
- , subq_6.booking_value AS booking_value
- , subq_6.max_booking_value AS max_booking_value
- , subq_6.min_booking_value AS min_booking_value
- , subq_6.bookers AS bookers
- , subq_6.average_booking_value AS average_booking_value
- , subq_6.referred_bookings AS referred_bookings
- , subq_6.median_booking_value AS median_booking_value
- , subq_6.booking_value_p99 AS booking_value_p99
- , subq_6.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_6.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_6.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ subq_16.booking__ds__day AS booking__ds__day
+ , subq_15.ds__day AS ds__day
+ , subq_15.ds__week AS ds__week
+ , subq_15.ds__month AS ds__month
+ , subq_15.ds__quarter AS ds__quarter
+ , subq_15.ds__year AS ds__year
+ , subq_15.ds__extract_year AS ds__extract_year
+ , subq_15.ds__extract_quarter AS ds__extract_quarter
+ , subq_15.ds__extract_month AS ds__extract_month
+ , subq_15.ds__extract_day AS ds__extract_day
+ , subq_15.ds__extract_dow AS ds__extract_dow
+ , subq_15.ds__extract_doy AS ds__extract_doy
+ , subq_15.ds_partitioned__day AS ds_partitioned__day
+ , subq_15.ds_partitioned__week AS ds_partitioned__week
+ , subq_15.ds_partitioned__month AS ds_partitioned__month
+ , subq_15.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_15.ds_partitioned__year AS ds_partitioned__year
+ , subq_15.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_15.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_15.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_15.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_15.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_15.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_15.paid_at__day AS paid_at__day
+ , subq_15.paid_at__week AS paid_at__week
+ , subq_15.paid_at__month AS paid_at__month
+ , subq_15.paid_at__quarter AS paid_at__quarter
+ , subq_15.paid_at__year AS paid_at__year
+ , subq_15.paid_at__extract_year AS paid_at__extract_year
+ , subq_15.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_15.paid_at__extract_month AS paid_at__extract_month
+ , subq_15.paid_at__extract_day AS paid_at__extract_day
+ , subq_15.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_15.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_15.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_15.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_15.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_15.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_15.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_15.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_15.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_15.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_15.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_15.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_15.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_15.booking__paid_at__day AS booking__paid_at__day
+ , subq_15.booking__paid_at__week AS booking__paid_at__week
+ , subq_15.booking__paid_at__month AS booking__paid_at__month
+ , subq_15.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_15.booking__paid_at__year AS booking__paid_at__year
+ , subq_15.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_15.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_15.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_15.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_15.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_15.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_15.metric_time__day AS metric_time__day
+ , subq_15.metric_time__week AS metric_time__week
+ , subq_15.metric_time__month AS metric_time__month
+ , subq_15.metric_time__quarter AS metric_time__quarter
+ , subq_15.metric_time__year AS metric_time__year
+ , subq_15.metric_time__extract_year AS metric_time__extract_year
+ , subq_15.metric_time__extract_quarter AS metric_time__extract_quarter
+ , subq_15.metric_time__extract_month AS metric_time__extract_month
+ , subq_15.metric_time__extract_day AS metric_time__extract_day
+ , subq_15.metric_time__extract_dow AS metric_time__extract_dow
+ , subq_15.metric_time__extract_doy AS metric_time__extract_doy
+ , subq_15.listing AS listing
+ , subq_15.guest AS guest
+ , subq_15.host AS host
+ , subq_15.booking__listing AS booking__listing
+ , subq_15.booking__guest AS booking__guest
+ , subq_15.booking__host AS booking__host
+ , subq_15.is_instant AS is_instant
+ , subq_15.booking__is_instant AS booking__is_instant
+ , subq_15.bookings AS bookings
+ , subq_15.instant_bookings AS instant_bookings
+ , subq_15.booking_value AS booking_value
+ , subq_15.max_booking_value AS max_booking_value
+ , subq_15.min_booking_value AS min_booking_value
+ , subq_15.bookers AS bookers
+ , subq_15.average_booking_value AS average_booking_value
+ , subq_15.referred_bookings AS referred_bookings
+ , subq_15.median_booking_value AS median_booking_value
+ , subq_15.booking_value_p99 AS booking_value_p99
+ , subq_15.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_15.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_15.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_8.ds AS booking__ds__day
- FROM ***************************.mf_time_spine subq_8
- ) subq_7
+ subq_17.ds AS booking__ds__day
+ FROM ***************************.mf_time_spine subq_17
+ ) subq_16
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_5.ds__day
- , subq_5.ds__week
- , subq_5.ds__month
- , subq_5.ds__quarter
- , subq_5.ds__year
- , subq_5.ds__extract_year
- , subq_5.ds__extract_quarter
- , subq_5.ds__extract_month
- , subq_5.ds__extract_day
- , subq_5.ds__extract_dow
- , subq_5.ds__extract_doy
- , subq_5.ds_partitioned__day
- , subq_5.ds_partitioned__week
- , subq_5.ds_partitioned__month
- , subq_5.ds_partitioned__quarter
- , subq_5.ds_partitioned__year
- , subq_5.ds_partitioned__extract_year
- , subq_5.ds_partitioned__extract_quarter
- , subq_5.ds_partitioned__extract_month
- , subq_5.ds_partitioned__extract_day
- , subq_5.ds_partitioned__extract_dow
- , subq_5.ds_partitioned__extract_doy
- , subq_5.paid_at__day
- , subq_5.paid_at__week
- , subq_5.paid_at__month
- , subq_5.paid_at__quarter
- , subq_5.paid_at__year
- , subq_5.paid_at__extract_year
- , subq_5.paid_at__extract_quarter
- , subq_5.paid_at__extract_month
- , subq_5.paid_at__extract_day
- , subq_5.paid_at__extract_dow
- , subq_5.paid_at__extract_doy
- , subq_5.booking__ds__day
- , subq_5.booking__ds__week
- , subq_5.booking__ds__month
- , subq_5.booking__ds__quarter
- , subq_5.booking__ds__year
- , subq_5.booking__ds__extract_year
- , subq_5.booking__ds__extract_quarter
- , subq_5.booking__ds__extract_month
- , subq_5.booking__ds__extract_day
- , subq_5.booking__ds__extract_dow
- , subq_5.booking__ds__extract_doy
- , subq_5.booking__ds_partitioned__day
- , subq_5.booking__ds_partitioned__week
- , subq_5.booking__ds_partitioned__month
- , subq_5.booking__ds_partitioned__quarter
- , subq_5.booking__ds_partitioned__year
- , subq_5.booking__ds_partitioned__extract_year
- , subq_5.booking__ds_partitioned__extract_quarter
- , subq_5.booking__ds_partitioned__extract_month
- , subq_5.booking__ds_partitioned__extract_day
- , subq_5.booking__ds_partitioned__extract_dow
- , subq_5.booking__ds_partitioned__extract_doy
- , subq_5.booking__paid_at__day
- , subq_5.booking__paid_at__week
- , subq_5.booking__paid_at__month
- , subq_5.booking__paid_at__quarter
- , subq_5.booking__paid_at__year
- , subq_5.booking__paid_at__extract_year
- , subq_5.booking__paid_at__extract_quarter
- , subq_5.booking__paid_at__extract_month
- , subq_5.booking__paid_at__extract_day
- , subq_5.booking__paid_at__extract_dow
- , subq_5.booking__paid_at__extract_doy
- , subq_5.ds__day AS metric_time__day
- , subq_5.ds__week AS metric_time__week
- , subq_5.ds__month AS metric_time__month
- , subq_5.ds__quarter AS metric_time__quarter
- , subq_5.ds__year AS metric_time__year
- , subq_5.ds__extract_year AS metric_time__extract_year
- , subq_5.ds__extract_quarter AS metric_time__extract_quarter
- , subq_5.ds__extract_month AS metric_time__extract_month
- , subq_5.ds__extract_day AS metric_time__extract_day
- , subq_5.ds__extract_dow AS metric_time__extract_dow
- , subq_5.ds__extract_doy AS metric_time__extract_doy
- , subq_5.listing
- , subq_5.guest
- , subq_5.host
- , subq_5.booking__listing
- , subq_5.booking__guest
- , subq_5.booking__host
- , subq_5.is_instant
- , subq_5.booking__is_instant
- , subq_5.bookings
- , subq_5.instant_bookings
- , subq_5.booking_value
- , subq_5.max_booking_value
- , subq_5.min_booking_value
- , subq_5.bookers
- , subq_5.average_booking_value
- , subq_5.referred_bookings
- , subq_5.median_booking_value
- , subq_5.booking_value_p99
- , subq_5.discrete_booking_value_p99
- , subq_5.approximate_continuous_booking_value_p99
- , subq_5.approximate_discrete_booking_value_p99
+ subq_14.ds__day
+ , subq_14.ds__week
+ , subq_14.ds__month
+ , subq_14.ds__quarter
+ , subq_14.ds__year
+ , subq_14.ds__extract_year
+ , subq_14.ds__extract_quarter
+ , subq_14.ds__extract_month
+ , subq_14.ds__extract_day
+ , subq_14.ds__extract_dow
+ , subq_14.ds__extract_doy
+ , subq_14.ds_partitioned__day
+ , subq_14.ds_partitioned__week
+ , subq_14.ds_partitioned__month
+ , subq_14.ds_partitioned__quarter
+ , subq_14.ds_partitioned__year
+ , subq_14.ds_partitioned__extract_year
+ , subq_14.ds_partitioned__extract_quarter
+ , subq_14.ds_partitioned__extract_month
+ , subq_14.ds_partitioned__extract_day
+ , subq_14.ds_partitioned__extract_dow
+ , subq_14.ds_partitioned__extract_doy
+ , subq_14.paid_at__day
+ , subq_14.paid_at__week
+ , subq_14.paid_at__month
+ , subq_14.paid_at__quarter
+ , subq_14.paid_at__year
+ , subq_14.paid_at__extract_year
+ , subq_14.paid_at__extract_quarter
+ , subq_14.paid_at__extract_month
+ , subq_14.paid_at__extract_day
+ , subq_14.paid_at__extract_dow
+ , subq_14.paid_at__extract_doy
+ , subq_14.booking__ds__day
+ , subq_14.booking__ds__week
+ , subq_14.booking__ds__month
+ , subq_14.booking__ds__quarter
+ , subq_14.booking__ds__year
+ , subq_14.booking__ds__extract_year
+ , subq_14.booking__ds__extract_quarter
+ , subq_14.booking__ds__extract_month
+ , subq_14.booking__ds__extract_day
+ , subq_14.booking__ds__extract_dow
+ , subq_14.booking__ds__extract_doy
+ , subq_14.booking__ds_partitioned__day
+ , subq_14.booking__ds_partitioned__week
+ , subq_14.booking__ds_partitioned__month
+ , subq_14.booking__ds_partitioned__quarter
+ , subq_14.booking__ds_partitioned__year
+ , subq_14.booking__ds_partitioned__extract_year
+ , subq_14.booking__ds_partitioned__extract_quarter
+ , subq_14.booking__ds_partitioned__extract_month
+ , subq_14.booking__ds_partitioned__extract_day
+ , subq_14.booking__ds_partitioned__extract_dow
+ , subq_14.booking__ds_partitioned__extract_doy
+ , subq_14.booking__paid_at__day
+ , subq_14.booking__paid_at__week
+ , subq_14.booking__paid_at__month
+ , subq_14.booking__paid_at__quarter
+ , subq_14.booking__paid_at__year
+ , subq_14.booking__paid_at__extract_year
+ , subq_14.booking__paid_at__extract_quarter
+ , subq_14.booking__paid_at__extract_month
+ , subq_14.booking__paid_at__extract_day
+ , subq_14.booking__paid_at__extract_dow
+ , subq_14.booking__paid_at__extract_doy
+ , subq_14.ds__day AS metric_time__day
+ , subq_14.ds__week AS metric_time__week
+ , subq_14.ds__month AS metric_time__month
+ , subq_14.ds__quarter AS metric_time__quarter
+ , subq_14.ds__year AS metric_time__year
+ , subq_14.ds__extract_year AS metric_time__extract_year
+ , subq_14.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_14.ds__extract_month AS metric_time__extract_month
+ , subq_14.ds__extract_day AS metric_time__extract_day
+ , subq_14.ds__extract_dow AS metric_time__extract_dow
+ , subq_14.ds__extract_doy AS metric_time__extract_doy
+ , subq_14.listing
+ , subq_14.guest
+ , subq_14.host
+ , subq_14.booking__listing
+ , subq_14.booking__guest
+ , subq_14.booking__host
+ , subq_14.is_instant
+ , subq_14.booking__is_instant
+ , subq_14.bookings
+ , subq_14.instant_bookings
+ , subq_14.booking_value
+ , subq_14.max_booking_value
+ , subq_14.min_booking_value
+ , subq_14.bookers
+ , subq_14.average_booking_value
+ , subq_14.referred_bookings
+ , subq_14.median_booking_value
+ , subq_14.booking_value_p99
+ , subq_14.discrete_booking_value_p99
+ , subq_14.approximate_continuous_booking_value_p99
+ , subq_14.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_5
- ) subq_6
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_14
+ ) subq_15
ON
- subq_7.booking__ds__day - INTERVAL 14 day = subq_6.booking__ds__day
- ) subq_9
- ) subq_10
+ subq_16.booking__ds__day - INTERVAL 14 day = subq_15.booking__ds__day
+ ) subq_18
+ ) subq_19
GROUP BY
- subq_10.booking__ds__day
- ) subq_11
- ) subq_12
+ subq_19.booking__ds__day
+ ) subq_20
+ ) subq_21
ON
- subq_4.booking__ds__day = subq_12.booking__ds__day
+ subq_13.booking__ds__day = subq_21.booking__ds__day
GROUP BY
- COALESCE(subq_4.booking__ds__day, subq_12.booking__ds__day)
-) subq_13
+ COALESCE(subq_13.booking__ds__day, subq_21.booking__ds__day)
+) subq_22
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_offset_window_with_agg_time_dim__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_offset_window_with_agg_time_dim__plan0_optimized.sql
index 7c15aff8a3..8ff4d862e8 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_offset_window_with_agg_time_dim__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_offset_window_with_agg_time_dim__plan0_optimized.sql
@@ -5,9 +5,9 @@ SELECT
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_18.booking__ds__day, subq_26.booking__ds__day) AS booking__ds__day
- , MAX(subq_18.bookings) AS bookings
- , MAX(subq_26.bookings_2_weeks_ago) AS bookings_2_weeks_ago
+ COALESCE(subq_27.booking__ds__day, subq_35.booking__ds__day) AS booking__ds__day
+ , MAX(subq_27.bookings) AS bookings
+ , MAX(subq_35.bookings_2_weeks_ago) AS bookings_2_weeks_ago
FROM (
-- Aggregate Measures
-- Compute Metrics via Expressions
@@ -21,35 +21,35 @@ FROM (
SELECT
DATE_TRUNC('day', ds) AS booking__ds__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_16
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_25
GROUP BY
booking__ds__day
- ) subq_18
+ ) subq_27
FULL OUTER JOIN (
-- Join to Time Spine Dataset
-- Pass Only Elements: ['bookings', 'booking__ds__day']
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_22.ds AS booking__ds__day
- , SUM(subq_20.bookings) AS bookings_2_weeks_ago
- FROM ***************************.mf_time_spine subq_22
+ subq_31.ds AS booking__ds__day
+ , SUM(subq_29.bookings) AS bookings_2_weeks_ago
+ FROM ***************************.mf_time_spine subq_31
INNER JOIN (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
SELECT
DATE_TRUNC('day', ds) AS booking__ds__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_20
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_29
ON
- subq_22.ds - INTERVAL 14 day = subq_20.booking__ds__day
+ subq_31.ds - INTERVAL 14 day = subq_29.booking__ds__day
GROUP BY
- subq_22.ds
- ) subq_26
+ subq_31.ds
+ ) subq_35
ON
- subq_18.booking__ds__day = subq_26.booking__ds__day
+ subq_27.booking__ds__day = subq_35.booking__ds__day
GROUP BY
- COALESCE(subq_18.booking__ds__day, subq_26.booking__ds__day)
-) subq_27
+ COALESCE(subq_27.booking__ds__day, subq_35.booking__ds__day)
+) subq_36
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_time_offset_metric_with_time_constraint__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_time_offset_metric_with_time_constraint__plan0.sql
index 7c503cf26e..9224ec5199 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_time_offset_metric_with_time_constraint__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_time_offset_metric_with_time_constraint__plan0.sql
@@ -1,320 +1,320 @@
-- Compute Metrics via Expressions
SELECT
- subq_7.metric_time__day
+ subq_16.metric_time__day
, bookings_5_days_ago AS bookings_5_day_lag
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_6.metric_time__day
- , subq_6.bookings AS bookings_5_days_ago
+ subq_15.metric_time__day
+ , subq_15.bookings AS bookings_5_days_ago
FROM (
-- Aggregate Measures
SELECT
- subq_5.metric_time__day
- , SUM(subq_5.bookings) AS bookings
+ subq_14.metric_time__day
+ , SUM(subq_14.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__day']
SELECT
- subq_4.metric_time__day
- , subq_4.bookings
+ subq_13.metric_time__day
+ , subq_13.bookings
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_2.metric_time__day AS metric_time__day
- , subq_1.ds__day AS ds__day
- , subq_1.ds__week AS ds__week
- , subq_1.ds__month AS ds__month
- , subq_1.ds__quarter AS ds__quarter
- , subq_1.ds__year AS ds__year
- , subq_1.ds__extract_year AS ds__extract_year
- , subq_1.ds__extract_quarter AS ds__extract_quarter
- , subq_1.ds__extract_month AS ds__extract_month
- , subq_1.ds__extract_day AS ds__extract_day
- , subq_1.ds__extract_dow AS ds__extract_dow
- , subq_1.ds__extract_doy AS ds__extract_doy
- , subq_1.ds_partitioned__day AS ds_partitioned__day
- , subq_1.ds_partitioned__week AS ds_partitioned__week
- , subq_1.ds_partitioned__month AS ds_partitioned__month
- , subq_1.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_1.ds_partitioned__year AS ds_partitioned__year
- , subq_1.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_1.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_1.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_1.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_1.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_1.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_1.paid_at__day AS paid_at__day
- , subq_1.paid_at__week AS paid_at__week
- , subq_1.paid_at__month AS paid_at__month
- , subq_1.paid_at__quarter AS paid_at__quarter
- , subq_1.paid_at__year AS paid_at__year
- , subq_1.paid_at__extract_year AS paid_at__extract_year
- , subq_1.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_1.paid_at__extract_month AS paid_at__extract_month
- , subq_1.paid_at__extract_day AS paid_at__extract_day
- , subq_1.paid_at__extract_dow AS paid_at__extract_dow
- , subq_1.paid_at__extract_doy AS paid_at__extract_doy
- , subq_1.booking__ds__day AS booking__ds__day
- , subq_1.booking__ds__week AS booking__ds__week
- , subq_1.booking__ds__month AS booking__ds__month
- , subq_1.booking__ds__quarter AS booking__ds__quarter
- , subq_1.booking__ds__year AS booking__ds__year
- , subq_1.booking__ds__extract_year AS booking__ds__extract_year
- , subq_1.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_1.booking__ds__extract_month AS booking__ds__extract_month
- , subq_1.booking__ds__extract_day AS booking__ds__extract_day
- , subq_1.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_1.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_1.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_1.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_1.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_1.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_1.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_1.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_1.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_1.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_1.booking__paid_at__day AS booking__paid_at__day
- , subq_1.booking__paid_at__week AS booking__paid_at__week
- , subq_1.booking__paid_at__month AS booking__paid_at__month
- , subq_1.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_1.booking__paid_at__year AS booking__paid_at__year
- , subq_1.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_1.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_1.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_1.listing AS listing
- , subq_1.guest AS guest
- , subq_1.host AS host
- , subq_1.booking__listing AS booking__listing
- , subq_1.booking__guest AS booking__guest
- , subq_1.booking__host AS booking__host
- , subq_1.is_instant AS is_instant
- , subq_1.booking__is_instant AS booking__is_instant
- , subq_1.bookings AS bookings
- , subq_1.instant_bookings AS instant_bookings
- , subq_1.booking_value AS booking_value
- , subq_1.max_booking_value AS max_booking_value
- , subq_1.min_booking_value AS min_booking_value
- , subq_1.bookers AS bookers
- , subq_1.average_booking_value AS average_booking_value
- , subq_1.referred_bookings AS referred_bookings
- , subq_1.median_booking_value AS median_booking_value
- , subq_1.booking_value_p99 AS booking_value_p99
- , subq_1.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_1.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_1.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ subq_11.metric_time__day AS metric_time__day
+ , subq_10.ds__day AS ds__day
+ , subq_10.ds__week AS ds__week
+ , subq_10.ds__month AS ds__month
+ , subq_10.ds__quarter AS ds__quarter
+ , subq_10.ds__year AS ds__year
+ , subq_10.ds__extract_year AS ds__extract_year
+ , subq_10.ds__extract_quarter AS ds__extract_quarter
+ , subq_10.ds__extract_month AS ds__extract_month
+ , subq_10.ds__extract_day AS ds__extract_day
+ , subq_10.ds__extract_dow AS ds__extract_dow
+ , subq_10.ds__extract_doy AS ds__extract_doy
+ , subq_10.ds_partitioned__day AS ds_partitioned__day
+ , subq_10.ds_partitioned__week AS ds_partitioned__week
+ , subq_10.ds_partitioned__month AS ds_partitioned__month
+ , subq_10.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_10.ds_partitioned__year AS ds_partitioned__year
+ , subq_10.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_10.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_10.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_10.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_10.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_10.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_10.paid_at__day AS paid_at__day
+ , subq_10.paid_at__week AS paid_at__week
+ , subq_10.paid_at__month AS paid_at__month
+ , subq_10.paid_at__quarter AS paid_at__quarter
+ , subq_10.paid_at__year AS paid_at__year
+ , subq_10.paid_at__extract_year AS paid_at__extract_year
+ , subq_10.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_10.paid_at__extract_month AS paid_at__extract_month
+ , subq_10.paid_at__extract_day AS paid_at__extract_day
+ , subq_10.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_10.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_10.booking__ds__day AS booking__ds__day
+ , subq_10.booking__ds__week AS booking__ds__week
+ , subq_10.booking__ds__month AS booking__ds__month
+ , subq_10.booking__ds__quarter AS booking__ds__quarter
+ , subq_10.booking__ds__year AS booking__ds__year
+ , subq_10.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_10.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_10.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_10.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_10.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_10.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_10.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_10.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_10.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_10.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_10.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_10.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_10.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_10.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_10.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_10.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_10.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_10.booking__paid_at__day AS booking__paid_at__day
+ , subq_10.booking__paid_at__week AS booking__paid_at__week
+ , subq_10.booking__paid_at__month AS booking__paid_at__month
+ , subq_10.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_10.booking__paid_at__year AS booking__paid_at__year
+ , subq_10.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_10.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_10.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_10.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_10.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_10.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_10.listing AS listing
+ , subq_10.guest AS guest
+ , subq_10.host AS host
+ , subq_10.booking__listing AS booking__listing
+ , subq_10.booking__guest AS booking__guest
+ , subq_10.booking__host AS booking__host
+ , subq_10.is_instant AS is_instant
+ , subq_10.booking__is_instant AS booking__is_instant
+ , subq_10.bookings AS bookings
+ , subq_10.instant_bookings AS instant_bookings
+ , subq_10.booking_value AS booking_value
+ , subq_10.max_booking_value AS max_booking_value
+ , subq_10.min_booking_value AS min_booking_value
+ , subq_10.bookers AS bookers
+ , subq_10.average_booking_value AS average_booking_value
+ , subq_10.referred_bookings AS referred_bookings
+ , subq_10.median_booking_value AS median_booking_value
+ , subq_10.booking_value_p99 AS booking_value_p99
+ , subq_10.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_10.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_10.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_3.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_3
- WHERE subq_3.ds BETWEEN '2019-12-19' AND '2020-01-02'
- ) subq_2
+ subq_12.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_12
+ WHERE subq_12.ds BETWEEN '2019-12-19' AND '2020-01-02'
+ ) subq_11
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
ON
- subq_2.metric_time__day - INTERVAL 5 day = subq_1.metric_time__day
- ) subq_4
- ) subq_5
+ subq_11.metric_time__day - INTERVAL 5 day = subq_10.metric_time__day
+ ) subq_13
+ ) subq_14
GROUP BY
- subq_5.metric_time__day
- ) subq_6
-) subq_7
+ subq_14.metric_time__day
+ ) subq_15
+) subq_16
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_time_offset_metric_with_time_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_time_offset_metric_with_time_constraint__plan0_optimized.sql
index 0c95d432b8..14d9b3da81 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_time_offset_metric_with_time_constraint__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/DuckDB/test_time_offset_metric_with_time_constraint__plan0_optimized.sql
@@ -8,25 +8,25 @@ FROM (
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_10.metric_time__day AS metric_time__day
- , SUM(subq_9.bookings) AS bookings_5_days_ago
+ subq_19.metric_time__day AS metric_time__day
+ , SUM(subq_18.bookings) AS bookings_5_days_ago
FROM (
-- Time Spine
SELECT
ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_11
+ FROM ***************************.mf_time_spine subq_20
WHERE ds BETWEEN '2019-12-19' AND '2020-01-02'
- ) subq_10
+ ) subq_19
INNER JOIN (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
SELECT
DATE_TRUNC('day', ds) AS metric_time__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_9
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_18
ON
- subq_10.metric_time__day - INTERVAL 5 day = subq_9.metric_time__day
+ subq_19.metric_time__day - INTERVAL 5 day = subq_18.metric_time__day
GROUP BY
- subq_10.metric_time__day
-) subq_15
+ subq_19.metric_time__day
+) subq_24
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_time_offset_metric_with_time_constraint__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_time_offset_metric_with_time_constraint__plan0.sql
index f7f967a868..85539f43d3 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_time_offset_metric_with_time_constraint__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_time_offset_metric_with_time_constraint__plan0.sql
@@ -1,441 +1,441 @@
-- Compute Metrics via Expressions
SELECT
- subq_11.metric_time__day
+ subq_20.metric_time__day
, every_2_days_bookers_2_days_ago AS every_2_days_bookers_2_days_ago
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_10.metric_time__day
- , subq_10.bookers AS every_2_days_bookers_2_days_ago
+ subq_19.metric_time__day
+ , subq_19.bookers AS every_2_days_bookers_2_days_ago
FROM (
-- Aggregate Measures
SELECT
- subq_9.metric_time__day
- , COUNT(DISTINCT subq_9.bookers) AS bookers
+ subq_18.metric_time__day
+ , COUNT(DISTINCT subq_18.bookers) AS bookers
FROM (
-- Constrain Time Range to [2019-12-19T00:00:00, 2020-01-02T00:00:00]
SELECT
- subq_8.metric_time__day
- , subq_8.bookers
+ subq_17.metric_time__day
+ , subq_17.bookers
FROM (
-- Pass Only Elements: ['bookers', 'metric_time__day']
SELECT
- subq_7.metric_time__day
- , subq_7.bookers
+ subq_16.metric_time__day
+ , subq_16.bookers
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_5.metric_time__day AS metric_time__day
- , subq_4.ds__day AS ds__day
- , subq_4.ds__week AS ds__week
- , subq_4.ds__month AS ds__month
- , subq_4.ds__quarter AS ds__quarter
- , subq_4.ds__year AS ds__year
- , subq_4.ds__extract_year AS ds__extract_year
- , subq_4.ds__extract_quarter AS ds__extract_quarter
- , subq_4.ds__extract_month AS ds__extract_month
- , subq_4.ds__extract_day AS ds__extract_day
- , subq_4.ds__extract_dow AS ds__extract_dow
- , subq_4.ds__extract_doy AS ds__extract_doy
- , subq_4.ds_partitioned__day AS ds_partitioned__day
- , subq_4.ds_partitioned__week AS ds_partitioned__week
- , subq_4.ds_partitioned__month AS ds_partitioned__month
- , subq_4.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_4.ds_partitioned__year AS ds_partitioned__year
- , subq_4.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_4.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_4.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_4.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_4.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_4.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_4.paid_at__day AS paid_at__day
- , subq_4.paid_at__week AS paid_at__week
- , subq_4.paid_at__month AS paid_at__month
- , subq_4.paid_at__quarter AS paid_at__quarter
- , subq_4.paid_at__year AS paid_at__year
- , subq_4.paid_at__extract_year AS paid_at__extract_year
- , subq_4.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_4.paid_at__extract_month AS paid_at__extract_month
- , subq_4.paid_at__extract_day AS paid_at__extract_day
- , subq_4.paid_at__extract_dow AS paid_at__extract_dow
- , subq_4.paid_at__extract_doy AS paid_at__extract_doy
- , subq_4.booking__ds__day AS booking__ds__day
- , subq_4.booking__ds__week AS booking__ds__week
- , subq_4.booking__ds__month AS booking__ds__month
- , subq_4.booking__ds__quarter AS booking__ds__quarter
- , subq_4.booking__ds__year AS booking__ds__year
- , subq_4.booking__ds__extract_year AS booking__ds__extract_year
- , subq_4.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_4.booking__ds__extract_month AS booking__ds__extract_month
- , subq_4.booking__ds__extract_day AS booking__ds__extract_day
- , subq_4.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_4.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_4.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_4.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_4.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_4.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_4.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_4.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_4.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_4.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_4.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_4.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_4.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_4.booking__paid_at__day AS booking__paid_at__day
- , subq_4.booking__paid_at__week AS booking__paid_at__week
- , subq_4.booking__paid_at__month AS booking__paid_at__month
- , subq_4.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_4.booking__paid_at__year AS booking__paid_at__year
- , subq_4.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_4.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_4.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_4.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_4.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_4.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_4.listing AS listing
- , subq_4.guest AS guest
- , subq_4.host AS host
- , subq_4.booking__listing AS booking__listing
- , subq_4.booking__guest AS booking__guest
- , subq_4.booking__host AS booking__host
- , subq_4.is_instant AS is_instant
- , subq_4.booking__is_instant AS booking__is_instant
- , subq_4.bookings AS bookings
- , subq_4.instant_bookings AS instant_bookings
- , subq_4.booking_value AS booking_value
- , subq_4.max_booking_value AS max_booking_value
- , subq_4.min_booking_value AS min_booking_value
- , subq_4.bookers AS bookers
- , subq_4.average_booking_value AS average_booking_value
- , subq_4.referred_bookings AS referred_bookings
- , subq_4.median_booking_value AS median_booking_value
- , subq_4.booking_value_p99 AS booking_value_p99
- , subq_4.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_4.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_4.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ subq_14.metric_time__day AS metric_time__day
+ , subq_13.ds__day AS ds__day
+ , subq_13.ds__week AS ds__week
+ , subq_13.ds__month AS ds__month
+ , subq_13.ds__quarter AS ds__quarter
+ , subq_13.ds__year AS ds__year
+ , subq_13.ds__extract_year AS ds__extract_year
+ , subq_13.ds__extract_quarter AS ds__extract_quarter
+ , subq_13.ds__extract_month AS ds__extract_month
+ , subq_13.ds__extract_day AS ds__extract_day
+ , subq_13.ds__extract_dow AS ds__extract_dow
+ , subq_13.ds__extract_doy AS ds__extract_doy
+ , subq_13.ds_partitioned__day AS ds_partitioned__day
+ , subq_13.ds_partitioned__week AS ds_partitioned__week
+ , subq_13.ds_partitioned__month AS ds_partitioned__month
+ , subq_13.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_13.ds_partitioned__year AS ds_partitioned__year
+ , subq_13.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_13.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_13.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_13.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_13.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_13.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_13.paid_at__day AS paid_at__day
+ , subq_13.paid_at__week AS paid_at__week
+ , subq_13.paid_at__month AS paid_at__month
+ , subq_13.paid_at__quarter AS paid_at__quarter
+ , subq_13.paid_at__year AS paid_at__year
+ , subq_13.paid_at__extract_year AS paid_at__extract_year
+ , subq_13.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_13.paid_at__extract_month AS paid_at__extract_month
+ , subq_13.paid_at__extract_day AS paid_at__extract_day
+ , subq_13.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_13.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_13.booking__ds__day AS booking__ds__day
+ , subq_13.booking__ds__week AS booking__ds__week
+ , subq_13.booking__ds__month AS booking__ds__month
+ , subq_13.booking__ds__quarter AS booking__ds__quarter
+ , subq_13.booking__ds__year AS booking__ds__year
+ , subq_13.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_13.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_13.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_13.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_13.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_13.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_13.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_13.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_13.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_13.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_13.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_13.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_13.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_13.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_13.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_13.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_13.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_13.booking__paid_at__day AS booking__paid_at__day
+ , subq_13.booking__paid_at__week AS booking__paid_at__week
+ , subq_13.booking__paid_at__month AS booking__paid_at__month
+ , subq_13.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_13.booking__paid_at__year AS booking__paid_at__year
+ , subq_13.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_13.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_13.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_13.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_13.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_13.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_13.listing AS listing
+ , subq_13.guest AS guest
+ , subq_13.host AS host
+ , subq_13.booking__listing AS booking__listing
+ , subq_13.booking__guest AS booking__guest
+ , subq_13.booking__host AS booking__host
+ , subq_13.is_instant AS is_instant
+ , subq_13.booking__is_instant AS booking__is_instant
+ , subq_13.bookings AS bookings
+ , subq_13.instant_bookings AS instant_bookings
+ , subq_13.booking_value AS booking_value
+ , subq_13.max_booking_value AS max_booking_value
+ , subq_13.min_booking_value AS min_booking_value
+ , subq_13.bookers AS bookers
+ , subq_13.average_booking_value AS average_booking_value
+ , subq_13.referred_bookings AS referred_bookings
+ , subq_13.median_booking_value AS median_booking_value
+ , subq_13.booking_value_p99 AS booking_value_p99
+ , subq_13.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_13.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_13.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_6.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_6
- WHERE subq_6.ds BETWEEN '2019-12-19' AND '2020-01-02'
- ) subq_5
+ subq_15.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_15
+ WHERE subq_15.ds BETWEEN '2019-12-19' AND '2020-01-02'
+ ) subq_14
INNER JOIN (
-- Join Self Over Time Range
SELECT
- subq_2.metric_time__day AS metric_time__day
- , subq_1.ds__day AS ds__day
- , subq_1.ds__week AS ds__week
- , subq_1.ds__month AS ds__month
- , subq_1.ds__quarter AS ds__quarter
- , subq_1.ds__year AS ds__year
- , subq_1.ds__extract_year AS ds__extract_year
- , subq_1.ds__extract_quarter AS ds__extract_quarter
- , subq_1.ds__extract_month AS ds__extract_month
- , subq_1.ds__extract_day AS ds__extract_day
- , subq_1.ds__extract_dow AS ds__extract_dow
- , subq_1.ds__extract_doy AS ds__extract_doy
- , subq_1.ds_partitioned__day AS ds_partitioned__day
- , subq_1.ds_partitioned__week AS ds_partitioned__week
- , subq_1.ds_partitioned__month AS ds_partitioned__month
- , subq_1.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_1.ds_partitioned__year AS ds_partitioned__year
- , subq_1.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_1.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_1.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_1.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_1.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_1.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_1.paid_at__day AS paid_at__day
- , subq_1.paid_at__week AS paid_at__week
- , subq_1.paid_at__month AS paid_at__month
- , subq_1.paid_at__quarter AS paid_at__quarter
- , subq_1.paid_at__year AS paid_at__year
- , subq_1.paid_at__extract_year AS paid_at__extract_year
- , subq_1.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_1.paid_at__extract_month AS paid_at__extract_month
- , subq_1.paid_at__extract_day AS paid_at__extract_day
- , subq_1.paid_at__extract_dow AS paid_at__extract_dow
- , subq_1.paid_at__extract_doy AS paid_at__extract_doy
- , subq_1.booking__ds__day AS booking__ds__day
- , subq_1.booking__ds__week AS booking__ds__week
- , subq_1.booking__ds__month AS booking__ds__month
- , subq_1.booking__ds__quarter AS booking__ds__quarter
- , subq_1.booking__ds__year AS booking__ds__year
- , subq_1.booking__ds__extract_year AS booking__ds__extract_year
- , subq_1.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_1.booking__ds__extract_month AS booking__ds__extract_month
- , subq_1.booking__ds__extract_day AS booking__ds__extract_day
- , subq_1.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_1.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_1.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_1.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_1.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_1.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_1.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_1.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_1.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_1.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_1.booking__paid_at__day AS booking__paid_at__day
- , subq_1.booking__paid_at__week AS booking__paid_at__week
- , subq_1.booking__paid_at__month AS booking__paid_at__month
- , subq_1.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_1.booking__paid_at__year AS booking__paid_at__year
- , subq_1.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_1.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_1.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_1.metric_time__week AS metric_time__week
- , subq_1.metric_time__month AS metric_time__month
- , subq_1.metric_time__quarter AS metric_time__quarter
- , subq_1.metric_time__year AS metric_time__year
- , subq_1.metric_time__extract_year AS metric_time__extract_year
- , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter
- , subq_1.metric_time__extract_month AS metric_time__extract_month
- , subq_1.metric_time__extract_day AS metric_time__extract_day
- , subq_1.metric_time__extract_dow AS metric_time__extract_dow
- , subq_1.metric_time__extract_doy AS metric_time__extract_doy
- , subq_1.listing AS listing
- , subq_1.guest AS guest
- , subq_1.host AS host
- , subq_1.booking__listing AS booking__listing
- , subq_1.booking__guest AS booking__guest
- , subq_1.booking__host AS booking__host
- , subq_1.is_instant AS is_instant
- , subq_1.booking__is_instant AS booking__is_instant
- , subq_1.bookings AS bookings
- , subq_1.instant_bookings AS instant_bookings
- , subq_1.booking_value AS booking_value
- , subq_1.max_booking_value AS max_booking_value
- , subq_1.min_booking_value AS min_booking_value
- , subq_1.bookers AS bookers
- , subq_1.average_booking_value AS average_booking_value
- , subq_1.referred_bookings AS referred_bookings
- , subq_1.median_booking_value AS median_booking_value
- , subq_1.booking_value_p99 AS booking_value_p99
- , subq_1.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_1.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_1.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ subq_11.metric_time__day AS metric_time__day
+ , subq_10.ds__day AS ds__day
+ , subq_10.ds__week AS ds__week
+ , subq_10.ds__month AS ds__month
+ , subq_10.ds__quarter AS ds__quarter
+ , subq_10.ds__year AS ds__year
+ , subq_10.ds__extract_year AS ds__extract_year
+ , subq_10.ds__extract_quarter AS ds__extract_quarter
+ , subq_10.ds__extract_month AS ds__extract_month
+ , subq_10.ds__extract_day AS ds__extract_day
+ , subq_10.ds__extract_dow AS ds__extract_dow
+ , subq_10.ds__extract_doy AS ds__extract_doy
+ , subq_10.ds_partitioned__day AS ds_partitioned__day
+ , subq_10.ds_partitioned__week AS ds_partitioned__week
+ , subq_10.ds_partitioned__month AS ds_partitioned__month
+ , subq_10.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_10.ds_partitioned__year AS ds_partitioned__year
+ , subq_10.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_10.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_10.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_10.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_10.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_10.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_10.paid_at__day AS paid_at__day
+ , subq_10.paid_at__week AS paid_at__week
+ , subq_10.paid_at__month AS paid_at__month
+ , subq_10.paid_at__quarter AS paid_at__quarter
+ , subq_10.paid_at__year AS paid_at__year
+ , subq_10.paid_at__extract_year AS paid_at__extract_year
+ , subq_10.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_10.paid_at__extract_month AS paid_at__extract_month
+ , subq_10.paid_at__extract_day AS paid_at__extract_day
+ , subq_10.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_10.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_10.booking__ds__day AS booking__ds__day
+ , subq_10.booking__ds__week AS booking__ds__week
+ , subq_10.booking__ds__month AS booking__ds__month
+ , subq_10.booking__ds__quarter AS booking__ds__quarter
+ , subq_10.booking__ds__year AS booking__ds__year
+ , subq_10.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_10.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_10.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_10.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_10.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_10.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_10.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_10.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_10.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_10.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_10.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_10.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_10.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_10.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_10.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_10.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_10.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_10.booking__paid_at__day AS booking__paid_at__day
+ , subq_10.booking__paid_at__week AS booking__paid_at__week
+ , subq_10.booking__paid_at__month AS booking__paid_at__month
+ , subq_10.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_10.booking__paid_at__year AS booking__paid_at__year
+ , subq_10.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_10.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_10.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_10.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_10.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_10.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_10.metric_time__week AS metric_time__week
+ , subq_10.metric_time__month AS metric_time__month
+ , subq_10.metric_time__quarter AS metric_time__quarter
+ , subq_10.metric_time__year AS metric_time__year
+ , subq_10.metric_time__extract_year AS metric_time__extract_year
+ , subq_10.metric_time__extract_quarter AS metric_time__extract_quarter
+ , subq_10.metric_time__extract_month AS metric_time__extract_month
+ , subq_10.metric_time__extract_day AS metric_time__extract_day
+ , subq_10.metric_time__extract_dow AS metric_time__extract_dow
+ , subq_10.metric_time__extract_doy AS metric_time__extract_doy
+ , subq_10.listing AS listing
+ , subq_10.guest AS guest
+ , subq_10.host AS host
+ , subq_10.booking__listing AS booking__listing
+ , subq_10.booking__guest AS booking__guest
+ , subq_10.booking__host AS booking__host
+ , subq_10.is_instant AS is_instant
+ , subq_10.booking__is_instant AS booking__is_instant
+ , subq_10.bookings AS bookings
+ , subq_10.instant_bookings AS instant_bookings
+ , subq_10.booking_value AS booking_value
+ , subq_10.max_booking_value AS max_booking_value
+ , subq_10.min_booking_value AS min_booking_value
+ , subq_10.bookers AS bookers
+ , subq_10.average_booking_value AS average_booking_value
+ , subq_10.referred_bookings AS referred_bookings
+ , subq_10.median_booking_value AS median_booking_value
+ , subq_10.booking_value_p99 AS booking_value_p99
+ , subq_10.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_10.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_10.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_3.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_3
- ) subq_2
+ subq_12.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_12
+ ) subq_11
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
ON
(
- subq_1.metric_time__day <= subq_2.metric_time__day
+ subq_10.metric_time__day <= subq_11.metric_time__day
) AND (
- subq_1.metric_time__day > subq_2.metric_time__day - MAKE_INTERVAL(days => 2)
+ subq_10.metric_time__day > subq_11.metric_time__day - MAKE_INTERVAL(days => 2)
)
- ) subq_4
+ ) subq_13
ON
- subq_5.metric_time__day - MAKE_INTERVAL(days => 2) = subq_4.metric_time__day
- ) subq_7
- ) subq_8
- WHERE subq_8.metric_time__day BETWEEN '2019-12-19' AND '2020-01-02'
- ) subq_9
+ subq_14.metric_time__day - MAKE_INTERVAL(days => 2) = subq_13.metric_time__day
+ ) subq_16
+ ) subq_17
+ WHERE subq_17.metric_time__day BETWEEN '2019-12-19' AND '2020-01-02'
+ ) subq_18
GROUP BY
- subq_9.metric_time__day
- ) subq_10
-) subq_11
+ subq_18.metric_time__day
+ ) subq_19
+) subq_20
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_time_offset_metric_with_time_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_time_offset_metric_with_time_constraint__plan0_optimized.sql
index ae64ce456a..c4a9c3e2bb 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_time_offset_metric_with_time_constraint__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_cumulative_time_offset_metric_with_time_constraint__plan0_optimized.sql
@@ -9,33 +9,33 @@ FROM (
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_17.metric_time__day AS metric_time__day
- , COUNT(DISTINCT subq_16.bookers) AS every_2_days_bookers_2_days_ago
+ subq_26.metric_time__day AS metric_time__day
+ , COUNT(DISTINCT subq_25.bookers) AS every_2_days_bookers_2_days_ago
FROM (
-- Time Spine
SELECT
ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_18
+ FROM ***************************.mf_time_spine subq_27
WHERE ds BETWEEN '2019-12-19' AND '2020-01-02'
- ) subq_17
+ ) subq_26
INNER JOIN (
-- Join Self Over Time Range
SELECT
- subq_15.ds AS metric_time__day
- , bookings_source_src_28001.guest_id AS bookers
- FROM ***************************.mf_time_spine subq_15
+ subq_24.ds AS metric_time__day
+ , bookings_source_src_28000.guest_id AS bookers
+ FROM ***************************.mf_time_spine subq_24
INNER JOIN
- ***************************.fct_bookings bookings_source_src_28001
+ ***************************.fct_bookings bookings_source_src_28000
ON
(
- DATE_TRUNC('day', bookings_source_src_28001.ds) <= subq_15.ds
+ DATE_TRUNC('day', bookings_source_src_28000.ds) <= subq_24.ds
) AND (
- DATE_TRUNC('day', bookings_source_src_28001.ds) > subq_15.ds - MAKE_INTERVAL(days => 2)
+ DATE_TRUNC('day', bookings_source_src_28000.ds) > subq_24.ds - MAKE_INTERVAL(days => 2)
)
- ) subq_16
+ ) subq_25
ON
- subq_17.metric_time__day - MAKE_INTERVAL(days => 2) = subq_16.metric_time__day
- WHERE subq_17.metric_time__day BETWEEN '2019-12-19' AND '2020-01-02'
+ subq_26.metric_time__day - MAKE_INTERVAL(days => 2) = subq_25.metric_time__day
+ WHERE subq_26.metric_time__day BETWEEN '2019-12-19' AND '2020-01-02'
GROUP BY
- subq_17.metric_time__day
-) subq_23
+ subq_26.metric_time__day
+) subq_32
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric__plan0.sql
index ea8a884590..7d019a0866 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric__plan0.sql
@@ -1,445 +1,445 @@
-- Compute Metrics via Expressions
SELECT
- subq_10.metric_time__day
+ subq_19.metric_time__day
, (bookings - ref_bookings) * 1.0 / bookings AS non_referred_bookings_pct
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_4.metric_time__day, subq_9.metric_time__day) AS metric_time__day
- , MAX(subq_4.ref_bookings) AS ref_bookings
- , MAX(subq_9.bookings) AS bookings
+ COALESCE(subq_13.metric_time__day, subq_18.metric_time__day) AS metric_time__day
+ , MAX(subq_13.ref_bookings) AS ref_bookings
+ , MAX(subq_18.bookings) AS bookings
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_3.metric_time__day
- , subq_3.referred_bookings AS ref_bookings
+ subq_12.metric_time__day
+ , subq_12.referred_bookings AS ref_bookings
FROM (
-- Aggregate Measures
SELECT
- subq_2.metric_time__day
- , SUM(subq_2.referred_bookings) AS referred_bookings
+ subq_11.metric_time__day
+ , SUM(subq_11.referred_bookings) AS referred_bookings
FROM (
-- Pass Only Elements: ['referred_bookings', 'metric_time__day']
SELECT
- subq_1.metric_time__day
- , subq_1.referred_bookings
+ subq_10.metric_time__day
+ , subq_10.referred_bookings
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
- ) subq_2
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
GROUP BY
- subq_2.metric_time__day
- ) subq_3
- ) subq_4
+ subq_11.metric_time__day
+ ) subq_12
+ ) subq_13
FULL OUTER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_8.metric_time__day
- , subq_8.bookings
+ subq_17.metric_time__day
+ , subq_17.bookings
FROM (
-- Aggregate Measures
SELECT
- subq_7.metric_time__day
- , SUM(subq_7.bookings) AS bookings
+ subq_16.metric_time__day
+ , SUM(subq_16.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__day']
SELECT
- subq_6.metric_time__day
- , subq_6.bookings
+ subq_15.metric_time__day
+ , subq_15.bookings
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_5.ds__day
- , subq_5.ds__week
- , subq_5.ds__month
- , subq_5.ds__quarter
- , subq_5.ds__year
- , subq_5.ds__extract_year
- , subq_5.ds__extract_quarter
- , subq_5.ds__extract_month
- , subq_5.ds__extract_day
- , subq_5.ds__extract_dow
- , subq_5.ds__extract_doy
- , subq_5.ds_partitioned__day
- , subq_5.ds_partitioned__week
- , subq_5.ds_partitioned__month
- , subq_5.ds_partitioned__quarter
- , subq_5.ds_partitioned__year
- , subq_5.ds_partitioned__extract_year
- , subq_5.ds_partitioned__extract_quarter
- , subq_5.ds_partitioned__extract_month
- , subq_5.ds_partitioned__extract_day
- , subq_5.ds_partitioned__extract_dow
- , subq_5.ds_partitioned__extract_doy
- , subq_5.paid_at__day
- , subq_5.paid_at__week
- , subq_5.paid_at__month
- , subq_5.paid_at__quarter
- , subq_5.paid_at__year
- , subq_5.paid_at__extract_year
- , subq_5.paid_at__extract_quarter
- , subq_5.paid_at__extract_month
- , subq_5.paid_at__extract_day
- , subq_5.paid_at__extract_dow
- , subq_5.paid_at__extract_doy
- , subq_5.booking__ds__day
- , subq_5.booking__ds__week
- , subq_5.booking__ds__month
- , subq_5.booking__ds__quarter
- , subq_5.booking__ds__year
- , subq_5.booking__ds__extract_year
- , subq_5.booking__ds__extract_quarter
- , subq_5.booking__ds__extract_month
- , subq_5.booking__ds__extract_day
- , subq_5.booking__ds__extract_dow
- , subq_5.booking__ds__extract_doy
- , subq_5.booking__ds_partitioned__day
- , subq_5.booking__ds_partitioned__week
- , subq_5.booking__ds_partitioned__month
- , subq_5.booking__ds_partitioned__quarter
- , subq_5.booking__ds_partitioned__year
- , subq_5.booking__ds_partitioned__extract_year
- , subq_5.booking__ds_partitioned__extract_quarter
- , subq_5.booking__ds_partitioned__extract_month
- , subq_5.booking__ds_partitioned__extract_day
- , subq_5.booking__ds_partitioned__extract_dow
- , subq_5.booking__ds_partitioned__extract_doy
- , subq_5.booking__paid_at__day
- , subq_5.booking__paid_at__week
- , subq_5.booking__paid_at__month
- , subq_5.booking__paid_at__quarter
- , subq_5.booking__paid_at__year
- , subq_5.booking__paid_at__extract_year
- , subq_5.booking__paid_at__extract_quarter
- , subq_5.booking__paid_at__extract_month
- , subq_5.booking__paid_at__extract_day
- , subq_5.booking__paid_at__extract_dow
- , subq_5.booking__paid_at__extract_doy
- , subq_5.ds__day AS metric_time__day
- , subq_5.ds__week AS metric_time__week
- , subq_5.ds__month AS metric_time__month
- , subq_5.ds__quarter AS metric_time__quarter
- , subq_5.ds__year AS metric_time__year
- , subq_5.ds__extract_year AS metric_time__extract_year
- , subq_5.ds__extract_quarter AS metric_time__extract_quarter
- , subq_5.ds__extract_month AS metric_time__extract_month
- , subq_5.ds__extract_day AS metric_time__extract_day
- , subq_5.ds__extract_dow AS metric_time__extract_dow
- , subq_5.ds__extract_doy AS metric_time__extract_doy
- , subq_5.listing
- , subq_5.guest
- , subq_5.host
- , subq_5.booking__listing
- , subq_5.booking__guest
- , subq_5.booking__host
- , subq_5.is_instant
- , subq_5.booking__is_instant
- , subq_5.bookings
- , subq_5.instant_bookings
- , subq_5.booking_value
- , subq_5.max_booking_value
- , subq_5.min_booking_value
- , subq_5.bookers
- , subq_5.average_booking_value
- , subq_5.referred_bookings
- , subq_5.median_booking_value
- , subq_5.booking_value_p99
- , subq_5.discrete_booking_value_p99
- , subq_5.approximate_continuous_booking_value_p99
- , subq_5.approximate_discrete_booking_value_p99
+ subq_14.ds__day
+ , subq_14.ds__week
+ , subq_14.ds__month
+ , subq_14.ds__quarter
+ , subq_14.ds__year
+ , subq_14.ds__extract_year
+ , subq_14.ds__extract_quarter
+ , subq_14.ds__extract_month
+ , subq_14.ds__extract_day
+ , subq_14.ds__extract_dow
+ , subq_14.ds__extract_doy
+ , subq_14.ds_partitioned__day
+ , subq_14.ds_partitioned__week
+ , subq_14.ds_partitioned__month
+ , subq_14.ds_partitioned__quarter
+ , subq_14.ds_partitioned__year
+ , subq_14.ds_partitioned__extract_year
+ , subq_14.ds_partitioned__extract_quarter
+ , subq_14.ds_partitioned__extract_month
+ , subq_14.ds_partitioned__extract_day
+ , subq_14.ds_partitioned__extract_dow
+ , subq_14.ds_partitioned__extract_doy
+ , subq_14.paid_at__day
+ , subq_14.paid_at__week
+ , subq_14.paid_at__month
+ , subq_14.paid_at__quarter
+ , subq_14.paid_at__year
+ , subq_14.paid_at__extract_year
+ , subq_14.paid_at__extract_quarter
+ , subq_14.paid_at__extract_month
+ , subq_14.paid_at__extract_day
+ , subq_14.paid_at__extract_dow
+ , subq_14.paid_at__extract_doy
+ , subq_14.booking__ds__day
+ , subq_14.booking__ds__week
+ , subq_14.booking__ds__month
+ , subq_14.booking__ds__quarter
+ , subq_14.booking__ds__year
+ , subq_14.booking__ds__extract_year
+ , subq_14.booking__ds__extract_quarter
+ , subq_14.booking__ds__extract_month
+ , subq_14.booking__ds__extract_day
+ , subq_14.booking__ds__extract_dow
+ , subq_14.booking__ds__extract_doy
+ , subq_14.booking__ds_partitioned__day
+ , subq_14.booking__ds_partitioned__week
+ , subq_14.booking__ds_partitioned__month
+ , subq_14.booking__ds_partitioned__quarter
+ , subq_14.booking__ds_partitioned__year
+ , subq_14.booking__ds_partitioned__extract_year
+ , subq_14.booking__ds_partitioned__extract_quarter
+ , subq_14.booking__ds_partitioned__extract_month
+ , subq_14.booking__ds_partitioned__extract_day
+ , subq_14.booking__ds_partitioned__extract_dow
+ , subq_14.booking__ds_partitioned__extract_doy
+ , subq_14.booking__paid_at__day
+ , subq_14.booking__paid_at__week
+ , subq_14.booking__paid_at__month
+ , subq_14.booking__paid_at__quarter
+ , subq_14.booking__paid_at__year
+ , subq_14.booking__paid_at__extract_year
+ , subq_14.booking__paid_at__extract_quarter
+ , subq_14.booking__paid_at__extract_month
+ , subq_14.booking__paid_at__extract_day
+ , subq_14.booking__paid_at__extract_dow
+ , subq_14.booking__paid_at__extract_doy
+ , subq_14.ds__day AS metric_time__day
+ , subq_14.ds__week AS metric_time__week
+ , subq_14.ds__month AS metric_time__month
+ , subq_14.ds__quarter AS metric_time__quarter
+ , subq_14.ds__year AS metric_time__year
+ , subq_14.ds__extract_year AS metric_time__extract_year
+ , subq_14.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_14.ds__extract_month AS metric_time__extract_month
+ , subq_14.ds__extract_day AS metric_time__extract_day
+ , subq_14.ds__extract_dow AS metric_time__extract_dow
+ , subq_14.ds__extract_doy AS metric_time__extract_doy
+ , subq_14.listing
+ , subq_14.guest
+ , subq_14.host
+ , subq_14.booking__listing
+ , subq_14.booking__guest
+ , subq_14.booking__host
+ , subq_14.is_instant
+ , subq_14.booking__is_instant
+ , subq_14.bookings
+ , subq_14.instant_bookings
+ , subq_14.booking_value
+ , subq_14.max_booking_value
+ , subq_14.min_booking_value
+ , subq_14.bookers
+ , subq_14.average_booking_value
+ , subq_14.referred_bookings
+ , subq_14.median_booking_value
+ , subq_14.booking_value_p99
+ , subq_14.discrete_booking_value_p99
+ , subq_14.approximate_continuous_booking_value_p99
+ , subq_14.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_5
- ) subq_6
- ) subq_7
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_14
+ ) subq_15
+ ) subq_16
GROUP BY
- subq_7.metric_time__day
- ) subq_8
- ) subq_9
+ subq_16.metric_time__day
+ ) subq_17
+ ) subq_18
ON
- subq_4.metric_time__day = subq_9.metric_time__day
+ subq_13.metric_time__day = subq_18.metric_time__day
GROUP BY
- COALESCE(subq_4.metric_time__day, subq_9.metric_time__day)
-) subq_10
+ COALESCE(subq_13.metric_time__day, subq_18.metric_time__day)
+) subq_19
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric__plan0_optimized.sql
index 23f7234c6e..1638560b4d 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric__plan0_optimized.sql
@@ -5,9 +5,9 @@ SELECT
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_15.metric_time__day, subq_20.metric_time__day) AS metric_time__day
- , MAX(subq_15.ref_bookings) AS ref_bookings
- , MAX(subq_20.bookings) AS bookings
+ COALESCE(subq_24.metric_time__day, subq_29.metric_time__day) AS metric_time__day
+ , MAX(subq_24.ref_bookings) AS ref_bookings
+ , MAX(subq_29.bookings) AS bookings
FROM (
-- Aggregate Measures
-- Compute Metrics via Expressions
@@ -21,11 +21,11 @@ FROM (
SELECT
DATE_TRUNC('day', ds) 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_28001
- ) subq_13
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_22
GROUP BY
metric_time__day
- ) subq_15
+ ) subq_24
FULL OUTER JOIN (
-- Aggregate Measures
-- Compute Metrics via Expressions
@@ -39,13 +39,13 @@ FROM (
SELECT
DATE_TRUNC('day', ds) AS metric_time__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_18
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_27
GROUP BY
metric_time__day
- ) subq_20
+ ) subq_29
ON
- subq_15.metric_time__day = subq_20.metric_time__day
+ subq_24.metric_time__day = subq_29.metric_time__day
GROUP BY
- COALESCE(subq_15.metric_time__day, subq_20.metric_time__day)
-) subq_21
+ COALESCE(subq_24.metric_time__day, subq_29.metric_time__day)
+) subq_30
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_month_dimension_and_offset_window__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_month_dimension_and_offset_window__plan0.sql
index 95226e4eb9..f8dc6c39e5 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_month_dimension_and_offset_window__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_month_dimension_and_offset_window__plan0.sql
@@ -1,73 +1,73 @@
-- Compute Metrics via Expressions
SELECT
- subq_7.metric_time__month
+ subq_9.metric_time__month
, bookings_last_month AS bookings_last_month
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_6.metric_time__month
- , subq_6.bookings_monthly AS bookings_last_month
+ subq_8.metric_time__month
+ , subq_8.bookings_monthly AS bookings_last_month
FROM (
-- Aggregate Measures
SELECT
- subq_5.metric_time__month
- , SUM(subq_5.bookings_monthly) AS bookings_monthly
+ subq_7.metric_time__month
+ , SUM(subq_7.bookings_monthly) AS bookings_monthly
FROM (
-- Pass Only Elements: ['bookings_monthly', 'metric_time__month']
SELECT
- subq_4.metric_time__month
- , subq_4.bookings_monthly
+ subq_6.metric_time__month
+ , subq_6.bookings_monthly
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_2.metric_time__month AS metric_time__month
- , subq_1.monthly_ds__month AS monthly_ds__month
- , subq_1.monthly_ds__quarter AS monthly_ds__quarter
- , subq_1.monthly_ds__year AS monthly_ds__year
- , subq_1.monthly_ds__extract_year AS monthly_ds__extract_year
- , subq_1.monthly_ds__extract_quarter AS monthly_ds__extract_quarter
- , subq_1.monthly_ds__extract_month AS monthly_ds__extract_month
- , subq_1.booking__monthly_ds__month AS booking__monthly_ds__month
- , subq_1.booking__monthly_ds__quarter AS booking__monthly_ds__quarter
- , subq_1.booking__monthly_ds__year AS booking__monthly_ds__year
- , subq_1.booking__monthly_ds__extract_year AS booking__monthly_ds__extract_year
- , subq_1.booking__monthly_ds__extract_quarter AS booking__monthly_ds__extract_quarter
- , subq_1.booking__monthly_ds__extract_month AS booking__monthly_ds__extract_month
- , subq_1.listing AS listing
- , subq_1.booking__listing AS booking__listing
- , subq_1.bookings_monthly AS bookings_monthly
+ subq_4.metric_time__month AS metric_time__month
+ , subq_3.monthly_ds__month AS monthly_ds__month
+ , subq_3.monthly_ds__quarter AS monthly_ds__quarter
+ , subq_3.monthly_ds__year AS monthly_ds__year
+ , subq_3.monthly_ds__extract_year AS monthly_ds__extract_year
+ , subq_3.monthly_ds__extract_quarter AS monthly_ds__extract_quarter
+ , subq_3.monthly_ds__extract_month AS monthly_ds__extract_month
+ , subq_3.booking__monthly_ds__month AS booking__monthly_ds__month
+ , subq_3.booking__monthly_ds__quarter AS booking__monthly_ds__quarter
+ , subq_3.booking__monthly_ds__year AS booking__monthly_ds__year
+ , subq_3.booking__monthly_ds__extract_year AS booking__monthly_ds__extract_year
+ , subq_3.booking__monthly_ds__extract_quarter AS booking__monthly_ds__extract_quarter
+ , subq_3.booking__monthly_ds__extract_month AS booking__monthly_ds__extract_month
+ , subq_3.listing AS listing
+ , subq_3.booking__listing AS booking__listing
+ , subq_3.bookings_monthly AS bookings_monthly
FROM (
-- Time Spine
SELECT
- DATE_TRUNC('month', subq_3.ds) AS metric_time__month
- FROM ***************************.mf_time_spine subq_3
+ DATE_TRUNC('month', subq_5.ds) AS metric_time__month
+ FROM ***************************.mf_time_spine subq_5
GROUP BY
- DATE_TRUNC('month', subq_3.ds)
- ) subq_2
+ DATE_TRUNC('month', subq_5.ds)
+ ) subq_4
INNER JOIN (
-- Metric Time Dimension 'monthly_ds'
SELECT
- subq_0.monthly_ds__month
- , subq_0.monthly_ds__quarter
- , subq_0.monthly_ds__year
- , subq_0.monthly_ds__extract_year
- , subq_0.monthly_ds__extract_quarter
- , subq_0.monthly_ds__extract_month
- , subq_0.booking__monthly_ds__month
- , subq_0.booking__monthly_ds__quarter
- , subq_0.booking__monthly_ds__year
- , subq_0.booking__monthly_ds__extract_year
- , subq_0.booking__monthly_ds__extract_quarter
- , subq_0.booking__monthly_ds__extract_month
- , subq_0.monthly_ds__month AS metric_time__month
- , subq_0.monthly_ds__quarter AS metric_time__quarter
- , subq_0.monthly_ds__year AS metric_time__year
- , subq_0.monthly_ds__extract_year AS metric_time__extract_year
- , subq_0.monthly_ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.monthly_ds__extract_month AS metric_time__extract_month
- , subq_0.listing
- , subq_0.booking__listing
- , subq_0.bookings_monthly
+ subq_2.monthly_ds__month
+ , subq_2.monthly_ds__quarter
+ , subq_2.monthly_ds__year
+ , subq_2.monthly_ds__extract_year
+ , subq_2.monthly_ds__extract_quarter
+ , subq_2.monthly_ds__extract_month
+ , subq_2.booking__monthly_ds__month
+ , subq_2.booking__monthly_ds__quarter
+ , subq_2.booking__monthly_ds__year
+ , subq_2.booking__monthly_ds__extract_year
+ , subq_2.booking__monthly_ds__extract_quarter
+ , subq_2.booking__monthly_ds__extract_month
+ , subq_2.monthly_ds__month AS metric_time__month
+ , subq_2.monthly_ds__quarter AS metric_time__quarter
+ , subq_2.monthly_ds__year AS metric_time__year
+ , subq_2.monthly_ds__extract_year AS metric_time__extract_year
+ , subq_2.monthly_ds__extract_quarter AS metric_time__extract_quarter
+ , subq_2.monthly_ds__extract_month AS metric_time__extract_month
+ , subq_2.listing
+ , subq_2.booking__listing
+ , subq_2.bookings_monthly
FROM (
-- Read Elements From Semantic Model 'bookings_monthly_source'
SELECT
@@ -87,13 +87,13 @@ FROM (
, bookings_monthly_source_src_16000.listing_id AS listing
, bookings_monthly_source_src_16000.listing_id AS booking__listing
FROM ***************************.fct_bookings_extended_monthly bookings_monthly_source_src_16000
- ) subq_0
- ) subq_1
+ ) subq_2
+ ) subq_3
ON
- subq_2.metric_time__month - MAKE_INTERVAL(months => 1) = subq_1.metric_time__month
- ) subq_4
- ) subq_5
+ subq_4.metric_time__month - MAKE_INTERVAL(months => 1) = subq_3.metric_time__month
+ ) subq_6
+ ) subq_7
GROUP BY
- subq_5.metric_time__month
- ) subq_6
-) subq_7
+ subq_7.metric_time__month
+ ) subq_8
+) subq_9
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_month_dimension_and_offset_window__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_month_dimension_and_offset_window__plan0_optimized.sql
index 314a91a06c..ed8ea8634b 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_month_dimension_and_offset_window__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_month_dimension_and_offset_window__plan0_optimized.sql
@@ -8,20 +8,20 @@ FROM (
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_10.metric_time__month AS metric_time__month
+ subq_12.metric_time__month AS metric_time__month
, SUM(bookings_monthly_source_src_16000.bookings_monthly) AS bookings_last_month
FROM (
-- Time Spine
SELECT
DATE_TRUNC('month', ds) AS metric_time__month
- FROM ***************************.mf_time_spine subq_11
+ FROM ***************************.mf_time_spine subq_13
GROUP BY
DATE_TRUNC('month', ds)
- ) subq_10
+ ) subq_12
INNER JOIN
***************************.fct_bookings_extended_monthly bookings_monthly_source_src_16000
ON
- subq_10.metric_time__month - MAKE_INTERVAL(months => 1) = DATE_TRUNC('month', bookings_monthly_source_src_16000.ds)
+ subq_12.metric_time__month - MAKE_INTERVAL(months => 1) = DATE_TRUNC('month', bookings_monthly_source_src_16000.ds)
GROUP BY
- subq_10.metric_time__month
-) subq_15
+ subq_12.metric_time__month
+) subq_17
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_to_grain__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_to_grain__plan0.sql
index 7128b81a47..05bcafad18 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_to_grain__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_to_grain__plan0.sql
@@ -1,545 +1,545 @@
-- Compute Metrics via Expressions
SELECT
- subq_13.metric_time__day
+ subq_22.metric_time__day
, bookings - bookings_at_start_of_month AS bookings_growth_since_start_of_month
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_4.metric_time__day, subq_12.metric_time__day) AS metric_time__day
- , MAX(subq_4.bookings) AS bookings
- , MAX(subq_12.bookings_at_start_of_month) AS bookings_at_start_of_month
+ COALESCE(subq_13.metric_time__day, subq_21.metric_time__day) AS metric_time__day
+ , MAX(subq_13.bookings) AS bookings
+ , MAX(subq_21.bookings_at_start_of_month) AS bookings_at_start_of_month
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_3.metric_time__day
- , subq_3.bookings
+ subq_12.metric_time__day
+ , subq_12.bookings
FROM (
-- Aggregate Measures
SELECT
- subq_2.metric_time__day
- , SUM(subq_2.bookings) AS bookings
+ subq_11.metric_time__day
+ , SUM(subq_11.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__day']
SELECT
- subq_1.metric_time__day
- , subq_1.bookings
+ subq_10.metric_time__day
+ , subq_10.bookings
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
- ) subq_2
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
GROUP BY
- subq_2.metric_time__day
- ) subq_3
- ) subq_4
+ subq_11.metric_time__day
+ ) subq_12
+ ) subq_13
FULL OUTER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_11.metric_time__day
- , subq_11.bookings AS bookings_at_start_of_month
+ subq_20.metric_time__day
+ , subq_20.bookings AS bookings_at_start_of_month
FROM (
-- Aggregate Measures
SELECT
- subq_10.metric_time__day
- , SUM(subq_10.bookings) AS bookings
+ subq_19.metric_time__day
+ , SUM(subq_19.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__day']
SELECT
- subq_9.metric_time__day
- , subq_9.bookings
+ subq_18.metric_time__day
+ , subq_18.bookings
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_7.metric_time__day AS metric_time__day
- , subq_6.ds__day AS ds__day
- , subq_6.ds__week AS ds__week
- , subq_6.ds__month AS ds__month
- , subq_6.ds__quarter AS ds__quarter
- , subq_6.ds__year AS ds__year
- , subq_6.ds__extract_year AS ds__extract_year
- , subq_6.ds__extract_quarter AS ds__extract_quarter
- , subq_6.ds__extract_month AS ds__extract_month
- , subq_6.ds__extract_day AS ds__extract_day
- , subq_6.ds__extract_dow AS ds__extract_dow
- , subq_6.ds__extract_doy AS ds__extract_doy
- , subq_6.ds_partitioned__day AS ds_partitioned__day
- , subq_6.ds_partitioned__week AS ds_partitioned__week
- , subq_6.ds_partitioned__month AS ds_partitioned__month
- , subq_6.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_6.ds_partitioned__year AS ds_partitioned__year
- , subq_6.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_6.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_6.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_6.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_6.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_6.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_6.paid_at__day AS paid_at__day
- , subq_6.paid_at__week AS paid_at__week
- , subq_6.paid_at__month AS paid_at__month
- , subq_6.paid_at__quarter AS paid_at__quarter
- , subq_6.paid_at__year AS paid_at__year
- , subq_6.paid_at__extract_year AS paid_at__extract_year
- , subq_6.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_6.paid_at__extract_month AS paid_at__extract_month
- , subq_6.paid_at__extract_day AS paid_at__extract_day
- , subq_6.paid_at__extract_dow AS paid_at__extract_dow
- , subq_6.paid_at__extract_doy AS paid_at__extract_doy
- , subq_6.booking__ds__day AS booking__ds__day
- , subq_6.booking__ds__week AS booking__ds__week
- , subq_6.booking__ds__month AS booking__ds__month
- , subq_6.booking__ds__quarter AS booking__ds__quarter
- , subq_6.booking__ds__year AS booking__ds__year
- , subq_6.booking__ds__extract_year AS booking__ds__extract_year
- , subq_6.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_6.booking__ds__extract_month AS booking__ds__extract_month
- , subq_6.booking__ds__extract_day AS booking__ds__extract_day
- , subq_6.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_6.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_6.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_6.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_6.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_6.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_6.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_6.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_6.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_6.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_6.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_6.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_6.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_6.booking__paid_at__day AS booking__paid_at__day
- , subq_6.booking__paid_at__week AS booking__paid_at__week
- , subq_6.booking__paid_at__month AS booking__paid_at__month
- , subq_6.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_6.booking__paid_at__year AS booking__paid_at__year
- , subq_6.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_6.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_6.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_6.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_6.listing AS listing
- , subq_6.guest AS guest
- , subq_6.host AS host
- , subq_6.booking__listing AS booking__listing
- , subq_6.booking__guest AS booking__guest
- , subq_6.booking__host AS booking__host
- , subq_6.is_instant AS is_instant
- , subq_6.booking__is_instant AS booking__is_instant
- , subq_6.bookings AS bookings
- , subq_6.instant_bookings AS instant_bookings
- , subq_6.booking_value AS booking_value
- , subq_6.max_booking_value AS max_booking_value
- , subq_6.min_booking_value AS min_booking_value
- , subq_6.bookers AS bookers
- , subq_6.average_booking_value AS average_booking_value
- , subq_6.referred_bookings AS referred_bookings
- , subq_6.median_booking_value AS median_booking_value
- , subq_6.booking_value_p99 AS booking_value_p99
- , subq_6.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_6.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_6.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ subq_16.metric_time__day AS metric_time__day
+ , subq_15.ds__day AS ds__day
+ , subq_15.ds__week AS ds__week
+ , subq_15.ds__month AS ds__month
+ , subq_15.ds__quarter AS ds__quarter
+ , subq_15.ds__year AS ds__year
+ , subq_15.ds__extract_year AS ds__extract_year
+ , subq_15.ds__extract_quarter AS ds__extract_quarter
+ , subq_15.ds__extract_month AS ds__extract_month
+ , subq_15.ds__extract_day AS ds__extract_day
+ , subq_15.ds__extract_dow AS ds__extract_dow
+ , subq_15.ds__extract_doy AS ds__extract_doy
+ , subq_15.ds_partitioned__day AS ds_partitioned__day
+ , subq_15.ds_partitioned__week AS ds_partitioned__week
+ , subq_15.ds_partitioned__month AS ds_partitioned__month
+ , subq_15.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_15.ds_partitioned__year AS ds_partitioned__year
+ , subq_15.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_15.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_15.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_15.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_15.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_15.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_15.paid_at__day AS paid_at__day
+ , subq_15.paid_at__week AS paid_at__week
+ , subq_15.paid_at__month AS paid_at__month
+ , subq_15.paid_at__quarter AS paid_at__quarter
+ , subq_15.paid_at__year AS paid_at__year
+ , subq_15.paid_at__extract_year AS paid_at__extract_year
+ , subq_15.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_15.paid_at__extract_month AS paid_at__extract_month
+ , subq_15.paid_at__extract_day AS paid_at__extract_day
+ , subq_15.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_15.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_15.booking__ds__day AS booking__ds__day
+ , subq_15.booking__ds__week AS booking__ds__week
+ , subq_15.booking__ds__month AS booking__ds__month
+ , subq_15.booking__ds__quarter AS booking__ds__quarter
+ , subq_15.booking__ds__year AS booking__ds__year
+ , subq_15.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_15.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_15.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_15.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_15.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_15.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_15.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_15.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_15.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_15.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_15.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_15.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_15.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_15.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_15.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_15.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_15.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_15.booking__paid_at__day AS booking__paid_at__day
+ , subq_15.booking__paid_at__week AS booking__paid_at__week
+ , subq_15.booking__paid_at__month AS booking__paid_at__month
+ , subq_15.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_15.booking__paid_at__year AS booking__paid_at__year
+ , subq_15.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_15.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_15.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_15.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_15.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_15.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_15.listing AS listing
+ , subq_15.guest AS guest
+ , subq_15.host AS host
+ , subq_15.booking__listing AS booking__listing
+ , subq_15.booking__guest AS booking__guest
+ , subq_15.booking__host AS booking__host
+ , subq_15.is_instant AS is_instant
+ , subq_15.booking__is_instant AS booking__is_instant
+ , subq_15.bookings AS bookings
+ , subq_15.instant_bookings AS instant_bookings
+ , subq_15.booking_value AS booking_value
+ , subq_15.max_booking_value AS max_booking_value
+ , subq_15.min_booking_value AS min_booking_value
+ , subq_15.bookers AS bookers
+ , subq_15.average_booking_value AS average_booking_value
+ , subq_15.referred_bookings AS referred_bookings
+ , subq_15.median_booking_value AS median_booking_value
+ , subq_15.booking_value_p99 AS booking_value_p99
+ , subq_15.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_15.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_15.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_8.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_8
- ) subq_7
+ subq_17.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_17
+ ) subq_16
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_5.ds__day
- , subq_5.ds__week
- , subq_5.ds__month
- , subq_5.ds__quarter
- , subq_5.ds__year
- , subq_5.ds__extract_year
- , subq_5.ds__extract_quarter
- , subq_5.ds__extract_month
- , subq_5.ds__extract_day
- , subq_5.ds__extract_dow
- , subq_5.ds__extract_doy
- , subq_5.ds_partitioned__day
- , subq_5.ds_partitioned__week
- , subq_5.ds_partitioned__month
- , subq_5.ds_partitioned__quarter
- , subq_5.ds_partitioned__year
- , subq_5.ds_partitioned__extract_year
- , subq_5.ds_partitioned__extract_quarter
- , subq_5.ds_partitioned__extract_month
- , subq_5.ds_partitioned__extract_day
- , subq_5.ds_partitioned__extract_dow
- , subq_5.ds_partitioned__extract_doy
- , subq_5.paid_at__day
- , subq_5.paid_at__week
- , subq_5.paid_at__month
- , subq_5.paid_at__quarter
- , subq_5.paid_at__year
- , subq_5.paid_at__extract_year
- , subq_5.paid_at__extract_quarter
- , subq_5.paid_at__extract_month
- , subq_5.paid_at__extract_day
- , subq_5.paid_at__extract_dow
- , subq_5.paid_at__extract_doy
- , subq_5.booking__ds__day
- , subq_5.booking__ds__week
- , subq_5.booking__ds__month
- , subq_5.booking__ds__quarter
- , subq_5.booking__ds__year
- , subq_5.booking__ds__extract_year
- , subq_5.booking__ds__extract_quarter
- , subq_5.booking__ds__extract_month
- , subq_5.booking__ds__extract_day
- , subq_5.booking__ds__extract_dow
- , subq_5.booking__ds__extract_doy
- , subq_5.booking__ds_partitioned__day
- , subq_5.booking__ds_partitioned__week
- , subq_5.booking__ds_partitioned__month
- , subq_5.booking__ds_partitioned__quarter
- , subq_5.booking__ds_partitioned__year
- , subq_5.booking__ds_partitioned__extract_year
- , subq_5.booking__ds_partitioned__extract_quarter
- , subq_5.booking__ds_partitioned__extract_month
- , subq_5.booking__ds_partitioned__extract_day
- , subq_5.booking__ds_partitioned__extract_dow
- , subq_5.booking__ds_partitioned__extract_doy
- , subq_5.booking__paid_at__day
- , subq_5.booking__paid_at__week
- , subq_5.booking__paid_at__month
- , subq_5.booking__paid_at__quarter
- , subq_5.booking__paid_at__year
- , subq_5.booking__paid_at__extract_year
- , subq_5.booking__paid_at__extract_quarter
- , subq_5.booking__paid_at__extract_month
- , subq_5.booking__paid_at__extract_day
- , subq_5.booking__paid_at__extract_dow
- , subq_5.booking__paid_at__extract_doy
- , subq_5.ds__day AS metric_time__day
- , subq_5.ds__week AS metric_time__week
- , subq_5.ds__month AS metric_time__month
- , subq_5.ds__quarter AS metric_time__quarter
- , subq_5.ds__year AS metric_time__year
- , subq_5.ds__extract_year AS metric_time__extract_year
- , subq_5.ds__extract_quarter AS metric_time__extract_quarter
- , subq_5.ds__extract_month AS metric_time__extract_month
- , subq_5.ds__extract_day AS metric_time__extract_day
- , subq_5.ds__extract_dow AS metric_time__extract_dow
- , subq_5.ds__extract_doy AS metric_time__extract_doy
- , subq_5.listing
- , subq_5.guest
- , subq_5.host
- , subq_5.booking__listing
- , subq_5.booking__guest
- , subq_5.booking__host
- , subq_5.is_instant
- , subq_5.booking__is_instant
- , subq_5.bookings
- , subq_5.instant_bookings
- , subq_5.booking_value
- , subq_5.max_booking_value
- , subq_5.min_booking_value
- , subq_5.bookers
- , subq_5.average_booking_value
- , subq_5.referred_bookings
- , subq_5.median_booking_value
- , subq_5.booking_value_p99
- , subq_5.discrete_booking_value_p99
- , subq_5.approximate_continuous_booking_value_p99
- , subq_5.approximate_discrete_booking_value_p99
+ subq_14.ds__day
+ , subq_14.ds__week
+ , subq_14.ds__month
+ , subq_14.ds__quarter
+ , subq_14.ds__year
+ , subq_14.ds__extract_year
+ , subq_14.ds__extract_quarter
+ , subq_14.ds__extract_month
+ , subq_14.ds__extract_day
+ , subq_14.ds__extract_dow
+ , subq_14.ds__extract_doy
+ , subq_14.ds_partitioned__day
+ , subq_14.ds_partitioned__week
+ , subq_14.ds_partitioned__month
+ , subq_14.ds_partitioned__quarter
+ , subq_14.ds_partitioned__year
+ , subq_14.ds_partitioned__extract_year
+ , subq_14.ds_partitioned__extract_quarter
+ , subq_14.ds_partitioned__extract_month
+ , subq_14.ds_partitioned__extract_day
+ , subq_14.ds_partitioned__extract_dow
+ , subq_14.ds_partitioned__extract_doy
+ , subq_14.paid_at__day
+ , subq_14.paid_at__week
+ , subq_14.paid_at__month
+ , subq_14.paid_at__quarter
+ , subq_14.paid_at__year
+ , subq_14.paid_at__extract_year
+ , subq_14.paid_at__extract_quarter
+ , subq_14.paid_at__extract_month
+ , subq_14.paid_at__extract_day
+ , subq_14.paid_at__extract_dow
+ , subq_14.paid_at__extract_doy
+ , subq_14.booking__ds__day
+ , subq_14.booking__ds__week
+ , subq_14.booking__ds__month
+ , subq_14.booking__ds__quarter
+ , subq_14.booking__ds__year
+ , subq_14.booking__ds__extract_year
+ , subq_14.booking__ds__extract_quarter
+ , subq_14.booking__ds__extract_month
+ , subq_14.booking__ds__extract_day
+ , subq_14.booking__ds__extract_dow
+ , subq_14.booking__ds__extract_doy
+ , subq_14.booking__ds_partitioned__day
+ , subq_14.booking__ds_partitioned__week
+ , subq_14.booking__ds_partitioned__month
+ , subq_14.booking__ds_partitioned__quarter
+ , subq_14.booking__ds_partitioned__year
+ , subq_14.booking__ds_partitioned__extract_year
+ , subq_14.booking__ds_partitioned__extract_quarter
+ , subq_14.booking__ds_partitioned__extract_month
+ , subq_14.booking__ds_partitioned__extract_day
+ , subq_14.booking__ds_partitioned__extract_dow
+ , subq_14.booking__ds_partitioned__extract_doy
+ , subq_14.booking__paid_at__day
+ , subq_14.booking__paid_at__week
+ , subq_14.booking__paid_at__month
+ , subq_14.booking__paid_at__quarter
+ , subq_14.booking__paid_at__year
+ , subq_14.booking__paid_at__extract_year
+ , subq_14.booking__paid_at__extract_quarter
+ , subq_14.booking__paid_at__extract_month
+ , subq_14.booking__paid_at__extract_day
+ , subq_14.booking__paid_at__extract_dow
+ , subq_14.booking__paid_at__extract_doy
+ , subq_14.ds__day AS metric_time__day
+ , subq_14.ds__week AS metric_time__week
+ , subq_14.ds__month AS metric_time__month
+ , subq_14.ds__quarter AS metric_time__quarter
+ , subq_14.ds__year AS metric_time__year
+ , subq_14.ds__extract_year AS metric_time__extract_year
+ , subq_14.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_14.ds__extract_month AS metric_time__extract_month
+ , subq_14.ds__extract_day AS metric_time__extract_day
+ , subq_14.ds__extract_dow AS metric_time__extract_dow
+ , subq_14.ds__extract_doy AS metric_time__extract_doy
+ , subq_14.listing
+ , subq_14.guest
+ , subq_14.host
+ , subq_14.booking__listing
+ , subq_14.booking__guest
+ , subq_14.booking__host
+ , subq_14.is_instant
+ , subq_14.booking__is_instant
+ , subq_14.bookings
+ , subq_14.instant_bookings
+ , subq_14.booking_value
+ , subq_14.max_booking_value
+ , subq_14.min_booking_value
+ , subq_14.bookers
+ , subq_14.average_booking_value
+ , subq_14.referred_bookings
+ , subq_14.median_booking_value
+ , subq_14.booking_value_p99
+ , subq_14.discrete_booking_value_p99
+ , subq_14.approximate_continuous_booking_value_p99
+ , subq_14.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_5
- ) subq_6
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_14
+ ) subq_15
ON
- DATE_TRUNC('month', subq_7.metric_time__day) = subq_6.metric_time__day
- ) subq_9
- ) subq_10
+ DATE_TRUNC('month', subq_16.metric_time__day) = subq_15.metric_time__day
+ ) subq_18
+ ) subq_19
GROUP BY
- subq_10.metric_time__day
- ) subq_11
- ) subq_12
+ subq_19.metric_time__day
+ ) subq_20
+ ) subq_21
ON
- subq_4.metric_time__day = subq_12.metric_time__day
+ subq_13.metric_time__day = subq_21.metric_time__day
GROUP BY
- COALESCE(subq_4.metric_time__day, subq_12.metric_time__day)
-) subq_13
+ COALESCE(subq_13.metric_time__day, subq_21.metric_time__day)
+) subq_22
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_to_grain__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_to_grain__plan0_optimized.sql
index 5138fe8ae6..2061be23cf 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_to_grain__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_to_grain__plan0_optimized.sql
@@ -5,9 +5,9 @@ SELECT
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_18.metric_time__day, subq_26.metric_time__day) AS metric_time__day
- , MAX(subq_18.bookings) AS bookings
- , MAX(subq_26.bookings_at_start_of_month) AS bookings_at_start_of_month
+ COALESCE(subq_27.metric_time__day, subq_35.metric_time__day) AS metric_time__day
+ , MAX(subq_27.bookings) AS bookings
+ , MAX(subq_35.bookings_at_start_of_month) AS bookings_at_start_of_month
FROM (
-- Aggregate Measures
-- Compute Metrics via Expressions
@@ -21,35 +21,35 @@ FROM (
SELECT
DATE_TRUNC('day', ds) AS metric_time__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_16
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_25
GROUP BY
metric_time__day
- ) subq_18
+ ) subq_27
FULL OUTER JOIN (
-- Join to Time Spine Dataset
-- Pass Only Elements: ['bookings', 'metric_time__day']
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_22.ds AS metric_time__day
- , SUM(subq_20.bookings) AS bookings_at_start_of_month
- FROM ***************************.mf_time_spine subq_22
+ subq_31.ds AS metric_time__day
+ , SUM(subq_29.bookings) AS bookings_at_start_of_month
+ FROM ***************************.mf_time_spine subq_31
INNER JOIN (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
SELECT
DATE_TRUNC('day', ds) AS metric_time__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_20
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_29
ON
- DATE_TRUNC('month', subq_22.ds) = subq_20.metric_time__day
+ DATE_TRUNC('month', subq_31.ds) = subq_29.metric_time__day
GROUP BY
- subq_22.ds
- ) subq_26
+ subq_31.ds
+ ) subq_35
ON
- subq_18.metric_time__day = subq_26.metric_time__day
+ subq_27.metric_time__day = subq_35.metric_time__day
GROUP BY
- COALESCE(subq_18.metric_time__day, subq_26.metric_time__day)
-) subq_27
+ COALESCE(subq_27.metric_time__day, subq_35.metric_time__day)
+) subq_36
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql
index a18f1a3e30..a8b56fb822 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql
@@ -1,546 +1,546 @@
-- Compute Metrics via Expressions
SELECT
- subq_13.metric_time__week
+ subq_22.metric_time__week
, bookings - bookings_at_start_of_month AS bookings_growth_since_start_of_month
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_4.metric_time__week, subq_12.metric_time__week) AS metric_time__week
- , MAX(subq_4.bookings) AS bookings
- , MAX(subq_12.bookings_at_start_of_month) AS bookings_at_start_of_month
+ COALESCE(subq_13.metric_time__week, subq_21.metric_time__week) AS metric_time__week
+ , MAX(subq_13.bookings) AS bookings
+ , MAX(subq_21.bookings_at_start_of_month) AS bookings_at_start_of_month
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_3.metric_time__week
- , subq_3.bookings
+ subq_12.metric_time__week
+ , subq_12.bookings
FROM (
-- Aggregate Measures
SELECT
- subq_2.metric_time__week
- , SUM(subq_2.bookings) AS bookings
+ subq_11.metric_time__week
+ , SUM(subq_11.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__week']
SELECT
- subq_1.metric_time__week
- , subq_1.bookings
+ subq_10.metric_time__week
+ , subq_10.bookings
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
- ) subq_2
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
GROUP BY
- subq_2.metric_time__week
- ) subq_3
- ) subq_4
+ subq_11.metric_time__week
+ ) subq_12
+ ) subq_13
FULL OUTER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_11.metric_time__week
- , subq_11.bookings AS bookings_at_start_of_month
+ subq_20.metric_time__week
+ , subq_20.bookings AS bookings_at_start_of_month
FROM (
-- Aggregate Measures
SELECT
- subq_10.metric_time__week
- , SUM(subq_10.bookings) AS bookings
+ subq_19.metric_time__week
+ , SUM(subq_19.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__week']
SELECT
- subq_9.metric_time__week
- , subq_9.bookings
+ subq_18.metric_time__week
+ , subq_18.bookings
FROM (
-- Join to Time Spine Dataset
SELECT
- DATE_TRUNC('week', subq_7.metric_time__day) AS metric_time__week
- , subq_6.ds__day AS ds__day
- , subq_6.ds__week AS ds__week
- , subq_6.ds__month AS ds__month
- , subq_6.ds__quarter AS ds__quarter
- , subq_6.ds__year AS ds__year
- , subq_6.ds__extract_year AS ds__extract_year
- , subq_6.ds__extract_quarter AS ds__extract_quarter
- , subq_6.ds__extract_month AS ds__extract_month
- , subq_6.ds__extract_day AS ds__extract_day
- , subq_6.ds__extract_dow AS ds__extract_dow
- , subq_6.ds__extract_doy AS ds__extract_doy
- , subq_6.ds_partitioned__day AS ds_partitioned__day
- , subq_6.ds_partitioned__week AS ds_partitioned__week
- , subq_6.ds_partitioned__month AS ds_partitioned__month
- , subq_6.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_6.ds_partitioned__year AS ds_partitioned__year
- , subq_6.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_6.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_6.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_6.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_6.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_6.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_6.paid_at__day AS paid_at__day
- , subq_6.paid_at__week AS paid_at__week
- , subq_6.paid_at__month AS paid_at__month
- , subq_6.paid_at__quarter AS paid_at__quarter
- , subq_6.paid_at__year AS paid_at__year
- , subq_6.paid_at__extract_year AS paid_at__extract_year
- , subq_6.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_6.paid_at__extract_month AS paid_at__extract_month
- , subq_6.paid_at__extract_day AS paid_at__extract_day
- , subq_6.paid_at__extract_dow AS paid_at__extract_dow
- , subq_6.paid_at__extract_doy AS paid_at__extract_doy
- , subq_6.booking__ds__day AS booking__ds__day
- , subq_6.booking__ds__week AS booking__ds__week
- , subq_6.booking__ds__month AS booking__ds__month
- , subq_6.booking__ds__quarter AS booking__ds__quarter
- , subq_6.booking__ds__year AS booking__ds__year
- , subq_6.booking__ds__extract_year AS booking__ds__extract_year
- , subq_6.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_6.booking__ds__extract_month AS booking__ds__extract_month
- , subq_6.booking__ds__extract_day AS booking__ds__extract_day
- , subq_6.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_6.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_6.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_6.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_6.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_6.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_6.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_6.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_6.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_6.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_6.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_6.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_6.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_6.booking__paid_at__day AS booking__paid_at__day
- , subq_6.booking__paid_at__week AS booking__paid_at__week
- , subq_6.booking__paid_at__month AS booking__paid_at__month
- , subq_6.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_6.booking__paid_at__year AS booking__paid_at__year
- , subq_6.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_6.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_6.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_6.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_6.listing AS listing
- , subq_6.guest AS guest
- , subq_6.host AS host
- , subq_6.booking__listing AS booking__listing
- , subq_6.booking__guest AS booking__guest
- , subq_6.booking__host AS booking__host
- , subq_6.is_instant AS is_instant
- , subq_6.booking__is_instant AS booking__is_instant
- , subq_6.bookings AS bookings
- , subq_6.instant_bookings AS instant_bookings
- , subq_6.booking_value AS booking_value
- , subq_6.max_booking_value AS max_booking_value
- , subq_6.min_booking_value AS min_booking_value
- , subq_6.bookers AS bookers
- , subq_6.average_booking_value AS average_booking_value
- , subq_6.referred_bookings AS referred_bookings
- , subq_6.median_booking_value AS median_booking_value
- , subq_6.booking_value_p99 AS booking_value_p99
- , subq_6.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_6.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_6.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ DATE_TRUNC('week', subq_16.metric_time__day) AS metric_time__week
+ , subq_15.ds__day AS ds__day
+ , subq_15.ds__week AS ds__week
+ , subq_15.ds__month AS ds__month
+ , subq_15.ds__quarter AS ds__quarter
+ , subq_15.ds__year AS ds__year
+ , subq_15.ds__extract_year AS ds__extract_year
+ , subq_15.ds__extract_quarter AS ds__extract_quarter
+ , subq_15.ds__extract_month AS ds__extract_month
+ , subq_15.ds__extract_day AS ds__extract_day
+ , subq_15.ds__extract_dow AS ds__extract_dow
+ , subq_15.ds__extract_doy AS ds__extract_doy
+ , subq_15.ds_partitioned__day AS ds_partitioned__day
+ , subq_15.ds_partitioned__week AS ds_partitioned__week
+ , subq_15.ds_partitioned__month AS ds_partitioned__month
+ , subq_15.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_15.ds_partitioned__year AS ds_partitioned__year
+ , subq_15.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_15.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_15.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_15.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_15.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_15.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_15.paid_at__day AS paid_at__day
+ , subq_15.paid_at__week AS paid_at__week
+ , subq_15.paid_at__month AS paid_at__month
+ , subq_15.paid_at__quarter AS paid_at__quarter
+ , subq_15.paid_at__year AS paid_at__year
+ , subq_15.paid_at__extract_year AS paid_at__extract_year
+ , subq_15.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_15.paid_at__extract_month AS paid_at__extract_month
+ , subq_15.paid_at__extract_day AS paid_at__extract_day
+ , subq_15.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_15.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_15.booking__ds__day AS booking__ds__day
+ , subq_15.booking__ds__week AS booking__ds__week
+ , subq_15.booking__ds__month AS booking__ds__month
+ , subq_15.booking__ds__quarter AS booking__ds__quarter
+ , subq_15.booking__ds__year AS booking__ds__year
+ , subq_15.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_15.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_15.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_15.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_15.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_15.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_15.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_15.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_15.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_15.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_15.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_15.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_15.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_15.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_15.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_15.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_15.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_15.booking__paid_at__day AS booking__paid_at__day
+ , subq_15.booking__paid_at__week AS booking__paid_at__week
+ , subq_15.booking__paid_at__month AS booking__paid_at__month
+ , subq_15.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_15.booking__paid_at__year AS booking__paid_at__year
+ , subq_15.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_15.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_15.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_15.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_15.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_15.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_15.listing AS listing
+ , subq_15.guest AS guest
+ , subq_15.host AS host
+ , subq_15.booking__listing AS booking__listing
+ , subq_15.booking__guest AS booking__guest
+ , subq_15.booking__host AS booking__host
+ , subq_15.is_instant AS is_instant
+ , subq_15.booking__is_instant AS booking__is_instant
+ , subq_15.bookings AS bookings
+ , subq_15.instant_bookings AS instant_bookings
+ , subq_15.booking_value AS booking_value
+ , subq_15.max_booking_value AS max_booking_value
+ , subq_15.min_booking_value AS min_booking_value
+ , subq_15.bookers AS bookers
+ , subq_15.average_booking_value AS average_booking_value
+ , subq_15.referred_bookings AS referred_bookings
+ , subq_15.median_booking_value AS median_booking_value
+ , subq_15.booking_value_p99 AS booking_value_p99
+ , subq_15.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_15.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_15.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_8.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_8
- ) subq_7
+ subq_17.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_17
+ ) subq_16
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_5.ds__day
- , subq_5.ds__week
- , subq_5.ds__month
- , subq_5.ds__quarter
- , subq_5.ds__year
- , subq_5.ds__extract_year
- , subq_5.ds__extract_quarter
- , subq_5.ds__extract_month
- , subq_5.ds__extract_day
- , subq_5.ds__extract_dow
- , subq_5.ds__extract_doy
- , subq_5.ds_partitioned__day
- , subq_5.ds_partitioned__week
- , subq_5.ds_partitioned__month
- , subq_5.ds_partitioned__quarter
- , subq_5.ds_partitioned__year
- , subq_5.ds_partitioned__extract_year
- , subq_5.ds_partitioned__extract_quarter
- , subq_5.ds_partitioned__extract_month
- , subq_5.ds_partitioned__extract_day
- , subq_5.ds_partitioned__extract_dow
- , subq_5.ds_partitioned__extract_doy
- , subq_5.paid_at__day
- , subq_5.paid_at__week
- , subq_5.paid_at__month
- , subq_5.paid_at__quarter
- , subq_5.paid_at__year
- , subq_5.paid_at__extract_year
- , subq_5.paid_at__extract_quarter
- , subq_5.paid_at__extract_month
- , subq_5.paid_at__extract_day
- , subq_5.paid_at__extract_dow
- , subq_5.paid_at__extract_doy
- , subq_5.booking__ds__day
- , subq_5.booking__ds__week
- , subq_5.booking__ds__month
- , subq_5.booking__ds__quarter
- , subq_5.booking__ds__year
- , subq_5.booking__ds__extract_year
- , subq_5.booking__ds__extract_quarter
- , subq_5.booking__ds__extract_month
- , subq_5.booking__ds__extract_day
- , subq_5.booking__ds__extract_dow
- , subq_5.booking__ds__extract_doy
- , subq_5.booking__ds_partitioned__day
- , subq_5.booking__ds_partitioned__week
- , subq_5.booking__ds_partitioned__month
- , subq_5.booking__ds_partitioned__quarter
- , subq_5.booking__ds_partitioned__year
- , subq_5.booking__ds_partitioned__extract_year
- , subq_5.booking__ds_partitioned__extract_quarter
- , subq_5.booking__ds_partitioned__extract_month
- , subq_5.booking__ds_partitioned__extract_day
- , subq_5.booking__ds_partitioned__extract_dow
- , subq_5.booking__ds_partitioned__extract_doy
- , subq_5.booking__paid_at__day
- , subq_5.booking__paid_at__week
- , subq_5.booking__paid_at__month
- , subq_5.booking__paid_at__quarter
- , subq_5.booking__paid_at__year
- , subq_5.booking__paid_at__extract_year
- , subq_5.booking__paid_at__extract_quarter
- , subq_5.booking__paid_at__extract_month
- , subq_5.booking__paid_at__extract_day
- , subq_5.booking__paid_at__extract_dow
- , subq_5.booking__paid_at__extract_doy
- , subq_5.ds__day AS metric_time__day
- , subq_5.ds__week AS metric_time__week
- , subq_5.ds__month AS metric_time__month
- , subq_5.ds__quarter AS metric_time__quarter
- , subq_5.ds__year AS metric_time__year
- , subq_5.ds__extract_year AS metric_time__extract_year
- , subq_5.ds__extract_quarter AS metric_time__extract_quarter
- , subq_5.ds__extract_month AS metric_time__extract_month
- , subq_5.ds__extract_day AS metric_time__extract_day
- , subq_5.ds__extract_dow AS metric_time__extract_dow
- , subq_5.ds__extract_doy AS metric_time__extract_doy
- , subq_5.listing
- , subq_5.guest
- , subq_5.host
- , subq_5.booking__listing
- , subq_5.booking__guest
- , subq_5.booking__host
- , subq_5.is_instant
- , subq_5.booking__is_instant
- , subq_5.bookings
- , subq_5.instant_bookings
- , subq_5.booking_value
- , subq_5.max_booking_value
- , subq_5.min_booking_value
- , subq_5.bookers
- , subq_5.average_booking_value
- , subq_5.referred_bookings
- , subq_5.median_booking_value
- , subq_5.booking_value_p99
- , subq_5.discrete_booking_value_p99
- , subq_5.approximate_continuous_booking_value_p99
- , subq_5.approximate_discrete_booking_value_p99
+ subq_14.ds__day
+ , subq_14.ds__week
+ , subq_14.ds__month
+ , subq_14.ds__quarter
+ , subq_14.ds__year
+ , subq_14.ds__extract_year
+ , subq_14.ds__extract_quarter
+ , subq_14.ds__extract_month
+ , subq_14.ds__extract_day
+ , subq_14.ds__extract_dow
+ , subq_14.ds__extract_doy
+ , subq_14.ds_partitioned__day
+ , subq_14.ds_partitioned__week
+ , subq_14.ds_partitioned__month
+ , subq_14.ds_partitioned__quarter
+ , subq_14.ds_partitioned__year
+ , subq_14.ds_partitioned__extract_year
+ , subq_14.ds_partitioned__extract_quarter
+ , subq_14.ds_partitioned__extract_month
+ , subq_14.ds_partitioned__extract_day
+ , subq_14.ds_partitioned__extract_dow
+ , subq_14.ds_partitioned__extract_doy
+ , subq_14.paid_at__day
+ , subq_14.paid_at__week
+ , subq_14.paid_at__month
+ , subq_14.paid_at__quarter
+ , subq_14.paid_at__year
+ , subq_14.paid_at__extract_year
+ , subq_14.paid_at__extract_quarter
+ , subq_14.paid_at__extract_month
+ , subq_14.paid_at__extract_day
+ , subq_14.paid_at__extract_dow
+ , subq_14.paid_at__extract_doy
+ , subq_14.booking__ds__day
+ , subq_14.booking__ds__week
+ , subq_14.booking__ds__month
+ , subq_14.booking__ds__quarter
+ , subq_14.booking__ds__year
+ , subq_14.booking__ds__extract_year
+ , subq_14.booking__ds__extract_quarter
+ , subq_14.booking__ds__extract_month
+ , subq_14.booking__ds__extract_day
+ , subq_14.booking__ds__extract_dow
+ , subq_14.booking__ds__extract_doy
+ , subq_14.booking__ds_partitioned__day
+ , subq_14.booking__ds_partitioned__week
+ , subq_14.booking__ds_partitioned__month
+ , subq_14.booking__ds_partitioned__quarter
+ , subq_14.booking__ds_partitioned__year
+ , subq_14.booking__ds_partitioned__extract_year
+ , subq_14.booking__ds_partitioned__extract_quarter
+ , subq_14.booking__ds_partitioned__extract_month
+ , subq_14.booking__ds_partitioned__extract_day
+ , subq_14.booking__ds_partitioned__extract_dow
+ , subq_14.booking__ds_partitioned__extract_doy
+ , subq_14.booking__paid_at__day
+ , subq_14.booking__paid_at__week
+ , subq_14.booking__paid_at__month
+ , subq_14.booking__paid_at__quarter
+ , subq_14.booking__paid_at__year
+ , subq_14.booking__paid_at__extract_year
+ , subq_14.booking__paid_at__extract_quarter
+ , subq_14.booking__paid_at__extract_month
+ , subq_14.booking__paid_at__extract_day
+ , subq_14.booking__paid_at__extract_dow
+ , subq_14.booking__paid_at__extract_doy
+ , subq_14.ds__day AS metric_time__day
+ , subq_14.ds__week AS metric_time__week
+ , subq_14.ds__month AS metric_time__month
+ , subq_14.ds__quarter AS metric_time__quarter
+ , subq_14.ds__year AS metric_time__year
+ , subq_14.ds__extract_year AS metric_time__extract_year
+ , subq_14.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_14.ds__extract_month AS metric_time__extract_month
+ , subq_14.ds__extract_day AS metric_time__extract_day
+ , subq_14.ds__extract_dow AS metric_time__extract_dow
+ , subq_14.ds__extract_doy AS metric_time__extract_doy
+ , subq_14.listing
+ , subq_14.guest
+ , subq_14.host
+ , subq_14.booking__listing
+ , subq_14.booking__guest
+ , subq_14.booking__host
+ , subq_14.is_instant
+ , subq_14.booking__is_instant
+ , subq_14.bookings
+ , subq_14.instant_bookings
+ , subq_14.booking_value
+ , subq_14.max_booking_value
+ , subq_14.min_booking_value
+ , subq_14.bookers
+ , subq_14.average_booking_value
+ , subq_14.referred_bookings
+ , subq_14.median_booking_value
+ , subq_14.booking_value_p99
+ , subq_14.discrete_booking_value_p99
+ , subq_14.approximate_continuous_booking_value_p99
+ , subq_14.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_5
- ) subq_6
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_14
+ ) subq_15
ON
- DATE_TRUNC('month', subq_7.metric_time__day) = subq_6.metric_time__day
- WHERE DATE_TRUNC('week', subq_7.metric_time__day) = subq_7.metric_time__day
- ) subq_9
- ) subq_10
+ DATE_TRUNC('month', subq_16.metric_time__day) = subq_15.metric_time__day
+ WHERE DATE_TRUNC('week', subq_16.metric_time__day) = subq_16.metric_time__day
+ ) subq_18
+ ) subq_19
GROUP BY
- subq_10.metric_time__week
- ) subq_11
- ) subq_12
+ subq_19.metric_time__week
+ ) subq_20
+ ) subq_21
ON
- subq_4.metric_time__week = subq_12.metric_time__week
+ subq_13.metric_time__week = subq_21.metric_time__week
GROUP BY
- COALESCE(subq_4.metric_time__week, subq_12.metric_time__week)
-) subq_13
+ COALESCE(subq_13.metric_time__week, subq_21.metric_time__week)
+) subq_22
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_to_grain_and_granularity__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_to_grain_and_granularity__plan0_optimized.sql
index b9e4162413..65cf132abd 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_to_grain_and_granularity__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_to_grain_and_granularity__plan0_optimized.sql
@@ -5,9 +5,9 @@ SELECT
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_18.metric_time__week, subq_26.metric_time__week) AS metric_time__week
- , MAX(subq_18.bookings) AS bookings
- , MAX(subq_26.bookings_at_start_of_month) AS bookings_at_start_of_month
+ COALESCE(subq_27.metric_time__week, subq_35.metric_time__week) AS metric_time__week
+ , MAX(subq_27.bookings) AS bookings
+ , MAX(subq_35.bookings_at_start_of_month) AS bookings_at_start_of_month
FROM (
-- Aggregate Measures
-- Compute Metrics via Expressions
@@ -21,36 +21,36 @@ FROM (
SELECT
DATE_TRUNC('week', ds) AS metric_time__week
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_16
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_25
GROUP BY
metric_time__week
- ) subq_18
+ ) subq_27
FULL OUTER JOIN (
-- Join to Time Spine Dataset
-- Pass Only Elements: ['bookings', 'metric_time__week']
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- DATE_TRUNC('week', subq_22.ds) AS metric_time__week
- , SUM(subq_20.bookings) AS bookings_at_start_of_month
- FROM ***************************.mf_time_spine subq_22
+ DATE_TRUNC('week', subq_31.ds) AS metric_time__week
+ , SUM(subq_29.bookings) AS bookings_at_start_of_month
+ FROM ***************************.mf_time_spine subq_31
INNER JOIN (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
SELECT
DATE_TRUNC('day', ds) AS metric_time__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_20
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_29
ON
- DATE_TRUNC('month', subq_22.ds) = subq_20.metric_time__day
- WHERE DATE_TRUNC('week', subq_22.ds) = subq_22.ds
+ DATE_TRUNC('month', subq_31.ds) = subq_29.metric_time__day
+ WHERE DATE_TRUNC('week', subq_31.ds) = subq_31.ds
GROUP BY
- DATE_TRUNC('week', subq_22.ds)
- ) subq_26
+ DATE_TRUNC('week', subq_31.ds)
+ ) subq_35
ON
- subq_18.metric_time__week = subq_26.metric_time__week
+ subq_27.metric_time__week = subq_35.metric_time__week
GROUP BY
- COALESCE(subq_18.metric_time__week, subq_26.metric_time__week)
-) subq_27
+ COALESCE(subq_27.metric_time__week, subq_35.metric_time__week)
+) subq_36
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window__plan0.sql
index ba751be035..7c51255420 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window__plan0.sql
@@ -1,545 +1,545 @@
-- Compute Metrics via Expressions
SELECT
- subq_13.metric_time__day
+ subq_22.metric_time__day
, bookings - bookings_2_weeks_ago AS bookings_growth_2_weeks
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_4.metric_time__day, subq_12.metric_time__day) AS metric_time__day
- , MAX(subq_4.bookings) AS bookings
- , MAX(subq_12.bookings_2_weeks_ago) AS bookings_2_weeks_ago
+ COALESCE(subq_13.metric_time__day, subq_21.metric_time__day) AS metric_time__day
+ , MAX(subq_13.bookings) AS bookings
+ , MAX(subq_21.bookings_2_weeks_ago) AS bookings_2_weeks_ago
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_3.metric_time__day
- , subq_3.bookings
+ subq_12.metric_time__day
+ , subq_12.bookings
FROM (
-- Aggregate Measures
SELECT
- subq_2.metric_time__day
- , SUM(subq_2.bookings) AS bookings
+ subq_11.metric_time__day
+ , SUM(subq_11.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__day']
SELECT
- subq_1.metric_time__day
- , subq_1.bookings
+ subq_10.metric_time__day
+ , subq_10.bookings
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
- ) subq_2
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
GROUP BY
- subq_2.metric_time__day
- ) subq_3
- ) subq_4
+ subq_11.metric_time__day
+ ) subq_12
+ ) subq_13
FULL OUTER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_11.metric_time__day
- , subq_11.bookings AS bookings_2_weeks_ago
+ subq_20.metric_time__day
+ , subq_20.bookings AS bookings_2_weeks_ago
FROM (
-- Aggregate Measures
SELECT
- subq_10.metric_time__day
- , SUM(subq_10.bookings) AS bookings
+ subq_19.metric_time__day
+ , SUM(subq_19.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__day']
SELECT
- subq_9.metric_time__day
- , subq_9.bookings
+ subq_18.metric_time__day
+ , subq_18.bookings
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_7.metric_time__day AS metric_time__day
- , subq_6.ds__day AS ds__day
- , subq_6.ds__week AS ds__week
- , subq_6.ds__month AS ds__month
- , subq_6.ds__quarter AS ds__quarter
- , subq_6.ds__year AS ds__year
- , subq_6.ds__extract_year AS ds__extract_year
- , subq_6.ds__extract_quarter AS ds__extract_quarter
- , subq_6.ds__extract_month AS ds__extract_month
- , subq_6.ds__extract_day AS ds__extract_day
- , subq_6.ds__extract_dow AS ds__extract_dow
- , subq_6.ds__extract_doy AS ds__extract_doy
- , subq_6.ds_partitioned__day AS ds_partitioned__day
- , subq_6.ds_partitioned__week AS ds_partitioned__week
- , subq_6.ds_partitioned__month AS ds_partitioned__month
- , subq_6.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_6.ds_partitioned__year AS ds_partitioned__year
- , subq_6.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_6.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_6.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_6.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_6.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_6.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_6.paid_at__day AS paid_at__day
- , subq_6.paid_at__week AS paid_at__week
- , subq_6.paid_at__month AS paid_at__month
- , subq_6.paid_at__quarter AS paid_at__quarter
- , subq_6.paid_at__year AS paid_at__year
- , subq_6.paid_at__extract_year AS paid_at__extract_year
- , subq_6.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_6.paid_at__extract_month AS paid_at__extract_month
- , subq_6.paid_at__extract_day AS paid_at__extract_day
- , subq_6.paid_at__extract_dow AS paid_at__extract_dow
- , subq_6.paid_at__extract_doy AS paid_at__extract_doy
- , subq_6.booking__ds__day AS booking__ds__day
- , subq_6.booking__ds__week AS booking__ds__week
- , subq_6.booking__ds__month AS booking__ds__month
- , subq_6.booking__ds__quarter AS booking__ds__quarter
- , subq_6.booking__ds__year AS booking__ds__year
- , subq_6.booking__ds__extract_year AS booking__ds__extract_year
- , subq_6.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_6.booking__ds__extract_month AS booking__ds__extract_month
- , subq_6.booking__ds__extract_day AS booking__ds__extract_day
- , subq_6.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_6.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_6.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_6.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_6.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_6.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_6.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_6.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_6.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_6.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_6.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_6.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_6.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_6.booking__paid_at__day AS booking__paid_at__day
- , subq_6.booking__paid_at__week AS booking__paid_at__week
- , subq_6.booking__paid_at__month AS booking__paid_at__month
- , subq_6.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_6.booking__paid_at__year AS booking__paid_at__year
- , subq_6.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_6.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_6.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_6.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_6.listing AS listing
- , subq_6.guest AS guest
- , subq_6.host AS host
- , subq_6.booking__listing AS booking__listing
- , subq_6.booking__guest AS booking__guest
- , subq_6.booking__host AS booking__host
- , subq_6.is_instant AS is_instant
- , subq_6.booking__is_instant AS booking__is_instant
- , subq_6.bookings AS bookings
- , subq_6.instant_bookings AS instant_bookings
- , subq_6.booking_value AS booking_value
- , subq_6.max_booking_value AS max_booking_value
- , subq_6.min_booking_value AS min_booking_value
- , subq_6.bookers AS bookers
- , subq_6.average_booking_value AS average_booking_value
- , subq_6.referred_bookings AS referred_bookings
- , subq_6.median_booking_value AS median_booking_value
- , subq_6.booking_value_p99 AS booking_value_p99
- , subq_6.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_6.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_6.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ subq_16.metric_time__day AS metric_time__day
+ , subq_15.ds__day AS ds__day
+ , subq_15.ds__week AS ds__week
+ , subq_15.ds__month AS ds__month
+ , subq_15.ds__quarter AS ds__quarter
+ , subq_15.ds__year AS ds__year
+ , subq_15.ds__extract_year AS ds__extract_year
+ , subq_15.ds__extract_quarter AS ds__extract_quarter
+ , subq_15.ds__extract_month AS ds__extract_month
+ , subq_15.ds__extract_day AS ds__extract_day
+ , subq_15.ds__extract_dow AS ds__extract_dow
+ , subq_15.ds__extract_doy AS ds__extract_doy
+ , subq_15.ds_partitioned__day AS ds_partitioned__day
+ , subq_15.ds_partitioned__week AS ds_partitioned__week
+ , subq_15.ds_partitioned__month AS ds_partitioned__month
+ , subq_15.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_15.ds_partitioned__year AS ds_partitioned__year
+ , subq_15.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_15.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_15.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_15.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_15.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_15.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_15.paid_at__day AS paid_at__day
+ , subq_15.paid_at__week AS paid_at__week
+ , subq_15.paid_at__month AS paid_at__month
+ , subq_15.paid_at__quarter AS paid_at__quarter
+ , subq_15.paid_at__year AS paid_at__year
+ , subq_15.paid_at__extract_year AS paid_at__extract_year
+ , subq_15.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_15.paid_at__extract_month AS paid_at__extract_month
+ , subq_15.paid_at__extract_day AS paid_at__extract_day
+ , subq_15.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_15.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_15.booking__ds__day AS booking__ds__day
+ , subq_15.booking__ds__week AS booking__ds__week
+ , subq_15.booking__ds__month AS booking__ds__month
+ , subq_15.booking__ds__quarter AS booking__ds__quarter
+ , subq_15.booking__ds__year AS booking__ds__year
+ , subq_15.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_15.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_15.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_15.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_15.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_15.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_15.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_15.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_15.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_15.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_15.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_15.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_15.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_15.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_15.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_15.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_15.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_15.booking__paid_at__day AS booking__paid_at__day
+ , subq_15.booking__paid_at__week AS booking__paid_at__week
+ , subq_15.booking__paid_at__month AS booking__paid_at__month
+ , subq_15.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_15.booking__paid_at__year AS booking__paid_at__year
+ , subq_15.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_15.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_15.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_15.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_15.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_15.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_15.listing AS listing
+ , subq_15.guest AS guest
+ , subq_15.host AS host
+ , subq_15.booking__listing AS booking__listing
+ , subq_15.booking__guest AS booking__guest
+ , subq_15.booking__host AS booking__host
+ , subq_15.is_instant AS is_instant
+ , subq_15.booking__is_instant AS booking__is_instant
+ , subq_15.bookings AS bookings
+ , subq_15.instant_bookings AS instant_bookings
+ , subq_15.booking_value AS booking_value
+ , subq_15.max_booking_value AS max_booking_value
+ , subq_15.min_booking_value AS min_booking_value
+ , subq_15.bookers AS bookers
+ , subq_15.average_booking_value AS average_booking_value
+ , subq_15.referred_bookings AS referred_bookings
+ , subq_15.median_booking_value AS median_booking_value
+ , subq_15.booking_value_p99 AS booking_value_p99
+ , subq_15.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_15.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_15.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_8.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_8
- ) subq_7
+ subq_17.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_17
+ ) subq_16
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_5.ds__day
- , subq_5.ds__week
- , subq_5.ds__month
- , subq_5.ds__quarter
- , subq_5.ds__year
- , subq_5.ds__extract_year
- , subq_5.ds__extract_quarter
- , subq_5.ds__extract_month
- , subq_5.ds__extract_day
- , subq_5.ds__extract_dow
- , subq_5.ds__extract_doy
- , subq_5.ds_partitioned__day
- , subq_5.ds_partitioned__week
- , subq_5.ds_partitioned__month
- , subq_5.ds_partitioned__quarter
- , subq_5.ds_partitioned__year
- , subq_5.ds_partitioned__extract_year
- , subq_5.ds_partitioned__extract_quarter
- , subq_5.ds_partitioned__extract_month
- , subq_5.ds_partitioned__extract_day
- , subq_5.ds_partitioned__extract_dow
- , subq_5.ds_partitioned__extract_doy
- , subq_5.paid_at__day
- , subq_5.paid_at__week
- , subq_5.paid_at__month
- , subq_5.paid_at__quarter
- , subq_5.paid_at__year
- , subq_5.paid_at__extract_year
- , subq_5.paid_at__extract_quarter
- , subq_5.paid_at__extract_month
- , subq_5.paid_at__extract_day
- , subq_5.paid_at__extract_dow
- , subq_5.paid_at__extract_doy
- , subq_5.booking__ds__day
- , subq_5.booking__ds__week
- , subq_5.booking__ds__month
- , subq_5.booking__ds__quarter
- , subq_5.booking__ds__year
- , subq_5.booking__ds__extract_year
- , subq_5.booking__ds__extract_quarter
- , subq_5.booking__ds__extract_month
- , subq_5.booking__ds__extract_day
- , subq_5.booking__ds__extract_dow
- , subq_5.booking__ds__extract_doy
- , subq_5.booking__ds_partitioned__day
- , subq_5.booking__ds_partitioned__week
- , subq_5.booking__ds_partitioned__month
- , subq_5.booking__ds_partitioned__quarter
- , subq_5.booking__ds_partitioned__year
- , subq_5.booking__ds_partitioned__extract_year
- , subq_5.booking__ds_partitioned__extract_quarter
- , subq_5.booking__ds_partitioned__extract_month
- , subq_5.booking__ds_partitioned__extract_day
- , subq_5.booking__ds_partitioned__extract_dow
- , subq_5.booking__ds_partitioned__extract_doy
- , subq_5.booking__paid_at__day
- , subq_5.booking__paid_at__week
- , subq_5.booking__paid_at__month
- , subq_5.booking__paid_at__quarter
- , subq_5.booking__paid_at__year
- , subq_5.booking__paid_at__extract_year
- , subq_5.booking__paid_at__extract_quarter
- , subq_5.booking__paid_at__extract_month
- , subq_5.booking__paid_at__extract_day
- , subq_5.booking__paid_at__extract_dow
- , subq_5.booking__paid_at__extract_doy
- , subq_5.ds__day AS metric_time__day
- , subq_5.ds__week AS metric_time__week
- , subq_5.ds__month AS metric_time__month
- , subq_5.ds__quarter AS metric_time__quarter
- , subq_5.ds__year AS metric_time__year
- , subq_5.ds__extract_year AS metric_time__extract_year
- , subq_5.ds__extract_quarter AS metric_time__extract_quarter
- , subq_5.ds__extract_month AS metric_time__extract_month
- , subq_5.ds__extract_day AS metric_time__extract_day
- , subq_5.ds__extract_dow AS metric_time__extract_dow
- , subq_5.ds__extract_doy AS metric_time__extract_doy
- , subq_5.listing
- , subq_5.guest
- , subq_5.host
- , subq_5.booking__listing
- , subq_5.booking__guest
- , subq_5.booking__host
- , subq_5.is_instant
- , subq_5.booking__is_instant
- , subq_5.bookings
- , subq_5.instant_bookings
- , subq_5.booking_value
- , subq_5.max_booking_value
- , subq_5.min_booking_value
- , subq_5.bookers
- , subq_5.average_booking_value
- , subq_5.referred_bookings
- , subq_5.median_booking_value
- , subq_5.booking_value_p99
- , subq_5.discrete_booking_value_p99
- , subq_5.approximate_continuous_booking_value_p99
- , subq_5.approximate_discrete_booking_value_p99
+ subq_14.ds__day
+ , subq_14.ds__week
+ , subq_14.ds__month
+ , subq_14.ds__quarter
+ , subq_14.ds__year
+ , subq_14.ds__extract_year
+ , subq_14.ds__extract_quarter
+ , subq_14.ds__extract_month
+ , subq_14.ds__extract_day
+ , subq_14.ds__extract_dow
+ , subq_14.ds__extract_doy
+ , subq_14.ds_partitioned__day
+ , subq_14.ds_partitioned__week
+ , subq_14.ds_partitioned__month
+ , subq_14.ds_partitioned__quarter
+ , subq_14.ds_partitioned__year
+ , subq_14.ds_partitioned__extract_year
+ , subq_14.ds_partitioned__extract_quarter
+ , subq_14.ds_partitioned__extract_month
+ , subq_14.ds_partitioned__extract_day
+ , subq_14.ds_partitioned__extract_dow
+ , subq_14.ds_partitioned__extract_doy
+ , subq_14.paid_at__day
+ , subq_14.paid_at__week
+ , subq_14.paid_at__month
+ , subq_14.paid_at__quarter
+ , subq_14.paid_at__year
+ , subq_14.paid_at__extract_year
+ , subq_14.paid_at__extract_quarter
+ , subq_14.paid_at__extract_month
+ , subq_14.paid_at__extract_day
+ , subq_14.paid_at__extract_dow
+ , subq_14.paid_at__extract_doy
+ , subq_14.booking__ds__day
+ , subq_14.booking__ds__week
+ , subq_14.booking__ds__month
+ , subq_14.booking__ds__quarter
+ , subq_14.booking__ds__year
+ , subq_14.booking__ds__extract_year
+ , subq_14.booking__ds__extract_quarter
+ , subq_14.booking__ds__extract_month
+ , subq_14.booking__ds__extract_day
+ , subq_14.booking__ds__extract_dow
+ , subq_14.booking__ds__extract_doy
+ , subq_14.booking__ds_partitioned__day
+ , subq_14.booking__ds_partitioned__week
+ , subq_14.booking__ds_partitioned__month
+ , subq_14.booking__ds_partitioned__quarter
+ , subq_14.booking__ds_partitioned__year
+ , subq_14.booking__ds_partitioned__extract_year
+ , subq_14.booking__ds_partitioned__extract_quarter
+ , subq_14.booking__ds_partitioned__extract_month
+ , subq_14.booking__ds_partitioned__extract_day
+ , subq_14.booking__ds_partitioned__extract_dow
+ , subq_14.booking__ds_partitioned__extract_doy
+ , subq_14.booking__paid_at__day
+ , subq_14.booking__paid_at__week
+ , subq_14.booking__paid_at__month
+ , subq_14.booking__paid_at__quarter
+ , subq_14.booking__paid_at__year
+ , subq_14.booking__paid_at__extract_year
+ , subq_14.booking__paid_at__extract_quarter
+ , subq_14.booking__paid_at__extract_month
+ , subq_14.booking__paid_at__extract_day
+ , subq_14.booking__paid_at__extract_dow
+ , subq_14.booking__paid_at__extract_doy
+ , subq_14.ds__day AS metric_time__day
+ , subq_14.ds__week AS metric_time__week
+ , subq_14.ds__month AS metric_time__month
+ , subq_14.ds__quarter AS metric_time__quarter
+ , subq_14.ds__year AS metric_time__year
+ , subq_14.ds__extract_year AS metric_time__extract_year
+ , subq_14.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_14.ds__extract_month AS metric_time__extract_month
+ , subq_14.ds__extract_day AS metric_time__extract_day
+ , subq_14.ds__extract_dow AS metric_time__extract_dow
+ , subq_14.ds__extract_doy AS metric_time__extract_doy
+ , subq_14.listing
+ , subq_14.guest
+ , subq_14.host
+ , subq_14.booking__listing
+ , subq_14.booking__guest
+ , subq_14.booking__host
+ , subq_14.is_instant
+ , subq_14.booking__is_instant
+ , subq_14.bookings
+ , subq_14.instant_bookings
+ , subq_14.booking_value
+ , subq_14.max_booking_value
+ , subq_14.min_booking_value
+ , subq_14.bookers
+ , subq_14.average_booking_value
+ , subq_14.referred_bookings
+ , subq_14.median_booking_value
+ , subq_14.booking_value_p99
+ , subq_14.discrete_booking_value_p99
+ , subq_14.approximate_continuous_booking_value_p99
+ , subq_14.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_5
- ) subq_6
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_14
+ ) subq_15
ON
- subq_7.metric_time__day - MAKE_INTERVAL(days => 14) = subq_6.metric_time__day
- ) subq_9
- ) subq_10
+ subq_16.metric_time__day - MAKE_INTERVAL(days => 14) = subq_15.metric_time__day
+ ) subq_18
+ ) subq_19
GROUP BY
- subq_10.metric_time__day
- ) subq_11
- ) subq_12
+ subq_19.metric_time__day
+ ) subq_20
+ ) subq_21
ON
- subq_4.metric_time__day = subq_12.metric_time__day
+ subq_13.metric_time__day = subq_21.metric_time__day
GROUP BY
- COALESCE(subq_4.metric_time__day, subq_12.metric_time__day)
-) subq_13
+ COALESCE(subq_13.metric_time__day, subq_21.metric_time__day)
+) subq_22
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window__plan0_optimized.sql
index c71c75b485..304d0d012a 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window__plan0_optimized.sql
@@ -5,9 +5,9 @@ SELECT
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_18.metric_time__day, subq_26.metric_time__day) AS metric_time__day
- , MAX(subq_18.bookings) AS bookings
- , MAX(subq_26.bookings_2_weeks_ago) AS bookings_2_weeks_ago
+ COALESCE(subq_27.metric_time__day, subq_35.metric_time__day) AS metric_time__day
+ , MAX(subq_27.bookings) AS bookings
+ , MAX(subq_35.bookings_2_weeks_ago) AS bookings_2_weeks_ago
FROM (
-- Aggregate Measures
-- Compute Metrics via Expressions
@@ -21,35 +21,35 @@ FROM (
SELECT
DATE_TRUNC('day', ds) AS metric_time__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_16
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_25
GROUP BY
metric_time__day
- ) subq_18
+ ) subq_27
FULL OUTER JOIN (
-- Join to Time Spine Dataset
-- Pass Only Elements: ['bookings', 'metric_time__day']
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_22.ds AS metric_time__day
- , SUM(subq_20.bookings) AS bookings_2_weeks_ago
- FROM ***************************.mf_time_spine subq_22
+ subq_31.ds AS metric_time__day
+ , SUM(subq_29.bookings) AS bookings_2_weeks_ago
+ FROM ***************************.mf_time_spine subq_31
INNER JOIN (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
SELECT
DATE_TRUNC('day', ds) AS metric_time__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_20
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_29
ON
- subq_22.ds - MAKE_INTERVAL(days => 14) = subq_20.metric_time__day
+ subq_31.ds - MAKE_INTERVAL(days => 14) = subq_29.metric_time__day
GROUP BY
- subq_22.ds
- ) subq_26
+ subq_31.ds
+ ) subq_35
ON
- subq_18.metric_time__day = subq_26.metric_time__day
+ subq_27.metric_time__day = subq_35.metric_time__day
GROUP BY
- COALESCE(subq_18.metric_time__day, subq_26.metric_time__day)
-) subq_27
+ COALESCE(subq_27.metric_time__day, subq_35.metric_time__day)
+) subq_36
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window_and_granularity__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window_and_granularity__plan0.sql
index ec4e767aca..25d1a70740 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window_and_granularity__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window_and_granularity__plan0.sql
@@ -1,545 +1,545 @@
-- Compute Metrics via Expressions
SELECT
- subq_13.metric_time__quarter
+ subq_22.metric_time__quarter
, bookings - bookings_2_weeks_ago AS bookings_growth_2_weeks
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_4.metric_time__quarter, subq_12.metric_time__quarter) AS metric_time__quarter
- , MAX(subq_4.bookings) AS bookings
- , MAX(subq_12.bookings_2_weeks_ago) AS bookings_2_weeks_ago
+ COALESCE(subq_13.metric_time__quarter, subq_21.metric_time__quarter) AS metric_time__quarter
+ , MAX(subq_13.bookings) AS bookings
+ , MAX(subq_21.bookings_2_weeks_ago) AS bookings_2_weeks_ago
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_3.metric_time__quarter
- , subq_3.bookings
+ subq_12.metric_time__quarter
+ , subq_12.bookings
FROM (
-- Aggregate Measures
SELECT
- subq_2.metric_time__quarter
- , SUM(subq_2.bookings) AS bookings
+ subq_11.metric_time__quarter
+ , SUM(subq_11.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__quarter']
SELECT
- subq_1.metric_time__quarter
- , subq_1.bookings
+ subq_10.metric_time__quarter
+ , subq_10.bookings
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
- ) subq_2
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
GROUP BY
- subq_2.metric_time__quarter
- ) subq_3
- ) subq_4
+ subq_11.metric_time__quarter
+ ) subq_12
+ ) subq_13
FULL OUTER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_11.metric_time__quarter
- , subq_11.bookings AS bookings_2_weeks_ago
+ subq_20.metric_time__quarter
+ , subq_20.bookings AS bookings_2_weeks_ago
FROM (
-- Aggregate Measures
SELECT
- subq_10.metric_time__quarter
- , SUM(subq_10.bookings) AS bookings
+ subq_19.metric_time__quarter
+ , SUM(subq_19.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__quarter']
SELECT
- subq_9.metric_time__quarter
- , subq_9.bookings
+ subq_18.metric_time__quarter
+ , subq_18.bookings
FROM (
-- Join to Time Spine Dataset
SELECT
- DATE_TRUNC('quarter', subq_7.metric_time__day) AS metric_time__quarter
- , subq_6.ds__day AS ds__day
- , subq_6.ds__week AS ds__week
- , subq_6.ds__month AS ds__month
- , subq_6.ds__quarter AS ds__quarter
- , subq_6.ds__year AS ds__year
- , subq_6.ds__extract_year AS ds__extract_year
- , subq_6.ds__extract_quarter AS ds__extract_quarter
- , subq_6.ds__extract_month AS ds__extract_month
- , subq_6.ds__extract_day AS ds__extract_day
- , subq_6.ds__extract_dow AS ds__extract_dow
- , subq_6.ds__extract_doy AS ds__extract_doy
- , subq_6.ds_partitioned__day AS ds_partitioned__day
- , subq_6.ds_partitioned__week AS ds_partitioned__week
- , subq_6.ds_partitioned__month AS ds_partitioned__month
- , subq_6.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_6.ds_partitioned__year AS ds_partitioned__year
- , subq_6.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_6.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_6.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_6.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_6.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_6.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_6.paid_at__day AS paid_at__day
- , subq_6.paid_at__week AS paid_at__week
- , subq_6.paid_at__month AS paid_at__month
- , subq_6.paid_at__quarter AS paid_at__quarter
- , subq_6.paid_at__year AS paid_at__year
- , subq_6.paid_at__extract_year AS paid_at__extract_year
- , subq_6.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_6.paid_at__extract_month AS paid_at__extract_month
- , subq_6.paid_at__extract_day AS paid_at__extract_day
- , subq_6.paid_at__extract_dow AS paid_at__extract_dow
- , subq_6.paid_at__extract_doy AS paid_at__extract_doy
- , subq_6.booking__ds__day AS booking__ds__day
- , subq_6.booking__ds__week AS booking__ds__week
- , subq_6.booking__ds__month AS booking__ds__month
- , subq_6.booking__ds__quarter AS booking__ds__quarter
- , subq_6.booking__ds__year AS booking__ds__year
- , subq_6.booking__ds__extract_year AS booking__ds__extract_year
- , subq_6.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_6.booking__ds__extract_month AS booking__ds__extract_month
- , subq_6.booking__ds__extract_day AS booking__ds__extract_day
- , subq_6.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_6.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_6.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_6.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_6.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_6.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_6.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_6.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_6.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_6.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_6.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_6.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_6.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_6.booking__paid_at__day AS booking__paid_at__day
- , subq_6.booking__paid_at__week AS booking__paid_at__week
- , subq_6.booking__paid_at__month AS booking__paid_at__month
- , subq_6.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_6.booking__paid_at__year AS booking__paid_at__year
- , subq_6.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_6.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_6.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_6.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_6.listing AS listing
- , subq_6.guest AS guest
- , subq_6.host AS host
- , subq_6.booking__listing AS booking__listing
- , subq_6.booking__guest AS booking__guest
- , subq_6.booking__host AS booking__host
- , subq_6.is_instant AS is_instant
- , subq_6.booking__is_instant AS booking__is_instant
- , subq_6.bookings AS bookings
- , subq_6.instant_bookings AS instant_bookings
- , subq_6.booking_value AS booking_value
- , subq_6.max_booking_value AS max_booking_value
- , subq_6.min_booking_value AS min_booking_value
- , subq_6.bookers AS bookers
- , subq_6.average_booking_value AS average_booking_value
- , subq_6.referred_bookings AS referred_bookings
- , subq_6.median_booking_value AS median_booking_value
- , subq_6.booking_value_p99 AS booking_value_p99
- , subq_6.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_6.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_6.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ DATE_TRUNC('quarter', subq_16.metric_time__day) AS metric_time__quarter
+ , subq_15.ds__day AS ds__day
+ , subq_15.ds__week AS ds__week
+ , subq_15.ds__month AS ds__month
+ , subq_15.ds__quarter AS ds__quarter
+ , subq_15.ds__year AS ds__year
+ , subq_15.ds__extract_year AS ds__extract_year
+ , subq_15.ds__extract_quarter AS ds__extract_quarter
+ , subq_15.ds__extract_month AS ds__extract_month
+ , subq_15.ds__extract_day AS ds__extract_day
+ , subq_15.ds__extract_dow AS ds__extract_dow
+ , subq_15.ds__extract_doy AS ds__extract_doy
+ , subq_15.ds_partitioned__day AS ds_partitioned__day
+ , subq_15.ds_partitioned__week AS ds_partitioned__week
+ , subq_15.ds_partitioned__month AS ds_partitioned__month
+ , subq_15.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_15.ds_partitioned__year AS ds_partitioned__year
+ , subq_15.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_15.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_15.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_15.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_15.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_15.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_15.paid_at__day AS paid_at__day
+ , subq_15.paid_at__week AS paid_at__week
+ , subq_15.paid_at__month AS paid_at__month
+ , subq_15.paid_at__quarter AS paid_at__quarter
+ , subq_15.paid_at__year AS paid_at__year
+ , subq_15.paid_at__extract_year AS paid_at__extract_year
+ , subq_15.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_15.paid_at__extract_month AS paid_at__extract_month
+ , subq_15.paid_at__extract_day AS paid_at__extract_day
+ , subq_15.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_15.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_15.booking__ds__day AS booking__ds__day
+ , subq_15.booking__ds__week AS booking__ds__week
+ , subq_15.booking__ds__month AS booking__ds__month
+ , subq_15.booking__ds__quarter AS booking__ds__quarter
+ , subq_15.booking__ds__year AS booking__ds__year
+ , subq_15.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_15.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_15.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_15.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_15.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_15.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_15.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_15.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_15.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_15.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_15.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_15.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_15.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_15.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_15.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_15.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_15.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_15.booking__paid_at__day AS booking__paid_at__day
+ , subq_15.booking__paid_at__week AS booking__paid_at__week
+ , subq_15.booking__paid_at__month AS booking__paid_at__month
+ , subq_15.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_15.booking__paid_at__year AS booking__paid_at__year
+ , subq_15.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_15.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_15.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_15.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_15.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_15.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_15.listing AS listing
+ , subq_15.guest AS guest
+ , subq_15.host AS host
+ , subq_15.booking__listing AS booking__listing
+ , subq_15.booking__guest AS booking__guest
+ , subq_15.booking__host AS booking__host
+ , subq_15.is_instant AS is_instant
+ , subq_15.booking__is_instant AS booking__is_instant
+ , subq_15.bookings AS bookings
+ , subq_15.instant_bookings AS instant_bookings
+ , subq_15.booking_value AS booking_value
+ , subq_15.max_booking_value AS max_booking_value
+ , subq_15.min_booking_value AS min_booking_value
+ , subq_15.bookers AS bookers
+ , subq_15.average_booking_value AS average_booking_value
+ , subq_15.referred_bookings AS referred_bookings
+ , subq_15.median_booking_value AS median_booking_value
+ , subq_15.booking_value_p99 AS booking_value_p99
+ , subq_15.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_15.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_15.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_8.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_8
- ) subq_7
+ subq_17.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_17
+ ) subq_16
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_5.ds__day
- , subq_5.ds__week
- , subq_5.ds__month
- , subq_5.ds__quarter
- , subq_5.ds__year
- , subq_5.ds__extract_year
- , subq_5.ds__extract_quarter
- , subq_5.ds__extract_month
- , subq_5.ds__extract_day
- , subq_5.ds__extract_dow
- , subq_5.ds__extract_doy
- , subq_5.ds_partitioned__day
- , subq_5.ds_partitioned__week
- , subq_5.ds_partitioned__month
- , subq_5.ds_partitioned__quarter
- , subq_5.ds_partitioned__year
- , subq_5.ds_partitioned__extract_year
- , subq_5.ds_partitioned__extract_quarter
- , subq_5.ds_partitioned__extract_month
- , subq_5.ds_partitioned__extract_day
- , subq_5.ds_partitioned__extract_dow
- , subq_5.ds_partitioned__extract_doy
- , subq_5.paid_at__day
- , subq_5.paid_at__week
- , subq_5.paid_at__month
- , subq_5.paid_at__quarter
- , subq_5.paid_at__year
- , subq_5.paid_at__extract_year
- , subq_5.paid_at__extract_quarter
- , subq_5.paid_at__extract_month
- , subq_5.paid_at__extract_day
- , subq_5.paid_at__extract_dow
- , subq_5.paid_at__extract_doy
- , subq_5.booking__ds__day
- , subq_5.booking__ds__week
- , subq_5.booking__ds__month
- , subq_5.booking__ds__quarter
- , subq_5.booking__ds__year
- , subq_5.booking__ds__extract_year
- , subq_5.booking__ds__extract_quarter
- , subq_5.booking__ds__extract_month
- , subq_5.booking__ds__extract_day
- , subq_5.booking__ds__extract_dow
- , subq_5.booking__ds__extract_doy
- , subq_5.booking__ds_partitioned__day
- , subq_5.booking__ds_partitioned__week
- , subq_5.booking__ds_partitioned__month
- , subq_5.booking__ds_partitioned__quarter
- , subq_5.booking__ds_partitioned__year
- , subq_5.booking__ds_partitioned__extract_year
- , subq_5.booking__ds_partitioned__extract_quarter
- , subq_5.booking__ds_partitioned__extract_month
- , subq_5.booking__ds_partitioned__extract_day
- , subq_5.booking__ds_partitioned__extract_dow
- , subq_5.booking__ds_partitioned__extract_doy
- , subq_5.booking__paid_at__day
- , subq_5.booking__paid_at__week
- , subq_5.booking__paid_at__month
- , subq_5.booking__paid_at__quarter
- , subq_5.booking__paid_at__year
- , subq_5.booking__paid_at__extract_year
- , subq_5.booking__paid_at__extract_quarter
- , subq_5.booking__paid_at__extract_month
- , subq_5.booking__paid_at__extract_day
- , subq_5.booking__paid_at__extract_dow
- , subq_5.booking__paid_at__extract_doy
- , subq_5.ds__day AS metric_time__day
- , subq_5.ds__week AS metric_time__week
- , subq_5.ds__month AS metric_time__month
- , subq_5.ds__quarter AS metric_time__quarter
- , subq_5.ds__year AS metric_time__year
- , subq_5.ds__extract_year AS metric_time__extract_year
- , subq_5.ds__extract_quarter AS metric_time__extract_quarter
- , subq_5.ds__extract_month AS metric_time__extract_month
- , subq_5.ds__extract_day AS metric_time__extract_day
- , subq_5.ds__extract_dow AS metric_time__extract_dow
- , subq_5.ds__extract_doy AS metric_time__extract_doy
- , subq_5.listing
- , subq_5.guest
- , subq_5.host
- , subq_5.booking__listing
- , subq_5.booking__guest
- , subq_5.booking__host
- , subq_5.is_instant
- , subq_5.booking__is_instant
- , subq_5.bookings
- , subq_5.instant_bookings
- , subq_5.booking_value
- , subq_5.max_booking_value
- , subq_5.min_booking_value
- , subq_5.bookers
- , subq_5.average_booking_value
- , subq_5.referred_bookings
- , subq_5.median_booking_value
- , subq_5.booking_value_p99
- , subq_5.discrete_booking_value_p99
- , subq_5.approximate_continuous_booking_value_p99
- , subq_5.approximate_discrete_booking_value_p99
+ subq_14.ds__day
+ , subq_14.ds__week
+ , subq_14.ds__month
+ , subq_14.ds__quarter
+ , subq_14.ds__year
+ , subq_14.ds__extract_year
+ , subq_14.ds__extract_quarter
+ , subq_14.ds__extract_month
+ , subq_14.ds__extract_day
+ , subq_14.ds__extract_dow
+ , subq_14.ds__extract_doy
+ , subq_14.ds_partitioned__day
+ , subq_14.ds_partitioned__week
+ , subq_14.ds_partitioned__month
+ , subq_14.ds_partitioned__quarter
+ , subq_14.ds_partitioned__year
+ , subq_14.ds_partitioned__extract_year
+ , subq_14.ds_partitioned__extract_quarter
+ , subq_14.ds_partitioned__extract_month
+ , subq_14.ds_partitioned__extract_day
+ , subq_14.ds_partitioned__extract_dow
+ , subq_14.ds_partitioned__extract_doy
+ , subq_14.paid_at__day
+ , subq_14.paid_at__week
+ , subq_14.paid_at__month
+ , subq_14.paid_at__quarter
+ , subq_14.paid_at__year
+ , subq_14.paid_at__extract_year
+ , subq_14.paid_at__extract_quarter
+ , subq_14.paid_at__extract_month
+ , subq_14.paid_at__extract_day
+ , subq_14.paid_at__extract_dow
+ , subq_14.paid_at__extract_doy
+ , subq_14.booking__ds__day
+ , subq_14.booking__ds__week
+ , subq_14.booking__ds__month
+ , subq_14.booking__ds__quarter
+ , subq_14.booking__ds__year
+ , subq_14.booking__ds__extract_year
+ , subq_14.booking__ds__extract_quarter
+ , subq_14.booking__ds__extract_month
+ , subq_14.booking__ds__extract_day
+ , subq_14.booking__ds__extract_dow
+ , subq_14.booking__ds__extract_doy
+ , subq_14.booking__ds_partitioned__day
+ , subq_14.booking__ds_partitioned__week
+ , subq_14.booking__ds_partitioned__month
+ , subq_14.booking__ds_partitioned__quarter
+ , subq_14.booking__ds_partitioned__year
+ , subq_14.booking__ds_partitioned__extract_year
+ , subq_14.booking__ds_partitioned__extract_quarter
+ , subq_14.booking__ds_partitioned__extract_month
+ , subq_14.booking__ds_partitioned__extract_day
+ , subq_14.booking__ds_partitioned__extract_dow
+ , subq_14.booking__ds_partitioned__extract_doy
+ , subq_14.booking__paid_at__day
+ , subq_14.booking__paid_at__week
+ , subq_14.booking__paid_at__month
+ , subq_14.booking__paid_at__quarter
+ , subq_14.booking__paid_at__year
+ , subq_14.booking__paid_at__extract_year
+ , subq_14.booking__paid_at__extract_quarter
+ , subq_14.booking__paid_at__extract_month
+ , subq_14.booking__paid_at__extract_day
+ , subq_14.booking__paid_at__extract_dow
+ , subq_14.booking__paid_at__extract_doy
+ , subq_14.ds__day AS metric_time__day
+ , subq_14.ds__week AS metric_time__week
+ , subq_14.ds__month AS metric_time__month
+ , subq_14.ds__quarter AS metric_time__quarter
+ , subq_14.ds__year AS metric_time__year
+ , subq_14.ds__extract_year AS metric_time__extract_year
+ , subq_14.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_14.ds__extract_month AS metric_time__extract_month
+ , subq_14.ds__extract_day AS metric_time__extract_day
+ , subq_14.ds__extract_dow AS metric_time__extract_dow
+ , subq_14.ds__extract_doy AS metric_time__extract_doy
+ , subq_14.listing
+ , subq_14.guest
+ , subq_14.host
+ , subq_14.booking__listing
+ , subq_14.booking__guest
+ , subq_14.booking__host
+ , subq_14.is_instant
+ , subq_14.booking__is_instant
+ , subq_14.bookings
+ , subq_14.instant_bookings
+ , subq_14.booking_value
+ , subq_14.max_booking_value
+ , subq_14.min_booking_value
+ , subq_14.bookers
+ , subq_14.average_booking_value
+ , subq_14.referred_bookings
+ , subq_14.median_booking_value
+ , subq_14.booking_value_p99
+ , subq_14.discrete_booking_value_p99
+ , subq_14.approximate_continuous_booking_value_p99
+ , subq_14.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_5
- ) subq_6
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_14
+ ) subq_15
ON
- subq_7.metric_time__day - MAKE_INTERVAL(days => 14) = subq_6.metric_time__day
- ) subq_9
- ) subq_10
+ subq_16.metric_time__day - MAKE_INTERVAL(days => 14) = subq_15.metric_time__day
+ ) subq_18
+ ) subq_19
GROUP BY
- subq_10.metric_time__quarter
- ) subq_11
- ) subq_12
+ subq_19.metric_time__quarter
+ ) subq_20
+ ) subq_21
ON
- subq_4.metric_time__quarter = subq_12.metric_time__quarter
+ subq_13.metric_time__quarter = subq_21.metric_time__quarter
GROUP BY
- COALESCE(subq_4.metric_time__quarter, subq_12.metric_time__quarter)
-) subq_13
+ COALESCE(subq_13.metric_time__quarter, subq_21.metric_time__quarter)
+) subq_22
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window_and_granularity__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window_and_granularity__plan0_optimized.sql
index 4e2759b5d9..6567183a12 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window_and_granularity__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window_and_granularity__plan0_optimized.sql
@@ -5,9 +5,9 @@ SELECT
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_18.metric_time__quarter, subq_26.metric_time__quarter) AS metric_time__quarter
- , MAX(subq_18.bookings) AS bookings
- , MAX(subq_26.bookings_2_weeks_ago) AS bookings_2_weeks_ago
+ COALESCE(subq_27.metric_time__quarter, subq_35.metric_time__quarter) AS metric_time__quarter
+ , MAX(subq_27.bookings) AS bookings
+ , MAX(subq_35.bookings_2_weeks_ago) AS bookings_2_weeks_ago
FROM (
-- Aggregate Measures
-- Compute Metrics via Expressions
@@ -21,35 +21,35 @@ FROM (
SELECT
DATE_TRUNC('quarter', ds) AS metric_time__quarter
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_16
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_25
GROUP BY
metric_time__quarter
- ) subq_18
+ ) subq_27
FULL OUTER JOIN (
-- Join to Time Spine Dataset
-- Pass Only Elements: ['bookings', 'metric_time__quarter']
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- DATE_TRUNC('quarter', subq_22.ds) AS metric_time__quarter
- , SUM(subq_20.bookings) AS bookings_2_weeks_ago
- FROM ***************************.mf_time_spine subq_22
+ DATE_TRUNC('quarter', subq_31.ds) AS metric_time__quarter
+ , SUM(subq_29.bookings) AS bookings_2_weeks_ago
+ FROM ***************************.mf_time_spine subq_31
INNER JOIN (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
SELECT
DATE_TRUNC('day', ds) AS metric_time__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_20
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_29
ON
- subq_22.ds - MAKE_INTERVAL(days => 14) = subq_20.metric_time__day
+ subq_31.ds - MAKE_INTERVAL(days => 14) = subq_29.metric_time__day
GROUP BY
- DATE_TRUNC('quarter', subq_22.ds)
- ) subq_26
+ DATE_TRUNC('quarter', subq_31.ds)
+ ) subq_35
ON
- subq_18.metric_time__quarter = subq_26.metric_time__quarter
+ subq_27.metric_time__quarter = subq_35.metric_time__quarter
GROUP BY
- COALESCE(subq_18.metric_time__quarter, subq_26.metric_time__quarter)
-) subq_27
+ COALESCE(subq_27.metric_time__quarter, subq_35.metric_time__quarter)
+) subq_36
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql
index 296c677724..410d334758 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql
@@ -1,645 +1,645 @@
-- Compute Metrics via Expressions
SELECT
- subq_16.metric_time__day
+ subq_25.metric_time__day
, month_start_bookings - bookings_1_month_ago AS bookings_month_start_compared_to_1_month_prior
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_7.metric_time__day, subq_15.metric_time__day) AS metric_time__day
- , MAX(subq_7.month_start_bookings) AS month_start_bookings
- , MAX(subq_15.bookings_1_month_ago) AS bookings_1_month_ago
+ COALESCE(subq_16.metric_time__day, subq_24.metric_time__day) AS metric_time__day
+ , MAX(subq_16.month_start_bookings) AS month_start_bookings
+ , MAX(subq_24.bookings_1_month_ago) AS bookings_1_month_ago
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_6.metric_time__day
- , subq_6.bookings AS month_start_bookings
+ subq_15.metric_time__day
+ , subq_15.bookings AS month_start_bookings
FROM (
-- Aggregate Measures
SELECT
- subq_5.metric_time__day
- , SUM(subq_5.bookings) AS bookings
+ subq_14.metric_time__day
+ , SUM(subq_14.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__day']
SELECT
- subq_4.metric_time__day
- , subq_4.bookings
+ subq_13.metric_time__day
+ , subq_13.bookings
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_2.metric_time__day AS metric_time__day
- , subq_1.ds__day AS ds__day
- , subq_1.ds__week AS ds__week
- , subq_1.ds__month AS ds__month
- , subq_1.ds__quarter AS ds__quarter
- , subq_1.ds__year AS ds__year
- , subq_1.ds__extract_year AS ds__extract_year
- , subq_1.ds__extract_quarter AS ds__extract_quarter
- , subq_1.ds__extract_month AS ds__extract_month
- , subq_1.ds__extract_day AS ds__extract_day
- , subq_1.ds__extract_dow AS ds__extract_dow
- , subq_1.ds__extract_doy AS ds__extract_doy
- , subq_1.ds_partitioned__day AS ds_partitioned__day
- , subq_1.ds_partitioned__week AS ds_partitioned__week
- , subq_1.ds_partitioned__month AS ds_partitioned__month
- , subq_1.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_1.ds_partitioned__year AS ds_partitioned__year
- , subq_1.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_1.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_1.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_1.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_1.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_1.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_1.paid_at__day AS paid_at__day
- , subq_1.paid_at__week AS paid_at__week
- , subq_1.paid_at__month AS paid_at__month
- , subq_1.paid_at__quarter AS paid_at__quarter
- , subq_1.paid_at__year AS paid_at__year
- , subq_1.paid_at__extract_year AS paid_at__extract_year
- , subq_1.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_1.paid_at__extract_month AS paid_at__extract_month
- , subq_1.paid_at__extract_day AS paid_at__extract_day
- , subq_1.paid_at__extract_dow AS paid_at__extract_dow
- , subq_1.paid_at__extract_doy AS paid_at__extract_doy
- , subq_1.booking__ds__day AS booking__ds__day
- , subq_1.booking__ds__week AS booking__ds__week
- , subq_1.booking__ds__month AS booking__ds__month
- , subq_1.booking__ds__quarter AS booking__ds__quarter
- , subq_1.booking__ds__year AS booking__ds__year
- , subq_1.booking__ds__extract_year AS booking__ds__extract_year
- , subq_1.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_1.booking__ds__extract_month AS booking__ds__extract_month
- , subq_1.booking__ds__extract_day AS booking__ds__extract_day
- , subq_1.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_1.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_1.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_1.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_1.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_1.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_1.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_1.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_1.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_1.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_1.booking__paid_at__day AS booking__paid_at__day
- , subq_1.booking__paid_at__week AS booking__paid_at__week
- , subq_1.booking__paid_at__month AS booking__paid_at__month
- , subq_1.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_1.booking__paid_at__year AS booking__paid_at__year
- , subq_1.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_1.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_1.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_1.listing AS listing
- , subq_1.guest AS guest
- , subq_1.host AS host
- , subq_1.booking__listing AS booking__listing
- , subq_1.booking__guest AS booking__guest
- , subq_1.booking__host AS booking__host
- , subq_1.is_instant AS is_instant
- , subq_1.booking__is_instant AS booking__is_instant
- , subq_1.bookings AS bookings
- , subq_1.instant_bookings AS instant_bookings
- , subq_1.booking_value AS booking_value
- , subq_1.max_booking_value AS max_booking_value
- , subq_1.min_booking_value AS min_booking_value
- , subq_1.bookers AS bookers
- , subq_1.average_booking_value AS average_booking_value
- , subq_1.referred_bookings AS referred_bookings
- , subq_1.median_booking_value AS median_booking_value
- , subq_1.booking_value_p99 AS booking_value_p99
- , subq_1.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_1.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_1.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ subq_11.metric_time__day AS metric_time__day
+ , subq_10.ds__day AS ds__day
+ , subq_10.ds__week AS ds__week
+ , subq_10.ds__month AS ds__month
+ , subq_10.ds__quarter AS ds__quarter
+ , subq_10.ds__year AS ds__year
+ , subq_10.ds__extract_year AS ds__extract_year
+ , subq_10.ds__extract_quarter AS ds__extract_quarter
+ , subq_10.ds__extract_month AS ds__extract_month
+ , subq_10.ds__extract_day AS ds__extract_day
+ , subq_10.ds__extract_dow AS ds__extract_dow
+ , subq_10.ds__extract_doy AS ds__extract_doy
+ , subq_10.ds_partitioned__day AS ds_partitioned__day
+ , subq_10.ds_partitioned__week AS ds_partitioned__week
+ , subq_10.ds_partitioned__month AS ds_partitioned__month
+ , subq_10.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_10.ds_partitioned__year AS ds_partitioned__year
+ , subq_10.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_10.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_10.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_10.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_10.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_10.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_10.paid_at__day AS paid_at__day
+ , subq_10.paid_at__week AS paid_at__week
+ , subq_10.paid_at__month AS paid_at__month
+ , subq_10.paid_at__quarter AS paid_at__quarter
+ , subq_10.paid_at__year AS paid_at__year
+ , subq_10.paid_at__extract_year AS paid_at__extract_year
+ , subq_10.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_10.paid_at__extract_month AS paid_at__extract_month
+ , subq_10.paid_at__extract_day AS paid_at__extract_day
+ , subq_10.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_10.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_10.booking__ds__day AS booking__ds__day
+ , subq_10.booking__ds__week AS booking__ds__week
+ , subq_10.booking__ds__month AS booking__ds__month
+ , subq_10.booking__ds__quarter AS booking__ds__quarter
+ , subq_10.booking__ds__year AS booking__ds__year
+ , subq_10.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_10.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_10.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_10.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_10.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_10.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_10.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_10.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_10.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_10.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_10.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_10.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_10.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_10.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_10.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_10.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_10.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_10.booking__paid_at__day AS booking__paid_at__day
+ , subq_10.booking__paid_at__week AS booking__paid_at__week
+ , subq_10.booking__paid_at__month AS booking__paid_at__month
+ , subq_10.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_10.booking__paid_at__year AS booking__paid_at__year
+ , subq_10.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_10.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_10.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_10.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_10.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_10.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_10.listing AS listing
+ , subq_10.guest AS guest
+ , subq_10.host AS host
+ , subq_10.booking__listing AS booking__listing
+ , subq_10.booking__guest AS booking__guest
+ , subq_10.booking__host AS booking__host
+ , subq_10.is_instant AS is_instant
+ , subq_10.booking__is_instant AS booking__is_instant
+ , subq_10.bookings AS bookings
+ , subq_10.instant_bookings AS instant_bookings
+ , subq_10.booking_value AS booking_value
+ , subq_10.max_booking_value AS max_booking_value
+ , subq_10.min_booking_value AS min_booking_value
+ , subq_10.bookers AS bookers
+ , subq_10.average_booking_value AS average_booking_value
+ , subq_10.referred_bookings AS referred_bookings
+ , subq_10.median_booking_value AS median_booking_value
+ , subq_10.booking_value_p99 AS booking_value_p99
+ , subq_10.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_10.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_10.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_3.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_3
- ) subq_2
+ subq_12.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_12
+ ) subq_11
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
ON
- DATE_TRUNC('month', subq_2.metric_time__day) = subq_1.metric_time__day
- ) subq_4
- ) subq_5
+ DATE_TRUNC('month', subq_11.metric_time__day) = subq_10.metric_time__day
+ ) subq_13
+ ) subq_14
GROUP BY
- subq_5.metric_time__day
- ) subq_6
- ) subq_7
+ subq_14.metric_time__day
+ ) subq_15
+ ) subq_16
FULL OUTER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_14.metric_time__day
- , subq_14.bookings AS bookings_1_month_ago
+ subq_23.metric_time__day
+ , subq_23.bookings AS bookings_1_month_ago
FROM (
-- Aggregate Measures
SELECT
- subq_13.metric_time__day
- , SUM(subq_13.bookings) AS bookings
+ subq_22.metric_time__day
+ , SUM(subq_22.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__day']
SELECT
- subq_12.metric_time__day
- , subq_12.bookings
+ subq_21.metric_time__day
+ , subq_21.bookings
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_10.metric_time__day AS metric_time__day
- , subq_9.ds__day AS ds__day
- , subq_9.ds__week AS ds__week
- , subq_9.ds__month AS ds__month
- , subq_9.ds__quarter AS ds__quarter
- , subq_9.ds__year AS ds__year
- , subq_9.ds__extract_year AS ds__extract_year
- , subq_9.ds__extract_quarter AS ds__extract_quarter
- , subq_9.ds__extract_month AS ds__extract_month
- , subq_9.ds__extract_day AS ds__extract_day
- , subq_9.ds__extract_dow AS ds__extract_dow
- , subq_9.ds__extract_doy AS ds__extract_doy
- , subq_9.ds_partitioned__day AS ds_partitioned__day
- , subq_9.ds_partitioned__week AS ds_partitioned__week
- , subq_9.ds_partitioned__month AS ds_partitioned__month
- , subq_9.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_9.ds_partitioned__year AS ds_partitioned__year
- , subq_9.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_9.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_9.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_9.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_9.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_9.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_9.paid_at__day AS paid_at__day
- , subq_9.paid_at__week AS paid_at__week
- , subq_9.paid_at__month AS paid_at__month
- , subq_9.paid_at__quarter AS paid_at__quarter
- , subq_9.paid_at__year AS paid_at__year
- , subq_9.paid_at__extract_year AS paid_at__extract_year
- , subq_9.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_9.paid_at__extract_month AS paid_at__extract_month
- , subq_9.paid_at__extract_day AS paid_at__extract_day
- , subq_9.paid_at__extract_dow AS paid_at__extract_dow
- , subq_9.paid_at__extract_doy AS paid_at__extract_doy
- , subq_9.booking__ds__day AS booking__ds__day
- , subq_9.booking__ds__week AS booking__ds__week
- , subq_9.booking__ds__month AS booking__ds__month
- , subq_9.booking__ds__quarter AS booking__ds__quarter
- , subq_9.booking__ds__year AS booking__ds__year
- , subq_9.booking__ds__extract_year AS booking__ds__extract_year
- , subq_9.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_9.booking__ds__extract_month AS booking__ds__extract_month
- , subq_9.booking__ds__extract_day AS booking__ds__extract_day
- , subq_9.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_9.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_9.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_9.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_9.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_9.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_9.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_9.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_9.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_9.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_9.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_9.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_9.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_9.booking__paid_at__day AS booking__paid_at__day
- , subq_9.booking__paid_at__week AS booking__paid_at__week
- , subq_9.booking__paid_at__month AS booking__paid_at__month
- , subq_9.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_9.booking__paid_at__year AS booking__paid_at__year
- , subq_9.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_9.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_9.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_9.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_9.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_9.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_9.listing AS listing
- , subq_9.guest AS guest
- , subq_9.host AS host
- , subq_9.booking__listing AS booking__listing
- , subq_9.booking__guest AS booking__guest
- , subq_9.booking__host AS booking__host
- , subq_9.is_instant AS is_instant
- , subq_9.booking__is_instant AS booking__is_instant
- , subq_9.bookings AS bookings
- , subq_9.instant_bookings AS instant_bookings
- , subq_9.booking_value AS booking_value
- , subq_9.max_booking_value AS max_booking_value
- , subq_9.min_booking_value AS min_booking_value
- , subq_9.bookers AS bookers
- , subq_9.average_booking_value AS average_booking_value
- , subq_9.referred_bookings AS referred_bookings
- , subq_9.median_booking_value AS median_booking_value
- , subq_9.booking_value_p99 AS booking_value_p99
- , subq_9.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_9.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_9.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ subq_19.metric_time__day AS metric_time__day
+ , subq_18.ds__day AS ds__day
+ , subq_18.ds__week AS ds__week
+ , subq_18.ds__month AS ds__month
+ , subq_18.ds__quarter AS ds__quarter
+ , subq_18.ds__year AS ds__year
+ , subq_18.ds__extract_year AS ds__extract_year
+ , subq_18.ds__extract_quarter AS ds__extract_quarter
+ , subq_18.ds__extract_month AS ds__extract_month
+ , subq_18.ds__extract_day AS ds__extract_day
+ , subq_18.ds__extract_dow AS ds__extract_dow
+ , subq_18.ds__extract_doy AS ds__extract_doy
+ , subq_18.ds_partitioned__day AS ds_partitioned__day
+ , subq_18.ds_partitioned__week AS ds_partitioned__week
+ , subq_18.ds_partitioned__month AS ds_partitioned__month
+ , subq_18.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_18.ds_partitioned__year AS ds_partitioned__year
+ , subq_18.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_18.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_18.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_18.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_18.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_18.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_18.paid_at__day AS paid_at__day
+ , subq_18.paid_at__week AS paid_at__week
+ , subq_18.paid_at__month AS paid_at__month
+ , subq_18.paid_at__quarter AS paid_at__quarter
+ , subq_18.paid_at__year AS paid_at__year
+ , subq_18.paid_at__extract_year AS paid_at__extract_year
+ , subq_18.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_18.paid_at__extract_month AS paid_at__extract_month
+ , subq_18.paid_at__extract_day AS paid_at__extract_day
+ , subq_18.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_18.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_18.booking__ds__day AS booking__ds__day
+ , subq_18.booking__ds__week AS booking__ds__week
+ , subq_18.booking__ds__month AS booking__ds__month
+ , subq_18.booking__ds__quarter AS booking__ds__quarter
+ , subq_18.booking__ds__year AS booking__ds__year
+ , subq_18.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_18.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_18.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_18.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_18.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_18.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_18.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_18.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_18.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_18.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_18.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_18.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_18.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_18.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_18.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_18.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_18.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_18.booking__paid_at__day AS booking__paid_at__day
+ , subq_18.booking__paid_at__week AS booking__paid_at__week
+ , subq_18.booking__paid_at__month AS booking__paid_at__month
+ , subq_18.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_18.booking__paid_at__year AS booking__paid_at__year
+ , subq_18.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_18.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_18.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_18.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_18.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_18.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_18.listing AS listing
+ , subq_18.guest AS guest
+ , subq_18.host AS host
+ , subq_18.booking__listing AS booking__listing
+ , subq_18.booking__guest AS booking__guest
+ , subq_18.booking__host AS booking__host
+ , subq_18.is_instant AS is_instant
+ , subq_18.booking__is_instant AS booking__is_instant
+ , subq_18.bookings AS bookings
+ , subq_18.instant_bookings AS instant_bookings
+ , subq_18.booking_value AS booking_value
+ , subq_18.max_booking_value AS max_booking_value
+ , subq_18.min_booking_value AS min_booking_value
+ , subq_18.bookers AS bookers
+ , subq_18.average_booking_value AS average_booking_value
+ , subq_18.referred_bookings AS referred_bookings
+ , subq_18.median_booking_value AS median_booking_value
+ , subq_18.booking_value_p99 AS booking_value_p99
+ , subq_18.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_18.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_18.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_11.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_11
- ) subq_10
+ subq_20.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_20
+ ) subq_19
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_8.ds__day
- , subq_8.ds__week
- , subq_8.ds__month
- , subq_8.ds__quarter
- , subq_8.ds__year
- , subq_8.ds__extract_year
- , subq_8.ds__extract_quarter
- , subq_8.ds__extract_month
- , subq_8.ds__extract_day
- , subq_8.ds__extract_dow
- , subq_8.ds__extract_doy
- , subq_8.ds_partitioned__day
- , subq_8.ds_partitioned__week
- , subq_8.ds_partitioned__month
- , subq_8.ds_partitioned__quarter
- , subq_8.ds_partitioned__year
- , subq_8.ds_partitioned__extract_year
- , subq_8.ds_partitioned__extract_quarter
- , subq_8.ds_partitioned__extract_month
- , subq_8.ds_partitioned__extract_day
- , subq_8.ds_partitioned__extract_dow
- , subq_8.ds_partitioned__extract_doy
- , subq_8.paid_at__day
- , subq_8.paid_at__week
- , subq_8.paid_at__month
- , subq_8.paid_at__quarter
- , subq_8.paid_at__year
- , subq_8.paid_at__extract_year
- , subq_8.paid_at__extract_quarter
- , subq_8.paid_at__extract_month
- , subq_8.paid_at__extract_day
- , subq_8.paid_at__extract_dow
- , subq_8.paid_at__extract_doy
- , subq_8.booking__ds__day
- , subq_8.booking__ds__week
- , subq_8.booking__ds__month
- , subq_8.booking__ds__quarter
- , subq_8.booking__ds__year
- , subq_8.booking__ds__extract_year
- , subq_8.booking__ds__extract_quarter
- , subq_8.booking__ds__extract_month
- , subq_8.booking__ds__extract_day
- , subq_8.booking__ds__extract_dow
- , subq_8.booking__ds__extract_doy
- , subq_8.booking__ds_partitioned__day
- , subq_8.booking__ds_partitioned__week
- , subq_8.booking__ds_partitioned__month
- , subq_8.booking__ds_partitioned__quarter
- , subq_8.booking__ds_partitioned__year
- , subq_8.booking__ds_partitioned__extract_year
- , subq_8.booking__ds_partitioned__extract_quarter
- , subq_8.booking__ds_partitioned__extract_month
- , subq_8.booking__ds_partitioned__extract_day
- , subq_8.booking__ds_partitioned__extract_dow
- , subq_8.booking__ds_partitioned__extract_doy
- , subq_8.booking__paid_at__day
- , subq_8.booking__paid_at__week
- , subq_8.booking__paid_at__month
- , subq_8.booking__paid_at__quarter
- , subq_8.booking__paid_at__year
- , subq_8.booking__paid_at__extract_year
- , subq_8.booking__paid_at__extract_quarter
- , subq_8.booking__paid_at__extract_month
- , subq_8.booking__paid_at__extract_day
- , subq_8.booking__paid_at__extract_dow
- , subq_8.booking__paid_at__extract_doy
- , subq_8.ds__day AS metric_time__day
- , subq_8.ds__week AS metric_time__week
- , subq_8.ds__month AS metric_time__month
- , subq_8.ds__quarter AS metric_time__quarter
- , subq_8.ds__year AS metric_time__year
- , subq_8.ds__extract_year AS metric_time__extract_year
- , subq_8.ds__extract_quarter AS metric_time__extract_quarter
- , subq_8.ds__extract_month AS metric_time__extract_month
- , subq_8.ds__extract_day AS metric_time__extract_day
- , subq_8.ds__extract_dow AS metric_time__extract_dow
- , subq_8.ds__extract_doy AS metric_time__extract_doy
- , subq_8.listing
- , subq_8.guest
- , subq_8.host
- , subq_8.booking__listing
- , subq_8.booking__guest
- , subq_8.booking__host
- , subq_8.is_instant
- , subq_8.booking__is_instant
- , subq_8.bookings
- , subq_8.instant_bookings
- , subq_8.booking_value
- , subq_8.max_booking_value
- , subq_8.min_booking_value
- , subq_8.bookers
- , subq_8.average_booking_value
- , subq_8.referred_bookings
- , subq_8.median_booking_value
- , subq_8.booking_value_p99
- , subq_8.discrete_booking_value_p99
- , subq_8.approximate_continuous_booking_value_p99
- , subq_8.approximate_discrete_booking_value_p99
+ subq_17.ds__day
+ , subq_17.ds__week
+ , subq_17.ds__month
+ , subq_17.ds__quarter
+ , subq_17.ds__year
+ , subq_17.ds__extract_year
+ , subq_17.ds__extract_quarter
+ , subq_17.ds__extract_month
+ , subq_17.ds__extract_day
+ , subq_17.ds__extract_dow
+ , subq_17.ds__extract_doy
+ , subq_17.ds_partitioned__day
+ , subq_17.ds_partitioned__week
+ , subq_17.ds_partitioned__month
+ , subq_17.ds_partitioned__quarter
+ , subq_17.ds_partitioned__year
+ , subq_17.ds_partitioned__extract_year
+ , subq_17.ds_partitioned__extract_quarter
+ , subq_17.ds_partitioned__extract_month
+ , subq_17.ds_partitioned__extract_day
+ , subq_17.ds_partitioned__extract_dow
+ , subq_17.ds_partitioned__extract_doy
+ , subq_17.paid_at__day
+ , subq_17.paid_at__week
+ , subq_17.paid_at__month
+ , subq_17.paid_at__quarter
+ , subq_17.paid_at__year
+ , subq_17.paid_at__extract_year
+ , subq_17.paid_at__extract_quarter
+ , subq_17.paid_at__extract_month
+ , subq_17.paid_at__extract_day
+ , subq_17.paid_at__extract_dow
+ , subq_17.paid_at__extract_doy
+ , subq_17.booking__ds__day
+ , subq_17.booking__ds__week
+ , subq_17.booking__ds__month
+ , subq_17.booking__ds__quarter
+ , subq_17.booking__ds__year
+ , subq_17.booking__ds__extract_year
+ , subq_17.booking__ds__extract_quarter
+ , subq_17.booking__ds__extract_month
+ , subq_17.booking__ds__extract_day
+ , subq_17.booking__ds__extract_dow
+ , subq_17.booking__ds__extract_doy
+ , subq_17.booking__ds_partitioned__day
+ , subq_17.booking__ds_partitioned__week
+ , subq_17.booking__ds_partitioned__month
+ , subq_17.booking__ds_partitioned__quarter
+ , subq_17.booking__ds_partitioned__year
+ , subq_17.booking__ds_partitioned__extract_year
+ , subq_17.booking__ds_partitioned__extract_quarter
+ , subq_17.booking__ds_partitioned__extract_month
+ , subq_17.booking__ds_partitioned__extract_day
+ , subq_17.booking__ds_partitioned__extract_dow
+ , subq_17.booking__ds_partitioned__extract_doy
+ , subq_17.booking__paid_at__day
+ , subq_17.booking__paid_at__week
+ , subq_17.booking__paid_at__month
+ , subq_17.booking__paid_at__quarter
+ , subq_17.booking__paid_at__year
+ , subq_17.booking__paid_at__extract_year
+ , subq_17.booking__paid_at__extract_quarter
+ , subq_17.booking__paid_at__extract_month
+ , subq_17.booking__paid_at__extract_day
+ , subq_17.booking__paid_at__extract_dow
+ , subq_17.booking__paid_at__extract_doy
+ , subq_17.ds__day AS metric_time__day
+ , subq_17.ds__week AS metric_time__week
+ , subq_17.ds__month AS metric_time__month
+ , subq_17.ds__quarter AS metric_time__quarter
+ , subq_17.ds__year AS metric_time__year
+ , subq_17.ds__extract_year AS metric_time__extract_year
+ , subq_17.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_17.ds__extract_month AS metric_time__extract_month
+ , subq_17.ds__extract_day AS metric_time__extract_day
+ , subq_17.ds__extract_dow AS metric_time__extract_dow
+ , subq_17.ds__extract_doy AS metric_time__extract_doy
+ , subq_17.listing
+ , subq_17.guest
+ , subq_17.host
+ , subq_17.booking__listing
+ , subq_17.booking__guest
+ , subq_17.booking__host
+ , subq_17.is_instant
+ , subq_17.booking__is_instant
+ , subq_17.bookings
+ , subq_17.instant_bookings
+ , subq_17.booking_value
+ , subq_17.max_booking_value
+ , subq_17.min_booking_value
+ , subq_17.bookers
+ , subq_17.average_booking_value
+ , subq_17.referred_bookings
+ , subq_17.median_booking_value
+ , subq_17.booking_value_p99
+ , subq_17.discrete_booking_value_p99
+ , subq_17.approximate_continuous_booking_value_p99
+ , subq_17.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_8
- ) subq_9
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_17
+ ) subq_18
ON
- subq_10.metric_time__day - MAKE_INTERVAL(months => 1) = subq_9.metric_time__day
- ) subq_12
- ) subq_13
+ subq_19.metric_time__day - MAKE_INTERVAL(months => 1) = subq_18.metric_time__day
+ ) subq_21
+ ) subq_22
GROUP BY
- subq_13.metric_time__day
- ) subq_14
- ) subq_15
+ subq_22.metric_time__day
+ ) subq_23
+ ) subq_24
ON
- subq_7.metric_time__day = subq_15.metric_time__day
+ subq_16.metric_time__day = subq_24.metric_time__day
GROUP BY
- COALESCE(subq_7.metric_time__day, subq_15.metric_time__day)
-) subq_16
+ COALESCE(subq_16.metric_time__day, subq_24.metric_time__day)
+) subq_25
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window_and_offset_to_grain__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window_and_offset_to_grain__plan0_optimized.sql
index 0ec2c2c404..28c1c682f6 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window_and_offset_to_grain__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window_and_offset_to_grain__plan0_optimized.sql
@@ -5,55 +5,55 @@ SELECT
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_24.metric_time__day, subq_32.metric_time__day) AS metric_time__day
- , MAX(subq_24.month_start_bookings) AS month_start_bookings
- , MAX(subq_32.bookings_1_month_ago) AS bookings_1_month_ago
+ COALESCE(subq_33.metric_time__day, subq_41.metric_time__day) AS metric_time__day
+ , MAX(subq_33.month_start_bookings) AS month_start_bookings
+ , MAX(subq_41.bookings_1_month_ago) AS bookings_1_month_ago
FROM (
-- Join to Time Spine Dataset
-- Pass Only Elements: ['bookings', 'metric_time__day']
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_20.ds AS metric_time__day
- , SUM(subq_18.bookings) AS month_start_bookings
- FROM ***************************.mf_time_spine subq_20
+ subq_29.ds AS metric_time__day
+ , SUM(subq_27.bookings) AS month_start_bookings
+ FROM ***************************.mf_time_spine subq_29
INNER JOIN (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
SELECT
DATE_TRUNC('day', ds) AS metric_time__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_18
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_27
ON
- DATE_TRUNC('month', subq_20.ds) = subq_18.metric_time__day
+ DATE_TRUNC('month', subq_29.ds) = subq_27.metric_time__day
GROUP BY
- subq_20.ds
- ) subq_24
+ subq_29.ds
+ ) subq_33
FULL OUTER JOIN (
-- Join to Time Spine Dataset
-- Pass Only Elements: ['bookings', 'metric_time__day']
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_28.ds AS metric_time__day
- , SUM(subq_26.bookings) AS bookings_1_month_ago
- FROM ***************************.mf_time_spine subq_28
+ subq_37.ds AS metric_time__day
+ , SUM(subq_35.bookings) AS bookings_1_month_ago
+ FROM ***************************.mf_time_spine subq_37
INNER JOIN (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
SELECT
DATE_TRUNC('day', ds) AS metric_time__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_26
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_35
ON
- subq_28.ds - MAKE_INTERVAL(months => 1) = subq_26.metric_time__day
+ subq_37.ds - MAKE_INTERVAL(months => 1) = subq_35.metric_time__day
GROUP BY
- subq_28.ds
- ) subq_32
+ subq_37.ds
+ ) subq_41
ON
- subq_24.metric_time__day = subq_32.metric_time__day
+ subq_33.metric_time__day = subq_41.metric_time__day
GROUP BY
- COALESCE(subq_24.metric_time__day, subq_32.metric_time__day)
-) subq_33
+ COALESCE(subq_33.metric_time__day, subq_41.metric_time__day)
+) subq_42
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql
index f4c09e0f1c..de3508c301 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql
@@ -1,646 +1,646 @@
-- Compute Metrics via Expressions
SELECT
- subq_16.metric_time__year
+ subq_25.metric_time__year
, month_start_bookings - bookings_1_month_ago AS bookings_month_start_compared_to_1_month_prior
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_7.metric_time__year, subq_15.metric_time__year) AS metric_time__year
- , MAX(subq_7.month_start_bookings) AS month_start_bookings
- , MAX(subq_15.bookings_1_month_ago) AS bookings_1_month_ago
+ COALESCE(subq_16.metric_time__year, subq_24.metric_time__year) AS metric_time__year
+ , MAX(subq_16.month_start_bookings) AS month_start_bookings
+ , MAX(subq_24.bookings_1_month_ago) AS bookings_1_month_ago
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_6.metric_time__year
- , subq_6.bookings AS month_start_bookings
+ subq_15.metric_time__year
+ , subq_15.bookings AS month_start_bookings
FROM (
-- Aggregate Measures
SELECT
- subq_5.metric_time__year
- , SUM(subq_5.bookings) AS bookings
+ subq_14.metric_time__year
+ , SUM(subq_14.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__year']
SELECT
- subq_4.metric_time__year
- , subq_4.bookings
+ subq_13.metric_time__year
+ , subq_13.bookings
FROM (
-- Join to Time Spine Dataset
SELECT
- DATE_TRUNC('year', subq_2.metric_time__day) AS metric_time__year
- , subq_1.ds__day AS ds__day
- , subq_1.ds__week AS ds__week
- , subq_1.ds__month AS ds__month
- , subq_1.ds__quarter AS ds__quarter
- , subq_1.ds__year AS ds__year
- , subq_1.ds__extract_year AS ds__extract_year
- , subq_1.ds__extract_quarter AS ds__extract_quarter
- , subq_1.ds__extract_month AS ds__extract_month
- , subq_1.ds__extract_day AS ds__extract_day
- , subq_1.ds__extract_dow AS ds__extract_dow
- , subq_1.ds__extract_doy AS ds__extract_doy
- , subq_1.ds_partitioned__day AS ds_partitioned__day
- , subq_1.ds_partitioned__week AS ds_partitioned__week
- , subq_1.ds_partitioned__month AS ds_partitioned__month
- , subq_1.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_1.ds_partitioned__year AS ds_partitioned__year
- , subq_1.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_1.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_1.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_1.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_1.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_1.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_1.paid_at__day AS paid_at__day
- , subq_1.paid_at__week AS paid_at__week
- , subq_1.paid_at__month AS paid_at__month
- , subq_1.paid_at__quarter AS paid_at__quarter
- , subq_1.paid_at__year AS paid_at__year
- , subq_1.paid_at__extract_year AS paid_at__extract_year
- , subq_1.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_1.paid_at__extract_month AS paid_at__extract_month
- , subq_1.paid_at__extract_day AS paid_at__extract_day
- , subq_1.paid_at__extract_dow AS paid_at__extract_dow
- , subq_1.paid_at__extract_doy AS paid_at__extract_doy
- , subq_1.booking__ds__day AS booking__ds__day
- , subq_1.booking__ds__week AS booking__ds__week
- , subq_1.booking__ds__month AS booking__ds__month
- , subq_1.booking__ds__quarter AS booking__ds__quarter
- , subq_1.booking__ds__year AS booking__ds__year
- , subq_1.booking__ds__extract_year AS booking__ds__extract_year
- , subq_1.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_1.booking__ds__extract_month AS booking__ds__extract_month
- , subq_1.booking__ds__extract_day AS booking__ds__extract_day
- , subq_1.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_1.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_1.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_1.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_1.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_1.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_1.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_1.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_1.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_1.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_1.booking__paid_at__day AS booking__paid_at__day
- , subq_1.booking__paid_at__week AS booking__paid_at__week
- , subq_1.booking__paid_at__month AS booking__paid_at__month
- , subq_1.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_1.booking__paid_at__year AS booking__paid_at__year
- , subq_1.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_1.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_1.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_1.listing AS listing
- , subq_1.guest AS guest
- , subq_1.host AS host
- , subq_1.booking__listing AS booking__listing
- , subq_1.booking__guest AS booking__guest
- , subq_1.booking__host AS booking__host
- , subq_1.is_instant AS is_instant
- , subq_1.booking__is_instant AS booking__is_instant
- , subq_1.bookings AS bookings
- , subq_1.instant_bookings AS instant_bookings
- , subq_1.booking_value AS booking_value
- , subq_1.max_booking_value AS max_booking_value
- , subq_1.min_booking_value AS min_booking_value
- , subq_1.bookers AS bookers
- , subq_1.average_booking_value AS average_booking_value
- , subq_1.referred_bookings AS referred_bookings
- , subq_1.median_booking_value AS median_booking_value
- , subq_1.booking_value_p99 AS booking_value_p99
- , subq_1.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_1.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_1.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ DATE_TRUNC('year', subq_11.metric_time__day) AS metric_time__year
+ , subq_10.ds__day AS ds__day
+ , subq_10.ds__week AS ds__week
+ , subq_10.ds__month AS ds__month
+ , subq_10.ds__quarter AS ds__quarter
+ , subq_10.ds__year AS ds__year
+ , subq_10.ds__extract_year AS ds__extract_year
+ , subq_10.ds__extract_quarter AS ds__extract_quarter
+ , subq_10.ds__extract_month AS ds__extract_month
+ , subq_10.ds__extract_day AS ds__extract_day
+ , subq_10.ds__extract_dow AS ds__extract_dow
+ , subq_10.ds__extract_doy AS ds__extract_doy
+ , subq_10.ds_partitioned__day AS ds_partitioned__day
+ , subq_10.ds_partitioned__week AS ds_partitioned__week
+ , subq_10.ds_partitioned__month AS ds_partitioned__month
+ , subq_10.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_10.ds_partitioned__year AS ds_partitioned__year
+ , subq_10.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_10.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_10.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_10.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_10.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_10.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_10.paid_at__day AS paid_at__day
+ , subq_10.paid_at__week AS paid_at__week
+ , subq_10.paid_at__month AS paid_at__month
+ , subq_10.paid_at__quarter AS paid_at__quarter
+ , subq_10.paid_at__year AS paid_at__year
+ , subq_10.paid_at__extract_year AS paid_at__extract_year
+ , subq_10.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_10.paid_at__extract_month AS paid_at__extract_month
+ , subq_10.paid_at__extract_day AS paid_at__extract_day
+ , subq_10.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_10.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_10.booking__ds__day AS booking__ds__day
+ , subq_10.booking__ds__week AS booking__ds__week
+ , subq_10.booking__ds__month AS booking__ds__month
+ , subq_10.booking__ds__quarter AS booking__ds__quarter
+ , subq_10.booking__ds__year AS booking__ds__year
+ , subq_10.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_10.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_10.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_10.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_10.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_10.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_10.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_10.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_10.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_10.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_10.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_10.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_10.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_10.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_10.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_10.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_10.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_10.booking__paid_at__day AS booking__paid_at__day
+ , subq_10.booking__paid_at__week AS booking__paid_at__week
+ , subq_10.booking__paid_at__month AS booking__paid_at__month
+ , subq_10.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_10.booking__paid_at__year AS booking__paid_at__year
+ , subq_10.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_10.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_10.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_10.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_10.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_10.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_10.listing AS listing
+ , subq_10.guest AS guest
+ , subq_10.host AS host
+ , subq_10.booking__listing AS booking__listing
+ , subq_10.booking__guest AS booking__guest
+ , subq_10.booking__host AS booking__host
+ , subq_10.is_instant AS is_instant
+ , subq_10.booking__is_instant AS booking__is_instant
+ , subq_10.bookings AS bookings
+ , subq_10.instant_bookings AS instant_bookings
+ , subq_10.booking_value AS booking_value
+ , subq_10.max_booking_value AS max_booking_value
+ , subq_10.min_booking_value AS min_booking_value
+ , subq_10.bookers AS bookers
+ , subq_10.average_booking_value AS average_booking_value
+ , subq_10.referred_bookings AS referred_bookings
+ , subq_10.median_booking_value AS median_booking_value
+ , subq_10.booking_value_p99 AS booking_value_p99
+ , subq_10.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_10.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_10.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_3.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_3
- ) subq_2
+ subq_12.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_12
+ ) subq_11
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
ON
- DATE_TRUNC('month', subq_2.metric_time__day) = subq_1.metric_time__day
- WHERE DATE_TRUNC('year', subq_2.metric_time__day) = subq_2.metric_time__day
- ) subq_4
- ) subq_5
+ DATE_TRUNC('month', subq_11.metric_time__day) = subq_10.metric_time__day
+ WHERE DATE_TRUNC('year', subq_11.metric_time__day) = subq_11.metric_time__day
+ ) subq_13
+ ) subq_14
GROUP BY
- subq_5.metric_time__year
- ) subq_6
- ) subq_7
+ subq_14.metric_time__year
+ ) subq_15
+ ) subq_16
FULL OUTER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_14.metric_time__year
- , subq_14.bookings AS bookings_1_month_ago
+ subq_23.metric_time__year
+ , subq_23.bookings AS bookings_1_month_ago
FROM (
-- Aggregate Measures
SELECT
- subq_13.metric_time__year
- , SUM(subq_13.bookings) AS bookings
+ subq_22.metric_time__year
+ , SUM(subq_22.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__year']
SELECT
- subq_12.metric_time__year
- , subq_12.bookings
+ subq_21.metric_time__year
+ , subq_21.bookings
FROM (
-- Join to Time Spine Dataset
SELECT
- DATE_TRUNC('year', subq_10.metric_time__day) AS metric_time__year
- , subq_9.ds__day AS ds__day
- , subq_9.ds__week AS ds__week
- , subq_9.ds__month AS ds__month
- , subq_9.ds__quarter AS ds__quarter
- , subq_9.ds__year AS ds__year
- , subq_9.ds__extract_year AS ds__extract_year
- , subq_9.ds__extract_quarter AS ds__extract_quarter
- , subq_9.ds__extract_month AS ds__extract_month
- , subq_9.ds__extract_day AS ds__extract_day
- , subq_9.ds__extract_dow AS ds__extract_dow
- , subq_9.ds__extract_doy AS ds__extract_doy
- , subq_9.ds_partitioned__day AS ds_partitioned__day
- , subq_9.ds_partitioned__week AS ds_partitioned__week
- , subq_9.ds_partitioned__month AS ds_partitioned__month
- , subq_9.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_9.ds_partitioned__year AS ds_partitioned__year
- , subq_9.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_9.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_9.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_9.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_9.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_9.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_9.paid_at__day AS paid_at__day
- , subq_9.paid_at__week AS paid_at__week
- , subq_9.paid_at__month AS paid_at__month
- , subq_9.paid_at__quarter AS paid_at__quarter
- , subq_9.paid_at__year AS paid_at__year
- , subq_9.paid_at__extract_year AS paid_at__extract_year
- , subq_9.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_9.paid_at__extract_month AS paid_at__extract_month
- , subq_9.paid_at__extract_day AS paid_at__extract_day
- , subq_9.paid_at__extract_dow AS paid_at__extract_dow
- , subq_9.paid_at__extract_doy AS paid_at__extract_doy
- , subq_9.booking__ds__day AS booking__ds__day
- , subq_9.booking__ds__week AS booking__ds__week
- , subq_9.booking__ds__month AS booking__ds__month
- , subq_9.booking__ds__quarter AS booking__ds__quarter
- , subq_9.booking__ds__year AS booking__ds__year
- , subq_9.booking__ds__extract_year AS booking__ds__extract_year
- , subq_9.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_9.booking__ds__extract_month AS booking__ds__extract_month
- , subq_9.booking__ds__extract_day AS booking__ds__extract_day
- , subq_9.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_9.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_9.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_9.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_9.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_9.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_9.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_9.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_9.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_9.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_9.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_9.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_9.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_9.booking__paid_at__day AS booking__paid_at__day
- , subq_9.booking__paid_at__week AS booking__paid_at__week
- , subq_9.booking__paid_at__month AS booking__paid_at__month
- , subq_9.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_9.booking__paid_at__year AS booking__paid_at__year
- , subq_9.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_9.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_9.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_9.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_9.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_9.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_9.listing AS listing
- , subq_9.guest AS guest
- , subq_9.host AS host
- , subq_9.booking__listing AS booking__listing
- , subq_9.booking__guest AS booking__guest
- , subq_9.booking__host AS booking__host
- , subq_9.is_instant AS is_instant
- , subq_9.booking__is_instant AS booking__is_instant
- , subq_9.bookings AS bookings
- , subq_9.instant_bookings AS instant_bookings
- , subq_9.booking_value AS booking_value
- , subq_9.max_booking_value AS max_booking_value
- , subq_9.min_booking_value AS min_booking_value
- , subq_9.bookers AS bookers
- , subq_9.average_booking_value AS average_booking_value
- , subq_9.referred_bookings AS referred_bookings
- , subq_9.median_booking_value AS median_booking_value
- , subq_9.booking_value_p99 AS booking_value_p99
- , subq_9.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_9.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_9.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ DATE_TRUNC('year', subq_19.metric_time__day) AS metric_time__year
+ , subq_18.ds__day AS ds__day
+ , subq_18.ds__week AS ds__week
+ , subq_18.ds__month AS ds__month
+ , subq_18.ds__quarter AS ds__quarter
+ , subq_18.ds__year AS ds__year
+ , subq_18.ds__extract_year AS ds__extract_year
+ , subq_18.ds__extract_quarter AS ds__extract_quarter
+ , subq_18.ds__extract_month AS ds__extract_month
+ , subq_18.ds__extract_day AS ds__extract_day
+ , subq_18.ds__extract_dow AS ds__extract_dow
+ , subq_18.ds__extract_doy AS ds__extract_doy
+ , subq_18.ds_partitioned__day AS ds_partitioned__day
+ , subq_18.ds_partitioned__week AS ds_partitioned__week
+ , subq_18.ds_partitioned__month AS ds_partitioned__month
+ , subq_18.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_18.ds_partitioned__year AS ds_partitioned__year
+ , subq_18.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_18.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_18.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_18.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_18.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_18.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_18.paid_at__day AS paid_at__day
+ , subq_18.paid_at__week AS paid_at__week
+ , subq_18.paid_at__month AS paid_at__month
+ , subq_18.paid_at__quarter AS paid_at__quarter
+ , subq_18.paid_at__year AS paid_at__year
+ , subq_18.paid_at__extract_year AS paid_at__extract_year
+ , subq_18.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_18.paid_at__extract_month AS paid_at__extract_month
+ , subq_18.paid_at__extract_day AS paid_at__extract_day
+ , subq_18.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_18.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_18.booking__ds__day AS booking__ds__day
+ , subq_18.booking__ds__week AS booking__ds__week
+ , subq_18.booking__ds__month AS booking__ds__month
+ , subq_18.booking__ds__quarter AS booking__ds__quarter
+ , subq_18.booking__ds__year AS booking__ds__year
+ , subq_18.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_18.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_18.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_18.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_18.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_18.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_18.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_18.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_18.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_18.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_18.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_18.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_18.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_18.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_18.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_18.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_18.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_18.booking__paid_at__day AS booking__paid_at__day
+ , subq_18.booking__paid_at__week AS booking__paid_at__week
+ , subq_18.booking__paid_at__month AS booking__paid_at__month
+ , subq_18.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_18.booking__paid_at__year AS booking__paid_at__year
+ , subq_18.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_18.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_18.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_18.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_18.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_18.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_18.listing AS listing
+ , subq_18.guest AS guest
+ , subq_18.host AS host
+ , subq_18.booking__listing AS booking__listing
+ , subq_18.booking__guest AS booking__guest
+ , subq_18.booking__host AS booking__host
+ , subq_18.is_instant AS is_instant
+ , subq_18.booking__is_instant AS booking__is_instant
+ , subq_18.bookings AS bookings
+ , subq_18.instant_bookings AS instant_bookings
+ , subq_18.booking_value AS booking_value
+ , subq_18.max_booking_value AS max_booking_value
+ , subq_18.min_booking_value AS min_booking_value
+ , subq_18.bookers AS bookers
+ , subq_18.average_booking_value AS average_booking_value
+ , subq_18.referred_bookings AS referred_bookings
+ , subq_18.median_booking_value AS median_booking_value
+ , subq_18.booking_value_p99 AS booking_value_p99
+ , subq_18.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_18.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_18.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_11.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_11
- ) subq_10
+ subq_20.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_20
+ ) subq_19
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_8.ds__day
- , subq_8.ds__week
- , subq_8.ds__month
- , subq_8.ds__quarter
- , subq_8.ds__year
- , subq_8.ds__extract_year
- , subq_8.ds__extract_quarter
- , subq_8.ds__extract_month
- , subq_8.ds__extract_day
- , subq_8.ds__extract_dow
- , subq_8.ds__extract_doy
- , subq_8.ds_partitioned__day
- , subq_8.ds_partitioned__week
- , subq_8.ds_partitioned__month
- , subq_8.ds_partitioned__quarter
- , subq_8.ds_partitioned__year
- , subq_8.ds_partitioned__extract_year
- , subq_8.ds_partitioned__extract_quarter
- , subq_8.ds_partitioned__extract_month
- , subq_8.ds_partitioned__extract_day
- , subq_8.ds_partitioned__extract_dow
- , subq_8.ds_partitioned__extract_doy
- , subq_8.paid_at__day
- , subq_8.paid_at__week
- , subq_8.paid_at__month
- , subq_8.paid_at__quarter
- , subq_8.paid_at__year
- , subq_8.paid_at__extract_year
- , subq_8.paid_at__extract_quarter
- , subq_8.paid_at__extract_month
- , subq_8.paid_at__extract_day
- , subq_8.paid_at__extract_dow
- , subq_8.paid_at__extract_doy
- , subq_8.booking__ds__day
- , subq_8.booking__ds__week
- , subq_8.booking__ds__month
- , subq_8.booking__ds__quarter
- , subq_8.booking__ds__year
- , subq_8.booking__ds__extract_year
- , subq_8.booking__ds__extract_quarter
- , subq_8.booking__ds__extract_month
- , subq_8.booking__ds__extract_day
- , subq_8.booking__ds__extract_dow
- , subq_8.booking__ds__extract_doy
- , subq_8.booking__ds_partitioned__day
- , subq_8.booking__ds_partitioned__week
- , subq_8.booking__ds_partitioned__month
- , subq_8.booking__ds_partitioned__quarter
- , subq_8.booking__ds_partitioned__year
- , subq_8.booking__ds_partitioned__extract_year
- , subq_8.booking__ds_partitioned__extract_quarter
- , subq_8.booking__ds_partitioned__extract_month
- , subq_8.booking__ds_partitioned__extract_day
- , subq_8.booking__ds_partitioned__extract_dow
- , subq_8.booking__ds_partitioned__extract_doy
- , subq_8.booking__paid_at__day
- , subq_8.booking__paid_at__week
- , subq_8.booking__paid_at__month
- , subq_8.booking__paid_at__quarter
- , subq_8.booking__paid_at__year
- , subq_8.booking__paid_at__extract_year
- , subq_8.booking__paid_at__extract_quarter
- , subq_8.booking__paid_at__extract_month
- , subq_8.booking__paid_at__extract_day
- , subq_8.booking__paid_at__extract_dow
- , subq_8.booking__paid_at__extract_doy
- , subq_8.ds__day AS metric_time__day
- , subq_8.ds__week AS metric_time__week
- , subq_8.ds__month AS metric_time__month
- , subq_8.ds__quarter AS metric_time__quarter
- , subq_8.ds__year AS metric_time__year
- , subq_8.ds__extract_year AS metric_time__extract_year
- , subq_8.ds__extract_quarter AS metric_time__extract_quarter
- , subq_8.ds__extract_month AS metric_time__extract_month
- , subq_8.ds__extract_day AS metric_time__extract_day
- , subq_8.ds__extract_dow AS metric_time__extract_dow
- , subq_8.ds__extract_doy AS metric_time__extract_doy
- , subq_8.listing
- , subq_8.guest
- , subq_8.host
- , subq_8.booking__listing
- , subq_8.booking__guest
- , subq_8.booking__host
- , subq_8.is_instant
- , subq_8.booking__is_instant
- , subq_8.bookings
- , subq_8.instant_bookings
- , subq_8.booking_value
- , subq_8.max_booking_value
- , subq_8.min_booking_value
- , subq_8.bookers
- , subq_8.average_booking_value
- , subq_8.referred_bookings
- , subq_8.median_booking_value
- , subq_8.booking_value_p99
- , subq_8.discrete_booking_value_p99
- , subq_8.approximate_continuous_booking_value_p99
- , subq_8.approximate_discrete_booking_value_p99
+ subq_17.ds__day
+ , subq_17.ds__week
+ , subq_17.ds__month
+ , subq_17.ds__quarter
+ , subq_17.ds__year
+ , subq_17.ds__extract_year
+ , subq_17.ds__extract_quarter
+ , subq_17.ds__extract_month
+ , subq_17.ds__extract_day
+ , subq_17.ds__extract_dow
+ , subq_17.ds__extract_doy
+ , subq_17.ds_partitioned__day
+ , subq_17.ds_partitioned__week
+ , subq_17.ds_partitioned__month
+ , subq_17.ds_partitioned__quarter
+ , subq_17.ds_partitioned__year
+ , subq_17.ds_partitioned__extract_year
+ , subq_17.ds_partitioned__extract_quarter
+ , subq_17.ds_partitioned__extract_month
+ , subq_17.ds_partitioned__extract_day
+ , subq_17.ds_partitioned__extract_dow
+ , subq_17.ds_partitioned__extract_doy
+ , subq_17.paid_at__day
+ , subq_17.paid_at__week
+ , subq_17.paid_at__month
+ , subq_17.paid_at__quarter
+ , subq_17.paid_at__year
+ , subq_17.paid_at__extract_year
+ , subq_17.paid_at__extract_quarter
+ , subq_17.paid_at__extract_month
+ , subq_17.paid_at__extract_day
+ , subq_17.paid_at__extract_dow
+ , subq_17.paid_at__extract_doy
+ , subq_17.booking__ds__day
+ , subq_17.booking__ds__week
+ , subq_17.booking__ds__month
+ , subq_17.booking__ds__quarter
+ , subq_17.booking__ds__year
+ , subq_17.booking__ds__extract_year
+ , subq_17.booking__ds__extract_quarter
+ , subq_17.booking__ds__extract_month
+ , subq_17.booking__ds__extract_day
+ , subq_17.booking__ds__extract_dow
+ , subq_17.booking__ds__extract_doy
+ , subq_17.booking__ds_partitioned__day
+ , subq_17.booking__ds_partitioned__week
+ , subq_17.booking__ds_partitioned__month
+ , subq_17.booking__ds_partitioned__quarter
+ , subq_17.booking__ds_partitioned__year
+ , subq_17.booking__ds_partitioned__extract_year
+ , subq_17.booking__ds_partitioned__extract_quarter
+ , subq_17.booking__ds_partitioned__extract_month
+ , subq_17.booking__ds_partitioned__extract_day
+ , subq_17.booking__ds_partitioned__extract_dow
+ , subq_17.booking__ds_partitioned__extract_doy
+ , subq_17.booking__paid_at__day
+ , subq_17.booking__paid_at__week
+ , subq_17.booking__paid_at__month
+ , subq_17.booking__paid_at__quarter
+ , subq_17.booking__paid_at__year
+ , subq_17.booking__paid_at__extract_year
+ , subq_17.booking__paid_at__extract_quarter
+ , subq_17.booking__paid_at__extract_month
+ , subq_17.booking__paid_at__extract_day
+ , subq_17.booking__paid_at__extract_dow
+ , subq_17.booking__paid_at__extract_doy
+ , subq_17.ds__day AS metric_time__day
+ , subq_17.ds__week AS metric_time__week
+ , subq_17.ds__month AS metric_time__month
+ , subq_17.ds__quarter AS metric_time__quarter
+ , subq_17.ds__year AS metric_time__year
+ , subq_17.ds__extract_year AS metric_time__extract_year
+ , subq_17.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_17.ds__extract_month AS metric_time__extract_month
+ , subq_17.ds__extract_day AS metric_time__extract_day
+ , subq_17.ds__extract_dow AS metric_time__extract_dow
+ , subq_17.ds__extract_doy AS metric_time__extract_doy
+ , subq_17.listing
+ , subq_17.guest
+ , subq_17.host
+ , subq_17.booking__listing
+ , subq_17.booking__guest
+ , subq_17.booking__host
+ , subq_17.is_instant
+ , subq_17.booking__is_instant
+ , subq_17.bookings
+ , subq_17.instant_bookings
+ , subq_17.booking_value
+ , subq_17.max_booking_value
+ , subq_17.min_booking_value
+ , subq_17.bookers
+ , subq_17.average_booking_value
+ , subq_17.referred_bookings
+ , subq_17.median_booking_value
+ , subq_17.booking_value_p99
+ , subq_17.discrete_booking_value_p99
+ , subq_17.approximate_continuous_booking_value_p99
+ , subq_17.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_8
- ) subq_9
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_17
+ ) subq_18
ON
- subq_10.metric_time__day - MAKE_INTERVAL(months => 1) = subq_9.metric_time__day
- ) subq_12
- ) subq_13
+ subq_19.metric_time__day - MAKE_INTERVAL(months => 1) = subq_18.metric_time__day
+ ) subq_21
+ ) subq_22
GROUP BY
- subq_13.metric_time__year
- ) subq_14
- ) subq_15
+ subq_22.metric_time__year
+ ) subq_23
+ ) subq_24
ON
- subq_7.metric_time__year = subq_15.metric_time__year
+ subq_16.metric_time__year = subq_24.metric_time__year
GROUP BY
- COALESCE(subq_7.metric_time__year, subq_15.metric_time__year)
-) subq_16
+ COALESCE(subq_16.metric_time__year, subq_24.metric_time__year)
+) subq_25
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0_optimized.sql
index 3835603ac1..09bdaaf5da 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0_optimized.sql
@@ -5,56 +5,56 @@ SELECT
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_24.metric_time__year, subq_32.metric_time__year) AS metric_time__year
- , MAX(subq_24.month_start_bookings) AS month_start_bookings
- , MAX(subq_32.bookings_1_month_ago) AS bookings_1_month_ago
+ COALESCE(subq_33.metric_time__year, subq_41.metric_time__year) AS metric_time__year
+ , MAX(subq_33.month_start_bookings) AS month_start_bookings
+ , MAX(subq_41.bookings_1_month_ago) AS bookings_1_month_ago
FROM (
-- Join to Time Spine Dataset
-- Pass Only Elements: ['bookings', 'metric_time__year']
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- DATE_TRUNC('year', subq_20.ds) AS metric_time__year
- , SUM(subq_18.bookings) AS month_start_bookings
- FROM ***************************.mf_time_spine subq_20
+ DATE_TRUNC('year', subq_29.ds) AS metric_time__year
+ , SUM(subq_27.bookings) AS month_start_bookings
+ FROM ***************************.mf_time_spine subq_29
INNER JOIN (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
SELECT
DATE_TRUNC('day', ds) AS metric_time__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_18
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_27
ON
- DATE_TRUNC('month', subq_20.ds) = subq_18.metric_time__day
- WHERE DATE_TRUNC('year', subq_20.ds) = subq_20.ds
+ DATE_TRUNC('month', subq_29.ds) = subq_27.metric_time__day
+ WHERE DATE_TRUNC('year', subq_29.ds) = subq_29.ds
GROUP BY
- DATE_TRUNC('year', subq_20.ds)
- ) subq_24
+ DATE_TRUNC('year', subq_29.ds)
+ ) subq_33
FULL OUTER JOIN (
-- Join to Time Spine Dataset
-- Pass Only Elements: ['bookings', 'metric_time__year']
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- DATE_TRUNC('year', subq_28.ds) AS metric_time__year
- , SUM(subq_26.bookings) AS bookings_1_month_ago
- FROM ***************************.mf_time_spine subq_28
+ DATE_TRUNC('year', subq_37.ds) AS metric_time__year
+ , SUM(subq_35.bookings) AS bookings_1_month_ago
+ FROM ***************************.mf_time_spine subq_37
INNER JOIN (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
SELECT
DATE_TRUNC('day', ds) AS metric_time__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_26
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_35
ON
- subq_28.ds - MAKE_INTERVAL(months => 1) = subq_26.metric_time__day
+ subq_37.ds - MAKE_INTERVAL(months => 1) = subq_35.metric_time__day
GROUP BY
- DATE_TRUNC('year', subq_28.ds)
- ) subq_32
+ DATE_TRUNC('year', subq_37.ds)
+ ) subq_41
ON
- subq_24.metric_time__year = subq_32.metric_time__year
+ subq_33.metric_time__year = subq_41.metric_time__year
GROUP BY
- COALESCE(subq_24.metric_time__year, subq_32.metric_time__year)
-) subq_33
+ COALESCE(subq_33.metric_time__year, subq_41.metric_time__year)
+) subq_42
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window_and_time_filter__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window_and_time_filter__plan0.sql
index ca417f07cf..07633ee407 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window_and_time_filter__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window_and_time_filter__plan0.sql
@@ -1,559 +1,559 @@
-- Compute Metrics via Expressions
SELECT
- subq_15.metric_time__day
+ subq_24.metric_time__day
, bookings - bookings_2_weeks_ago AS bookings_growth_2_weeks
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_5.metric_time__day, subq_14.metric_time__day) AS metric_time__day
- , MAX(subq_5.bookings) AS bookings
- , MAX(subq_14.bookings_2_weeks_ago) AS bookings_2_weeks_ago
+ COALESCE(subq_14.metric_time__day, subq_23.metric_time__day) AS metric_time__day
+ , MAX(subq_14.bookings) AS bookings
+ , MAX(subq_23.bookings_2_weeks_ago) AS bookings_2_weeks_ago
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_4.metric_time__day
- , subq_4.bookings
+ subq_13.metric_time__day
+ , subq_13.bookings
FROM (
-- Aggregate Measures
SELECT
- subq_3.metric_time__day
- , SUM(subq_3.bookings) AS bookings
+ subq_12.metric_time__day
+ , SUM(subq_12.bookings) AS bookings
FROM (
-- Constrain Output with WHERE
SELECT
- subq_2.metric_time__day
- , subq_2.bookings
+ subq_11.metric_time__day
+ , subq_11.bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__day']
SELECT
- subq_1.metric_time__day
- , subq_1.bookings
+ subq_10.metric_time__day
+ , subq_10.bookings
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
- ) subq_2
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
WHERE metric_time__day = '2020-01-01' or metric_time__day = '2020-01-14'
- ) subq_3
+ ) subq_12
GROUP BY
- subq_3.metric_time__day
- ) subq_4
- ) subq_5
+ subq_12.metric_time__day
+ ) subq_13
+ ) subq_14
FULL OUTER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_13.metric_time__day
- , subq_13.bookings AS bookings_2_weeks_ago
+ subq_22.metric_time__day
+ , subq_22.bookings AS bookings_2_weeks_ago
FROM (
-- Aggregate Measures
SELECT
- subq_12.metric_time__day
- , SUM(subq_12.bookings) AS bookings
+ subq_21.metric_time__day
+ , SUM(subq_21.bookings) AS bookings
FROM (
-- Constrain Output with WHERE
SELECT
- subq_11.metric_time__day
- , subq_11.bookings
+ subq_20.metric_time__day
+ , subq_20.bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__day']
SELECT
- subq_10.metric_time__day
- , subq_10.bookings
+ subq_19.metric_time__day
+ , subq_19.bookings
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_8.metric_time__day AS metric_time__day
- , subq_7.ds__day AS ds__day
- , subq_7.ds__week AS ds__week
- , subq_7.ds__month AS ds__month
- , subq_7.ds__quarter AS ds__quarter
- , subq_7.ds__year AS ds__year
- , subq_7.ds__extract_year AS ds__extract_year
- , subq_7.ds__extract_quarter AS ds__extract_quarter
- , subq_7.ds__extract_month AS ds__extract_month
- , subq_7.ds__extract_day AS ds__extract_day
- , subq_7.ds__extract_dow AS ds__extract_dow
- , subq_7.ds__extract_doy AS ds__extract_doy
- , subq_7.ds_partitioned__day AS ds_partitioned__day
- , subq_7.ds_partitioned__week AS ds_partitioned__week
- , subq_7.ds_partitioned__month AS ds_partitioned__month
- , subq_7.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_7.ds_partitioned__year AS ds_partitioned__year
- , subq_7.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_7.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_7.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_7.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_7.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_7.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_7.paid_at__day AS paid_at__day
- , subq_7.paid_at__week AS paid_at__week
- , subq_7.paid_at__month AS paid_at__month
- , subq_7.paid_at__quarter AS paid_at__quarter
- , subq_7.paid_at__year AS paid_at__year
- , subq_7.paid_at__extract_year AS paid_at__extract_year
- , subq_7.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_7.paid_at__extract_month AS paid_at__extract_month
- , subq_7.paid_at__extract_day AS paid_at__extract_day
- , subq_7.paid_at__extract_dow AS paid_at__extract_dow
- , subq_7.paid_at__extract_doy AS paid_at__extract_doy
- , subq_7.booking__ds__day AS booking__ds__day
- , subq_7.booking__ds__week AS booking__ds__week
- , subq_7.booking__ds__month AS booking__ds__month
- , subq_7.booking__ds__quarter AS booking__ds__quarter
- , subq_7.booking__ds__year AS booking__ds__year
- , subq_7.booking__ds__extract_year AS booking__ds__extract_year
- , subq_7.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_7.booking__ds__extract_month AS booking__ds__extract_month
- , subq_7.booking__ds__extract_day AS booking__ds__extract_day
- , subq_7.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_7.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_7.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_7.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_7.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_7.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_7.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_7.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_7.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_7.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_7.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_7.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_7.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_7.booking__paid_at__day AS booking__paid_at__day
- , subq_7.booking__paid_at__week AS booking__paid_at__week
- , subq_7.booking__paid_at__month AS booking__paid_at__month
- , subq_7.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_7.booking__paid_at__year AS booking__paid_at__year
- , subq_7.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_7.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_7.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_7.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_7.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_7.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_7.listing AS listing
- , subq_7.guest AS guest
- , subq_7.host AS host
- , subq_7.booking__listing AS booking__listing
- , subq_7.booking__guest AS booking__guest
- , subq_7.booking__host AS booking__host
- , subq_7.is_instant AS is_instant
- , subq_7.booking__is_instant AS booking__is_instant
- , subq_7.bookings AS bookings
- , subq_7.instant_bookings AS instant_bookings
- , subq_7.booking_value AS booking_value
- , subq_7.max_booking_value AS max_booking_value
- , subq_7.min_booking_value AS min_booking_value
- , subq_7.bookers AS bookers
- , subq_7.average_booking_value AS average_booking_value
- , subq_7.referred_bookings AS referred_bookings
- , subq_7.median_booking_value AS median_booking_value
- , subq_7.booking_value_p99 AS booking_value_p99
- , subq_7.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_7.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_7.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ subq_17.metric_time__day AS metric_time__day
+ , subq_16.ds__day AS ds__day
+ , subq_16.ds__week AS ds__week
+ , subq_16.ds__month AS ds__month
+ , subq_16.ds__quarter AS ds__quarter
+ , subq_16.ds__year AS ds__year
+ , subq_16.ds__extract_year AS ds__extract_year
+ , subq_16.ds__extract_quarter AS ds__extract_quarter
+ , subq_16.ds__extract_month AS ds__extract_month
+ , subq_16.ds__extract_day AS ds__extract_day
+ , subq_16.ds__extract_dow AS ds__extract_dow
+ , subq_16.ds__extract_doy AS ds__extract_doy
+ , subq_16.ds_partitioned__day AS ds_partitioned__day
+ , subq_16.ds_partitioned__week AS ds_partitioned__week
+ , subq_16.ds_partitioned__month AS ds_partitioned__month
+ , subq_16.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_16.ds_partitioned__year AS ds_partitioned__year
+ , subq_16.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_16.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_16.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_16.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_16.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_16.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_16.paid_at__day AS paid_at__day
+ , subq_16.paid_at__week AS paid_at__week
+ , subq_16.paid_at__month AS paid_at__month
+ , subq_16.paid_at__quarter AS paid_at__quarter
+ , subq_16.paid_at__year AS paid_at__year
+ , subq_16.paid_at__extract_year AS paid_at__extract_year
+ , subq_16.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_16.paid_at__extract_month AS paid_at__extract_month
+ , subq_16.paid_at__extract_day AS paid_at__extract_day
+ , subq_16.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_16.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_16.booking__ds__day AS booking__ds__day
+ , subq_16.booking__ds__week AS booking__ds__week
+ , subq_16.booking__ds__month AS booking__ds__month
+ , subq_16.booking__ds__quarter AS booking__ds__quarter
+ , subq_16.booking__ds__year AS booking__ds__year
+ , subq_16.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_16.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_16.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_16.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_16.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_16.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_16.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_16.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_16.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_16.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_16.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_16.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_16.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_16.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_16.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_16.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_16.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_16.booking__paid_at__day AS booking__paid_at__day
+ , subq_16.booking__paid_at__week AS booking__paid_at__week
+ , subq_16.booking__paid_at__month AS booking__paid_at__month
+ , subq_16.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_16.booking__paid_at__year AS booking__paid_at__year
+ , subq_16.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_16.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_16.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_16.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_16.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_16.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_16.listing AS listing
+ , subq_16.guest AS guest
+ , subq_16.host AS host
+ , subq_16.booking__listing AS booking__listing
+ , subq_16.booking__guest AS booking__guest
+ , subq_16.booking__host AS booking__host
+ , subq_16.is_instant AS is_instant
+ , subq_16.booking__is_instant AS booking__is_instant
+ , subq_16.bookings AS bookings
+ , subq_16.instant_bookings AS instant_bookings
+ , subq_16.booking_value AS booking_value
+ , subq_16.max_booking_value AS max_booking_value
+ , subq_16.min_booking_value AS min_booking_value
+ , subq_16.bookers AS bookers
+ , subq_16.average_booking_value AS average_booking_value
+ , subq_16.referred_bookings AS referred_bookings
+ , subq_16.median_booking_value AS median_booking_value
+ , subq_16.booking_value_p99 AS booking_value_p99
+ , subq_16.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_16.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_16.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_9.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_9
- ) subq_8
+ subq_18.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_18
+ ) subq_17
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_6.ds__day
- , subq_6.ds__week
- , subq_6.ds__month
- , subq_6.ds__quarter
- , subq_6.ds__year
- , subq_6.ds__extract_year
- , subq_6.ds__extract_quarter
- , subq_6.ds__extract_month
- , subq_6.ds__extract_day
- , subq_6.ds__extract_dow
- , subq_6.ds__extract_doy
- , subq_6.ds_partitioned__day
- , subq_6.ds_partitioned__week
- , subq_6.ds_partitioned__month
- , subq_6.ds_partitioned__quarter
- , subq_6.ds_partitioned__year
- , subq_6.ds_partitioned__extract_year
- , subq_6.ds_partitioned__extract_quarter
- , subq_6.ds_partitioned__extract_month
- , subq_6.ds_partitioned__extract_day
- , subq_6.ds_partitioned__extract_dow
- , subq_6.ds_partitioned__extract_doy
- , subq_6.paid_at__day
- , subq_6.paid_at__week
- , subq_6.paid_at__month
- , subq_6.paid_at__quarter
- , subq_6.paid_at__year
- , subq_6.paid_at__extract_year
- , subq_6.paid_at__extract_quarter
- , subq_6.paid_at__extract_month
- , subq_6.paid_at__extract_day
- , subq_6.paid_at__extract_dow
- , subq_6.paid_at__extract_doy
- , subq_6.booking__ds__day
- , subq_6.booking__ds__week
- , subq_6.booking__ds__month
- , subq_6.booking__ds__quarter
- , subq_6.booking__ds__year
- , subq_6.booking__ds__extract_year
- , subq_6.booking__ds__extract_quarter
- , subq_6.booking__ds__extract_month
- , subq_6.booking__ds__extract_day
- , subq_6.booking__ds__extract_dow
- , subq_6.booking__ds__extract_doy
- , subq_6.booking__ds_partitioned__day
- , subq_6.booking__ds_partitioned__week
- , subq_6.booking__ds_partitioned__month
- , subq_6.booking__ds_partitioned__quarter
- , subq_6.booking__ds_partitioned__year
- , subq_6.booking__ds_partitioned__extract_year
- , subq_6.booking__ds_partitioned__extract_quarter
- , subq_6.booking__ds_partitioned__extract_month
- , subq_6.booking__ds_partitioned__extract_day
- , subq_6.booking__ds_partitioned__extract_dow
- , subq_6.booking__ds_partitioned__extract_doy
- , subq_6.booking__paid_at__day
- , subq_6.booking__paid_at__week
- , subq_6.booking__paid_at__month
- , subq_6.booking__paid_at__quarter
- , subq_6.booking__paid_at__year
- , subq_6.booking__paid_at__extract_year
- , subq_6.booking__paid_at__extract_quarter
- , subq_6.booking__paid_at__extract_month
- , subq_6.booking__paid_at__extract_day
- , subq_6.booking__paid_at__extract_dow
- , subq_6.booking__paid_at__extract_doy
- , subq_6.ds__day AS metric_time__day
- , subq_6.ds__week AS metric_time__week
- , subq_6.ds__month AS metric_time__month
- , subq_6.ds__quarter AS metric_time__quarter
- , subq_6.ds__year AS metric_time__year
- , subq_6.ds__extract_year AS metric_time__extract_year
- , subq_6.ds__extract_quarter AS metric_time__extract_quarter
- , subq_6.ds__extract_month AS metric_time__extract_month
- , subq_6.ds__extract_day AS metric_time__extract_day
- , subq_6.ds__extract_dow AS metric_time__extract_dow
- , subq_6.ds__extract_doy AS metric_time__extract_doy
- , subq_6.listing
- , subq_6.guest
- , subq_6.host
- , subq_6.booking__listing
- , subq_6.booking__guest
- , subq_6.booking__host
- , subq_6.is_instant
- , subq_6.booking__is_instant
- , subq_6.bookings
- , subq_6.instant_bookings
- , subq_6.booking_value
- , subq_6.max_booking_value
- , subq_6.min_booking_value
- , subq_6.bookers
- , subq_6.average_booking_value
- , subq_6.referred_bookings
- , subq_6.median_booking_value
- , subq_6.booking_value_p99
- , subq_6.discrete_booking_value_p99
- , subq_6.approximate_continuous_booking_value_p99
- , subq_6.approximate_discrete_booking_value_p99
+ subq_15.ds__day
+ , subq_15.ds__week
+ , subq_15.ds__month
+ , subq_15.ds__quarter
+ , subq_15.ds__year
+ , subq_15.ds__extract_year
+ , subq_15.ds__extract_quarter
+ , subq_15.ds__extract_month
+ , subq_15.ds__extract_day
+ , subq_15.ds__extract_dow
+ , subq_15.ds__extract_doy
+ , subq_15.ds_partitioned__day
+ , subq_15.ds_partitioned__week
+ , subq_15.ds_partitioned__month
+ , subq_15.ds_partitioned__quarter
+ , subq_15.ds_partitioned__year
+ , subq_15.ds_partitioned__extract_year
+ , subq_15.ds_partitioned__extract_quarter
+ , subq_15.ds_partitioned__extract_month
+ , subq_15.ds_partitioned__extract_day
+ , subq_15.ds_partitioned__extract_dow
+ , subq_15.ds_partitioned__extract_doy
+ , subq_15.paid_at__day
+ , subq_15.paid_at__week
+ , subq_15.paid_at__month
+ , subq_15.paid_at__quarter
+ , subq_15.paid_at__year
+ , subq_15.paid_at__extract_year
+ , subq_15.paid_at__extract_quarter
+ , subq_15.paid_at__extract_month
+ , subq_15.paid_at__extract_day
+ , subq_15.paid_at__extract_dow
+ , subq_15.paid_at__extract_doy
+ , subq_15.booking__ds__day
+ , subq_15.booking__ds__week
+ , subq_15.booking__ds__month
+ , subq_15.booking__ds__quarter
+ , subq_15.booking__ds__year
+ , subq_15.booking__ds__extract_year
+ , subq_15.booking__ds__extract_quarter
+ , subq_15.booking__ds__extract_month
+ , subq_15.booking__ds__extract_day
+ , subq_15.booking__ds__extract_dow
+ , subq_15.booking__ds__extract_doy
+ , subq_15.booking__ds_partitioned__day
+ , subq_15.booking__ds_partitioned__week
+ , subq_15.booking__ds_partitioned__month
+ , subq_15.booking__ds_partitioned__quarter
+ , subq_15.booking__ds_partitioned__year
+ , subq_15.booking__ds_partitioned__extract_year
+ , subq_15.booking__ds_partitioned__extract_quarter
+ , subq_15.booking__ds_partitioned__extract_month
+ , subq_15.booking__ds_partitioned__extract_day
+ , subq_15.booking__ds_partitioned__extract_dow
+ , subq_15.booking__ds_partitioned__extract_doy
+ , subq_15.booking__paid_at__day
+ , subq_15.booking__paid_at__week
+ , subq_15.booking__paid_at__month
+ , subq_15.booking__paid_at__quarter
+ , subq_15.booking__paid_at__year
+ , subq_15.booking__paid_at__extract_year
+ , subq_15.booking__paid_at__extract_quarter
+ , subq_15.booking__paid_at__extract_month
+ , subq_15.booking__paid_at__extract_day
+ , subq_15.booking__paid_at__extract_dow
+ , subq_15.booking__paid_at__extract_doy
+ , subq_15.ds__day AS metric_time__day
+ , subq_15.ds__week AS metric_time__week
+ , subq_15.ds__month AS metric_time__month
+ , subq_15.ds__quarter AS metric_time__quarter
+ , subq_15.ds__year AS metric_time__year
+ , subq_15.ds__extract_year AS metric_time__extract_year
+ , subq_15.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_15.ds__extract_month AS metric_time__extract_month
+ , subq_15.ds__extract_day AS metric_time__extract_day
+ , subq_15.ds__extract_dow AS metric_time__extract_dow
+ , subq_15.ds__extract_doy AS metric_time__extract_doy
+ , subq_15.listing
+ , subq_15.guest
+ , subq_15.host
+ , subq_15.booking__listing
+ , subq_15.booking__guest
+ , subq_15.booking__host
+ , subq_15.is_instant
+ , subq_15.booking__is_instant
+ , subq_15.bookings
+ , subq_15.instant_bookings
+ , subq_15.booking_value
+ , subq_15.max_booking_value
+ , subq_15.min_booking_value
+ , subq_15.bookers
+ , subq_15.average_booking_value
+ , subq_15.referred_bookings
+ , subq_15.median_booking_value
+ , subq_15.booking_value_p99
+ , subq_15.discrete_booking_value_p99
+ , subq_15.approximate_continuous_booking_value_p99
+ , subq_15.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_6
- ) subq_7
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_15
+ ) subq_16
ON
- subq_8.metric_time__day - MAKE_INTERVAL(days => 14) = subq_7.metric_time__day
- ) subq_10
- ) subq_11
+ subq_17.metric_time__day - MAKE_INTERVAL(days => 14) = subq_16.metric_time__day
+ ) subq_19
+ ) subq_20
WHERE metric_time__day = '2020-01-01' or metric_time__day = '2020-01-14'
- ) subq_12
+ ) subq_21
GROUP BY
- subq_12.metric_time__day
- ) subq_13
- ) subq_14
+ subq_21.metric_time__day
+ ) subq_22
+ ) subq_23
ON
- subq_5.metric_time__day = subq_14.metric_time__day
+ subq_14.metric_time__day = subq_23.metric_time__day
GROUP BY
- COALESCE(subq_5.metric_time__day, subq_14.metric_time__day)
-) subq_15
+ COALESCE(subq_14.metric_time__day, subq_23.metric_time__day)
+) subq_24
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window_and_time_filter__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window_and_time_filter__plan0_optimized.sql
index a43927c170..536d9a95df 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window_and_time_filter__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_metric_with_offset_window_and_time_filter__plan0_optimized.sql
@@ -5,9 +5,9 @@ SELECT
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_21.metric_time__day, subq_30.metric_time__day) AS metric_time__day
- , MAX(subq_21.bookings) AS bookings
- , MAX(subq_30.bookings_2_weeks_ago) AS bookings_2_weeks_ago
+ COALESCE(subq_30.metric_time__day, subq_39.metric_time__day) AS metric_time__day
+ , MAX(subq_30.bookings) AS bookings
+ , MAX(subq_39.bookings_2_weeks_ago) AS bookings_2_weeks_ago
FROM (
-- Constrain Output with WHERE
-- Aggregate Measures
@@ -22,12 +22,12 @@ FROM (
SELECT
DATE_TRUNC('day', ds) AS metric_time__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_18
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_27
WHERE metric_time__day = '2020-01-01' or metric_time__day = '2020-01-14'
GROUP BY
metric_time__day
- ) subq_21
+ ) subq_30
FULL OUTER JOIN (
-- Constrain Output with WHERE
-- Aggregate Measures
@@ -39,26 +39,26 @@ FROM (
-- Join to Time Spine Dataset
-- Pass Only Elements: ['bookings', 'metric_time__day']
SELECT
- subq_25.ds AS metric_time__day
- , subq_23.bookings AS bookings
- FROM ***************************.mf_time_spine subq_25
+ subq_34.ds AS metric_time__day
+ , subq_32.bookings AS bookings
+ FROM ***************************.mf_time_spine subq_34
INNER JOIN (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
SELECT
DATE_TRUNC('day', ds) AS metric_time__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_23
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_32
ON
- subq_25.ds - MAKE_INTERVAL(days => 14) = subq_23.metric_time__day
- ) subq_27
+ subq_34.ds - MAKE_INTERVAL(days => 14) = subq_32.metric_time__day
+ ) subq_36
WHERE metric_time__day = '2020-01-01' or metric_time__day = '2020-01-14'
GROUP BY
metric_time__day
- ) subq_30
+ ) subq_39
ON
- subq_21.metric_time__day = subq_30.metric_time__day
+ subq_30.metric_time__day = subq_39.metric_time__day
GROUP BY
- COALESCE(subq_21.metric_time__day, subq_30.metric_time__day)
-) subq_31
+ COALESCE(subq_30.metric_time__day, subq_39.metric_time__day)
+) subq_40
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_offset_cumulative_metric__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_offset_cumulative_metric__plan0.sql
index 9f6aaa19c3..3d37c8406d 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_offset_cumulative_metric__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_offset_cumulative_metric__plan0.sql
@@ -1,433 +1,433 @@
-- Compute Metrics via Expressions
SELECT
- subq_10.metric_time__day
+ subq_19.metric_time__day
, every_2_days_bookers_2_days_ago AS every_2_days_bookers_2_days_ago
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_9.metric_time__day
- , subq_9.bookers AS every_2_days_bookers_2_days_ago
+ subq_18.metric_time__day
+ , subq_18.bookers AS every_2_days_bookers_2_days_ago
FROM (
-- Aggregate Measures
SELECT
- subq_8.metric_time__day
- , COUNT(DISTINCT subq_8.bookers) AS bookers
+ subq_17.metric_time__day
+ , COUNT(DISTINCT subq_17.bookers) AS bookers
FROM (
-- Pass Only Elements: ['bookers', 'metric_time__day']
SELECT
- subq_7.metric_time__day
- , subq_7.bookers
+ subq_16.metric_time__day
+ , subq_16.bookers
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_5.metric_time__day AS metric_time__day
- , subq_4.ds__day AS ds__day
- , subq_4.ds__week AS ds__week
- , subq_4.ds__month AS ds__month
- , subq_4.ds__quarter AS ds__quarter
- , subq_4.ds__year AS ds__year
- , subq_4.ds__extract_year AS ds__extract_year
- , subq_4.ds__extract_quarter AS ds__extract_quarter
- , subq_4.ds__extract_month AS ds__extract_month
- , subq_4.ds__extract_day AS ds__extract_day
- , subq_4.ds__extract_dow AS ds__extract_dow
- , subq_4.ds__extract_doy AS ds__extract_doy
- , subq_4.ds_partitioned__day AS ds_partitioned__day
- , subq_4.ds_partitioned__week AS ds_partitioned__week
- , subq_4.ds_partitioned__month AS ds_partitioned__month
- , subq_4.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_4.ds_partitioned__year AS ds_partitioned__year
- , subq_4.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_4.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_4.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_4.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_4.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_4.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_4.paid_at__day AS paid_at__day
- , subq_4.paid_at__week AS paid_at__week
- , subq_4.paid_at__month AS paid_at__month
- , subq_4.paid_at__quarter AS paid_at__quarter
- , subq_4.paid_at__year AS paid_at__year
- , subq_4.paid_at__extract_year AS paid_at__extract_year
- , subq_4.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_4.paid_at__extract_month AS paid_at__extract_month
- , subq_4.paid_at__extract_day AS paid_at__extract_day
- , subq_4.paid_at__extract_dow AS paid_at__extract_dow
- , subq_4.paid_at__extract_doy AS paid_at__extract_doy
- , subq_4.booking__ds__day AS booking__ds__day
- , subq_4.booking__ds__week AS booking__ds__week
- , subq_4.booking__ds__month AS booking__ds__month
- , subq_4.booking__ds__quarter AS booking__ds__quarter
- , subq_4.booking__ds__year AS booking__ds__year
- , subq_4.booking__ds__extract_year AS booking__ds__extract_year
- , subq_4.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_4.booking__ds__extract_month AS booking__ds__extract_month
- , subq_4.booking__ds__extract_day AS booking__ds__extract_day
- , subq_4.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_4.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_4.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_4.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_4.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_4.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_4.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_4.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_4.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_4.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_4.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_4.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_4.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_4.booking__paid_at__day AS booking__paid_at__day
- , subq_4.booking__paid_at__week AS booking__paid_at__week
- , subq_4.booking__paid_at__month AS booking__paid_at__month
- , subq_4.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_4.booking__paid_at__year AS booking__paid_at__year
- , subq_4.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_4.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_4.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_4.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_4.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_4.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_4.listing AS listing
- , subq_4.guest AS guest
- , subq_4.host AS host
- , subq_4.booking__listing AS booking__listing
- , subq_4.booking__guest AS booking__guest
- , subq_4.booking__host AS booking__host
- , subq_4.is_instant AS is_instant
- , subq_4.booking__is_instant AS booking__is_instant
- , subq_4.bookings AS bookings
- , subq_4.instant_bookings AS instant_bookings
- , subq_4.booking_value AS booking_value
- , subq_4.max_booking_value AS max_booking_value
- , subq_4.min_booking_value AS min_booking_value
- , subq_4.bookers AS bookers
- , subq_4.average_booking_value AS average_booking_value
- , subq_4.referred_bookings AS referred_bookings
- , subq_4.median_booking_value AS median_booking_value
- , subq_4.booking_value_p99 AS booking_value_p99
- , subq_4.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_4.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_4.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ subq_14.metric_time__day AS metric_time__day
+ , subq_13.ds__day AS ds__day
+ , subq_13.ds__week AS ds__week
+ , subq_13.ds__month AS ds__month
+ , subq_13.ds__quarter AS ds__quarter
+ , subq_13.ds__year AS ds__year
+ , subq_13.ds__extract_year AS ds__extract_year
+ , subq_13.ds__extract_quarter AS ds__extract_quarter
+ , subq_13.ds__extract_month AS ds__extract_month
+ , subq_13.ds__extract_day AS ds__extract_day
+ , subq_13.ds__extract_dow AS ds__extract_dow
+ , subq_13.ds__extract_doy AS ds__extract_doy
+ , subq_13.ds_partitioned__day AS ds_partitioned__day
+ , subq_13.ds_partitioned__week AS ds_partitioned__week
+ , subq_13.ds_partitioned__month AS ds_partitioned__month
+ , subq_13.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_13.ds_partitioned__year AS ds_partitioned__year
+ , subq_13.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_13.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_13.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_13.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_13.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_13.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_13.paid_at__day AS paid_at__day
+ , subq_13.paid_at__week AS paid_at__week
+ , subq_13.paid_at__month AS paid_at__month
+ , subq_13.paid_at__quarter AS paid_at__quarter
+ , subq_13.paid_at__year AS paid_at__year
+ , subq_13.paid_at__extract_year AS paid_at__extract_year
+ , subq_13.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_13.paid_at__extract_month AS paid_at__extract_month
+ , subq_13.paid_at__extract_day AS paid_at__extract_day
+ , subq_13.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_13.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_13.booking__ds__day AS booking__ds__day
+ , subq_13.booking__ds__week AS booking__ds__week
+ , subq_13.booking__ds__month AS booking__ds__month
+ , subq_13.booking__ds__quarter AS booking__ds__quarter
+ , subq_13.booking__ds__year AS booking__ds__year
+ , subq_13.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_13.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_13.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_13.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_13.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_13.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_13.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_13.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_13.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_13.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_13.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_13.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_13.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_13.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_13.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_13.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_13.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_13.booking__paid_at__day AS booking__paid_at__day
+ , subq_13.booking__paid_at__week AS booking__paid_at__week
+ , subq_13.booking__paid_at__month AS booking__paid_at__month
+ , subq_13.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_13.booking__paid_at__year AS booking__paid_at__year
+ , subq_13.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_13.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_13.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_13.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_13.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_13.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_13.listing AS listing
+ , subq_13.guest AS guest
+ , subq_13.host AS host
+ , subq_13.booking__listing AS booking__listing
+ , subq_13.booking__guest AS booking__guest
+ , subq_13.booking__host AS booking__host
+ , subq_13.is_instant AS is_instant
+ , subq_13.booking__is_instant AS booking__is_instant
+ , subq_13.bookings AS bookings
+ , subq_13.instant_bookings AS instant_bookings
+ , subq_13.booking_value AS booking_value
+ , subq_13.max_booking_value AS max_booking_value
+ , subq_13.min_booking_value AS min_booking_value
+ , subq_13.bookers AS bookers
+ , subq_13.average_booking_value AS average_booking_value
+ , subq_13.referred_bookings AS referred_bookings
+ , subq_13.median_booking_value AS median_booking_value
+ , subq_13.booking_value_p99 AS booking_value_p99
+ , subq_13.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_13.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_13.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_6.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_6
- ) subq_5
+ subq_15.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_15
+ ) subq_14
INNER JOIN (
-- Join Self Over Time Range
SELECT
- subq_2.metric_time__day AS metric_time__day
- , subq_1.ds__day AS ds__day
- , subq_1.ds__week AS ds__week
- , subq_1.ds__month AS ds__month
- , subq_1.ds__quarter AS ds__quarter
- , subq_1.ds__year AS ds__year
- , subq_1.ds__extract_year AS ds__extract_year
- , subq_1.ds__extract_quarter AS ds__extract_quarter
- , subq_1.ds__extract_month AS ds__extract_month
- , subq_1.ds__extract_day AS ds__extract_day
- , subq_1.ds__extract_dow AS ds__extract_dow
- , subq_1.ds__extract_doy AS ds__extract_doy
- , subq_1.ds_partitioned__day AS ds_partitioned__day
- , subq_1.ds_partitioned__week AS ds_partitioned__week
- , subq_1.ds_partitioned__month AS ds_partitioned__month
- , subq_1.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_1.ds_partitioned__year AS ds_partitioned__year
- , subq_1.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_1.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_1.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_1.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_1.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_1.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_1.paid_at__day AS paid_at__day
- , subq_1.paid_at__week AS paid_at__week
- , subq_1.paid_at__month AS paid_at__month
- , subq_1.paid_at__quarter AS paid_at__quarter
- , subq_1.paid_at__year AS paid_at__year
- , subq_1.paid_at__extract_year AS paid_at__extract_year
- , subq_1.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_1.paid_at__extract_month AS paid_at__extract_month
- , subq_1.paid_at__extract_day AS paid_at__extract_day
- , subq_1.paid_at__extract_dow AS paid_at__extract_dow
- , subq_1.paid_at__extract_doy AS paid_at__extract_doy
- , subq_1.booking__ds__day AS booking__ds__day
- , subq_1.booking__ds__week AS booking__ds__week
- , subq_1.booking__ds__month AS booking__ds__month
- , subq_1.booking__ds__quarter AS booking__ds__quarter
- , subq_1.booking__ds__year AS booking__ds__year
- , subq_1.booking__ds__extract_year AS booking__ds__extract_year
- , subq_1.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_1.booking__ds__extract_month AS booking__ds__extract_month
- , subq_1.booking__ds__extract_day AS booking__ds__extract_day
- , subq_1.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_1.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_1.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_1.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_1.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_1.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_1.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_1.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_1.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_1.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_1.booking__paid_at__day AS booking__paid_at__day
- , subq_1.booking__paid_at__week AS booking__paid_at__week
- , subq_1.booking__paid_at__month AS booking__paid_at__month
- , subq_1.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_1.booking__paid_at__year AS booking__paid_at__year
- , subq_1.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_1.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_1.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_1.metric_time__week AS metric_time__week
- , subq_1.metric_time__month AS metric_time__month
- , subq_1.metric_time__quarter AS metric_time__quarter
- , subq_1.metric_time__year AS metric_time__year
- , subq_1.metric_time__extract_year AS metric_time__extract_year
- , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter
- , subq_1.metric_time__extract_month AS metric_time__extract_month
- , subq_1.metric_time__extract_day AS metric_time__extract_day
- , subq_1.metric_time__extract_dow AS metric_time__extract_dow
- , subq_1.metric_time__extract_doy AS metric_time__extract_doy
- , subq_1.listing AS listing
- , subq_1.guest AS guest
- , subq_1.host AS host
- , subq_1.booking__listing AS booking__listing
- , subq_1.booking__guest AS booking__guest
- , subq_1.booking__host AS booking__host
- , subq_1.is_instant AS is_instant
- , subq_1.booking__is_instant AS booking__is_instant
- , subq_1.bookings AS bookings
- , subq_1.instant_bookings AS instant_bookings
- , subq_1.booking_value AS booking_value
- , subq_1.max_booking_value AS max_booking_value
- , subq_1.min_booking_value AS min_booking_value
- , subq_1.bookers AS bookers
- , subq_1.average_booking_value AS average_booking_value
- , subq_1.referred_bookings AS referred_bookings
- , subq_1.median_booking_value AS median_booking_value
- , subq_1.booking_value_p99 AS booking_value_p99
- , subq_1.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_1.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_1.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ subq_11.metric_time__day AS metric_time__day
+ , subq_10.ds__day AS ds__day
+ , subq_10.ds__week AS ds__week
+ , subq_10.ds__month AS ds__month
+ , subq_10.ds__quarter AS ds__quarter
+ , subq_10.ds__year AS ds__year
+ , subq_10.ds__extract_year AS ds__extract_year
+ , subq_10.ds__extract_quarter AS ds__extract_quarter
+ , subq_10.ds__extract_month AS ds__extract_month
+ , subq_10.ds__extract_day AS ds__extract_day
+ , subq_10.ds__extract_dow AS ds__extract_dow
+ , subq_10.ds__extract_doy AS ds__extract_doy
+ , subq_10.ds_partitioned__day AS ds_partitioned__day
+ , subq_10.ds_partitioned__week AS ds_partitioned__week
+ , subq_10.ds_partitioned__month AS ds_partitioned__month
+ , subq_10.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_10.ds_partitioned__year AS ds_partitioned__year
+ , subq_10.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_10.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_10.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_10.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_10.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_10.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_10.paid_at__day AS paid_at__day
+ , subq_10.paid_at__week AS paid_at__week
+ , subq_10.paid_at__month AS paid_at__month
+ , subq_10.paid_at__quarter AS paid_at__quarter
+ , subq_10.paid_at__year AS paid_at__year
+ , subq_10.paid_at__extract_year AS paid_at__extract_year
+ , subq_10.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_10.paid_at__extract_month AS paid_at__extract_month
+ , subq_10.paid_at__extract_day AS paid_at__extract_day
+ , subq_10.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_10.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_10.booking__ds__day AS booking__ds__day
+ , subq_10.booking__ds__week AS booking__ds__week
+ , subq_10.booking__ds__month AS booking__ds__month
+ , subq_10.booking__ds__quarter AS booking__ds__quarter
+ , subq_10.booking__ds__year AS booking__ds__year
+ , subq_10.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_10.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_10.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_10.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_10.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_10.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_10.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_10.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_10.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_10.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_10.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_10.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_10.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_10.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_10.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_10.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_10.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_10.booking__paid_at__day AS booking__paid_at__day
+ , subq_10.booking__paid_at__week AS booking__paid_at__week
+ , subq_10.booking__paid_at__month AS booking__paid_at__month
+ , subq_10.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_10.booking__paid_at__year AS booking__paid_at__year
+ , subq_10.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_10.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_10.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_10.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_10.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_10.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_10.metric_time__week AS metric_time__week
+ , subq_10.metric_time__month AS metric_time__month
+ , subq_10.metric_time__quarter AS metric_time__quarter
+ , subq_10.metric_time__year AS metric_time__year
+ , subq_10.metric_time__extract_year AS metric_time__extract_year
+ , subq_10.metric_time__extract_quarter AS metric_time__extract_quarter
+ , subq_10.metric_time__extract_month AS metric_time__extract_month
+ , subq_10.metric_time__extract_day AS metric_time__extract_day
+ , subq_10.metric_time__extract_dow AS metric_time__extract_dow
+ , subq_10.metric_time__extract_doy AS metric_time__extract_doy
+ , subq_10.listing AS listing
+ , subq_10.guest AS guest
+ , subq_10.host AS host
+ , subq_10.booking__listing AS booking__listing
+ , subq_10.booking__guest AS booking__guest
+ , subq_10.booking__host AS booking__host
+ , subq_10.is_instant AS is_instant
+ , subq_10.booking__is_instant AS booking__is_instant
+ , subq_10.bookings AS bookings
+ , subq_10.instant_bookings AS instant_bookings
+ , subq_10.booking_value AS booking_value
+ , subq_10.max_booking_value AS max_booking_value
+ , subq_10.min_booking_value AS min_booking_value
+ , subq_10.bookers AS bookers
+ , subq_10.average_booking_value AS average_booking_value
+ , subq_10.referred_bookings AS referred_bookings
+ , subq_10.median_booking_value AS median_booking_value
+ , subq_10.booking_value_p99 AS booking_value_p99
+ , subq_10.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_10.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_10.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_3.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_3
- ) subq_2
+ subq_12.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_12
+ ) subq_11
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
ON
(
- subq_1.metric_time__day <= subq_2.metric_time__day
+ subq_10.metric_time__day <= subq_11.metric_time__day
) AND (
- subq_1.metric_time__day > subq_2.metric_time__day - MAKE_INTERVAL(days => 2)
+ subq_10.metric_time__day > subq_11.metric_time__day - MAKE_INTERVAL(days => 2)
)
- ) subq_4
+ ) subq_13
ON
- subq_5.metric_time__day - MAKE_INTERVAL(days => 2) = subq_4.metric_time__day
- ) subq_7
- ) subq_8
+ subq_14.metric_time__day - MAKE_INTERVAL(days => 2) = subq_13.metric_time__day
+ ) subq_16
+ ) subq_17
GROUP BY
- subq_8.metric_time__day
- ) subq_9
-) subq_10
+ subq_17.metric_time__day
+ ) subq_18
+) subq_19
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_offset_cumulative_metric__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_offset_cumulative_metric__plan0_optimized.sql
index d021503497..fa1700be10 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_offset_cumulative_metric__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_offset_cumulative_metric__plan0_optimized.sql
@@ -8,26 +8,26 @@ FROM (
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_17.ds AS metric_time__day
- , COUNT(DISTINCT subq_15.bookers) AS every_2_days_bookers_2_days_ago
- FROM ***************************.mf_time_spine subq_17
+ subq_26.ds AS metric_time__day
+ , COUNT(DISTINCT subq_24.bookers) AS every_2_days_bookers_2_days_ago
+ FROM ***************************.mf_time_spine subq_26
INNER JOIN (
-- Join Self Over Time Range
SELECT
- subq_14.ds AS metric_time__day
- , bookings_source_src_28001.guest_id AS bookers
- FROM ***************************.mf_time_spine subq_14
+ subq_23.ds AS metric_time__day
+ , bookings_source_src_28000.guest_id AS bookers
+ FROM ***************************.mf_time_spine subq_23
INNER JOIN
- ***************************.fct_bookings bookings_source_src_28001
+ ***************************.fct_bookings bookings_source_src_28000
ON
(
- DATE_TRUNC('day', bookings_source_src_28001.ds) <= subq_14.ds
+ DATE_TRUNC('day', bookings_source_src_28000.ds) <= subq_23.ds
) AND (
- DATE_TRUNC('day', bookings_source_src_28001.ds) > subq_14.ds - MAKE_INTERVAL(days => 2)
+ DATE_TRUNC('day', bookings_source_src_28000.ds) > subq_23.ds - MAKE_INTERVAL(days => 2)
)
- ) subq_15
+ ) subq_24
ON
- subq_17.ds - MAKE_INTERVAL(days => 2) = subq_15.metric_time__day
+ subq_26.ds - MAKE_INTERVAL(days => 2) = subq_24.metric_time__day
GROUP BY
- subq_17.ds
-) subq_21
+ subq_26.ds
+) subq_30
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_offset_metric_with_agg_time_dim__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_offset_metric_with_agg_time_dim__plan0.sql
index 270ee8720a..61d458d0a0 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_offset_metric_with_agg_time_dim__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_offset_metric_with_agg_time_dim__plan0.sql
@@ -1,545 +1,545 @@
-- Compute Metrics via Expressions
SELECT
- subq_13.booking__ds__day
+ subq_22.booking__ds__day
, booking_value * 0.05 / bookers AS booking_fees_last_week_per_booker_this_week
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_7.booking__ds__day, subq_12.booking__ds__day) AS booking__ds__day
- , MAX(subq_7.booking_value) AS booking_value
- , MAX(subq_12.bookers) AS bookers
+ COALESCE(subq_16.booking__ds__day, subq_21.booking__ds__day) AS booking__ds__day
+ , MAX(subq_16.booking_value) AS booking_value
+ , MAX(subq_21.bookers) AS bookers
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_6.booking__ds__day
- , subq_6.booking_value
+ subq_15.booking__ds__day
+ , subq_15.booking_value
FROM (
-- Aggregate Measures
SELECT
- subq_5.booking__ds__day
- , SUM(subq_5.booking_value) AS booking_value
+ subq_14.booking__ds__day
+ , SUM(subq_14.booking_value) AS booking_value
FROM (
-- Pass Only Elements: ['booking_value', 'booking__ds__day']
SELECT
- subq_4.booking__ds__day
- , subq_4.booking_value
+ subq_13.booking__ds__day
+ , subq_13.booking_value
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_2.booking__ds__day AS booking__ds__day
- , subq_1.ds__day AS ds__day
- , subq_1.ds__week AS ds__week
- , subq_1.ds__month AS ds__month
- , subq_1.ds__quarter AS ds__quarter
- , subq_1.ds__year AS ds__year
- , subq_1.ds__extract_year AS ds__extract_year
- , subq_1.ds__extract_quarter AS ds__extract_quarter
- , subq_1.ds__extract_month AS ds__extract_month
- , subq_1.ds__extract_day AS ds__extract_day
- , subq_1.ds__extract_dow AS ds__extract_dow
- , subq_1.ds__extract_doy AS ds__extract_doy
- , subq_1.ds_partitioned__day AS ds_partitioned__day
- , subq_1.ds_partitioned__week AS ds_partitioned__week
- , subq_1.ds_partitioned__month AS ds_partitioned__month
- , subq_1.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_1.ds_partitioned__year AS ds_partitioned__year
- , subq_1.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_1.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_1.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_1.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_1.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_1.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_1.paid_at__day AS paid_at__day
- , subq_1.paid_at__week AS paid_at__week
- , subq_1.paid_at__month AS paid_at__month
- , subq_1.paid_at__quarter AS paid_at__quarter
- , subq_1.paid_at__year AS paid_at__year
- , subq_1.paid_at__extract_year AS paid_at__extract_year
- , subq_1.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_1.paid_at__extract_month AS paid_at__extract_month
- , subq_1.paid_at__extract_day AS paid_at__extract_day
- , subq_1.paid_at__extract_dow AS paid_at__extract_dow
- , subq_1.paid_at__extract_doy AS paid_at__extract_doy
- , subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_1.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_1.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_1.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_1.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_1.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_1.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_1.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_1.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_1.booking__paid_at__day AS booking__paid_at__day
- , subq_1.booking__paid_at__week AS booking__paid_at__week
- , subq_1.booking__paid_at__month AS booking__paid_at__month
- , subq_1.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_1.booking__paid_at__year AS booking__paid_at__year
- , subq_1.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_1.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_1.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_1.metric_time__day AS metric_time__day
- , subq_1.metric_time__week AS metric_time__week
- , subq_1.metric_time__month AS metric_time__month
- , subq_1.metric_time__quarter AS metric_time__quarter
- , subq_1.metric_time__year AS metric_time__year
- , subq_1.metric_time__extract_year AS metric_time__extract_year
- , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter
- , subq_1.metric_time__extract_month AS metric_time__extract_month
- , subq_1.metric_time__extract_day AS metric_time__extract_day
- , subq_1.metric_time__extract_dow AS metric_time__extract_dow
- , subq_1.metric_time__extract_doy AS metric_time__extract_doy
- , subq_1.listing AS listing
- , subq_1.guest AS guest
- , subq_1.host AS host
- , subq_1.booking__listing AS booking__listing
- , subq_1.booking__guest AS booking__guest
- , subq_1.booking__host AS booking__host
- , subq_1.is_instant AS is_instant
- , subq_1.booking__is_instant AS booking__is_instant
- , subq_1.bookings AS bookings
- , subq_1.instant_bookings AS instant_bookings
- , subq_1.booking_value AS booking_value
- , subq_1.max_booking_value AS max_booking_value
- , subq_1.min_booking_value AS min_booking_value
- , subq_1.bookers AS bookers
- , subq_1.average_booking_value AS average_booking_value
- , subq_1.referred_bookings AS referred_bookings
- , subq_1.median_booking_value AS median_booking_value
- , subq_1.booking_value_p99 AS booking_value_p99
- , subq_1.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_1.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_1.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ subq_11.booking__ds__day AS booking__ds__day
+ , subq_10.ds__day AS ds__day
+ , subq_10.ds__week AS ds__week
+ , subq_10.ds__month AS ds__month
+ , subq_10.ds__quarter AS ds__quarter
+ , subq_10.ds__year AS ds__year
+ , subq_10.ds__extract_year AS ds__extract_year
+ , subq_10.ds__extract_quarter AS ds__extract_quarter
+ , subq_10.ds__extract_month AS ds__extract_month
+ , subq_10.ds__extract_day AS ds__extract_day
+ , subq_10.ds__extract_dow AS ds__extract_dow
+ , subq_10.ds__extract_doy AS ds__extract_doy
+ , subq_10.ds_partitioned__day AS ds_partitioned__day
+ , subq_10.ds_partitioned__week AS ds_partitioned__week
+ , subq_10.ds_partitioned__month AS ds_partitioned__month
+ , subq_10.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_10.ds_partitioned__year AS ds_partitioned__year
+ , subq_10.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_10.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_10.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_10.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_10.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_10.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_10.paid_at__day AS paid_at__day
+ , subq_10.paid_at__week AS paid_at__week
+ , subq_10.paid_at__month AS paid_at__month
+ , subq_10.paid_at__quarter AS paid_at__quarter
+ , subq_10.paid_at__year AS paid_at__year
+ , subq_10.paid_at__extract_year AS paid_at__extract_year
+ , subq_10.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_10.paid_at__extract_month AS paid_at__extract_month
+ , subq_10.paid_at__extract_day AS paid_at__extract_day
+ , subq_10.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_10.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_10.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_10.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_10.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_10.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_10.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_10.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_10.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_10.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_10.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_10.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_10.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_10.booking__paid_at__day AS booking__paid_at__day
+ , subq_10.booking__paid_at__week AS booking__paid_at__week
+ , subq_10.booking__paid_at__month AS booking__paid_at__month
+ , subq_10.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_10.booking__paid_at__year AS booking__paid_at__year
+ , subq_10.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_10.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_10.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_10.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_10.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_10.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_10.metric_time__day AS metric_time__day
+ , subq_10.metric_time__week AS metric_time__week
+ , subq_10.metric_time__month AS metric_time__month
+ , subq_10.metric_time__quarter AS metric_time__quarter
+ , subq_10.metric_time__year AS metric_time__year
+ , subq_10.metric_time__extract_year AS metric_time__extract_year
+ , subq_10.metric_time__extract_quarter AS metric_time__extract_quarter
+ , subq_10.metric_time__extract_month AS metric_time__extract_month
+ , subq_10.metric_time__extract_day AS metric_time__extract_day
+ , subq_10.metric_time__extract_dow AS metric_time__extract_dow
+ , subq_10.metric_time__extract_doy AS metric_time__extract_doy
+ , subq_10.listing AS listing
+ , subq_10.guest AS guest
+ , subq_10.host AS host
+ , subq_10.booking__listing AS booking__listing
+ , subq_10.booking__guest AS booking__guest
+ , subq_10.booking__host AS booking__host
+ , subq_10.is_instant AS is_instant
+ , subq_10.booking__is_instant AS booking__is_instant
+ , subq_10.bookings AS bookings
+ , subq_10.instant_bookings AS instant_bookings
+ , subq_10.booking_value AS booking_value
+ , subq_10.max_booking_value AS max_booking_value
+ , subq_10.min_booking_value AS min_booking_value
+ , subq_10.bookers AS bookers
+ , subq_10.average_booking_value AS average_booking_value
+ , subq_10.referred_bookings AS referred_bookings
+ , subq_10.median_booking_value AS median_booking_value
+ , subq_10.booking_value_p99 AS booking_value_p99
+ , subq_10.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_10.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_10.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_3.ds AS booking__ds__day
- FROM ***************************.mf_time_spine subq_3
- ) subq_2
+ subq_12.ds AS booking__ds__day
+ FROM ***************************.mf_time_spine subq_12
+ ) subq_11
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
ON
- subq_2.booking__ds__day - MAKE_INTERVAL(weeks => 1) = subq_1.booking__ds__day
- ) subq_4
- ) subq_5
+ subq_11.booking__ds__day - MAKE_INTERVAL(weeks => 1) = subq_10.booking__ds__day
+ ) subq_13
+ ) subq_14
GROUP BY
- subq_5.booking__ds__day
- ) subq_6
- ) subq_7
+ subq_14.booking__ds__day
+ ) subq_15
+ ) subq_16
FULL OUTER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_11.booking__ds__day
- , subq_11.bookers
+ subq_20.booking__ds__day
+ , subq_20.bookers
FROM (
-- Aggregate Measures
SELECT
- subq_10.booking__ds__day
- , COUNT(DISTINCT subq_10.bookers) AS bookers
+ subq_19.booking__ds__day
+ , COUNT(DISTINCT subq_19.bookers) AS bookers
FROM (
-- Pass Only Elements: ['bookers', 'booking__ds__day']
SELECT
- subq_9.booking__ds__day
- , subq_9.bookers
+ subq_18.booking__ds__day
+ , subq_18.bookers
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_8.ds__day
- , subq_8.ds__week
- , subq_8.ds__month
- , subq_8.ds__quarter
- , subq_8.ds__year
- , subq_8.ds__extract_year
- , subq_8.ds__extract_quarter
- , subq_8.ds__extract_month
- , subq_8.ds__extract_day
- , subq_8.ds__extract_dow
- , subq_8.ds__extract_doy
- , subq_8.ds_partitioned__day
- , subq_8.ds_partitioned__week
- , subq_8.ds_partitioned__month
- , subq_8.ds_partitioned__quarter
- , subq_8.ds_partitioned__year
- , subq_8.ds_partitioned__extract_year
- , subq_8.ds_partitioned__extract_quarter
- , subq_8.ds_partitioned__extract_month
- , subq_8.ds_partitioned__extract_day
- , subq_8.ds_partitioned__extract_dow
- , subq_8.ds_partitioned__extract_doy
- , subq_8.paid_at__day
- , subq_8.paid_at__week
- , subq_8.paid_at__month
- , subq_8.paid_at__quarter
- , subq_8.paid_at__year
- , subq_8.paid_at__extract_year
- , subq_8.paid_at__extract_quarter
- , subq_8.paid_at__extract_month
- , subq_8.paid_at__extract_day
- , subq_8.paid_at__extract_dow
- , subq_8.paid_at__extract_doy
- , subq_8.booking__ds__day
- , subq_8.booking__ds__week
- , subq_8.booking__ds__month
- , subq_8.booking__ds__quarter
- , subq_8.booking__ds__year
- , subq_8.booking__ds__extract_year
- , subq_8.booking__ds__extract_quarter
- , subq_8.booking__ds__extract_month
- , subq_8.booking__ds__extract_day
- , subq_8.booking__ds__extract_dow
- , subq_8.booking__ds__extract_doy
- , subq_8.booking__ds_partitioned__day
- , subq_8.booking__ds_partitioned__week
- , subq_8.booking__ds_partitioned__month
- , subq_8.booking__ds_partitioned__quarter
- , subq_8.booking__ds_partitioned__year
- , subq_8.booking__ds_partitioned__extract_year
- , subq_8.booking__ds_partitioned__extract_quarter
- , subq_8.booking__ds_partitioned__extract_month
- , subq_8.booking__ds_partitioned__extract_day
- , subq_8.booking__ds_partitioned__extract_dow
- , subq_8.booking__ds_partitioned__extract_doy
- , subq_8.booking__paid_at__day
- , subq_8.booking__paid_at__week
- , subq_8.booking__paid_at__month
- , subq_8.booking__paid_at__quarter
- , subq_8.booking__paid_at__year
- , subq_8.booking__paid_at__extract_year
- , subq_8.booking__paid_at__extract_quarter
- , subq_8.booking__paid_at__extract_month
- , subq_8.booking__paid_at__extract_day
- , subq_8.booking__paid_at__extract_dow
- , subq_8.booking__paid_at__extract_doy
- , subq_8.ds__day AS metric_time__day
- , subq_8.ds__week AS metric_time__week
- , subq_8.ds__month AS metric_time__month
- , subq_8.ds__quarter AS metric_time__quarter
- , subq_8.ds__year AS metric_time__year
- , subq_8.ds__extract_year AS metric_time__extract_year
- , subq_8.ds__extract_quarter AS metric_time__extract_quarter
- , subq_8.ds__extract_month AS metric_time__extract_month
- , subq_8.ds__extract_day AS metric_time__extract_day
- , subq_8.ds__extract_dow AS metric_time__extract_dow
- , subq_8.ds__extract_doy AS metric_time__extract_doy
- , subq_8.listing
- , subq_8.guest
- , subq_8.host
- , subq_8.booking__listing
- , subq_8.booking__guest
- , subq_8.booking__host
- , subq_8.is_instant
- , subq_8.booking__is_instant
- , subq_8.bookings
- , subq_8.instant_bookings
- , subq_8.booking_value
- , subq_8.max_booking_value
- , subq_8.min_booking_value
- , subq_8.bookers
- , subq_8.average_booking_value
- , subq_8.referred_bookings
- , subq_8.median_booking_value
- , subq_8.booking_value_p99
- , subq_8.discrete_booking_value_p99
- , subq_8.approximate_continuous_booking_value_p99
- , subq_8.approximate_discrete_booking_value_p99
+ subq_17.ds__day
+ , subq_17.ds__week
+ , subq_17.ds__month
+ , subq_17.ds__quarter
+ , subq_17.ds__year
+ , subq_17.ds__extract_year
+ , subq_17.ds__extract_quarter
+ , subq_17.ds__extract_month
+ , subq_17.ds__extract_day
+ , subq_17.ds__extract_dow
+ , subq_17.ds__extract_doy
+ , subq_17.ds_partitioned__day
+ , subq_17.ds_partitioned__week
+ , subq_17.ds_partitioned__month
+ , subq_17.ds_partitioned__quarter
+ , subq_17.ds_partitioned__year
+ , subq_17.ds_partitioned__extract_year
+ , subq_17.ds_partitioned__extract_quarter
+ , subq_17.ds_partitioned__extract_month
+ , subq_17.ds_partitioned__extract_day
+ , subq_17.ds_partitioned__extract_dow
+ , subq_17.ds_partitioned__extract_doy
+ , subq_17.paid_at__day
+ , subq_17.paid_at__week
+ , subq_17.paid_at__month
+ , subq_17.paid_at__quarter
+ , subq_17.paid_at__year
+ , subq_17.paid_at__extract_year
+ , subq_17.paid_at__extract_quarter
+ , subq_17.paid_at__extract_month
+ , subq_17.paid_at__extract_day
+ , subq_17.paid_at__extract_dow
+ , subq_17.paid_at__extract_doy
+ , subq_17.booking__ds__day
+ , subq_17.booking__ds__week
+ , subq_17.booking__ds__month
+ , subq_17.booking__ds__quarter
+ , subq_17.booking__ds__year
+ , subq_17.booking__ds__extract_year
+ , subq_17.booking__ds__extract_quarter
+ , subq_17.booking__ds__extract_month
+ , subq_17.booking__ds__extract_day
+ , subq_17.booking__ds__extract_dow
+ , subq_17.booking__ds__extract_doy
+ , subq_17.booking__ds_partitioned__day
+ , subq_17.booking__ds_partitioned__week
+ , subq_17.booking__ds_partitioned__month
+ , subq_17.booking__ds_partitioned__quarter
+ , subq_17.booking__ds_partitioned__year
+ , subq_17.booking__ds_partitioned__extract_year
+ , subq_17.booking__ds_partitioned__extract_quarter
+ , subq_17.booking__ds_partitioned__extract_month
+ , subq_17.booking__ds_partitioned__extract_day
+ , subq_17.booking__ds_partitioned__extract_dow
+ , subq_17.booking__ds_partitioned__extract_doy
+ , subq_17.booking__paid_at__day
+ , subq_17.booking__paid_at__week
+ , subq_17.booking__paid_at__month
+ , subq_17.booking__paid_at__quarter
+ , subq_17.booking__paid_at__year
+ , subq_17.booking__paid_at__extract_year
+ , subq_17.booking__paid_at__extract_quarter
+ , subq_17.booking__paid_at__extract_month
+ , subq_17.booking__paid_at__extract_day
+ , subq_17.booking__paid_at__extract_dow
+ , subq_17.booking__paid_at__extract_doy
+ , subq_17.ds__day AS metric_time__day
+ , subq_17.ds__week AS metric_time__week
+ , subq_17.ds__month AS metric_time__month
+ , subq_17.ds__quarter AS metric_time__quarter
+ , subq_17.ds__year AS metric_time__year
+ , subq_17.ds__extract_year AS metric_time__extract_year
+ , subq_17.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_17.ds__extract_month AS metric_time__extract_month
+ , subq_17.ds__extract_day AS metric_time__extract_day
+ , subq_17.ds__extract_dow AS metric_time__extract_dow
+ , subq_17.ds__extract_doy AS metric_time__extract_doy
+ , subq_17.listing
+ , subq_17.guest
+ , subq_17.host
+ , subq_17.booking__listing
+ , subq_17.booking__guest
+ , subq_17.booking__host
+ , subq_17.is_instant
+ , subq_17.booking__is_instant
+ , subq_17.bookings
+ , subq_17.instant_bookings
+ , subq_17.booking_value
+ , subq_17.max_booking_value
+ , subq_17.min_booking_value
+ , subq_17.bookers
+ , subq_17.average_booking_value
+ , subq_17.referred_bookings
+ , subq_17.median_booking_value
+ , subq_17.booking_value_p99
+ , subq_17.discrete_booking_value_p99
+ , subq_17.approximate_continuous_booking_value_p99
+ , subq_17.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_8
- ) subq_9
- ) subq_10
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_17
+ ) subq_18
+ ) subq_19
GROUP BY
- subq_10.booking__ds__day
- ) subq_11
- ) subq_12
+ subq_19.booking__ds__day
+ ) subq_20
+ ) subq_21
ON
- subq_7.booking__ds__day = subq_12.booking__ds__day
+ subq_16.booking__ds__day = subq_21.booking__ds__day
GROUP BY
- COALESCE(subq_7.booking__ds__day, subq_12.booking__ds__day)
-) subq_13
+ COALESCE(subq_16.booking__ds__day, subq_21.booking__ds__day)
+) subq_22
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_offset_metric_with_agg_time_dim__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_offset_metric_with_agg_time_dim__plan0_optimized.sql
index bb2d834047..0ea88766b0 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_offset_metric_with_agg_time_dim__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_offset_metric_with_agg_time_dim__plan0_optimized.sql
@@ -5,25 +5,25 @@ SELECT
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_21.booking__ds__day, subq_26.booking__ds__day) AS booking__ds__day
- , MAX(subq_21.booking_value) AS booking_value
- , MAX(subq_26.bookers) AS bookers
+ COALESCE(subq_30.booking__ds__day, subq_35.booking__ds__day) AS booking__ds__day
+ , MAX(subq_30.booking_value) AS booking_value
+ , MAX(subq_35.bookers) AS bookers
FROM (
-- Join to Time Spine Dataset
-- Pass Only Elements: ['booking_value', 'booking__ds__day']
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_17.ds AS booking__ds__day
- , SUM(bookings_source_src_28001.booking_value) AS booking_value
- FROM ***************************.mf_time_spine subq_17
+ subq_26.ds AS booking__ds__day
+ , SUM(bookings_source_src_28000.booking_value) AS booking_value
+ FROM ***************************.mf_time_spine subq_26
INNER JOIN
- ***************************.fct_bookings bookings_source_src_28001
+ ***************************.fct_bookings bookings_source_src_28000
ON
- subq_17.ds - MAKE_INTERVAL(weeks => 1) = DATE_TRUNC('day', bookings_source_src_28001.ds)
+ subq_26.ds - MAKE_INTERVAL(weeks => 1) = DATE_TRUNC('day', bookings_source_src_28000.ds)
GROUP BY
- subq_17.ds
- ) subq_21
+ subq_26.ds
+ ) subq_30
FULL OUTER JOIN (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
@@ -33,12 +33,12 @@ FROM (
SELECT
DATE_TRUNC('day', ds) AS booking__ds__day
, COUNT(DISTINCT guest_id) AS bookers
- FROM ***************************.fct_bookings bookings_source_src_28001
+ FROM ***************************.fct_bookings bookings_source_src_28000
GROUP BY
DATE_TRUNC('day', ds)
- ) subq_26
+ ) subq_35
ON
- subq_21.booking__ds__day = subq_26.booking__ds__day
+ subq_30.booking__ds__day = subq_35.booking__ds__day
GROUP BY
- COALESCE(subq_21.booking__ds__day, subq_26.booking__ds__day)
-) subq_27
+ COALESCE(subq_30.booking__ds__day, subq_35.booking__ds__day)
+) subq_36
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_offset_metric_with_one_input_metric__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_offset_metric_with_one_input_metric__plan0.sql
index 38816518fd..42f80363f5 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_offset_metric_with_one_input_metric__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_offset_metric_with_one_input_metric__plan0.sql
@@ -1,319 +1,319 @@
-- Compute Metrics via Expressions
SELECT
- subq_7.metric_time__day
+ subq_16.metric_time__day
, bookings_5_days_ago AS bookings_5_day_lag
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_6.metric_time__day
- , subq_6.bookings AS bookings_5_days_ago
+ subq_15.metric_time__day
+ , subq_15.bookings AS bookings_5_days_ago
FROM (
-- Aggregate Measures
SELECT
- subq_5.metric_time__day
- , SUM(subq_5.bookings) AS bookings
+ subq_14.metric_time__day
+ , SUM(subq_14.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__day']
SELECT
- subq_4.metric_time__day
- , subq_4.bookings
+ subq_13.metric_time__day
+ , subq_13.bookings
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_2.metric_time__day AS metric_time__day
- , subq_1.ds__day AS ds__day
- , subq_1.ds__week AS ds__week
- , subq_1.ds__month AS ds__month
- , subq_1.ds__quarter AS ds__quarter
- , subq_1.ds__year AS ds__year
- , subq_1.ds__extract_year AS ds__extract_year
- , subq_1.ds__extract_quarter AS ds__extract_quarter
- , subq_1.ds__extract_month AS ds__extract_month
- , subq_1.ds__extract_day AS ds__extract_day
- , subq_1.ds__extract_dow AS ds__extract_dow
- , subq_1.ds__extract_doy AS ds__extract_doy
- , subq_1.ds_partitioned__day AS ds_partitioned__day
- , subq_1.ds_partitioned__week AS ds_partitioned__week
- , subq_1.ds_partitioned__month AS ds_partitioned__month
- , subq_1.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_1.ds_partitioned__year AS ds_partitioned__year
- , subq_1.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_1.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_1.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_1.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_1.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_1.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_1.paid_at__day AS paid_at__day
- , subq_1.paid_at__week AS paid_at__week
- , subq_1.paid_at__month AS paid_at__month
- , subq_1.paid_at__quarter AS paid_at__quarter
- , subq_1.paid_at__year AS paid_at__year
- , subq_1.paid_at__extract_year AS paid_at__extract_year
- , subq_1.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_1.paid_at__extract_month AS paid_at__extract_month
- , subq_1.paid_at__extract_day AS paid_at__extract_day
- , subq_1.paid_at__extract_dow AS paid_at__extract_dow
- , subq_1.paid_at__extract_doy AS paid_at__extract_doy
- , subq_1.booking__ds__day AS booking__ds__day
- , subq_1.booking__ds__week AS booking__ds__week
- , subq_1.booking__ds__month AS booking__ds__month
- , subq_1.booking__ds__quarter AS booking__ds__quarter
- , subq_1.booking__ds__year AS booking__ds__year
- , subq_1.booking__ds__extract_year AS booking__ds__extract_year
- , subq_1.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_1.booking__ds__extract_month AS booking__ds__extract_month
- , subq_1.booking__ds__extract_day AS booking__ds__extract_day
- , subq_1.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_1.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_1.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_1.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_1.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_1.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_1.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_1.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_1.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_1.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_1.booking__paid_at__day AS booking__paid_at__day
- , subq_1.booking__paid_at__week AS booking__paid_at__week
- , subq_1.booking__paid_at__month AS booking__paid_at__month
- , subq_1.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_1.booking__paid_at__year AS booking__paid_at__year
- , subq_1.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_1.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_1.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_1.listing AS listing
- , subq_1.guest AS guest
- , subq_1.host AS host
- , subq_1.booking__listing AS booking__listing
- , subq_1.booking__guest AS booking__guest
- , subq_1.booking__host AS booking__host
- , subq_1.is_instant AS is_instant
- , subq_1.booking__is_instant AS booking__is_instant
- , subq_1.bookings AS bookings
- , subq_1.instant_bookings AS instant_bookings
- , subq_1.booking_value AS booking_value
- , subq_1.max_booking_value AS max_booking_value
- , subq_1.min_booking_value AS min_booking_value
- , subq_1.bookers AS bookers
- , subq_1.average_booking_value AS average_booking_value
- , subq_1.referred_bookings AS referred_bookings
- , subq_1.median_booking_value AS median_booking_value
- , subq_1.booking_value_p99 AS booking_value_p99
- , subq_1.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_1.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_1.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ subq_11.metric_time__day AS metric_time__day
+ , subq_10.ds__day AS ds__day
+ , subq_10.ds__week AS ds__week
+ , subq_10.ds__month AS ds__month
+ , subq_10.ds__quarter AS ds__quarter
+ , subq_10.ds__year AS ds__year
+ , subq_10.ds__extract_year AS ds__extract_year
+ , subq_10.ds__extract_quarter AS ds__extract_quarter
+ , subq_10.ds__extract_month AS ds__extract_month
+ , subq_10.ds__extract_day AS ds__extract_day
+ , subq_10.ds__extract_dow AS ds__extract_dow
+ , subq_10.ds__extract_doy AS ds__extract_doy
+ , subq_10.ds_partitioned__day AS ds_partitioned__day
+ , subq_10.ds_partitioned__week AS ds_partitioned__week
+ , subq_10.ds_partitioned__month AS ds_partitioned__month
+ , subq_10.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_10.ds_partitioned__year AS ds_partitioned__year
+ , subq_10.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_10.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_10.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_10.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_10.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_10.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_10.paid_at__day AS paid_at__day
+ , subq_10.paid_at__week AS paid_at__week
+ , subq_10.paid_at__month AS paid_at__month
+ , subq_10.paid_at__quarter AS paid_at__quarter
+ , subq_10.paid_at__year AS paid_at__year
+ , subq_10.paid_at__extract_year AS paid_at__extract_year
+ , subq_10.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_10.paid_at__extract_month AS paid_at__extract_month
+ , subq_10.paid_at__extract_day AS paid_at__extract_day
+ , subq_10.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_10.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_10.booking__ds__day AS booking__ds__day
+ , subq_10.booking__ds__week AS booking__ds__week
+ , subq_10.booking__ds__month AS booking__ds__month
+ , subq_10.booking__ds__quarter AS booking__ds__quarter
+ , subq_10.booking__ds__year AS booking__ds__year
+ , subq_10.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_10.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_10.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_10.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_10.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_10.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_10.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_10.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_10.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_10.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_10.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_10.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_10.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_10.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_10.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_10.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_10.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_10.booking__paid_at__day AS booking__paid_at__day
+ , subq_10.booking__paid_at__week AS booking__paid_at__week
+ , subq_10.booking__paid_at__month AS booking__paid_at__month
+ , subq_10.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_10.booking__paid_at__year AS booking__paid_at__year
+ , subq_10.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_10.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_10.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_10.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_10.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_10.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_10.listing AS listing
+ , subq_10.guest AS guest
+ , subq_10.host AS host
+ , subq_10.booking__listing AS booking__listing
+ , subq_10.booking__guest AS booking__guest
+ , subq_10.booking__host AS booking__host
+ , subq_10.is_instant AS is_instant
+ , subq_10.booking__is_instant AS booking__is_instant
+ , subq_10.bookings AS bookings
+ , subq_10.instant_bookings AS instant_bookings
+ , subq_10.booking_value AS booking_value
+ , subq_10.max_booking_value AS max_booking_value
+ , subq_10.min_booking_value AS min_booking_value
+ , subq_10.bookers AS bookers
+ , subq_10.average_booking_value AS average_booking_value
+ , subq_10.referred_bookings AS referred_bookings
+ , subq_10.median_booking_value AS median_booking_value
+ , subq_10.booking_value_p99 AS booking_value_p99
+ , subq_10.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_10.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_10.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_3.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_3
- ) subq_2
+ subq_12.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_12
+ ) subq_11
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
ON
- subq_2.metric_time__day - MAKE_INTERVAL(days => 5) = subq_1.metric_time__day
- ) subq_4
- ) subq_5
+ subq_11.metric_time__day - MAKE_INTERVAL(days => 5) = subq_10.metric_time__day
+ ) subq_13
+ ) subq_14
GROUP BY
- subq_5.metric_time__day
- ) subq_6
-) subq_7
+ subq_14.metric_time__day
+ ) subq_15
+) subq_16
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_offset_metric_with_one_input_metric__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_offset_metric_with_one_input_metric__plan0_optimized.sql
index 0b538a304a..7b052383df 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_offset_metric_with_one_input_metric__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_derived_offset_metric_with_one_input_metric__plan0_optimized.sql
@@ -8,19 +8,19 @@ FROM (
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_11.ds AS metric_time__day
- , SUM(subq_9.bookings) AS bookings_5_days_ago
- FROM ***************************.mf_time_spine subq_11
+ subq_20.ds AS metric_time__day
+ , SUM(subq_18.bookings) AS bookings_5_days_ago
+ FROM ***************************.mf_time_spine subq_20
INNER JOIN (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
SELECT
DATE_TRUNC('day', ds) AS metric_time__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_9
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_18
ON
- subq_11.ds - MAKE_INTERVAL(days => 5) = subq_9.metric_time__day
+ subq_20.ds - MAKE_INTERVAL(days => 5) = subq_18.metric_time__day
GROUP BY
- subq_11.ds
-) subq_15
+ subq_20.ds
+) subq_24
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_derived_metric__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_derived_metric__plan0.sql
index 2d28d5feb7..7918ef7e73 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_derived_metric__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_derived_metric__plan0.sql
@@ -1,895 +1,895 @@
-- Compute Metrics via Expressions
SELECT
- subq_22.metric_time__day
+ subq_31.metric_time__day
, non_referred + (instant * 1.0 / bookings) AS instant_plus_non_referred_bookings_pct
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_11.metric_time__day, subq_16.metric_time__day, subq_21.metric_time__day) AS metric_time__day
- , MAX(subq_11.non_referred) AS non_referred
- , MAX(subq_16.instant) AS instant
- , MAX(subq_21.bookings) AS bookings
+ COALESCE(subq_20.metric_time__day, subq_25.metric_time__day, subq_30.metric_time__day) AS metric_time__day
+ , MAX(subq_20.non_referred) AS non_referred
+ , MAX(subq_25.instant) AS instant
+ , MAX(subq_30.bookings) AS bookings
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_10.metric_time__day
+ subq_19.metric_time__day
, (bookings - ref_bookings) * 1.0 / bookings AS non_referred
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_4.metric_time__day, subq_9.metric_time__day) AS metric_time__day
- , MAX(subq_4.ref_bookings) AS ref_bookings
- , MAX(subq_9.bookings) AS bookings
+ COALESCE(subq_13.metric_time__day, subq_18.metric_time__day) AS metric_time__day
+ , MAX(subq_13.ref_bookings) AS ref_bookings
+ , MAX(subq_18.bookings) AS bookings
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_3.metric_time__day
- , subq_3.referred_bookings AS ref_bookings
+ subq_12.metric_time__day
+ , subq_12.referred_bookings AS ref_bookings
FROM (
-- Aggregate Measures
SELECT
- subq_2.metric_time__day
- , SUM(subq_2.referred_bookings) AS referred_bookings
+ subq_11.metric_time__day
+ , SUM(subq_11.referred_bookings) AS referred_bookings
FROM (
-- Pass Only Elements: ['referred_bookings', 'metric_time__day']
SELECT
- subq_1.metric_time__day
- , subq_1.referred_bookings
+ subq_10.metric_time__day
+ , subq_10.referred_bookings
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
- ) subq_2
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
GROUP BY
- subq_2.metric_time__day
- ) subq_3
- ) subq_4
+ subq_11.metric_time__day
+ ) subq_12
+ ) subq_13
FULL OUTER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_8.metric_time__day
- , subq_8.bookings
+ subq_17.metric_time__day
+ , subq_17.bookings
FROM (
-- Aggregate Measures
SELECT
- subq_7.metric_time__day
- , SUM(subq_7.bookings) AS bookings
+ subq_16.metric_time__day
+ , SUM(subq_16.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__day']
SELECT
- subq_6.metric_time__day
- , subq_6.bookings
+ subq_15.metric_time__day
+ , subq_15.bookings
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_5.ds__day
- , subq_5.ds__week
- , subq_5.ds__month
- , subq_5.ds__quarter
- , subq_5.ds__year
- , subq_5.ds__extract_year
- , subq_5.ds__extract_quarter
- , subq_5.ds__extract_month
- , subq_5.ds__extract_day
- , subq_5.ds__extract_dow
- , subq_5.ds__extract_doy
- , subq_5.ds_partitioned__day
- , subq_5.ds_partitioned__week
- , subq_5.ds_partitioned__month
- , subq_5.ds_partitioned__quarter
- , subq_5.ds_partitioned__year
- , subq_5.ds_partitioned__extract_year
- , subq_5.ds_partitioned__extract_quarter
- , subq_5.ds_partitioned__extract_month
- , subq_5.ds_partitioned__extract_day
- , subq_5.ds_partitioned__extract_dow
- , subq_5.ds_partitioned__extract_doy
- , subq_5.paid_at__day
- , subq_5.paid_at__week
- , subq_5.paid_at__month
- , subq_5.paid_at__quarter
- , subq_5.paid_at__year
- , subq_5.paid_at__extract_year
- , subq_5.paid_at__extract_quarter
- , subq_5.paid_at__extract_month
- , subq_5.paid_at__extract_day
- , subq_5.paid_at__extract_dow
- , subq_5.paid_at__extract_doy
- , subq_5.booking__ds__day
- , subq_5.booking__ds__week
- , subq_5.booking__ds__month
- , subq_5.booking__ds__quarter
- , subq_5.booking__ds__year
- , subq_5.booking__ds__extract_year
- , subq_5.booking__ds__extract_quarter
- , subq_5.booking__ds__extract_month
- , subq_5.booking__ds__extract_day
- , subq_5.booking__ds__extract_dow
- , subq_5.booking__ds__extract_doy
- , subq_5.booking__ds_partitioned__day
- , subq_5.booking__ds_partitioned__week
- , subq_5.booking__ds_partitioned__month
- , subq_5.booking__ds_partitioned__quarter
- , subq_5.booking__ds_partitioned__year
- , subq_5.booking__ds_partitioned__extract_year
- , subq_5.booking__ds_partitioned__extract_quarter
- , subq_5.booking__ds_partitioned__extract_month
- , subq_5.booking__ds_partitioned__extract_day
- , subq_5.booking__ds_partitioned__extract_dow
- , subq_5.booking__ds_partitioned__extract_doy
- , subq_5.booking__paid_at__day
- , subq_5.booking__paid_at__week
- , subq_5.booking__paid_at__month
- , subq_5.booking__paid_at__quarter
- , subq_5.booking__paid_at__year
- , subq_5.booking__paid_at__extract_year
- , subq_5.booking__paid_at__extract_quarter
- , subq_5.booking__paid_at__extract_month
- , subq_5.booking__paid_at__extract_day
- , subq_5.booking__paid_at__extract_dow
- , subq_5.booking__paid_at__extract_doy
- , subq_5.ds__day AS metric_time__day
- , subq_5.ds__week AS metric_time__week
- , subq_5.ds__month AS metric_time__month
- , subq_5.ds__quarter AS metric_time__quarter
- , subq_5.ds__year AS metric_time__year
- , subq_5.ds__extract_year AS metric_time__extract_year
- , subq_5.ds__extract_quarter AS metric_time__extract_quarter
- , subq_5.ds__extract_month AS metric_time__extract_month
- , subq_5.ds__extract_day AS metric_time__extract_day
- , subq_5.ds__extract_dow AS metric_time__extract_dow
- , subq_5.ds__extract_doy AS metric_time__extract_doy
- , subq_5.listing
- , subq_5.guest
- , subq_5.host
- , subq_5.booking__listing
- , subq_5.booking__guest
- , subq_5.booking__host
- , subq_5.is_instant
- , subq_5.booking__is_instant
- , subq_5.bookings
- , subq_5.instant_bookings
- , subq_5.booking_value
- , subq_5.max_booking_value
- , subq_5.min_booking_value
- , subq_5.bookers
- , subq_5.average_booking_value
- , subq_5.referred_bookings
- , subq_5.median_booking_value
- , subq_5.booking_value_p99
- , subq_5.discrete_booking_value_p99
- , subq_5.approximate_continuous_booking_value_p99
- , subq_5.approximate_discrete_booking_value_p99
+ subq_14.ds__day
+ , subq_14.ds__week
+ , subq_14.ds__month
+ , subq_14.ds__quarter
+ , subq_14.ds__year
+ , subq_14.ds__extract_year
+ , subq_14.ds__extract_quarter
+ , subq_14.ds__extract_month
+ , subq_14.ds__extract_day
+ , subq_14.ds__extract_dow
+ , subq_14.ds__extract_doy
+ , subq_14.ds_partitioned__day
+ , subq_14.ds_partitioned__week
+ , subq_14.ds_partitioned__month
+ , subq_14.ds_partitioned__quarter
+ , subq_14.ds_partitioned__year
+ , subq_14.ds_partitioned__extract_year
+ , subq_14.ds_partitioned__extract_quarter
+ , subq_14.ds_partitioned__extract_month
+ , subq_14.ds_partitioned__extract_day
+ , subq_14.ds_partitioned__extract_dow
+ , subq_14.ds_partitioned__extract_doy
+ , subq_14.paid_at__day
+ , subq_14.paid_at__week
+ , subq_14.paid_at__month
+ , subq_14.paid_at__quarter
+ , subq_14.paid_at__year
+ , subq_14.paid_at__extract_year
+ , subq_14.paid_at__extract_quarter
+ , subq_14.paid_at__extract_month
+ , subq_14.paid_at__extract_day
+ , subq_14.paid_at__extract_dow
+ , subq_14.paid_at__extract_doy
+ , subq_14.booking__ds__day
+ , subq_14.booking__ds__week
+ , subq_14.booking__ds__month
+ , subq_14.booking__ds__quarter
+ , subq_14.booking__ds__year
+ , subq_14.booking__ds__extract_year
+ , subq_14.booking__ds__extract_quarter
+ , subq_14.booking__ds__extract_month
+ , subq_14.booking__ds__extract_day
+ , subq_14.booking__ds__extract_dow
+ , subq_14.booking__ds__extract_doy
+ , subq_14.booking__ds_partitioned__day
+ , subq_14.booking__ds_partitioned__week
+ , subq_14.booking__ds_partitioned__month
+ , subq_14.booking__ds_partitioned__quarter
+ , subq_14.booking__ds_partitioned__year
+ , subq_14.booking__ds_partitioned__extract_year
+ , subq_14.booking__ds_partitioned__extract_quarter
+ , subq_14.booking__ds_partitioned__extract_month
+ , subq_14.booking__ds_partitioned__extract_day
+ , subq_14.booking__ds_partitioned__extract_dow
+ , subq_14.booking__ds_partitioned__extract_doy
+ , subq_14.booking__paid_at__day
+ , subq_14.booking__paid_at__week
+ , subq_14.booking__paid_at__month
+ , subq_14.booking__paid_at__quarter
+ , subq_14.booking__paid_at__year
+ , subq_14.booking__paid_at__extract_year
+ , subq_14.booking__paid_at__extract_quarter
+ , subq_14.booking__paid_at__extract_month
+ , subq_14.booking__paid_at__extract_day
+ , subq_14.booking__paid_at__extract_dow
+ , subq_14.booking__paid_at__extract_doy
+ , subq_14.ds__day AS metric_time__day
+ , subq_14.ds__week AS metric_time__week
+ , subq_14.ds__month AS metric_time__month
+ , subq_14.ds__quarter AS metric_time__quarter
+ , subq_14.ds__year AS metric_time__year
+ , subq_14.ds__extract_year AS metric_time__extract_year
+ , subq_14.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_14.ds__extract_month AS metric_time__extract_month
+ , subq_14.ds__extract_day AS metric_time__extract_day
+ , subq_14.ds__extract_dow AS metric_time__extract_dow
+ , subq_14.ds__extract_doy AS metric_time__extract_doy
+ , subq_14.listing
+ , subq_14.guest
+ , subq_14.host
+ , subq_14.booking__listing
+ , subq_14.booking__guest
+ , subq_14.booking__host
+ , subq_14.is_instant
+ , subq_14.booking__is_instant
+ , subq_14.bookings
+ , subq_14.instant_bookings
+ , subq_14.booking_value
+ , subq_14.max_booking_value
+ , subq_14.min_booking_value
+ , subq_14.bookers
+ , subq_14.average_booking_value
+ , subq_14.referred_bookings
+ , subq_14.median_booking_value
+ , subq_14.booking_value_p99
+ , subq_14.discrete_booking_value_p99
+ , subq_14.approximate_continuous_booking_value_p99
+ , subq_14.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_5
- ) subq_6
- ) subq_7
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_14
+ ) subq_15
+ ) subq_16
GROUP BY
- subq_7.metric_time__day
- ) subq_8
- ) subq_9
+ subq_16.metric_time__day
+ ) subq_17
+ ) subq_18
ON
- subq_4.metric_time__day = subq_9.metric_time__day
+ subq_13.metric_time__day = subq_18.metric_time__day
GROUP BY
- COALESCE(subq_4.metric_time__day, subq_9.metric_time__day)
- ) subq_10
- ) subq_11
+ COALESCE(subq_13.metric_time__day, subq_18.metric_time__day)
+ ) subq_19
+ ) subq_20
FULL OUTER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_15.metric_time__day
- , subq_15.instant_bookings AS instant
+ subq_24.metric_time__day
+ , subq_24.instant_bookings AS instant
FROM (
-- Aggregate Measures
SELECT
- subq_14.metric_time__day
- , SUM(subq_14.instant_bookings) AS instant_bookings
+ subq_23.metric_time__day
+ , SUM(subq_23.instant_bookings) AS instant_bookings
FROM (
-- Pass Only Elements: ['instant_bookings', 'metric_time__day']
SELECT
- subq_13.metric_time__day
- , subq_13.instant_bookings
+ subq_22.metric_time__day
+ , subq_22.instant_bookings
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_12.ds__day
- , subq_12.ds__week
- , subq_12.ds__month
- , subq_12.ds__quarter
- , subq_12.ds__year
- , subq_12.ds__extract_year
- , subq_12.ds__extract_quarter
- , subq_12.ds__extract_month
- , subq_12.ds__extract_day
- , subq_12.ds__extract_dow
- , subq_12.ds__extract_doy
- , subq_12.ds_partitioned__day
- , subq_12.ds_partitioned__week
- , subq_12.ds_partitioned__month
- , subq_12.ds_partitioned__quarter
- , subq_12.ds_partitioned__year
- , subq_12.ds_partitioned__extract_year
- , subq_12.ds_partitioned__extract_quarter
- , subq_12.ds_partitioned__extract_month
- , subq_12.ds_partitioned__extract_day
- , subq_12.ds_partitioned__extract_dow
- , subq_12.ds_partitioned__extract_doy
- , subq_12.paid_at__day
- , subq_12.paid_at__week
- , subq_12.paid_at__month
- , subq_12.paid_at__quarter
- , subq_12.paid_at__year
- , subq_12.paid_at__extract_year
- , subq_12.paid_at__extract_quarter
- , subq_12.paid_at__extract_month
- , subq_12.paid_at__extract_day
- , subq_12.paid_at__extract_dow
- , subq_12.paid_at__extract_doy
- , subq_12.booking__ds__day
- , subq_12.booking__ds__week
- , subq_12.booking__ds__month
- , subq_12.booking__ds__quarter
- , subq_12.booking__ds__year
- , subq_12.booking__ds__extract_year
- , subq_12.booking__ds__extract_quarter
- , subq_12.booking__ds__extract_month
- , subq_12.booking__ds__extract_day
- , subq_12.booking__ds__extract_dow
- , subq_12.booking__ds__extract_doy
- , subq_12.booking__ds_partitioned__day
- , subq_12.booking__ds_partitioned__week
- , subq_12.booking__ds_partitioned__month
- , subq_12.booking__ds_partitioned__quarter
- , subq_12.booking__ds_partitioned__year
- , subq_12.booking__ds_partitioned__extract_year
- , subq_12.booking__ds_partitioned__extract_quarter
- , subq_12.booking__ds_partitioned__extract_month
- , subq_12.booking__ds_partitioned__extract_day
- , subq_12.booking__ds_partitioned__extract_dow
- , subq_12.booking__ds_partitioned__extract_doy
- , subq_12.booking__paid_at__day
- , subq_12.booking__paid_at__week
- , subq_12.booking__paid_at__month
- , subq_12.booking__paid_at__quarter
- , subq_12.booking__paid_at__year
- , subq_12.booking__paid_at__extract_year
- , subq_12.booking__paid_at__extract_quarter
- , subq_12.booking__paid_at__extract_month
- , subq_12.booking__paid_at__extract_day
- , subq_12.booking__paid_at__extract_dow
- , subq_12.booking__paid_at__extract_doy
- , subq_12.ds__day AS metric_time__day
- , subq_12.ds__week AS metric_time__week
- , subq_12.ds__month AS metric_time__month
- , subq_12.ds__quarter AS metric_time__quarter
- , subq_12.ds__year AS metric_time__year
- , subq_12.ds__extract_year AS metric_time__extract_year
- , subq_12.ds__extract_quarter AS metric_time__extract_quarter
- , subq_12.ds__extract_month AS metric_time__extract_month
- , subq_12.ds__extract_day AS metric_time__extract_day
- , subq_12.ds__extract_dow AS metric_time__extract_dow
- , subq_12.ds__extract_doy AS metric_time__extract_doy
- , subq_12.listing
- , subq_12.guest
- , subq_12.host
- , subq_12.booking__listing
- , subq_12.booking__guest
- , subq_12.booking__host
- , subq_12.is_instant
- , subq_12.booking__is_instant
- , subq_12.bookings
- , subq_12.instant_bookings
- , subq_12.booking_value
- , subq_12.max_booking_value
- , subq_12.min_booking_value
- , subq_12.bookers
- , subq_12.average_booking_value
- , subq_12.referred_bookings
- , subq_12.median_booking_value
- , subq_12.booking_value_p99
- , subq_12.discrete_booking_value_p99
- , subq_12.approximate_continuous_booking_value_p99
- , subq_12.approximate_discrete_booking_value_p99
+ subq_21.ds__day
+ , subq_21.ds__week
+ , subq_21.ds__month
+ , subq_21.ds__quarter
+ , subq_21.ds__year
+ , subq_21.ds__extract_year
+ , subq_21.ds__extract_quarter
+ , subq_21.ds__extract_month
+ , subq_21.ds__extract_day
+ , subq_21.ds__extract_dow
+ , subq_21.ds__extract_doy
+ , subq_21.ds_partitioned__day
+ , subq_21.ds_partitioned__week
+ , subq_21.ds_partitioned__month
+ , subq_21.ds_partitioned__quarter
+ , subq_21.ds_partitioned__year
+ , subq_21.ds_partitioned__extract_year
+ , subq_21.ds_partitioned__extract_quarter
+ , subq_21.ds_partitioned__extract_month
+ , subq_21.ds_partitioned__extract_day
+ , subq_21.ds_partitioned__extract_dow
+ , subq_21.ds_partitioned__extract_doy
+ , subq_21.paid_at__day
+ , subq_21.paid_at__week
+ , subq_21.paid_at__month
+ , subq_21.paid_at__quarter
+ , subq_21.paid_at__year
+ , subq_21.paid_at__extract_year
+ , subq_21.paid_at__extract_quarter
+ , subq_21.paid_at__extract_month
+ , subq_21.paid_at__extract_day
+ , subq_21.paid_at__extract_dow
+ , subq_21.paid_at__extract_doy
+ , subq_21.booking__ds__day
+ , subq_21.booking__ds__week
+ , subq_21.booking__ds__month
+ , subq_21.booking__ds__quarter
+ , subq_21.booking__ds__year
+ , subq_21.booking__ds__extract_year
+ , subq_21.booking__ds__extract_quarter
+ , subq_21.booking__ds__extract_month
+ , subq_21.booking__ds__extract_day
+ , subq_21.booking__ds__extract_dow
+ , subq_21.booking__ds__extract_doy
+ , subq_21.booking__ds_partitioned__day
+ , subq_21.booking__ds_partitioned__week
+ , subq_21.booking__ds_partitioned__month
+ , subq_21.booking__ds_partitioned__quarter
+ , subq_21.booking__ds_partitioned__year
+ , subq_21.booking__ds_partitioned__extract_year
+ , subq_21.booking__ds_partitioned__extract_quarter
+ , subq_21.booking__ds_partitioned__extract_month
+ , subq_21.booking__ds_partitioned__extract_day
+ , subq_21.booking__ds_partitioned__extract_dow
+ , subq_21.booking__ds_partitioned__extract_doy
+ , subq_21.booking__paid_at__day
+ , subq_21.booking__paid_at__week
+ , subq_21.booking__paid_at__month
+ , subq_21.booking__paid_at__quarter
+ , subq_21.booking__paid_at__year
+ , subq_21.booking__paid_at__extract_year
+ , subq_21.booking__paid_at__extract_quarter
+ , subq_21.booking__paid_at__extract_month
+ , subq_21.booking__paid_at__extract_day
+ , subq_21.booking__paid_at__extract_dow
+ , subq_21.booking__paid_at__extract_doy
+ , subq_21.ds__day AS metric_time__day
+ , subq_21.ds__week AS metric_time__week
+ , subq_21.ds__month AS metric_time__month
+ , subq_21.ds__quarter AS metric_time__quarter
+ , subq_21.ds__year AS metric_time__year
+ , subq_21.ds__extract_year AS metric_time__extract_year
+ , subq_21.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_21.ds__extract_month AS metric_time__extract_month
+ , subq_21.ds__extract_day AS metric_time__extract_day
+ , subq_21.ds__extract_dow AS metric_time__extract_dow
+ , subq_21.ds__extract_doy AS metric_time__extract_doy
+ , subq_21.listing
+ , subq_21.guest
+ , subq_21.host
+ , subq_21.booking__listing
+ , subq_21.booking__guest
+ , subq_21.booking__host
+ , subq_21.is_instant
+ , subq_21.booking__is_instant
+ , subq_21.bookings
+ , subq_21.instant_bookings
+ , subq_21.booking_value
+ , subq_21.max_booking_value
+ , subq_21.min_booking_value
+ , subq_21.bookers
+ , subq_21.average_booking_value
+ , subq_21.referred_bookings
+ , subq_21.median_booking_value
+ , subq_21.booking_value_p99
+ , subq_21.discrete_booking_value_p99
+ , subq_21.approximate_continuous_booking_value_p99
+ , subq_21.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_12
- ) subq_13
- ) subq_14
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_21
+ ) subq_22
+ ) subq_23
GROUP BY
- subq_14.metric_time__day
- ) subq_15
- ) subq_16
+ subq_23.metric_time__day
+ ) subq_24
+ ) subq_25
ON
- subq_11.metric_time__day = subq_16.metric_time__day
+ subq_20.metric_time__day = subq_25.metric_time__day
FULL OUTER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_20.metric_time__day
- , subq_20.bookings
+ subq_29.metric_time__day
+ , subq_29.bookings
FROM (
-- Aggregate Measures
SELECT
- subq_19.metric_time__day
- , SUM(subq_19.bookings) AS bookings
+ subq_28.metric_time__day
+ , SUM(subq_28.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__day']
SELECT
- subq_18.metric_time__day
- , subq_18.bookings
+ subq_27.metric_time__day
+ , subq_27.bookings
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_17.ds__day
- , subq_17.ds__week
- , subq_17.ds__month
- , subq_17.ds__quarter
- , subq_17.ds__year
- , subq_17.ds__extract_year
- , subq_17.ds__extract_quarter
- , subq_17.ds__extract_month
- , subq_17.ds__extract_day
- , subq_17.ds__extract_dow
- , subq_17.ds__extract_doy
- , subq_17.ds_partitioned__day
- , subq_17.ds_partitioned__week
- , subq_17.ds_partitioned__month
- , subq_17.ds_partitioned__quarter
- , subq_17.ds_partitioned__year
- , subq_17.ds_partitioned__extract_year
- , subq_17.ds_partitioned__extract_quarter
- , subq_17.ds_partitioned__extract_month
- , subq_17.ds_partitioned__extract_day
- , subq_17.ds_partitioned__extract_dow
- , subq_17.ds_partitioned__extract_doy
- , subq_17.paid_at__day
- , subq_17.paid_at__week
- , subq_17.paid_at__month
- , subq_17.paid_at__quarter
- , subq_17.paid_at__year
- , subq_17.paid_at__extract_year
- , subq_17.paid_at__extract_quarter
- , subq_17.paid_at__extract_month
- , subq_17.paid_at__extract_day
- , subq_17.paid_at__extract_dow
- , subq_17.paid_at__extract_doy
- , subq_17.booking__ds__day
- , subq_17.booking__ds__week
- , subq_17.booking__ds__month
- , subq_17.booking__ds__quarter
- , subq_17.booking__ds__year
- , subq_17.booking__ds__extract_year
- , subq_17.booking__ds__extract_quarter
- , subq_17.booking__ds__extract_month
- , subq_17.booking__ds__extract_day
- , subq_17.booking__ds__extract_dow
- , subq_17.booking__ds__extract_doy
- , subq_17.booking__ds_partitioned__day
- , subq_17.booking__ds_partitioned__week
- , subq_17.booking__ds_partitioned__month
- , subq_17.booking__ds_partitioned__quarter
- , subq_17.booking__ds_partitioned__year
- , subq_17.booking__ds_partitioned__extract_year
- , subq_17.booking__ds_partitioned__extract_quarter
- , subq_17.booking__ds_partitioned__extract_month
- , subq_17.booking__ds_partitioned__extract_day
- , subq_17.booking__ds_partitioned__extract_dow
- , subq_17.booking__ds_partitioned__extract_doy
- , subq_17.booking__paid_at__day
- , subq_17.booking__paid_at__week
- , subq_17.booking__paid_at__month
- , subq_17.booking__paid_at__quarter
- , subq_17.booking__paid_at__year
- , subq_17.booking__paid_at__extract_year
- , subq_17.booking__paid_at__extract_quarter
- , subq_17.booking__paid_at__extract_month
- , subq_17.booking__paid_at__extract_day
- , subq_17.booking__paid_at__extract_dow
- , subq_17.booking__paid_at__extract_doy
- , subq_17.ds__day AS metric_time__day
- , subq_17.ds__week AS metric_time__week
- , subq_17.ds__month AS metric_time__month
- , subq_17.ds__quarter AS metric_time__quarter
- , subq_17.ds__year AS metric_time__year
- , subq_17.ds__extract_year AS metric_time__extract_year
- , subq_17.ds__extract_quarter AS metric_time__extract_quarter
- , subq_17.ds__extract_month AS metric_time__extract_month
- , subq_17.ds__extract_day AS metric_time__extract_day
- , subq_17.ds__extract_dow AS metric_time__extract_dow
- , subq_17.ds__extract_doy AS metric_time__extract_doy
- , subq_17.listing
- , subq_17.guest
- , subq_17.host
- , subq_17.booking__listing
- , subq_17.booking__guest
- , subq_17.booking__host
- , subq_17.is_instant
- , subq_17.booking__is_instant
- , subq_17.bookings
- , subq_17.instant_bookings
- , subq_17.booking_value
- , subq_17.max_booking_value
- , subq_17.min_booking_value
- , subq_17.bookers
- , subq_17.average_booking_value
- , subq_17.referred_bookings
- , subq_17.median_booking_value
- , subq_17.booking_value_p99
- , subq_17.discrete_booking_value_p99
- , subq_17.approximate_continuous_booking_value_p99
- , subq_17.approximate_discrete_booking_value_p99
+ subq_26.ds__day
+ , subq_26.ds__week
+ , subq_26.ds__month
+ , subq_26.ds__quarter
+ , subq_26.ds__year
+ , subq_26.ds__extract_year
+ , subq_26.ds__extract_quarter
+ , subq_26.ds__extract_month
+ , subq_26.ds__extract_day
+ , subq_26.ds__extract_dow
+ , subq_26.ds__extract_doy
+ , subq_26.ds_partitioned__day
+ , subq_26.ds_partitioned__week
+ , subq_26.ds_partitioned__month
+ , subq_26.ds_partitioned__quarter
+ , subq_26.ds_partitioned__year
+ , subq_26.ds_partitioned__extract_year
+ , subq_26.ds_partitioned__extract_quarter
+ , subq_26.ds_partitioned__extract_month
+ , subq_26.ds_partitioned__extract_day
+ , subq_26.ds_partitioned__extract_dow
+ , subq_26.ds_partitioned__extract_doy
+ , subq_26.paid_at__day
+ , subq_26.paid_at__week
+ , subq_26.paid_at__month
+ , subq_26.paid_at__quarter
+ , subq_26.paid_at__year
+ , subq_26.paid_at__extract_year
+ , subq_26.paid_at__extract_quarter
+ , subq_26.paid_at__extract_month
+ , subq_26.paid_at__extract_day
+ , subq_26.paid_at__extract_dow
+ , subq_26.paid_at__extract_doy
+ , subq_26.booking__ds__day
+ , subq_26.booking__ds__week
+ , subq_26.booking__ds__month
+ , subq_26.booking__ds__quarter
+ , subq_26.booking__ds__year
+ , subq_26.booking__ds__extract_year
+ , subq_26.booking__ds__extract_quarter
+ , subq_26.booking__ds__extract_month
+ , subq_26.booking__ds__extract_day
+ , subq_26.booking__ds__extract_dow
+ , subq_26.booking__ds__extract_doy
+ , subq_26.booking__ds_partitioned__day
+ , subq_26.booking__ds_partitioned__week
+ , subq_26.booking__ds_partitioned__month
+ , subq_26.booking__ds_partitioned__quarter
+ , subq_26.booking__ds_partitioned__year
+ , subq_26.booking__ds_partitioned__extract_year
+ , subq_26.booking__ds_partitioned__extract_quarter
+ , subq_26.booking__ds_partitioned__extract_month
+ , subq_26.booking__ds_partitioned__extract_day
+ , subq_26.booking__ds_partitioned__extract_dow
+ , subq_26.booking__ds_partitioned__extract_doy
+ , subq_26.booking__paid_at__day
+ , subq_26.booking__paid_at__week
+ , subq_26.booking__paid_at__month
+ , subq_26.booking__paid_at__quarter
+ , subq_26.booking__paid_at__year
+ , subq_26.booking__paid_at__extract_year
+ , subq_26.booking__paid_at__extract_quarter
+ , subq_26.booking__paid_at__extract_month
+ , subq_26.booking__paid_at__extract_day
+ , subq_26.booking__paid_at__extract_dow
+ , subq_26.booking__paid_at__extract_doy
+ , subq_26.ds__day AS metric_time__day
+ , subq_26.ds__week AS metric_time__week
+ , subq_26.ds__month AS metric_time__month
+ , subq_26.ds__quarter AS metric_time__quarter
+ , subq_26.ds__year AS metric_time__year
+ , subq_26.ds__extract_year AS metric_time__extract_year
+ , subq_26.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_26.ds__extract_month AS metric_time__extract_month
+ , subq_26.ds__extract_day AS metric_time__extract_day
+ , subq_26.ds__extract_dow AS metric_time__extract_dow
+ , subq_26.ds__extract_doy AS metric_time__extract_doy
+ , subq_26.listing
+ , subq_26.guest
+ , subq_26.host
+ , subq_26.booking__listing
+ , subq_26.booking__guest
+ , subq_26.booking__host
+ , subq_26.is_instant
+ , subq_26.booking__is_instant
+ , subq_26.bookings
+ , subq_26.instant_bookings
+ , subq_26.booking_value
+ , subq_26.max_booking_value
+ , subq_26.min_booking_value
+ , subq_26.bookers
+ , subq_26.average_booking_value
+ , subq_26.referred_bookings
+ , subq_26.median_booking_value
+ , subq_26.booking_value_p99
+ , subq_26.discrete_booking_value_p99
+ , subq_26.approximate_continuous_booking_value_p99
+ , subq_26.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_17
- ) subq_18
- ) subq_19
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_26
+ ) subq_27
+ ) subq_28
GROUP BY
- subq_19.metric_time__day
- ) subq_20
- ) subq_21
+ subq_28.metric_time__day
+ ) subq_29
+ ) subq_30
ON
- COALESCE(subq_11.metric_time__day, subq_16.metric_time__day) = subq_21.metric_time__day
+ COALESCE(subq_20.metric_time__day, subq_25.metric_time__day) = subq_30.metric_time__day
GROUP BY
- COALESCE(subq_11.metric_time__day, subq_16.metric_time__day, subq_21.metric_time__day)
-) subq_22
+ COALESCE(subq_20.metric_time__day, subq_25.metric_time__day, subq_30.metric_time__day)
+) subq_31
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_derived_metric__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_derived_metric__plan0_optimized.sql
index 78837fdd96..da1e9fdd5a 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_derived_metric__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_derived_metric__plan0_optimized.sql
@@ -5,10 +5,10 @@ SELECT
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_34.metric_time__day, subq_39.metric_time__day, subq_44.metric_time__day) AS metric_time__day
- , MAX(subq_34.non_referred) AS non_referred
- , MAX(subq_39.instant) AS instant
- , MAX(subq_44.bookings) AS bookings
+ COALESCE(subq_43.metric_time__day, subq_48.metric_time__day, subq_53.metric_time__day) AS metric_time__day
+ , MAX(subq_43.non_referred) AS non_referred
+ , MAX(subq_48.instant) AS instant
+ , MAX(subq_53.bookings) AS bookings
FROM (
-- Compute Metrics via Expressions
SELECT
@@ -17,9 +17,9 @@ FROM (
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_27.metric_time__day, subq_32.metric_time__day) AS metric_time__day
- , MAX(subq_27.ref_bookings) AS ref_bookings
- , MAX(subq_32.bookings) AS bookings
+ COALESCE(subq_36.metric_time__day, subq_41.metric_time__day) AS metric_time__day
+ , MAX(subq_36.ref_bookings) AS ref_bookings
+ , MAX(subq_41.bookings) AS bookings
FROM (
-- Aggregate Measures
-- Compute Metrics via Expressions
@@ -33,11 +33,11 @@ FROM (
SELECT
DATE_TRUNC('day', ds) 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_28001
- ) subq_25
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_34
GROUP BY
metric_time__day
- ) subq_27
+ ) subq_36
FULL OUTER JOIN (
-- Aggregate Measures
-- Compute Metrics via Expressions
@@ -51,17 +51,17 @@ FROM (
SELECT
DATE_TRUNC('day', ds) AS metric_time__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_30
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_39
GROUP BY
metric_time__day
- ) subq_32
+ ) subq_41
ON
- subq_27.metric_time__day = subq_32.metric_time__day
+ subq_36.metric_time__day = subq_41.metric_time__day
GROUP BY
- COALESCE(subq_27.metric_time__day, subq_32.metric_time__day)
- ) subq_33
- ) subq_34
+ COALESCE(subq_36.metric_time__day, subq_41.metric_time__day)
+ ) subq_42
+ ) subq_43
FULL OUTER JOIN (
-- Aggregate Measures
-- Compute Metrics via Expressions
@@ -75,13 +75,13 @@ FROM (
SELECT
DATE_TRUNC('day', ds) AS metric_time__day
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_37
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_46
GROUP BY
metric_time__day
- ) subq_39
+ ) subq_48
ON
- subq_34.metric_time__day = subq_39.metric_time__day
+ subq_43.metric_time__day = subq_48.metric_time__day
FULL OUTER JOIN (
-- Aggregate Measures
-- Compute Metrics via Expressions
@@ -95,13 +95,13 @@ FROM (
SELECT
DATE_TRUNC('day', ds) AS metric_time__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_42
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_51
GROUP BY
metric_time__day
- ) subq_44
+ ) subq_53
ON
- COALESCE(subq_34.metric_time__day, subq_39.metric_time__day) = subq_44.metric_time__day
+ COALESCE(subq_43.metric_time__day, subq_48.metric_time__day) = subq_53.metric_time__day
GROUP BY
- COALESCE(subq_34.metric_time__day, subq_39.metric_time__day, subq_44.metric_time__day)
-) subq_45
+ COALESCE(subq_43.metric_time__day, subq_48.metric_time__day, subq_53.metric_time__day)
+) subq_54
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0.sql
index 7f1880083e..d0d0820c64 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0.sql
@@ -1,359 +1,359 @@
-- Compute Metrics via Expressions
SELECT
- subq_13.metric_time__day
+ subq_22.metric_time__day
, 2 * bookings_offset_once AS bookings_offset_twice
FROM (
-- Pass Only Elements: ['metric_time__day', 'bookings_offset_once']
SELECT
- subq_12.metric_time__day
- , subq_12.bookings_offset_once
+ subq_21.metric_time__day
+ , subq_21.bookings_offset_once
FROM (
-- Constrain Output with WHERE
SELECT
- subq_11.metric_time__day
- , subq_11.booking__is_instant
- , subq_11.bookings_offset_once
+ subq_20.metric_time__day
+ , subq_20.booking__is_instant
+ , subq_20.bookings_offset_once
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_9.metric_time__day AS metric_time__day
- , subq_8.booking__is_instant AS booking__is_instant
- , subq_8.bookings_offset_once AS bookings_offset_once
+ subq_18.metric_time__day AS metric_time__day
+ , subq_17.booking__is_instant AS booking__is_instant
+ , subq_17.bookings_offset_once AS bookings_offset_once
FROM (
-- Time Spine
SELECT
- subq_10.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_10
- ) subq_9
+ subq_19.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_19
+ ) subq_18
INNER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_7.metric_time__day
- , subq_7.booking__is_instant
+ subq_16.metric_time__day
+ , subq_16.booking__is_instant
, 2 * bookings AS bookings_offset_once
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_6.metric_time__day
- , subq_6.booking__is_instant
- , subq_6.bookings
+ subq_15.metric_time__day
+ , subq_15.booking__is_instant
+ , subq_15.bookings
FROM (
-- Aggregate Measures
SELECT
- subq_5.metric_time__day
- , subq_5.booking__is_instant
- , SUM(subq_5.bookings) AS bookings
+ subq_14.metric_time__day
+ , subq_14.booking__is_instant
+ , SUM(subq_14.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'booking__is_instant', 'metric_time__day']
SELECT
- subq_4.metric_time__day
- , subq_4.booking__is_instant
- , subq_4.bookings
+ subq_13.metric_time__day
+ , subq_13.booking__is_instant
+ , subq_13.bookings
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_2.metric_time__day AS metric_time__day
- , subq_1.ds__day AS ds__day
- , subq_1.ds__week AS ds__week
- , subq_1.ds__month AS ds__month
- , subq_1.ds__quarter AS ds__quarter
- , subq_1.ds__year AS ds__year
- , subq_1.ds__extract_year AS ds__extract_year
- , subq_1.ds__extract_quarter AS ds__extract_quarter
- , subq_1.ds__extract_month AS ds__extract_month
- , subq_1.ds__extract_day AS ds__extract_day
- , subq_1.ds__extract_dow AS ds__extract_dow
- , subq_1.ds__extract_doy AS ds__extract_doy
- , subq_1.ds_partitioned__day AS ds_partitioned__day
- , subq_1.ds_partitioned__week AS ds_partitioned__week
- , subq_1.ds_partitioned__month AS ds_partitioned__month
- , subq_1.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_1.ds_partitioned__year AS ds_partitioned__year
- , subq_1.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_1.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_1.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_1.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_1.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_1.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_1.paid_at__day AS paid_at__day
- , subq_1.paid_at__week AS paid_at__week
- , subq_1.paid_at__month AS paid_at__month
- , subq_1.paid_at__quarter AS paid_at__quarter
- , subq_1.paid_at__year AS paid_at__year
- , subq_1.paid_at__extract_year AS paid_at__extract_year
- , subq_1.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_1.paid_at__extract_month AS paid_at__extract_month
- , subq_1.paid_at__extract_day AS paid_at__extract_day
- , subq_1.paid_at__extract_dow AS paid_at__extract_dow
- , subq_1.paid_at__extract_doy AS paid_at__extract_doy
- , subq_1.booking__ds__day AS booking__ds__day
- , subq_1.booking__ds__week AS booking__ds__week
- , subq_1.booking__ds__month AS booking__ds__month
- , subq_1.booking__ds__quarter AS booking__ds__quarter
- , subq_1.booking__ds__year AS booking__ds__year
- , subq_1.booking__ds__extract_year AS booking__ds__extract_year
- , subq_1.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_1.booking__ds__extract_month AS booking__ds__extract_month
- , subq_1.booking__ds__extract_day AS booking__ds__extract_day
- , subq_1.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_1.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_1.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_1.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_1.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_1.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_1.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_1.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_1.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_1.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_1.booking__paid_at__day AS booking__paid_at__day
- , subq_1.booking__paid_at__week AS booking__paid_at__week
- , subq_1.booking__paid_at__month AS booking__paid_at__month
- , subq_1.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_1.booking__paid_at__year AS booking__paid_at__year
- , subq_1.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_1.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_1.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_1.listing AS listing
- , subq_1.guest AS guest
- , subq_1.host AS host
- , subq_1.booking__listing AS booking__listing
- , subq_1.booking__guest AS booking__guest
- , subq_1.booking__host AS booking__host
- , subq_1.is_instant AS is_instant
- , subq_1.booking__is_instant AS booking__is_instant
- , subq_1.bookings AS bookings
- , subq_1.instant_bookings AS instant_bookings
- , subq_1.booking_value AS booking_value
- , subq_1.max_booking_value AS max_booking_value
- , subq_1.min_booking_value AS min_booking_value
- , subq_1.bookers AS bookers
- , subq_1.average_booking_value AS average_booking_value
- , subq_1.referred_bookings AS referred_bookings
- , subq_1.median_booking_value AS median_booking_value
- , subq_1.booking_value_p99 AS booking_value_p99
- , subq_1.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_1.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_1.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ subq_11.metric_time__day AS metric_time__day
+ , subq_10.ds__day AS ds__day
+ , subq_10.ds__week AS ds__week
+ , subq_10.ds__month AS ds__month
+ , subq_10.ds__quarter AS ds__quarter
+ , subq_10.ds__year AS ds__year
+ , subq_10.ds__extract_year AS ds__extract_year
+ , subq_10.ds__extract_quarter AS ds__extract_quarter
+ , subq_10.ds__extract_month AS ds__extract_month
+ , subq_10.ds__extract_day AS ds__extract_day
+ , subq_10.ds__extract_dow AS ds__extract_dow
+ , subq_10.ds__extract_doy AS ds__extract_doy
+ , subq_10.ds_partitioned__day AS ds_partitioned__day
+ , subq_10.ds_partitioned__week AS ds_partitioned__week
+ , subq_10.ds_partitioned__month AS ds_partitioned__month
+ , subq_10.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_10.ds_partitioned__year AS ds_partitioned__year
+ , subq_10.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_10.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_10.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_10.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_10.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_10.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_10.paid_at__day AS paid_at__day
+ , subq_10.paid_at__week AS paid_at__week
+ , subq_10.paid_at__month AS paid_at__month
+ , subq_10.paid_at__quarter AS paid_at__quarter
+ , subq_10.paid_at__year AS paid_at__year
+ , subq_10.paid_at__extract_year AS paid_at__extract_year
+ , subq_10.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_10.paid_at__extract_month AS paid_at__extract_month
+ , subq_10.paid_at__extract_day AS paid_at__extract_day
+ , subq_10.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_10.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_10.booking__ds__day AS booking__ds__day
+ , subq_10.booking__ds__week AS booking__ds__week
+ , subq_10.booking__ds__month AS booking__ds__month
+ , subq_10.booking__ds__quarter AS booking__ds__quarter
+ , subq_10.booking__ds__year AS booking__ds__year
+ , subq_10.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_10.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_10.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_10.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_10.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_10.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_10.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_10.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_10.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_10.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_10.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_10.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_10.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_10.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_10.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_10.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_10.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_10.booking__paid_at__day AS booking__paid_at__day
+ , subq_10.booking__paid_at__week AS booking__paid_at__week
+ , subq_10.booking__paid_at__month AS booking__paid_at__month
+ , subq_10.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_10.booking__paid_at__year AS booking__paid_at__year
+ , subq_10.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_10.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_10.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_10.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_10.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_10.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_10.listing AS listing
+ , subq_10.guest AS guest
+ , subq_10.host AS host
+ , subq_10.booking__listing AS booking__listing
+ , subq_10.booking__guest AS booking__guest
+ , subq_10.booking__host AS booking__host
+ , subq_10.is_instant AS is_instant
+ , subq_10.booking__is_instant AS booking__is_instant
+ , subq_10.bookings AS bookings
+ , subq_10.instant_bookings AS instant_bookings
+ , subq_10.booking_value AS booking_value
+ , subq_10.max_booking_value AS max_booking_value
+ , subq_10.min_booking_value AS min_booking_value
+ , subq_10.bookers AS bookers
+ , subq_10.average_booking_value AS average_booking_value
+ , subq_10.referred_bookings AS referred_bookings
+ , subq_10.median_booking_value AS median_booking_value
+ , subq_10.booking_value_p99 AS booking_value_p99
+ , subq_10.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_10.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_10.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_3.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_3
- ) subq_2
+ subq_12.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_12
+ ) subq_11
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
ON
- subq_2.metric_time__day - MAKE_INTERVAL(days => 5) = subq_1.metric_time__day
- ) subq_4
- ) subq_5
+ subq_11.metric_time__day - MAKE_INTERVAL(days => 5) = subq_10.metric_time__day
+ ) subq_13
+ ) subq_14
GROUP BY
- subq_5.metric_time__day
- , subq_5.booking__is_instant
- ) subq_6
- ) subq_7
- ) subq_8
+ subq_14.metric_time__day
+ , subq_14.booking__is_instant
+ ) subq_15
+ ) subq_16
+ ) subq_17
ON
- subq_9.metric_time__day - MAKE_INTERVAL(days => 2) = subq_8.metric_time__day
- ) subq_11
+ subq_18.metric_time__day - MAKE_INTERVAL(days => 2) = subq_17.metric_time__day
+ ) subq_20
WHERE booking__is_instant
- ) subq_12
-) subq_13
+ ) subq_21
+) subq_22
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0_optimized.sql
index 9a38bf2182..95e045d876 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_derived_metric_offset_with_joined_where_constraint_not_selected__plan0_optimized.sql
@@ -11,10 +11,10 @@ FROM (
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_24.ds AS metric_time__day
- , subq_22.booking__is_instant AS booking__is_instant
- , subq_22.bookings_offset_once AS bookings_offset_once
- FROM ***************************.mf_time_spine subq_24
+ subq_33.ds AS metric_time__day
+ , subq_31.booking__is_instant AS booking__is_instant
+ , subq_31.bookings_offset_once AS bookings_offset_once
+ FROM ***************************.mf_time_spine subq_33
INNER JOIN (
-- Compute Metrics via Expressions
SELECT
@@ -27,10 +27,10 @@ FROM (
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_17.ds AS metric_time__day
- , subq_15.booking__is_instant AS booking__is_instant
- , SUM(subq_15.bookings) AS bookings
- FROM ***************************.mf_time_spine subq_17
+ subq_26.ds AS metric_time__day
+ , subq_24.booking__is_instant AS booking__is_instant
+ , SUM(subq_24.bookings) AS bookings
+ FROM ***************************.mf_time_spine subq_26
INNER JOIN (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
@@ -38,17 +38,17 @@ FROM (
DATE_TRUNC('day', ds) AS metric_time__day
, is_instant AS booking__is_instant
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_15
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_24
ON
- subq_17.ds - MAKE_INTERVAL(days => 5) = subq_15.metric_time__day
+ subq_26.ds - MAKE_INTERVAL(days => 5) = subq_24.metric_time__day
GROUP BY
- subq_17.ds
- , subq_15.booking__is_instant
- ) subq_21
- ) subq_22
+ subq_26.ds
+ , subq_24.booking__is_instant
+ ) subq_30
+ ) subq_31
ON
- subq_24.ds - MAKE_INTERVAL(days => 2) = subq_22.metric_time__day
- ) subq_25
+ subq_33.ds - MAKE_INTERVAL(days => 2) = subq_31.metric_time__day
+ ) subq_34
WHERE booking__is_instant
-) subq_27
+) subq_36
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0.sql
index b6024d9277..36d9bb6cd4 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0.sql
@@ -1,471 +1,471 @@
-- Compute Metrics via Expressions
SELECT
- subq_15.metric_time__day
+ subq_24.metric_time__day
, booking_fees - booking_fees_start_of_month AS booking_fees_since_start_of_month
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_8.metric_time__day, subq_14.metric_time__day) AS metric_time__day
- , MAX(subq_8.booking_fees_start_of_month) AS booking_fees_start_of_month
- , MAX(subq_14.booking_fees) AS booking_fees
+ COALESCE(subq_17.metric_time__day, subq_23.metric_time__day) AS metric_time__day
+ , MAX(subq_17.booking_fees_start_of_month) AS booking_fees_start_of_month
+ , MAX(subq_23.booking_fees) AS booking_fees
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_6.metric_time__day AS metric_time__day
- , subq_5.booking_fees_start_of_month AS booking_fees_start_of_month
+ subq_15.metric_time__day AS metric_time__day
+ , subq_14.booking_fees_start_of_month AS booking_fees_start_of_month
FROM (
-- Time Spine
SELECT
- subq_7.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_7
- ) subq_6
+ subq_16.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_16
+ ) subq_15
INNER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_4.metric_time__day
+ subq_13.metric_time__day
, booking_value * 0.05 AS booking_fees_start_of_month
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_3.metric_time__day
- , subq_3.booking_value
+ subq_12.metric_time__day
+ , subq_12.booking_value
FROM (
-- Aggregate Measures
SELECT
- subq_2.metric_time__day
- , SUM(subq_2.booking_value) AS booking_value
+ subq_11.metric_time__day
+ , SUM(subq_11.booking_value) AS booking_value
FROM (
-- Pass Only Elements: ['booking_value', 'metric_time__day']
SELECT
- subq_1.metric_time__day
- , subq_1.booking_value
+ subq_10.metric_time__day
+ , subq_10.booking_value
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
- ) subq_2
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
GROUP BY
- subq_2.metric_time__day
- ) subq_3
- ) subq_4
- ) subq_5
+ subq_11.metric_time__day
+ ) subq_12
+ ) subq_13
+ ) subq_14
ON
- DATE_TRUNC('month', subq_6.metric_time__day) = subq_5.metric_time__day
- ) subq_8
+ DATE_TRUNC('month', subq_15.metric_time__day) = subq_14.metric_time__day
+ ) subq_17
FULL OUTER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_13.metric_time__day
+ subq_22.metric_time__day
, booking_value * 0.05 AS booking_fees
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_12.metric_time__day
- , subq_12.booking_value
+ subq_21.metric_time__day
+ , subq_21.booking_value
FROM (
-- Aggregate Measures
SELECT
- subq_11.metric_time__day
- , SUM(subq_11.booking_value) AS booking_value
+ subq_20.metric_time__day
+ , SUM(subq_20.booking_value) AS booking_value
FROM (
-- Pass Only Elements: ['booking_value', 'metric_time__day']
SELECT
- subq_10.metric_time__day
- , subq_10.booking_value
+ subq_19.metric_time__day
+ , subq_19.booking_value
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_9.ds__day
- , subq_9.ds__week
- , subq_9.ds__month
- , subq_9.ds__quarter
- , subq_9.ds__year
- , subq_9.ds__extract_year
- , subq_9.ds__extract_quarter
- , subq_9.ds__extract_month
- , subq_9.ds__extract_day
- , subq_9.ds__extract_dow
- , subq_9.ds__extract_doy
- , subq_9.ds_partitioned__day
- , subq_9.ds_partitioned__week
- , subq_9.ds_partitioned__month
- , subq_9.ds_partitioned__quarter
- , subq_9.ds_partitioned__year
- , subq_9.ds_partitioned__extract_year
- , subq_9.ds_partitioned__extract_quarter
- , subq_9.ds_partitioned__extract_month
- , subq_9.ds_partitioned__extract_day
- , subq_9.ds_partitioned__extract_dow
- , subq_9.ds_partitioned__extract_doy
- , subq_9.paid_at__day
- , subq_9.paid_at__week
- , subq_9.paid_at__month
- , subq_9.paid_at__quarter
- , subq_9.paid_at__year
- , subq_9.paid_at__extract_year
- , subq_9.paid_at__extract_quarter
- , subq_9.paid_at__extract_month
- , subq_9.paid_at__extract_day
- , subq_9.paid_at__extract_dow
- , subq_9.paid_at__extract_doy
- , subq_9.booking__ds__day
- , subq_9.booking__ds__week
- , subq_9.booking__ds__month
- , subq_9.booking__ds__quarter
- , subq_9.booking__ds__year
- , subq_9.booking__ds__extract_year
- , subq_9.booking__ds__extract_quarter
- , subq_9.booking__ds__extract_month
- , subq_9.booking__ds__extract_day
- , subq_9.booking__ds__extract_dow
- , subq_9.booking__ds__extract_doy
- , subq_9.booking__ds_partitioned__day
- , subq_9.booking__ds_partitioned__week
- , subq_9.booking__ds_partitioned__month
- , subq_9.booking__ds_partitioned__quarter
- , subq_9.booking__ds_partitioned__year
- , subq_9.booking__ds_partitioned__extract_year
- , subq_9.booking__ds_partitioned__extract_quarter
- , subq_9.booking__ds_partitioned__extract_month
- , subq_9.booking__ds_partitioned__extract_day
- , subq_9.booking__ds_partitioned__extract_dow
- , subq_9.booking__ds_partitioned__extract_doy
- , subq_9.booking__paid_at__day
- , subq_9.booking__paid_at__week
- , subq_9.booking__paid_at__month
- , subq_9.booking__paid_at__quarter
- , subq_9.booking__paid_at__year
- , subq_9.booking__paid_at__extract_year
- , subq_9.booking__paid_at__extract_quarter
- , subq_9.booking__paid_at__extract_month
- , subq_9.booking__paid_at__extract_day
- , subq_9.booking__paid_at__extract_dow
- , subq_9.booking__paid_at__extract_doy
- , subq_9.ds__day AS metric_time__day
- , subq_9.ds__week AS metric_time__week
- , subq_9.ds__month AS metric_time__month
- , subq_9.ds__quarter AS metric_time__quarter
- , subq_9.ds__year AS metric_time__year
- , subq_9.ds__extract_year AS metric_time__extract_year
- , subq_9.ds__extract_quarter AS metric_time__extract_quarter
- , subq_9.ds__extract_month AS metric_time__extract_month
- , subq_9.ds__extract_day AS metric_time__extract_day
- , subq_9.ds__extract_dow AS metric_time__extract_dow
- , subq_9.ds__extract_doy AS metric_time__extract_doy
- , subq_9.listing
- , subq_9.guest
- , subq_9.host
- , subq_9.booking__listing
- , subq_9.booking__guest
- , subq_9.booking__host
- , subq_9.is_instant
- , subq_9.booking__is_instant
- , subq_9.bookings
- , subq_9.instant_bookings
- , subq_9.booking_value
- , subq_9.max_booking_value
- , subq_9.min_booking_value
- , subq_9.bookers
- , subq_9.average_booking_value
- , subq_9.referred_bookings
- , subq_9.median_booking_value
- , subq_9.booking_value_p99
- , subq_9.discrete_booking_value_p99
- , subq_9.approximate_continuous_booking_value_p99
- , subq_9.approximate_discrete_booking_value_p99
+ subq_18.ds__day
+ , subq_18.ds__week
+ , subq_18.ds__month
+ , subq_18.ds__quarter
+ , subq_18.ds__year
+ , subq_18.ds__extract_year
+ , subq_18.ds__extract_quarter
+ , subq_18.ds__extract_month
+ , subq_18.ds__extract_day
+ , subq_18.ds__extract_dow
+ , subq_18.ds__extract_doy
+ , subq_18.ds_partitioned__day
+ , subq_18.ds_partitioned__week
+ , subq_18.ds_partitioned__month
+ , subq_18.ds_partitioned__quarter
+ , subq_18.ds_partitioned__year
+ , subq_18.ds_partitioned__extract_year
+ , subq_18.ds_partitioned__extract_quarter
+ , subq_18.ds_partitioned__extract_month
+ , subq_18.ds_partitioned__extract_day
+ , subq_18.ds_partitioned__extract_dow
+ , subq_18.ds_partitioned__extract_doy
+ , subq_18.paid_at__day
+ , subq_18.paid_at__week
+ , subq_18.paid_at__month
+ , subq_18.paid_at__quarter
+ , subq_18.paid_at__year
+ , subq_18.paid_at__extract_year
+ , subq_18.paid_at__extract_quarter
+ , subq_18.paid_at__extract_month
+ , subq_18.paid_at__extract_day
+ , subq_18.paid_at__extract_dow
+ , subq_18.paid_at__extract_doy
+ , subq_18.booking__ds__day
+ , subq_18.booking__ds__week
+ , subq_18.booking__ds__month
+ , subq_18.booking__ds__quarter
+ , subq_18.booking__ds__year
+ , subq_18.booking__ds__extract_year
+ , subq_18.booking__ds__extract_quarter
+ , subq_18.booking__ds__extract_month
+ , subq_18.booking__ds__extract_day
+ , subq_18.booking__ds__extract_dow
+ , subq_18.booking__ds__extract_doy
+ , subq_18.booking__ds_partitioned__day
+ , subq_18.booking__ds_partitioned__week
+ , subq_18.booking__ds_partitioned__month
+ , subq_18.booking__ds_partitioned__quarter
+ , subq_18.booking__ds_partitioned__year
+ , subq_18.booking__ds_partitioned__extract_year
+ , subq_18.booking__ds_partitioned__extract_quarter
+ , subq_18.booking__ds_partitioned__extract_month
+ , subq_18.booking__ds_partitioned__extract_day
+ , subq_18.booking__ds_partitioned__extract_dow
+ , subq_18.booking__ds_partitioned__extract_doy
+ , subq_18.booking__paid_at__day
+ , subq_18.booking__paid_at__week
+ , subq_18.booking__paid_at__month
+ , subq_18.booking__paid_at__quarter
+ , subq_18.booking__paid_at__year
+ , subq_18.booking__paid_at__extract_year
+ , subq_18.booking__paid_at__extract_quarter
+ , subq_18.booking__paid_at__extract_month
+ , subq_18.booking__paid_at__extract_day
+ , subq_18.booking__paid_at__extract_dow
+ , subq_18.booking__paid_at__extract_doy
+ , subq_18.ds__day AS metric_time__day
+ , subq_18.ds__week AS metric_time__week
+ , subq_18.ds__month AS metric_time__month
+ , subq_18.ds__quarter AS metric_time__quarter
+ , subq_18.ds__year AS metric_time__year
+ , subq_18.ds__extract_year AS metric_time__extract_year
+ , subq_18.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_18.ds__extract_month AS metric_time__extract_month
+ , subq_18.ds__extract_day AS metric_time__extract_day
+ , subq_18.ds__extract_dow AS metric_time__extract_dow
+ , subq_18.ds__extract_doy AS metric_time__extract_doy
+ , subq_18.listing
+ , subq_18.guest
+ , subq_18.host
+ , subq_18.booking__listing
+ , subq_18.booking__guest
+ , subq_18.booking__host
+ , subq_18.is_instant
+ , subq_18.booking__is_instant
+ , subq_18.bookings
+ , subq_18.instant_bookings
+ , subq_18.booking_value
+ , subq_18.max_booking_value
+ , subq_18.min_booking_value
+ , subq_18.bookers
+ , subq_18.average_booking_value
+ , subq_18.referred_bookings
+ , subq_18.median_booking_value
+ , subq_18.booking_value_p99
+ , subq_18.discrete_booking_value_p99
+ , subq_18.approximate_continuous_booking_value_p99
+ , subq_18.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_9
- ) subq_10
- ) subq_11
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_18
+ ) subq_19
+ ) subq_20
GROUP BY
- subq_11.metric_time__day
- ) subq_12
- ) subq_13
- ) subq_14
+ subq_20.metric_time__day
+ ) subq_21
+ ) subq_22
+ ) subq_23
ON
- subq_8.metric_time__day = subq_14.metric_time__day
+ subq_17.metric_time__day = subq_23.metric_time__day
GROUP BY
- COALESCE(subq_8.metric_time__day, subq_14.metric_time__day)
-) subq_15
+ COALESCE(subq_17.metric_time__day, subq_23.metric_time__day)
+) subq_24
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0_optimized.sql
index fc648c54b6..b28105f311 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_derived_metric_with_offset_multiple_input_metrics__plan0_optimized.sql
@@ -5,15 +5,15 @@ SELECT
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_24.metric_time__day, subq_30.metric_time__day) AS metric_time__day
- , MAX(subq_24.booking_fees_start_of_month) AS booking_fees_start_of_month
- , MAX(subq_30.booking_fees) AS booking_fees
+ COALESCE(subq_33.metric_time__day, subq_39.metric_time__day) AS metric_time__day
+ , MAX(subq_33.booking_fees_start_of_month) AS booking_fees_start_of_month
+ , MAX(subq_39.booking_fees) AS booking_fees
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_23.ds AS metric_time__day
- , subq_21.booking_fees_start_of_month AS booking_fees_start_of_month
- FROM ***************************.mf_time_spine subq_23
+ subq_32.ds AS metric_time__day
+ , subq_30.booking_fees_start_of_month AS booking_fees_start_of_month
+ FROM ***************************.mf_time_spine subq_32
INNER JOIN (
-- Compute Metrics via Expressions
SELECT
@@ -28,14 +28,14 @@ FROM (
SELECT
DATE_TRUNC('day', ds) AS metric_time__day
, SUM(booking_value) AS booking_value
- FROM ***************************.fct_bookings bookings_source_src_28001
+ FROM ***************************.fct_bookings bookings_source_src_28000
GROUP BY
DATE_TRUNC('day', ds)
- ) subq_20
- ) subq_21
+ ) subq_29
+ ) subq_30
ON
- DATE_TRUNC('month', subq_23.ds) = subq_21.metric_time__day
- ) subq_24
+ DATE_TRUNC('month', subq_32.ds) = subq_30.metric_time__day
+ ) subq_33
FULL OUTER JOIN (
-- Compute Metrics via Expressions
SELECT
@@ -50,13 +50,13 @@ FROM (
SELECT
DATE_TRUNC('day', ds) AS metric_time__day
, SUM(booking_value) AS booking_value
- FROM ***************************.fct_bookings bookings_source_src_28001
+ FROM ***************************.fct_bookings bookings_source_src_28000
GROUP BY
DATE_TRUNC('day', ds)
- ) subq_29
- ) subq_30
+ ) subq_38
+ ) subq_39
ON
- subq_24.metric_time__day = subq_30.metric_time__day
+ subq_33.metric_time__day = subq_39.metric_time__day
GROUP BY
- COALESCE(subq_24.metric_time__day, subq_30.metric_time__day)
-) subq_31
+ COALESCE(subq_33.metric_time__day, subq_39.metric_time__day)
+) subq_40
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_filters__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_filters__plan0.sql
index 25419e889e..dd594f7ee4 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_filters__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_filters__plan0.sql
@@ -8,991 +8,991 @@ FROM (
FROM (
-- Combine Aggregated Outputs
SELECT
- MAX(subq_11.average_booking_value) AS average_booking_value
- , MAX(subq_23.bookings) AS bookings
- , MAX(subq_30.booking_value) AS booking_value
+ MAX(subq_20.average_booking_value) AS average_booking_value
+ , MAX(subq_32.bookings) AS bookings
+ , MAX(subq_39.booking_value) AS booking_value
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_10.average_booking_value
+ subq_19.average_booking_value
FROM (
-- Aggregate Measures
SELECT
- AVG(subq_9.average_booking_value) AS average_booking_value
+ AVG(subq_18.average_booking_value) AS average_booking_value
FROM (
-- Pass Only Elements: ['average_booking_value',]
SELECT
- subq_8.average_booking_value
+ subq_17.average_booking_value
FROM (
-- Constrain Output with WHERE
SELECT
- subq_7.booking__is_instant
- , subq_7.listing__is_lux_latest
- , subq_7.average_booking_value
+ subq_16.booking__is_instant
+ , subq_16.listing__is_lux_latest
+ , subq_16.average_booking_value
FROM (
-- Pass Only Elements: ['average_booking_value', 'listing__is_lux_latest', 'booking__is_instant']
SELECT
- subq_6.booking__is_instant
- , subq_6.listing__is_lux_latest
- , subq_6.average_booking_value
+ subq_15.booking__is_instant
+ , subq_15.listing__is_lux_latest
+ , subq_15.average_booking_value
FROM (
-- Join Standard Outputs
SELECT
- subq_2.listing AS listing
- , subq_2.booking__is_instant AS booking__is_instant
- , subq_5.is_lux_latest AS listing__is_lux_latest
- , subq_2.average_booking_value AS average_booking_value
+ subq_11.listing AS listing
+ , subq_11.booking__is_instant AS booking__is_instant
+ , subq_14.is_lux_latest AS listing__is_lux_latest
+ , subq_11.average_booking_value AS average_booking_value
FROM (
-- Pass Only Elements: ['average_booking_value', 'booking__is_instant', 'listing']
SELECT
- subq_1.listing
- , subq_1.booking__is_instant
- , subq_1.average_booking_value
+ subq_10.listing
+ , subq_10.booking__is_instant
+ , subq_10.average_booking_value
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
- ) subq_2
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
LEFT OUTER JOIN (
-- Pass Only Elements: ['is_lux_latest', 'listing']
SELECT
- subq_4.listing
- , subq_4.is_lux_latest
+ subq_13.listing
+ , subq_13.is_lux_latest
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_3.ds__day
- , subq_3.ds__week
- , subq_3.ds__month
- , subq_3.ds__quarter
- , subq_3.ds__year
- , subq_3.ds__extract_year
- , subq_3.ds__extract_quarter
- , subq_3.ds__extract_month
- , subq_3.ds__extract_day
- , subq_3.ds__extract_dow
- , subq_3.ds__extract_doy
- , subq_3.created_at__day
- , subq_3.created_at__week
- , subq_3.created_at__month
- , subq_3.created_at__quarter
- , subq_3.created_at__year
- , subq_3.created_at__extract_year
- , subq_3.created_at__extract_quarter
- , subq_3.created_at__extract_month
- , subq_3.created_at__extract_day
- , subq_3.created_at__extract_dow
- , subq_3.created_at__extract_doy
- , subq_3.listing__ds__day
- , subq_3.listing__ds__week
- , subq_3.listing__ds__month
- , subq_3.listing__ds__quarter
- , subq_3.listing__ds__year
- , subq_3.listing__ds__extract_year
- , subq_3.listing__ds__extract_quarter
- , subq_3.listing__ds__extract_month
- , subq_3.listing__ds__extract_day
- , subq_3.listing__ds__extract_dow
- , subq_3.listing__ds__extract_doy
- , subq_3.listing__created_at__day
- , subq_3.listing__created_at__week
- , subq_3.listing__created_at__month
- , subq_3.listing__created_at__quarter
- , subq_3.listing__created_at__year
- , subq_3.listing__created_at__extract_year
- , subq_3.listing__created_at__extract_quarter
- , subq_3.listing__created_at__extract_month
- , subq_3.listing__created_at__extract_day
- , subq_3.listing__created_at__extract_dow
- , subq_3.listing__created_at__extract_doy
- , subq_3.ds__day AS metric_time__day
- , subq_3.ds__week AS metric_time__week
- , subq_3.ds__month AS metric_time__month
- , subq_3.ds__quarter AS metric_time__quarter
- , subq_3.ds__year AS metric_time__year
- , subq_3.ds__extract_year AS metric_time__extract_year
- , subq_3.ds__extract_quarter AS metric_time__extract_quarter
- , subq_3.ds__extract_month AS metric_time__extract_month
- , subq_3.ds__extract_day AS metric_time__extract_day
- , subq_3.ds__extract_dow AS metric_time__extract_dow
- , subq_3.ds__extract_doy AS metric_time__extract_doy
- , subq_3.listing
- , subq_3.user
- , subq_3.listing__user
- , subq_3.country_latest
- , subq_3.is_lux_latest
- , subq_3.capacity_latest
- , subq_3.listing__country_latest
- , subq_3.listing__is_lux_latest
- , subq_3.listing__capacity_latest
- , subq_3.listings
- , subq_3.largest_listing
- , subq_3.smallest_listing
+ subq_12.ds__day
+ , subq_12.ds__week
+ , subq_12.ds__month
+ , subq_12.ds__quarter
+ , subq_12.ds__year
+ , subq_12.ds__extract_year
+ , subq_12.ds__extract_quarter
+ , subq_12.ds__extract_month
+ , subq_12.ds__extract_day
+ , subq_12.ds__extract_dow
+ , subq_12.ds__extract_doy
+ , subq_12.created_at__day
+ , subq_12.created_at__week
+ , subq_12.created_at__month
+ , subq_12.created_at__quarter
+ , subq_12.created_at__year
+ , subq_12.created_at__extract_year
+ , subq_12.created_at__extract_quarter
+ , subq_12.created_at__extract_month
+ , subq_12.created_at__extract_day
+ , subq_12.created_at__extract_dow
+ , subq_12.created_at__extract_doy
+ , subq_12.listing__ds__day
+ , subq_12.listing__ds__week
+ , subq_12.listing__ds__month
+ , subq_12.listing__ds__quarter
+ , subq_12.listing__ds__year
+ , subq_12.listing__ds__extract_year
+ , subq_12.listing__ds__extract_quarter
+ , subq_12.listing__ds__extract_month
+ , subq_12.listing__ds__extract_day
+ , subq_12.listing__ds__extract_dow
+ , subq_12.listing__ds__extract_doy
+ , subq_12.listing__created_at__day
+ , subq_12.listing__created_at__week
+ , subq_12.listing__created_at__month
+ , subq_12.listing__created_at__quarter
+ , subq_12.listing__created_at__year
+ , subq_12.listing__created_at__extract_year
+ , subq_12.listing__created_at__extract_quarter
+ , subq_12.listing__created_at__extract_month
+ , subq_12.listing__created_at__extract_day
+ , subq_12.listing__created_at__extract_dow
+ , subq_12.listing__created_at__extract_doy
+ , subq_12.ds__day AS metric_time__day
+ , subq_12.ds__week AS metric_time__week
+ , subq_12.ds__month AS metric_time__month
+ , subq_12.ds__quarter AS metric_time__quarter
+ , subq_12.ds__year AS metric_time__year
+ , subq_12.ds__extract_year AS metric_time__extract_year
+ , subq_12.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_12.ds__extract_month AS metric_time__extract_month
+ , subq_12.ds__extract_day AS metric_time__extract_day
+ , subq_12.ds__extract_dow AS metric_time__extract_dow
+ , subq_12.ds__extract_doy AS metric_time__extract_doy
+ , subq_12.listing
+ , subq_12.user
+ , subq_12.listing__user
+ , subq_12.country_latest
+ , subq_12.is_lux_latest
+ , subq_12.capacity_latest
+ , subq_12.listing__country_latest
+ , subq_12.listing__is_lux_latest
+ , subq_12.listing__capacity_latest
+ , subq_12.listings
+ , subq_12.largest_listing
+ , subq_12.smallest_listing
FROM (
-- Read Elements From Semantic Model 'listings_latest'
SELECT
1 AS listings
- , listings_latest_src_28005.capacity AS largest_listing
- , listings_latest_src_28005.capacity AS smallest_listing
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy
- , listings_latest_src_28005.country AS country_latest
- , listings_latest_src_28005.is_lux AS is_lux_latest
- , listings_latest_src_28005.capacity AS capacity_latest
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy
- , listings_latest_src_28005.country AS listing__country_latest
- , listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , listings_latest_src_28005.capacity AS listing__capacity_latest
- , listings_latest_src_28005.listing_id AS listing
- , listings_latest_src_28005.user_id AS user
- , listings_latest_src_28005.user_id AS listing__user
- FROM ***************************.dim_listings_latest listings_latest_src_28005
- ) subq_3
- ) subq_4
- ) subq_5
+ , listings_latest_src_28000.capacity AS largest_listing
+ , listings_latest_src_28000.capacity AS smallest_listing
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS created_at__extract_day
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS created_at__extract_doy
+ , 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('day', listings_latest_src_28000.created_at) AS listing__ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS listing__ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS listing__created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_day
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_doy
+ , listings_latest_src_28000.country AS listing__country_latest
+ , listings_latest_src_28000.is_lux AS listing__is_lux_latest
+ , listings_latest_src_28000.capacity AS listing__capacity_latest
+ , listings_latest_src_28000.listing_id AS listing
+ , listings_latest_src_28000.user_id AS user
+ , listings_latest_src_28000.user_id AS listing__user
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
+ ) subq_12
+ ) subq_13
+ ) subq_14
ON
- subq_2.listing = subq_5.listing
- ) subq_6
- ) subq_7
+ subq_11.listing = subq_14.listing
+ ) subq_15
+ ) subq_16
WHERE (listing__is_lux_latest) AND (booking__is_instant)
- ) subq_8
- ) subq_9
- ) subq_10
- ) subq_11
+ ) subq_17
+ ) subq_18
+ ) subq_19
+ ) subq_20
CROSS JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_22.bookings
+ subq_31.bookings
FROM (
-- Aggregate Measures
SELECT
- SUM(subq_21.bookings) AS bookings
+ SUM(subq_30.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings',]
SELECT
- subq_20.bookings
+ subq_29.bookings
FROM (
-- Constrain Output with WHERE
SELECT
- subq_19.booking__is_instant
- , subq_19.listing__is_lux_latest
- , subq_19.bookings
+ subq_28.booking__is_instant
+ , subq_28.listing__is_lux_latest
+ , subq_28.bookings
FROM (
-- Pass Only Elements: ['bookings', 'listing__is_lux_latest', 'booking__is_instant']
SELECT
- subq_18.booking__is_instant
- , subq_18.listing__is_lux_latest
- , subq_18.bookings
+ subq_27.booking__is_instant
+ , subq_27.listing__is_lux_latest
+ , subq_27.bookings
FROM (
-- Join Standard Outputs
SELECT
- subq_14.listing AS listing
- , subq_14.booking__is_instant AS booking__is_instant
- , subq_17.is_lux_latest AS listing__is_lux_latest
- , subq_14.bookings AS bookings
+ subq_23.listing AS listing
+ , subq_23.booking__is_instant AS booking__is_instant
+ , subq_26.is_lux_latest AS listing__is_lux_latest
+ , subq_23.bookings AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'booking__is_instant', 'listing']
SELECT
- subq_13.listing
- , subq_13.booking__is_instant
- , subq_13.bookings
+ subq_22.listing
+ , subq_22.booking__is_instant
+ , subq_22.bookings
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_12.ds__day
- , subq_12.ds__week
- , subq_12.ds__month
- , subq_12.ds__quarter
- , subq_12.ds__year
- , subq_12.ds__extract_year
- , subq_12.ds__extract_quarter
- , subq_12.ds__extract_month
- , subq_12.ds__extract_day
- , subq_12.ds__extract_dow
- , subq_12.ds__extract_doy
- , subq_12.ds_partitioned__day
- , subq_12.ds_partitioned__week
- , subq_12.ds_partitioned__month
- , subq_12.ds_partitioned__quarter
- , subq_12.ds_partitioned__year
- , subq_12.ds_partitioned__extract_year
- , subq_12.ds_partitioned__extract_quarter
- , subq_12.ds_partitioned__extract_month
- , subq_12.ds_partitioned__extract_day
- , subq_12.ds_partitioned__extract_dow
- , subq_12.ds_partitioned__extract_doy
- , subq_12.paid_at__day
- , subq_12.paid_at__week
- , subq_12.paid_at__month
- , subq_12.paid_at__quarter
- , subq_12.paid_at__year
- , subq_12.paid_at__extract_year
- , subq_12.paid_at__extract_quarter
- , subq_12.paid_at__extract_month
- , subq_12.paid_at__extract_day
- , subq_12.paid_at__extract_dow
- , subq_12.paid_at__extract_doy
- , subq_12.booking__ds__day
- , subq_12.booking__ds__week
- , subq_12.booking__ds__month
- , subq_12.booking__ds__quarter
- , subq_12.booking__ds__year
- , subq_12.booking__ds__extract_year
- , subq_12.booking__ds__extract_quarter
- , subq_12.booking__ds__extract_month
- , subq_12.booking__ds__extract_day
- , subq_12.booking__ds__extract_dow
- , subq_12.booking__ds__extract_doy
- , subq_12.booking__ds_partitioned__day
- , subq_12.booking__ds_partitioned__week
- , subq_12.booking__ds_partitioned__month
- , subq_12.booking__ds_partitioned__quarter
- , subq_12.booking__ds_partitioned__year
- , subq_12.booking__ds_partitioned__extract_year
- , subq_12.booking__ds_partitioned__extract_quarter
- , subq_12.booking__ds_partitioned__extract_month
- , subq_12.booking__ds_partitioned__extract_day
- , subq_12.booking__ds_partitioned__extract_dow
- , subq_12.booking__ds_partitioned__extract_doy
- , subq_12.booking__paid_at__day
- , subq_12.booking__paid_at__week
- , subq_12.booking__paid_at__month
- , subq_12.booking__paid_at__quarter
- , subq_12.booking__paid_at__year
- , subq_12.booking__paid_at__extract_year
- , subq_12.booking__paid_at__extract_quarter
- , subq_12.booking__paid_at__extract_month
- , subq_12.booking__paid_at__extract_day
- , subq_12.booking__paid_at__extract_dow
- , subq_12.booking__paid_at__extract_doy
- , subq_12.ds__day AS metric_time__day
- , subq_12.ds__week AS metric_time__week
- , subq_12.ds__month AS metric_time__month
- , subq_12.ds__quarter AS metric_time__quarter
- , subq_12.ds__year AS metric_time__year
- , subq_12.ds__extract_year AS metric_time__extract_year
- , subq_12.ds__extract_quarter AS metric_time__extract_quarter
- , subq_12.ds__extract_month AS metric_time__extract_month
- , subq_12.ds__extract_day AS metric_time__extract_day
- , subq_12.ds__extract_dow AS metric_time__extract_dow
- , subq_12.ds__extract_doy AS metric_time__extract_doy
- , subq_12.listing
- , subq_12.guest
- , subq_12.host
- , subq_12.booking__listing
- , subq_12.booking__guest
- , subq_12.booking__host
- , subq_12.is_instant
- , subq_12.booking__is_instant
- , subq_12.bookings
- , subq_12.instant_bookings
- , subq_12.booking_value
- , subq_12.max_booking_value
- , subq_12.min_booking_value
- , subq_12.bookers
- , subq_12.average_booking_value
- , subq_12.referred_bookings
- , subq_12.median_booking_value
- , subq_12.booking_value_p99
- , subq_12.discrete_booking_value_p99
- , subq_12.approximate_continuous_booking_value_p99
- , subq_12.approximate_discrete_booking_value_p99
+ subq_21.ds__day
+ , subq_21.ds__week
+ , subq_21.ds__month
+ , subq_21.ds__quarter
+ , subq_21.ds__year
+ , subq_21.ds__extract_year
+ , subq_21.ds__extract_quarter
+ , subq_21.ds__extract_month
+ , subq_21.ds__extract_day
+ , subq_21.ds__extract_dow
+ , subq_21.ds__extract_doy
+ , subq_21.ds_partitioned__day
+ , subq_21.ds_partitioned__week
+ , subq_21.ds_partitioned__month
+ , subq_21.ds_partitioned__quarter
+ , subq_21.ds_partitioned__year
+ , subq_21.ds_partitioned__extract_year
+ , subq_21.ds_partitioned__extract_quarter
+ , subq_21.ds_partitioned__extract_month
+ , subq_21.ds_partitioned__extract_day
+ , subq_21.ds_partitioned__extract_dow
+ , subq_21.ds_partitioned__extract_doy
+ , subq_21.paid_at__day
+ , subq_21.paid_at__week
+ , subq_21.paid_at__month
+ , subq_21.paid_at__quarter
+ , subq_21.paid_at__year
+ , subq_21.paid_at__extract_year
+ , subq_21.paid_at__extract_quarter
+ , subq_21.paid_at__extract_month
+ , subq_21.paid_at__extract_day
+ , subq_21.paid_at__extract_dow
+ , subq_21.paid_at__extract_doy
+ , subq_21.booking__ds__day
+ , subq_21.booking__ds__week
+ , subq_21.booking__ds__month
+ , subq_21.booking__ds__quarter
+ , subq_21.booking__ds__year
+ , subq_21.booking__ds__extract_year
+ , subq_21.booking__ds__extract_quarter
+ , subq_21.booking__ds__extract_month
+ , subq_21.booking__ds__extract_day
+ , subq_21.booking__ds__extract_dow
+ , subq_21.booking__ds__extract_doy
+ , subq_21.booking__ds_partitioned__day
+ , subq_21.booking__ds_partitioned__week
+ , subq_21.booking__ds_partitioned__month
+ , subq_21.booking__ds_partitioned__quarter
+ , subq_21.booking__ds_partitioned__year
+ , subq_21.booking__ds_partitioned__extract_year
+ , subq_21.booking__ds_partitioned__extract_quarter
+ , subq_21.booking__ds_partitioned__extract_month
+ , subq_21.booking__ds_partitioned__extract_day
+ , subq_21.booking__ds_partitioned__extract_dow
+ , subq_21.booking__ds_partitioned__extract_doy
+ , subq_21.booking__paid_at__day
+ , subq_21.booking__paid_at__week
+ , subq_21.booking__paid_at__month
+ , subq_21.booking__paid_at__quarter
+ , subq_21.booking__paid_at__year
+ , subq_21.booking__paid_at__extract_year
+ , subq_21.booking__paid_at__extract_quarter
+ , subq_21.booking__paid_at__extract_month
+ , subq_21.booking__paid_at__extract_day
+ , subq_21.booking__paid_at__extract_dow
+ , subq_21.booking__paid_at__extract_doy
+ , subq_21.ds__day AS metric_time__day
+ , subq_21.ds__week AS metric_time__week
+ , subq_21.ds__month AS metric_time__month
+ , subq_21.ds__quarter AS metric_time__quarter
+ , subq_21.ds__year AS metric_time__year
+ , subq_21.ds__extract_year AS metric_time__extract_year
+ , subq_21.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_21.ds__extract_month AS metric_time__extract_month
+ , subq_21.ds__extract_day AS metric_time__extract_day
+ , subq_21.ds__extract_dow AS metric_time__extract_dow
+ , subq_21.ds__extract_doy AS metric_time__extract_doy
+ , subq_21.listing
+ , subq_21.guest
+ , subq_21.host
+ , subq_21.booking__listing
+ , subq_21.booking__guest
+ , subq_21.booking__host
+ , subq_21.is_instant
+ , subq_21.booking__is_instant
+ , subq_21.bookings
+ , subq_21.instant_bookings
+ , subq_21.booking_value
+ , subq_21.max_booking_value
+ , subq_21.min_booking_value
+ , subq_21.bookers
+ , subq_21.average_booking_value
+ , subq_21.referred_bookings
+ , subq_21.median_booking_value
+ , subq_21.booking_value_p99
+ , subq_21.discrete_booking_value_p99
+ , subq_21.approximate_continuous_booking_value_p99
+ , subq_21.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_12
- ) subq_13
- ) subq_14
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_21
+ ) subq_22
+ ) subq_23
LEFT OUTER JOIN (
-- Pass Only Elements: ['is_lux_latest', 'listing']
SELECT
- subq_16.listing
- , subq_16.is_lux_latest
+ subq_25.listing
+ , subq_25.is_lux_latest
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_15.ds__day
- , subq_15.ds__week
- , subq_15.ds__month
- , subq_15.ds__quarter
- , subq_15.ds__year
- , subq_15.ds__extract_year
- , subq_15.ds__extract_quarter
- , subq_15.ds__extract_month
- , subq_15.ds__extract_day
- , subq_15.ds__extract_dow
- , subq_15.ds__extract_doy
- , subq_15.created_at__day
- , subq_15.created_at__week
- , subq_15.created_at__month
- , subq_15.created_at__quarter
- , subq_15.created_at__year
- , subq_15.created_at__extract_year
- , subq_15.created_at__extract_quarter
- , subq_15.created_at__extract_month
- , subq_15.created_at__extract_day
- , subq_15.created_at__extract_dow
- , subq_15.created_at__extract_doy
- , subq_15.listing__ds__day
- , subq_15.listing__ds__week
- , subq_15.listing__ds__month
- , subq_15.listing__ds__quarter
- , subq_15.listing__ds__year
- , subq_15.listing__ds__extract_year
- , subq_15.listing__ds__extract_quarter
- , subq_15.listing__ds__extract_month
- , subq_15.listing__ds__extract_day
- , subq_15.listing__ds__extract_dow
- , subq_15.listing__ds__extract_doy
- , subq_15.listing__created_at__day
- , subq_15.listing__created_at__week
- , subq_15.listing__created_at__month
- , subq_15.listing__created_at__quarter
- , subq_15.listing__created_at__year
- , subq_15.listing__created_at__extract_year
- , subq_15.listing__created_at__extract_quarter
- , subq_15.listing__created_at__extract_month
- , subq_15.listing__created_at__extract_day
- , subq_15.listing__created_at__extract_dow
- , subq_15.listing__created_at__extract_doy
- , subq_15.ds__day AS metric_time__day
- , subq_15.ds__week AS metric_time__week
- , subq_15.ds__month AS metric_time__month
- , subq_15.ds__quarter AS metric_time__quarter
- , subq_15.ds__year AS metric_time__year
- , subq_15.ds__extract_year AS metric_time__extract_year
- , subq_15.ds__extract_quarter AS metric_time__extract_quarter
- , subq_15.ds__extract_month AS metric_time__extract_month
- , subq_15.ds__extract_day AS metric_time__extract_day
- , subq_15.ds__extract_dow AS metric_time__extract_dow
- , subq_15.ds__extract_doy AS metric_time__extract_doy
- , subq_15.listing
- , subq_15.user
- , subq_15.listing__user
- , subq_15.country_latest
- , subq_15.is_lux_latest
- , subq_15.capacity_latest
- , subq_15.listing__country_latest
- , subq_15.listing__is_lux_latest
- , subq_15.listing__capacity_latest
- , subq_15.listings
- , subq_15.largest_listing
- , subq_15.smallest_listing
+ subq_24.ds__day
+ , subq_24.ds__week
+ , subq_24.ds__month
+ , subq_24.ds__quarter
+ , subq_24.ds__year
+ , subq_24.ds__extract_year
+ , subq_24.ds__extract_quarter
+ , subq_24.ds__extract_month
+ , subq_24.ds__extract_day
+ , subq_24.ds__extract_dow
+ , subq_24.ds__extract_doy
+ , subq_24.created_at__day
+ , subq_24.created_at__week
+ , subq_24.created_at__month
+ , subq_24.created_at__quarter
+ , subq_24.created_at__year
+ , subq_24.created_at__extract_year
+ , subq_24.created_at__extract_quarter
+ , subq_24.created_at__extract_month
+ , subq_24.created_at__extract_day
+ , subq_24.created_at__extract_dow
+ , subq_24.created_at__extract_doy
+ , subq_24.listing__ds__day
+ , subq_24.listing__ds__week
+ , subq_24.listing__ds__month
+ , subq_24.listing__ds__quarter
+ , subq_24.listing__ds__year
+ , subq_24.listing__ds__extract_year
+ , subq_24.listing__ds__extract_quarter
+ , subq_24.listing__ds__extract_month
+ , subq_24.listing__ds__extract_day
+ , subq_24.listing__ds__extract_dow
+ , subq_24.listing__ds__extract_doy
+ , subq_24.listing__created_at__day
+ , subq_24.listing__created_at__week
+ , subq_24.listing__created_at__month
+ , subq_24.listing__created_at__quarter
+ , subq_24.listing__created_at__year
+ , subq_24.listing__created_at__extract_year
+ , subq_24.listing__created_at__extract_quarter
+ , subq_24.listing__created_at__extract_month
+ , subq_24.listing__created_at__extract_day
+ , subq_24.listing__created_at__extract_dow
+ , subq_24.listing__created_at__extract_doy
+ , subq_24.ds__day AS metric_time__day
+ , subq_24.ds__week AS metric_time__week
+ , subq_24.ds__month AS metric_time__month
+ , subq_24.ds__quarter AS metric_time__quarter
+ , subq_24.ds__year AS metric_time__year
+ , subq_24.ds__extract_year AS metric_time__extract_year
+ , subq_24.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_24.ds__extract_month AS metric_time__extract_month
+ , subq_24.ds__extract_day AS metric_time__extract_day
+ , subq_24.ds__extract_dow AS metric_time__extract_dow
+ , subq_24.ds__extract_doy AS metric_time__extract_doy
+ , subq_24.listing
+ , subq_24.user
+ , subq_24.listing__user
+ , subq_24.country_latest
+ , subq_24.is_lux_latest
+ , subq_24.capacity_latest
+ , subq_24.listing__country_latest
+ , subq_24.listing__is_lux_latest
+ , subq_24.listing__capacity_latest
+ , subq_24.listings
+ , subq_24.largest_listing
+ , subq_24.smallest_listing
FROM (
-- Read Elements From Semantic Model 'listings_latest'
SELECT
1 AS listings
- , listings_latest_src_28005.capacity AS largest_listing
- , listings_latest_src_28005.capacity AS smallest_listing
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS ds__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS created_at__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS created_at__extract_doy
- , listings_latest_src_28005.country AS country_latest
- , listings_latest_src_28005.is_lux AS is_lux_latest
- , listings_latest_src_28005.capacity AS capacity_latest
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__ds__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__ds__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__ds__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__ds__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__ds__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__ds__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__ds__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__ds__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__ds__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__ds__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__ds__extract_doy
- , DATE_TRUNC('day', listings_latest_src_28005.created_at) AS listing__created_at__day
- , DATE_TRUNC('week', listings_latest_src_28005.created_at) AS listing__created_at__week
- , DATE_TRUNC('month', listings_latest_src_28005.created_at) AS listing__created_at__month
- , DATE_TRUNC('quarter', listings_latest_src_28005.created_at) AS listing__created_at__quarter
- , DATE_TRUNC('year', listings_latest_src_28005.created_at) AS listing__created_at__year
- , EXTRACT(year FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_year
- , EXTRACT(quarter FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_quarter
- , EXTRACT(month FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_month
- , EXTRACT(day FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_day
- , EXTRACT(isodow FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_dow
- , EXTRACT(doy FROM listings_latest_src_28005.created_at) AS listing__created_at__extract_doy
- , listings_latest_src_28005.country AS listing__country_latest
- , listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , listings_latest_src_28005.capacity AS listing__capacity_latest
- , listings_latest_src_28005.listing_id AS listing
- , listings_latest_src_28005.user_id AS user
- , listings_latest_src_28005.user_id AS listing__user
- FROM ***************************.dim_listings_latest listings_latest_src_28005
- ) subq_15
- ) subq_16
- ) subq_17
+ , listings_latest_src_28000.capacity AS largest_listing
+ , listings_latest_src_28000.capacity AS smallest_listing
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS created_at__extract_day
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS created_at__extract_doy
+ , 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('day', listings_latest_src_28000.created_at) AS listing__ds__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__ds__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__ds__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__ds__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS listing__ds__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__ds__extract_doy
+ , DATE_TRUNC('day', listings_latest_src_28000.created_at) AS listing__created_at__day
+ , DATE_TRUNC('week', listings_latest_src_28000.created_at) AS listing__created_at__week
+ , DATE_TRUNC('month', listings_latest_src_28000.created_at) AS listing__created_at__month
+ , DATE_TRUNC('quarter', listings_latest_src_28000.created_at) AS listing__created_at__quarter
+ , DATE_TRUNC('year', listings_latest_src_28000.created_at) 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
+ , EXTRACT(day FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_day
+ , EXTRACT(isodow FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_dow
+ , EXTRACT(doy FROM listings_latest_src_28000.created_at) AS listing__created_at__extract_doy
+ , listings_latest_src_28000.country AS listing__country_latest
+ , listings_latest_src_28000.is_lux AS listing__is_lux_latest
+ , listings_latest_src_28000.capacity AS listing__capacity_latest
+ , listings_latest_src_28000.listing_id AS listing
+ , listings_latest_src_28000.user_id AS user
+ , listings_latest_src_28000.user_id AS listing__user
+ FROM ***************************.dim_listings_latest listings_latest_src_28000
+ ) subq_24
+ ) subq_25
+ ) subq_26
ON
- subq_14.listing = subq_17.listing
- ) subq_18
- ) subq_19
+ subq_23.listing = subq_26.listing
+ ) subq_27
+ ) subq_28
WHERE (listing__is_lux_latest) AND (booking__is_instant)
- ) subq_20
- ) subq_21
- ) subq_22
- ) subq_23
+ ) subq_29
+ ) subq_30
+ ) subq_31
+ ) subq_32
CROSS JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_29.booking_value
+ subq_38.booking_value
FROM (
-- Aggregate Measures
SELECT
- SUM(subq_28.booking_value) AS booking_value
+ SUM(subq_37.booking_value) AS booking_value
FROM (
-- Pass Only Elements: ['booking_value',]
SELECT
- subq_27.booking_value
+ subq_36.booking_value
FROM (
-- Constrain Output with WHERE
SELECT
- subq_26.booking__is_instant
- , subq_26.booking_value
+ subq_35.booking__is_instant
+ , subq_35.booking_value
FROM (
-- Pass Only Elements: ['booking_value', 'booking__is_instant']
SELECT
- subq_25.booking__is_instant
- , subq_25.booking_value
+ subq_34.booking__is_instant
+ , subq_34.booking_value
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_24.ds__day
- , subq_24.ds__week
- , subq_24.ds__month
- , subq_24.ds__quarter
- , subq_24.ds__year
- , subq_24.ds__extract_year
- , subq_24.ds__extract_quarter
- , subq_24.ds__extract_month
- , subq_24.ds__extract_day
- , subq_24.ds__extract_dow
- , subq_24.ds__extract_doy
- , subq_24.ds_partitioned__day
- , subq_24.ds_partitioned__week
- , subq_24.ds_partitioned__month
- , subq_24.ds_partitioned__quarter
- , subq_24.ds_partitioned__year
- , subq_24.ds_partitioned__extract_year
- , subq_24.ds_partitioned__extract_quarter
- , subq_24.ds_partitioned__extract_month
- , subq_24.ds_partitioned__extract_day
- , subq_24.ds_partitioned__extract_dow
- , subq_24.ds_partitioned__extract_doy
- , subq_24.paid_at__day
- , subq_24.paid_at__week
- , subq_24.paid_at__month
- , subq_24.paid_at__quarter
- , subq_24.paid_at__year
- , subq_24.paid_at__extract_year
- , subq_24.paid_at__extract_quarter
- , subq_24.paid_at__extract_month
- , subq_24.paid_at__extract_day
- , subq_24.paid_at__extract_dow
- , subq_24.paid_at__extract_doy
- , subq_24.booking__ds__day
- , subq_24.booking__ds__week
- , subq_24.booking__ds__month
- , subq_24.booking__ds__quarter
- , subq_24.booking__ds__year
- , subq_24.booking__ds__extract_year
- , subq_24.booking__ds__extract_quarter
- , subq_24.booking__ds__extract_month
- , subq_24.booking__ds__extract_day
- , subq_24.booking__ds__extract_dow
- , subq_24.booking__ds__extract_doy
- , subq_24.booking__ds_partitioned__day
- , subq_24.booking__ds_partitioned__week
- , subq_24.booking__ds_partitioned__month
- , subq_24.booking__ds_partitioned__quarter
- , subq_24.booking__ds_partitioned__year
- , subq_24.booking__ds_partitioned__extract_year
- , subq_24.booking__ds_partitioned__extract_quarter
- , subq_24.booking__ds_partitioned__extract_month
- , subq_24.booking__ds_partitioned__extract_day
- , subq_24.booking__ds_partitioned__extract_dow
- , subq_24.booking__ds_partitioned__extract_doy
- , subq_24.booking__paid_at__day
- , subq_24.booking__paid_at__week
- , subq_24.booking__paid_at__month
- , subq_24.booking__paid_at__quarter
- , subq_24.booking__paid_at__year
- , subq_24.booking__paid_at__extract_year
- , subq_24.booking__paid_at__extract_quarter
- , subq_24.booking__paid_at__extract_month
- , subq_24.booking__paid_at__extract_day
- , subq_24.booking__paid_at__extract_dow
- , subq_24.booking__paid_at__extract_doy
- , subq_24.ds__day AS metric_time__day
- , subq_24.ds__week AS metric_time__week
- , subq_24.ds__month AS metric_time__month
- , subq_24.ds__quarter AS metric_time__quarter
- , subq_24.ds__year AS metric_time__year
- , subq_24.ds__extract_year AS metric_time__extract_year
- , subq_24.ds__extract_quarter AS metric_time__extract_quarter
- , subq_24.ds__extract_month AS metric_time__extract_month
- , subq_24.ds__extract_day AS metric_time__extract_day
- , subq_24.ds__extract_dow AS metric_time__extract_dow
- , subq_24.ds__extract_doy AS metric_time__extract_doy
- , subq_24.listing
- , subq_24.guest
- , subq_24.host
- , subq_24.booking__listing
- , subq_24.booking__guest
- , subq_24.booking__host
- , subq_24.is_instant
- , subq_24.booking__is_instant
- , subq_24.bookings
- , subq_24.instant_bookings
- , subq_24.booking_value
- , subq_24.max_booking_value
- , subq_24.min_booking_value
- , subq_24.bookers
- , subq_24.average_booking_value
- , subq_24.referred_bookings
- , subq_24.median_booking_value
- , subq_24.booking_value_p99
- , subq_24.discrete_booking_value_p99
- , subq_24.approximate_continuous_booking_value_p99
- , subq_24.approximate_discrete_booking_value_p99
+ subq_33.ds__day
+ , subq_33.ds__week
+ , subq_33.ds__month
+ , subq_33.ds__quarter
+ , subq_33.ds__year
+ , subq_33.ds__extract_year
+ , subq_33.ds__extract_quarter
+ , subq_33.ds__extract_month
+ , subq_33.ds__extract_day
+ , subq_33.ds__extract_dow
+ , subq_33.ds__extract_doy
+ , subq_33.ds_partitioned__day
+ , subq_33.ds_partitioned__week
+ , subq_33.ds_partitioned__month
+ , subq_33.ds_partitioned__quarter
+ , subq_33.ds_partitioned__year
+ , subq_33.ds_partitioned__extract_year
+ , subq_33.ds_partitioned__extract_quarter
+ , subq_33.ds_partitioned__extract_month
+ , subq_33.ds_partitioned__extract_day
+ , subq_33.ds_partitioned__extract_dow
+ , subq_33.ds_partitioned__extract_doy
+ , subq_33.paid_at__day
+ , subq_33.paid_at__week
+ , subq_33.paid_at__month
+ , subq_33.paid_at__quarter
+ , subq_33.paid_at__year
+ , subq_33.paid_at__extract_year
+ , subq_33.paid_at__extract_quarter
+ , subq_33.paid_at__extract_month
+ , subq_33.paid_at__extract_day
+ , subq_33.paid_at__extract_dow
+ , subq_33.paid_at__extract_doy
+ , subq_33.booking__ds__day
+ , subq_33.booking__ds__week
+ , subq_33.booking__ds__month
+ , subq_33.booking__ds__quarter
+ , subq_33.booking__ds__year
+ , subq_33.booking__ds__extract_year
+ , subq_33.booking__ds__extract_quarter
+ , subq_33.booking__ds__extract_month
+ , subq_33.booking__ds__extract_day
+ , subq_33.booking__ds__extract_dow
+ , subq_33.booking__ds__extract_doy
+ , subq_33.booking__ds_partitioned__day
+ , subq_33.booking__ds_partitioned__week
+ , subq_33.booking__ds_partitioned__month
+ , subq_33.booking__ds_partitioned__quarter
+ , subq_33.booking__ds_partitioned__year
+ , subq_33.booking__ds_partitioned__extract_year
+ , subq_33.booking__ds_partitioned__extract_quarter
+ , subq_33.booking__ds_partitioned__extract_month
+ , subq_33.booking__ds_partitioned__extract_day
+ , subq_33.booking__ds_partitioned__extract_dow
+ , subq_33.booking__ds_partitioned__extract_doy
+ , subq_33.booking__paid_at__day
+ , subq_33.booking__paid_at__week
+ , subq_33.booking__paid_at__month
+ , subq_33.booking__paid_at__quarter
+ , subq_33.booking__paid_at__year
+ , subq_33.booking__paid_at__extract_year
+ , subq_33.booking__paid_at__extract_quarter
+ , subq_33.booking__paid_at__extract_month
+ , subq_33.booking__paid_at__extract_day
+ , subq_33.booking__paid_at__extract_dow
+ , subq_33.booking__paid_at__extract_doy
+ , subq_33.ds__day AS metric_time__day
+ , subq_33.ds__week AS metric_time__week
+ , subq_33.ds__month AS metric_time__month
+ , subq_33.ds__quarter AS metric_time__quarter
+ , subq_33.ds__year AS metric_time__year
+ , subq_33.ds__extract_year AS metric_time__extract_year
+ , subq_33.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_33.ds__extract_month AS metric_time__extract_month
+ , subq_33.ds__extract_day AS metric_time__extract_day
+ , subq_33.ds__extract_dow AS metric_time__extract_dow
+ , subq_33.ds__extract_doy AS metric_time__extract_doy
+ , subq_33.listing
+ , subq_33.guest
+ , subq_33.host
+ , subq_33.booking__listing
+ , subq_33.booking__guest
+ , subq_33.booking__host
+ , subq_33.is_instant
+ , subq_33.booking__is_instant
+ , subq_33.bookings
+ , subq_33.instant_bookings
+ , subq_33.booking_value
+ , subq_33.max_booking_value
+ , subq_33.min_booking_value
+ , subq_33.bookers
+ , subq_33.average_booking_value
+ , subq_33.referred_bookings
+ , subq_33.median_booking_value
+ , subq_33.booking_value_p99
+ , subq_33.discrete_booking_value_p99
+ , subq_33.approximate_continuous_booking_value_p99
+ , subq_33.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_24
- ) subq_25
- ) subq_26
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_33
+ ) subq_34
+ ) subq_35
WHERE booking__is_instant
- ) subq_27
- ) subq_28
- ) subq_29
- ) subq_30
- ) subq_31
-) subq_32
+ ) subq_36
+ ) subq_37
+ ) subq_38
+ ) subq_39
+ ) subq_40
+) subq_41
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_filters__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_filters__plan0_optimized.sql
index 14649c62dd..35859d3713 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_filters__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_filters__plan0_optimized.sql
@@ -8,9 +8,9 @@ FROM (
FROM (
-- Combine Aggregated Outputs
SELECT
- MAX(subq_44.average_booking_value) AS average_booking_value
- , MAX(subq_56.bookings) AS bookings
- , MAX(subq_63.booking_value) AS booking_value
+ MAX(subq_53.average_booking_value) AS average_booking_value
+ , MAX(subq_65.bookings) AS bookings
+ , MAX(subq_72.booking_value) AS booking_value
FROM (
-- Constrain Output with WHERE
-- Pass Only Elements: ['average_booking_value',]
@@ -22,17 +22,17 @@ FROM (
-- Join Standard Outputs
-- Pass Only Elements: ['average_booking_value', 'listing__is_lux_latest', 'booking__is_instant']
SELECT
- bookings_source_src_28001.is_instant AS booking__is_instant
- , listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , bookings_source_src_28001.booking_value AS average_booking_value
- FROM ***************************.fct_bookings bookings_source_src_28001
+ bookings_source_src_28000.is_instant AS booking__is_instant
+ , 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
LEFT OUTER JOIN
- ***************************.dim_listings_latest listings_latest_src_28005
+ ***************************.dim_listings_latest listings_latest_src_28000
ON
- bookings_source_src_28001.listing_id = listings_latest_src_28005.listing_id
- ) subq_40
+ bookings_source_src_28000.listing_id = listings_latest_src_28000.listing_id
+ ) subq_49
WHERE (listing__is_lux_latest) AND (booking__is_instant)
- ) subq_44
+ ) subq_53
CROSS JOIN (
-- Constrain Output with WHERE
-- Pass Only Elements: ['bookings',]
@@ -44,9 +44,9 @@ FROM (
-- Join Standard Outputs
-- Pass Only Elements: ['bookings', 'listing__is_lux_latest', 'booking__is_instant']
SELECT
- subq_47.booking__is_instant AS booking__is_instant
- , listings_latest_src_28005.is_lux AS listing__is_lux_latest
- , subq_47.bookings AS bookings
+ subq_56.booking__is_instant AS booking__is_instant
+ , listings_latest_src_28000.is_lux AS listing__is_lux_latest
+ , subq_56.bookings AS bookings
FROM (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
@@ -55,15 +55,15 @@ FROM (
listing_id AS listing
, is_instant AS booking__is_instant
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_47
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_56
LEFT OUTER JOIN
- ***************************.dim_listings_latest listings_latest_src_28005
+ ***************************.dim_listings_latest listings_latest_src_28000
ON
- subq_47.listing = listings_latest_src_28005.listing_id
- ) subq_52
+ subq_56.listing = listings_latest_src_28000.listing_id
+ ) subq_61
WHERE (listing__is_lux_latest) AND (booking__is_instant)
- ) subq_56
+ ) subq_65
CROSS JOIN (
-- Constrain Output with WHERE
-- Pass Only Elements: ['booking_value',]
@@ -78,9 +78,9 @@ FROM (
SELECT
is_instant AS booking__is_instant
, booking_value
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_59
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_68
WHERE booking__is_instant
- ) subq_63
- ) subq_64
-) subq_65
+ ) subq_72
+ ) subq_73
+) subq_74
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_offsets__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_offsets__plan0.sql
index f76ae0aca9..49227536c3 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_offsets__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_offsets__plan0.sql
@@ -1,339 +1,339 @@
-- Compute Metrics via Expressions
SELECT
- subq_11.metric_time__day
+ subq_20.metric_time__day
, 2 * bookings_offset_once AS bookings_offset_twice
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_9.metric_time__day AS metric_time__day
- , subq_8.bookings_offset_once AS bookings_offset_once
+ subq_18.metric_time__day AS metric_time__day
+ , subq_17.bookings_offset_once AS bookings_offset_once
FROM (
-- Time Spine
SELECT
- subq_10.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_10
- ) subq_9
+ subq_19.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_19
+ ) subq_18
INNER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_7.metric_time__day
+ subq_16.metric_time__day
, 2 * bookings AS bookings_offset_once
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_6.metric_time__day
- , subq_6.bookings
+ subq_15.metric_time__day
+ , subq_15.bookings
FROM (
-- Aggregate Measures
SELECT
- subq_5.metric_time__day
- , SUM(subq_5.bookings) AS bookings
+ subq_14.metric_time__day
+ , SUM(subq_14.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__day']
SELECT
- subq_4.metric_time__day
- , subq_4.bookings
+ subq_13.metric_time__day
+ , subq_13.bookings
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_2.metric_time__day AS metric_time__day
- , subq_1.ds__day AS ds__day
- , subq_1.ds__week AS ds__week
- , subq_1.ds__month AS ds__month
- , subq_1.ds__quarter AS ds__quarter
- , subq_1.ds__year AS ds__year
- , subq_1.ds__extract_year AS ds__extract_year
- , subq_1.ds__extract_quarter AS ds__extract_quarter
- , subq_1.ds__extract_month AS ds__extract_month
- , subq_1.ds__extract_day AS ds__extract_day
- , subq_1.ds__extract_dow AS ds__extract_dow
- , subq_1.ds__extract_doy AS ds__extract_doy
- , subq_1.ds_partitioned__day AS ds_partitioned__day
- , subq_1.ds_partitioned__week AS ds_partitioned__week
- , subq_1.ds_partitioned__month AS ds_partitioned__month
- , subq_1.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_1.ds_partitioned__year AS ds_partitioned__year
- , subq_1.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_1.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_1.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_1.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_1.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_1.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_1.paid_at__day AS paid_at__day
- , subq_1.paid_at__week AS paid_at__week
- , subq_1.paid_at__month AS paid_at__month
- , subq_1.paid_at__quarter AS paid_at__quarter
- , subq_1.paid_at__year AS paid_at__year
- , subq_1.paid_at__extract_year AS paid_at__extract_year
- , subq_1.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_1.paid_at__extract_month AS paid_at__extract_month
- , subq_1.paid_at__extract_day AS paid_at__extract_day
- , subq_1.paid_at__extract_dow AS paid_at__extract_dow
- , subq_1.paid_at__extract_doy AS paid_at__extract_doy
- , subq_1.booking__ds__day AS booking__ds__day
- , subq_1.booking__ds__week AS booking__ds__week
- , subq_1.booking__ds__month AS booking__ds__month
- , subq_1.booking__ds__quarter AS booking__ds__quarter
- , subq_1.booking__ds__year AS booking__ds__year
- , subq_1.booking__ds__extract_year AS booking__ds__extract_year
- , subq_1.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_1.booking__ds__extract_month AS booking__ds__extract_month
- , subq_1.booking__ds__extract_day AS booking__ds__extract_day
- , subq_1.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_1.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_1.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_1.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_1.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_1.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_1.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_1.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_1.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_1.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_1.booking__paid_at__day AS booking__paid_at__day
- , subq_1.booking__paid_at__week AS booking__paid_at__week
- , subq_1.booking__paid_at__month AS booking__paid_at__month
- , subq_1.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_1.booking__paid_at__year AS booking__paid_at__year
- , subq_1.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_1.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_1.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_1.listing AS listing
- , subq_1.guest AS guest
- , subq_1.host AS host
- , subq_1.booking__listing AS booking__listing
- , subq_1.booking__guest AS booking__guest
- , subq_1.booking__host AS booking__host
- , subq_1.is_instant AS is_instant
- , subq_1.booking__is_instant AS booking__is_instant
- , subq_1.bookings AS bookings
- , subq_1.instant_bookings AS instant_bookings
- , subq_1.booking_value AS booking_value
- , subq_1.max_booking_value AS max_booking_value
- , subq_1.min_booking_value AS min_booking_value
- , subq_1.bookers AS bookers
- , subq_1.average_booking_value AS average_booking_value
- , subq_1.referred_bookings AS referred_bookings
- , subq_1.median_booking_value AS median_booking_value
- , subq_1.booking_value_p99 AS booking_value_p99
- , subq_1.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_1.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_1.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ subq_11.metric_time__day AS metric_time__day
+ , subq_10.ds__day AS ds__day
+ , subq_10.ds__week AS ds__week
+ , subq_10.ds__month AS ds__month
+ , subq_10.ds__quarter AS ds__quarter
+ , subq_10.ds__year AS ds__year
+ , subq_10.ds__extract_year AS ds__extract_year
+ , subq_10.ds__extract_quarter AS ds__extract_quarter
+ , subq_10.ds__extract_month AS ds__extract_month
+ , subq_10.ds__extract_day AS ds__extract_day
+ , subq_10.ds__extract_dow AS ds__extract_dow
+ , subq_10.ds__extract_doy AS ds__extract_doy
+ , subq_10.ds_partitioned__day AS ds_partitioned__day
+ , subq_10.ds_partitioned__week AS ds_partitioned__week
+ , subq_10.ds_partitioned__month AS ds_partitioned__month
+ , subq_10.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_10.ds_partitioned__year AS ds_partitioned__year
+ , subq_10.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_10.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_10.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_10.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_10.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_10.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_10.paid_at__day AS paid_at__day
+ , subq_10.paid_at__week AS paid_at__week
+ , subq_10.paid_at__month AS paid_at__month
+ , subq_10.paid_at__quarter AS paid_at__quarter
+ , subq_10.paid_at__year AS paid_at__year
+ , subq_10.paid_at__extract_year AS paid_at__extract_year
+ , subq_10.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_10.paid_at__extract_month AS paid_at__extract_month
+ , subq_10.paid_at__extract_day AS paid_at__extract_day
+ , subq_10.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_10.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_10.booking__ds__day AS booking__ds__day
+ , subq_10.booking__ds__week AS booking__ds__week
+ , subq_10.booking__ds__month AS booking__ds__month
+ , subq_10.booking__ds__quarter AS booking__ds__quarter
+ , subq_10.booking__ds__year AS booking__ds__year
+ , subq_10.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_10.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_10.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_10.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_10.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_10.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_10.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_10.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_10.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_10.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_10.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_10.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_10.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_10.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_10.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_10.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_10.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_10.booking__paid_at__day AS booking__paid_at__day
+ , subq_10.booking__paid_at__week AS booking__paid_at__week
+ , subq_10.booking__paid_at__month AS booking__paid_at__month
+ , subq_10.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_10.booking__paid_at__year AS booking__paid_at__year
+ , subq_10.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_10.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_10.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_10.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_10.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_10.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_10.listing AS listing
+ , subq_10.guest AS guest
+ , subq_10.host AS host
+ , subq_10.booking__listing AS booking__listing
+ , subq_10.booking__guest AS booking__guest
+ , subq_10.booking__host AS booking__host
+ , subq_10.is_instant AS is_instant
+ , subq_10.booking__is_instant AS booking__is_instant
+ , subq_10.bookings AS bookings
+ , subq_10.instant_bookings AS instant_bookings
+ , subq_10.booking_value AS booking_value
+ , subq_10.max_booking_value AS max_booking_value
+ , subq_10.min_booking_value AS min_booking_value
+ , subq_10.bookers AS bookers
+ , subq_10.average_booking_value AS average_booking_value
+ , subq_10.referred_bookings AS referred_bookings
+ , subq_10.median_booking_value AS median_booking_value
+ , subq_10.booking_value_p99 AS booking_value_p99
+ , subq_10.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_10.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_10.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_3.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_3
- ) subq_2
+ subq_12.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_12
+ ) subq_11
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
ON
- subq_2.metric_time__day - MAKE_INTERVAL(days => 5) = subq_1.metric_time__day
- ) subq_4
- ) subq_5
+ subq_11.metric_time__day - MAKE_INTERVAL(days => 5) = subq_10.metric_time__day
+ ) subq_13
+ ) subq_14
GROUP BY
- subq_5.metric_time__day
- ) subq_6
- ) subq_7
- ) subq_8
+ subq_14.metric_time__day
+ ) subq_15
+ ) subq_16
+ ) subq_17
ON
- subq_9.metric_time__day - MAKE_INTERVAL(days => 2) = subq_8.metric_time__day
-) subq_11
+ subq_18.metric_time__day - MAKE_INTERVAL(days => 2) = subq_17.metric_time__day
+) subq_20
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_offsets__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_offsets__plan0_optimized.sql
index dcf61d5017..dd486ba0ad 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_offsets__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_offsets__plan0_optimized.sql
@@ -5,9 +5,9 @@ SELECT
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_22.ds AS metric_time__day
- , subq_20.bookings_offset_once AS bookings_offset_once
- FROM ***************************.mf_time_spine subq_22
+ subq_31.ds AS metric_time__day
+ , subq_29.bookings_offset_once AS bookings_offset_once
+ FROM ***************************.mf_time_spine subq_31
INNER JOIN (
-- Compute Metrics via Expressions
SELECT
@@ -19,23 +19,23 @@ FROM (
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_15.ds AS metric_time__day
- , SUM(subq_13.bookings) AS bookings
- FROM ***************************.mf_time_spine subq_15
+ subq_24.ds AS metric_time__day
+ , SUM(subq_22.bookings) AS bookings
+ FROM ***************************.mf_time_spine subq_24
INNER JOIN (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
SELECT
DATE_TRUNC('day', ds) AS metric_time__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_13
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_22
ON
- subq_15.ds - MAKE_INTERVAL(days => 5) = subq_13.metric_time__day
+ subq_24.ds - MAKE_INTERVAL(days => 5) = subq_22.metric_time__day
GROUP BY
- subq_15.ds
- ) subq_19
- ) subq_20
+ subq_24.ds
+ ) subq_28
+ ) subq_29
ON
- subq_22.ds - MAKE_INTERVAL(days => 2) = subq_20.metric_time__day
-) subq_23
+ subq_31.ds - MAKE_INTERVAL(days => 2) = subq_29.metric_time__day
+) subq_32
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_offsets_with_time_constraint__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_offsets_with_time_constraint__plan0.sql
index 41f0e1b70c..1787519f1d 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_offsets_with_time_constraint__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_offsets_with_time_constraint__plan0.sql
@@ -1,340 +1,340 @@
-- Compute Metrics via Expressions
SELECT
- subq_11.metric_time__day
+ subq_20.metric_time__day
, 2 * bookings_offset_once AS bookings_offset_twice
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_9.metric_time__day AS metric_time__day
- , subq_8.bookings_offset_once AS bookings_offset_once
+ subq_18.metric_time__day AS metric_time__day
+ , subq_17.bookings_offset_once AS bookings_offset_once
FROM (
-- Time Spine
SELECT
- subq_10.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_10
- WHERE subq_10.ds BETWEEN '2020-01-12' AND '2020-01-13'
- ) subq_9
+ subq_19.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_19
+ WHERE subq_19.ds BETWEEN '2020-01-12' AND '2020-01-13'
+ ) subq_18
INNER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_7.metric_time__day
+ subq_16.metric_time__day
, 2 * bookings AS bookings_offset_once
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_6.metric_time__day
- , subq_6.bookings
+ subq_15.metric_time__day
+ , subq_15.bookings
FROM (
-- Aggregate Measures
SELECT
- subq_5.metric_time__day
- , SUM(subq_5.bookings) AS bookings
+ subq_14.metric_time__day
+ , SUM(subq_14.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__day']
SELECT
- subq_4.metric_time__day
- , subq_4.bookings
+ subq_13.metric_time__day
+ , subq_13.bookings
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_2.metric_time__day AS metric_time__day
- , subq_1.ds__day AS ds__day
- , subq_1.ds__week AS ds__week
- , subq_1.ds__month AS ds__month
- , subq_1.ds__quarter AS ds__quarter
- , subq_1.ds__year AS ds__year
- , subq_1.ds__extract_year AS ds__extract_year
- , subq_1.ds__extract_quarter AS ds__extract_quarter
- , subq_1.ds__extract_month AS ds__extract_month
- , subq_1.ds__extract_day AS ds__extract_day
- , subq_1.ds__extract_dow AS ds__extract_dow
- , subq_1.ds__extract_doy AS ds__extract_doy
- , subq_1.ds_partitioned__day AS ds_partitioned__day
- , subq_1.ds_partitioned__week AS ds_partitioned__week
- , subq_1.ds_partitioned__month AS ds_partitioned__month
- , subq_1.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_1.ds_partitioned__year AS ds_partitioned__year
- , subq_1.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_1.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_1.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_1.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_1.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_1.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_1.paid_at__day AS paid_at__day
- , subq_1.paid_at__week AS paid_at__week
- , subq_1.paid_at__month AS paid_at__month
- , subq_1.paid_at__quarter AS paid_at__quarter
- , subq_1.paid_at__year AS paid_at__year
- , subq_1.paid_at__extract_year AS paid_at__extract_year
- , subq_1.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_1.paid_at__extract_month AS paid_at__extract_month
- , subq_1.paid_at__extract_day AS paid_at__extract_day
- , subq_1.paid_at__extract_dow AS paid_at__extract_dow
- , subq_1.paid_at__extract_doy AS paid_at__extract_doy
- , subq_1.booking__ds__day AS booking__ds__day
- , subq_1.booking__ds__week AS booking__ds__week
- , subq_1.booking__ds__month AS booking__ds__month
- , subq_1.booking__ds__quarter AS booking__ds__quarter
- , subq_1.booking__ds__year AS booking__ds__year
- , subq_1.booking__ds__extract_year AS booking__ds__extract_year
- , subq_1.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_1.booking__ds__extract_month AS booking__ds__extract_month
- , subq_1.booking__ds__extract_day AS booking__ds__extract_day
- , subq_1.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_1.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_1.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_1.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_1.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_1.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_1.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_1.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_1.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_1.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_1.booking__paid_at__day AS booking__paid_at__day
- , subq_1.booking__paid_at__week AS booking__paid_at__week
- , subq_1.booking__paid_at__month AS booking__paid_at__month
- , subq_1.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_1.booking__paid_at__year AS booking__paid_at__year
- , subq_1.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_1.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_1.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_1.listing AS listing
- , subq_1.guest AS guest
- , subq_1.host AS host
- , subq_1.booking__listing AS booking__listing
- , subq_1.booking__guest AS booking__guest
- , subq_1.booking__host AS booking__host
- , subq_1.is_instant AS is_instant
- , subq_1.booking__is_instant AS booking__is_instant
- , subq_1.bookings AS bookings
- , subq_1.instant_bookings AS instant_bookings
- , subq_1.booking_value AS booking_value
- , subq_1.max_booking_value AS max_booking_value
- , subq_1.min_booking_value AS min_booking_value
- , subq_1.bookers AS bookers
- , subq_1.average_booking_value AS average_booking_value
- , subq_1.referred_bookings AS referred_bookings
- , subq_1.median_booking_value AS median_booking_value
- , subq_1.booking_value_p99 AS booking_value_p99
- , subq_1.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_1.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_1.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ subq_11.metric_time__day AS metric_time__day
+ , subq_10.ds__day AS ds__day
+ , subq_10.ds__week AS ds__week
+ , subq_10.ds__month AS ds__month
+ , subq_10.ds__quarter AS ds__quarter
+ , subq_10.ds__year AS ds__year
+ , subq_10.ds__extract_year AS ds__extract_year
+ , subq_10.ds__extract_quarter AS ds__extract_quarter
+ , subq_10.ds__extract_month AS ds__extract_month
+ , subq_10.ds__extract_day AS ds__extract_day
+ , subq_10.ds__extract_dow AS ds__extract_dow
+ , subq_10.ds__extract_doy AS ds__extract_doy
+ , subq_10.ds_partitioned__day AS ds_partitioned__day
+ , subq_10.ds_partitioned__week AS ds_partitioned__week
+ , subq_10.ds_partitioned__month AS ds_partitioned__month
+ , subq_10.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_10.ds_partitioned__year AS ds_partitioned__year
+ , subq_10.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_10.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_10.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_10.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_10.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_10.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_10.paid_at__day AS paid_at__day
+ , subq_10.paid_at__week AS paid_at__week
+ , subq_10.paid_at__month AS paid_at__month
+ , subq_10.paid_at__quarter AS paid_at__quarter
+ , subq_10.paid_at__year AS paid_at__year
+ , subq_10.paid_at__extract_year AS paid_at__extract_year
+ , subq_10.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_10.paid_at__extract_month AS paid_at__extract_month
+ , subq_10.paid_at__extract_day AS paid_at__extract_day
+ , subq_10.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_10.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_10.booking__ds__day AS booking__ds__day
+ , subq_10.booking__ds__week AS booking__ds__week
+ , subq_10.booking__ds__month AS booking__ds__month
+ , subq_10.booking__ds__quarter AS booking__ds__quarter
+ , subq_10.booking__ds__year AS booking__ds__year
+ , subq_10.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_10.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_10.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_10.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_10.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_10.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_10.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_10.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_10.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_10.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_10.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_10.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_10.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_10.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_10.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_10.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_10.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_10.booking__paid_at__day AS booking__paid_at__day
+ , subq_10.booking__paid_at__week AS booking__paid_at__week
+ , subq_10.booking__paid_at__month AS booking__paid_at__month
+ , subq_10.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_10.booking__paid_at__year AS booking__paid_at__year
+ , subq_10.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_10.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_10.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_10.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_10.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_10.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_10.listing AS listing
+ , subq_10.guest AS guest
+ , subq_10.host AS host
+ , subq_10.booking__listing AS booking__listing
+ , subq_10.booking__guest AS booking__guest
+ , subq_10.booking__host AS booking__host
+ , subq_10.is_instant AS is_instant
+ , subq_10.booking__is_instant AS booking__is_instant
+ , subq_10.bookings AS bookings
+ , subq_10.instant_bookings AS instant_bookings
+ , subq_10.booking_value AS booking_value
+ , subq_10.max_booking_value AS max_booking_value
+ , subq_10.min_booking_value AS min_booking_value
+ , subq_10.bookers AS bookers
+ , subq_10.average_booking_value AS average_booking_value
+ , subq_10.referred_bookings AS referred_bookings
+ , subq_10.median_booking_value AS median_booking_value
+ , subq_10.booking_value_p99 AS booking_value_p99
+ , subq_10.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_10.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_10.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_3.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_3
- ) subq_2
+ subq_12.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_12
+ ) subq_11
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
ON
- subq_2.metric_time__day - MAKE_INTERVAL(days => 5) = subq_1.metric_time__day
- ) subq_4
- ) subq_5
+ subq_11.metric_time__day - MAKE_INTERVAL(days => 5) = subq_10.metric_time__day
+ ) subq_13
+ ) subq_14
GROUP BY
- subq_5.metric_time__day
- ) subq_6
- ) subq_7
- ) subq_8
+ subq_14.metric_time__day
+ ) subq_15
+ ) subq_16
+ ) subq_17
ON
- subq_9.metric_time__day - MAKE_INTERVAL(days => 2) = subq_8.metric_time__day
-) subq_11
+ subq_18.metric_time__day - MAKE_INTERVAL(days => 2) = subq_17.metric_time__day
+) subq_20
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_offsets_with_time_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_offsets_with_time_constraint__plan0_optimized.sql
index e5b6f01b58..b0f023c10d 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_offsets_with_time_constraint__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_offsets_with_time_constraint__plan0_optimized.sql
@@ -5,15 +5,15 @@ SELECT
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_21.metric_time__day AS metric_time__day
- , subq_20.bookings_offset_once AS bookings_offset_once
+ subq_30.metric_time__day AS metric_time__day
+ , subq_29.bookings_offset_once AS bookings_offset_once
FROM (
-- Time Spine
SELECT
ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_22
+ FROM ***************************.mf_time_spine subq_31
WHERE ds BETWEEN '2020-01-12' AND '2020-01-13'
- ) subq_21
+ ) subq_30
INNER JOIN (
-- Compute Metrics via Expressions
SELECT
@@ -25,23 +25,23 @@ FROM (
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_15.ds AS metric_time__day
- , SUM(subq_13.bookings) AS bookings
- FROM ***************************.mf_time_spine subq_15
+ subq_24.ds AS metric_time__day
+ , SUM(subq_22.bookings) AS bookings
+ FROM ***************************.mf_time_spine subq_24
INNER JOIN (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
SELECT
DATE_TRUNC('day', ds) AS metric_time__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_13
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_22
ON
- subq_15.ds - MAKE_INTERVAL(days => 5) = subq_13.metric_time__day
+ subq_24.ds - MAKE_INTERVAL(days => 5) = subq_22.metric_time__day
GROUP BY
- subq_15.ds
- ) subq_19
- ) subq_20
+ subq_24.ds
+ ) subq_28
+ ) subq_29
ON
- subq_21.metric_time__day - MAKE_INTERVAL(days => 2) = subq_20.metric_time__day
-) subq_23
+ subq_30.metric_time__day - MAKE_INTERVAL(days => 2) = subq_29.metric_time__day
+) subq_32
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_offsets_with_where_constraint__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_offsets_with_where_constraint__plan0.sql
index 3fa4be6986..6f4645d17b 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_offsets_with_where_constraint__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_offsets_with_where_constraint__plan0.sql
@@ -1,346 +1,346 @@
-- Compute Metrics via Expressions
SELECT
- subq_12.metric_time__day
+ subq_21.metric_time__day
, 2 * bookings_offset_once AS bookings_offset_twice
FROM (
-- Constrain Output with WHERE
SELECT
- subq_11.metric_time__day
- , subq_11.bookings_offset_once
+ subq_20.metric_time__day
+ , subq_20.bookings_offset_once
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_9.metric_time__day AS metric_time__day
- , subq_8.bookings_offset_once AS bookings_offset_once
+ subq_18.metric_time__day AS metric_time__day
+ , subq_17.bookings_offset_once AS bookings_offset_once
FROM (
-- Time Spine
SELECT
- subq_10.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_10
- ) subq_9
+ subq_19.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_19
+ ) subq_18
INNER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_7.metric_time__day
+ subq_16.metric_time__day
, 2 * bookings AS bookings_offset_once
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_6.metric_time__day
- , subq_6.bookings
+ subq_15.metric_time__day
+ , subq_15.bookings
FROM (
-- Aggregate Measures
SELECT
- subq_5.metric_time__day
- , SUM(subq_5.bookings) AS bookings
+ subq_14.metric_time__day
+ , SUM(subq_14.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__day']
SELECT
- subq_4.metric_time__day
- , subq_4.bookings
+ subq_13.metric_time__day
+ , subq_13.bookings
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_2.metric_time__day AS metric_time__day
- , subq_1.ds__day AS ds__day
- , subq_1.ds__week AS ds__week
- , subq_1.ds__month AS ds__month
- , subq_1.ds__quarter AS ds__quarter
- , subq_1.ds__year AS ds__year
- , subq_1.ds__extract_year AS ds__extract_year
- , subq_1.ds__extract_quarter AS ds__extract_quarter
- , subq_1.ds__extract_month AS ds__extract_month
- , subq_1.ds__extract_day AS ds__extract_day
- , subq_1.ds__extract_dow AS ds__extract_dow
- , subq_1.ds__extract_doy AS ds__extract_doy
- , subq_1.ds_partitioned__day AS ds_partitioned__day
- , subq_1.ds_partitioned__week AS ds_partitioned__week
- , subq_1.ds_partitioned__month AS ds_partitioned__month
- , subq_1.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_1.ds_partitioned__year AS ds_partitioned__year
- , subq_1.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_1.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_1.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_1.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_1.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_1.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_1.paid_at__day AS paid_at__day
- , subq_1.paid_at__week AS paid_at__week
- , subq_1.paid_at__month AS paid_at__month
- , subq_1.paid_at__quarter AS paid_at__quarter
- , subq_1.paid_at__year AS paid_at__year
- , subq_1.paid_at__extract_year AS paid_at__extract_year
- , subq_1.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_1.paid_at__extract_month AS paid_at__extract_month
- , subq_1.paid_at__extract_day AS paid_at__extract_day
- , subq_1.paid_at__extract_dow AS paid_at__extract_dow
- , subq_1.paid_at__extract_doy AS paid_at__extract_doy
- , subq_1.booking__ds__day AS booking__ds__day
- , subq_1.booking__ds__week AS booking__ds__week
- , subq_1.booking__ds__month AS booking__ds__month
- , subq_1.booking__ds__quarter AS booking__ds__quarter
- , subq_1.booking__ds__year AS booking__ds__year
- , subq_1.booking__ds__extract_year AS booking__ds__extract_year
- , subq_1.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_1.booking__ds__extract_month AS booking__ds__extract_month
- , subq_1.booking__ds__extract_day AS booking__ds__extract_day
- , subq_1.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_1.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_1.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_1.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_1.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_1.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_1.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_1.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_1.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_1.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_1.booking__paid_at__day AS booking__paid_at__day
- , subq_1.booking__paid_at__week AS booking__paid_at__week
- , subq_1.booking__paid_at__month AS booking__paid_at__month
- , subq_1.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_1.booking__paid_at__year AS booking__paid_at__year
- , subq_1.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_1.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_1.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_1.listing AS listing
- , subq_1.guest AS guest
- , subq_1.host AS host
- , subq_1.booking__listing AS booking__listing
- , subq_1.booking__guest AS booking__guest
- , subq_1.booking__host AS booking__host
- , subq_1.is_instant AS is_instant
- , subq_1.booking__is_instant AS booking__is_instant
- , subq_1.bookings AS bookings
- , subq_1.instant_bookings AS instant_bookings
- , subq_1.booking_value AS booking_value
- , subq_1.max_booking_value AS max_booking_value
- , subq_1.min_booking_value AS min_booking_value
- , subq_1.bookers AS bookers
- , subq_1.average_booking_value AS average_booking_value
- , subq_1.referred_bookings AS referred_bookings
- , subq_1.median_booking_value AS median_booking_value
- , subq_1.booking_value_p99 AS booking_value_p99
- , subq_1.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_1.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_1.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ subq_11.metric_time__day AS metric_time__day
+ , subq_10.ds__day AS ds__day
+ , subq_10.ds__week AS ds__week
+ , subq_10.ds__month AS ds__month
+ , subq_10.ds__quarter AS ds__quarter
+ , subq_10.ds__year AS ds__year
+ , subq_10.ds__extract_year AS ds__extract_year
+ , subq_10.ds__extract_quarter AS ds__extract_quarter
+ , subq_10.ds__extract_month AS ds__extract_month
+ , subq_10.ds__extract_day AS ds__extract_day
+ , subq_10.ds__extract_dow AS ds__extract_dow
+ , subq_10.ds__extract_doy AS ds__extract_doy
+ , subq_10.ds_partitioned__day AS ds_partitioned__day
+ , subq_10.ds_partitioned__week AS ds_partitioned__week
+ , subq_10.ds_partitioned__month AS ds_partitioned__month
+ , subq_10.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_10.ds_partitioned__year AS ds_partitioned__year
+ , subq_10.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_10.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_10.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_10.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_10.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_10.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_10.paid_at__day AS paid_at__day
+ , subq_10.paid_at__week AS paid_at__week
+ , subq_10.paid_at__month AS paid_at__month
+ , subq_10.paid_at__quarter AS paid_at__quarter
+ , subq_10.paid_at__year AS paid_at__year
+ , subq_10.paid_at__extract_year AS paid_at__extract_year
+ , subq_10.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_10.paid_at__extract_month AS paid_at__extract_month
+ , subq_10.paid_at__extract_day AS paid_at__extract_day
+ , subq_10.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_10.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_10.booking__ds__day AS booking__ds__day
+ , subq_10.booking__ds__week AS booking__ds__week
+ , subq_10.booking__ds__month AS booking__ds__month
+ , subq_10.booking__ds__quarter AS booking__ds__quarter
+ , subq_10.booking__ds__year AS booking__ds__year
+ , subq_10.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_10.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_10.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_10.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_10.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_10.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_10.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_10.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_10.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_10.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_10.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_10.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_10.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_10.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_10.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_10.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_10.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_10.booking__paid_at__day AS booking__paid_at__day
+ , subq_10.booking__paid_at__week AS booking__paid_at__week
+ , subq_10.booking__paid_at__month AS booking__paid_at__month
+ , subq_10.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_10.booking__paid_at__year AS booking__paid_at__year
+ , subq_10.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_10.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_10.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_10.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_10.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_10.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_10.listing AS listing
+ , subq_10.guest AS guest
+ , subq_10.host AS host
+ , subq_10.booking__listing AS booking__listing
+ , subq_10.booking__guest AS booking__guest
+ , subq_10.booking__host AS booking__host
+ , subq_10.is_instant AS is_instant
+ , subq_10.booking__is_instant AS booking__is_instant
+ , subq_10.bookings AS bookings
+ , subq_10.instant_bookings AS instant_bookings
+ , subq_10.booking_value AS booking_value
+ , subq_10.max_booking_value AS max_booking_value
+ , subq_10.min_booking_value AS min_booking_value
+ , subq_10.bookers AS bookers
+ , subq_10.average_booking_value AS average_booking_value
+ , subq_10.referred_bookings AS referred_bookings
+ , subq_10.median_booking_value AS median_booking_value
+ , subq_10.booking_value_p99 AS booking_value_p99
+ , subq_10.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_10.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_10.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_3.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_3
- ) subq_2
+ subq_12.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_12
+ ) subq_11
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
ON
- subq_2.metric_time__day - MAKE_INTERVAL(days => 5) = subq_1.metric_time__day
- ) subq_4
- ) subq_5
+ subq_11.metric_time__day - MAKE_INTERVAL(days => 5) = subq_10.metric_time__day
+ ) subq_13
+ ) subq_14
GROUP BY
- subq_5.metric_time__day
- ) subq_6
- ) subq_7
- ) subq_8
+ subq_14.metric_time__day
+ ) subq_15
+ ) subq_16
+ ) subq_17
ON
- subq_9.metric_time__day - MAKE_INTERVAL(days => 2) = subq_8.metric_time__day
- ) subq_11
+ subq_18.metric_time__day - MAKE_INTERVAL(days => 2) = subq_17.metric_time__day
+ ) subq_20
WHERE metric_time__day = '2020-01-12' or metric_time__day = '2020-01-13'
-) subq_12
+) subq_21
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_offsets_with_where_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_offsets_with_where_constraint__plan0_optimized.sql
index a6a237f85e..0a7d172195 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_offsets_with_where_constraint__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_nested_offsets_with_where_constraint__plan0_optimized.sql
@@ -10,9 +10,9 @@ FROM (
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_23.ds AS metric_time__day
- , subq_21.bookings_offset_once AS bookings_offset_once
- FROM ***************************.mf_time_spine subq_23
+ subq_32.ds AS metric_time__day
+ , subq_30.bookings_offset_once AS bookings_offset_once
+ FROM ***************************.mf_time_spine subq_32
INNER JOIN (
-- Compute Metrics via Expressions
SELECT
@@ -24,25 +24,25 @@ FROM (
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_16.ds AS metric_time__day
- , SUM(subq_14.bookings) AS bookings
- FROM ***************************.mf_time_spine subq_16
+ subq_25.ds AS metric_time__day
+ , SUM(subq_23.bookings) AS bookings
+ FROM ***************************.mf_time_spine subq_25
INNER JOIN (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
SELECT
DATE_TRUNC('day', ds) AS metric_time__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_14
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_23
ON
- subq_16.ds - MAKE_INTERVAL(days => 5) = subq_14.metric_time__day
+ subq_25.ds - MAKE_INTERVAL(days => 5) = subq_23.metric_time__day
GROUP BY
- subq_16.ds
- ) subq_20
- ) subq_21
+ subq_25.ds
+ ) subq_29
+ ) subq_30
ON
- subq_23.ds - MAKE_INTERVAL(days => 2) = subq_21.metric_time__day
- ) subq_24
+ subq_32.ds - MAKE_INTERVAL(days => 2) = subq_30.metric_time__day
+ ) subq_33
WHERE metric_time__day = '2020-01-12' or metric_time__day = '2020-01-13'
-) subq_25
+) subq_34
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_offset_to_grain_with_agg_time_dim__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_offset_to_grain_with_agg_time_dim__plan0.sql
index df42cd08d1..efe0218840 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_offset_to_grain_with_agg_time_dim__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_offset_to_grain_with_agg_time_dim__plan0.sql
@@ -1,545 +1,545 @@
-- Compute Metrics via Expressions
SELECT
- subq_13.booking__ds__day
+ subq_22.booking__ds__day
, bookings - bookings_at_start_of_month AS bookings_growth_since_start_of_month
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_4.booking__ds__day, subq_12.booking__ds__day) AS booking__ds__day
- , MAX(subq_4.bookings) AS bookings
- , MAX(subq_12.bookings_at_start_of_month) AS bookings_at_start_of_month
+ COALESCE(subq_13.booking__ds__day, subq_21.booking__ds__day) AS booking__ds__day
+ , MAX(subq_13.bookings) AS bookings
+ , MAX(subq_21.bookings_at_start_of_month) AS bookings_at_start_of_month
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_3.booking__ds__day
- , subq_3.bookings
+ subq_12.booking__ds__day
+ , subq_12.bookings
FROM (
-- Aggregate Measures
SELECT
- subq_2.booking__ds__day
- , SUM(subq_2.bookings) AS bookings
+ subq_11.booking__ds__day
+ , SUM(subq_11.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'booking__ds__day']
SELECT
- subq_1.booking__ds__day
- , subq_1.bookings
+ subq_10.booking__ds__day
+ , subq_10.bookings
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
- ) subq_2
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
GROUP BY
- subq_2.booking__ds__day
- ) subq_3
- ) subq_4
+ subq_11.booking__ds__day
+ ) subq_12
+ ) subq_13
FULL OUTER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_11.booking__ds__day
- , subq_11.bookings AS bookings_at_start_of_month
+ subq_20.booking__ds__day
+ , subq_20.bookings AS bookings_at_start_of_month
FROM (
-- Aggregate Measures
SELECT
- subq_10.booking__ds__day
- , SUM(subq_10.bookings) AS bookings
+ subq_19.booking__ds__day
+ , SUM(subq_19.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'booking__ds__day']
SELECT
- subq_9.booking__ds__day
- , subq_9.bookings
+ subq_18.booking__ds__day
+ , subq_18.bookings
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_7.booking__ds__day AS booking__ds__day
- , subq_6.ds__day AS ds__day
- , subq_6.ds__week AS ds__week
- , subq_6.ds__month AS ds__month
- , subq_6.ds__quarter AS ds__quarter
- , subq_6.ds__year AS ds__year
- , subq_6.ds__extract_year AS ds__extract_year
- , subq_6.ds__extract_quarter AS ds__extract_quarter
- , subq_6.ds__extract_month AS ds__extract_month
- , subq_6.ds__extract_day AS ds__extract_day
- , subq_6.ds__extract_dow AS ds__extract_dow
- , subq_6.ds__extract_doy AS ds__extract_doy
- , subq_6.ds_partitioned__day AS ds_partitioned__day
- , subq_6.ds_partitioned__week AS ds_partitioned__week
- , subq_6.ds_partitioned__month AS ds_partitioned__month
- , subq_6.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_6.ds_partitioned__year AS ds_partitioned__year
- , subq_6.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_6.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_6.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_6.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_6.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_6.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_6.paid_at__day AS paid_at__day
- , subq_6.paid_at__week AS paid_at__week
- , subq_6.paid_at__month AS paid_at__month
- , subq_6.paid_at__quarter AS paid_at__quarter
- , subq_6.paid_at__year AS paid_at__year
- , subq_6.paid_at__extract_year AS paid_at__extract_year
- , subq_6.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_6.paid_at__extract_month AS paid_at__extract_month
- , subq_6.paid_at__extract_day AS paid_at__extract_day
- , subq_6.paid_at__extract_dow AS paid_at__extract_dow
- , subq_6.paid_at__extract_doy AS paid_at__extract_doy
- , subq_6.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_6.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_6.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_6.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_6.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_6.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_6.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_6.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_6.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_6.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_6.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_6.booking__paid_at__day AS booking__paid_at__day
- , subq_6.booking__paid_at__week AS booking__paid_at__week
- , subq_6.booking__paid_at__month AS booking__paid_at__month
- , subq_6.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_6.booking__paid_at__year AS booking__paid_at__year
- , subq_6.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_6.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_6.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_6.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_6.metric_time__day AS metric_time__day
- , subq_6.metric_time__week AS metric_time__week
- , subq_6.metric_time__month AS metric_time__month
- , subq_6.metric_time__quarter AS metric_time__quarter
- , subq_6.metric_time__year AS metric_time__year
- , subq_6.metric_time__extract_year AS metric_time__extract_year
- , subq_6.metric_time__extract_quarter AS metric_time__extract_quarter
- , subq_6.metric_time__extract_month AS metric_time__extract_month
- , subq_6.metric_time__extract_day AS metric_time__extract_day
- , subq_6.metric_time__extract_dow AS metric_time__extract_dow
- , subq_6.metric_time__extract_doy AS metric_time__extract_doy
- , subq_6.listing AS listing
- , subq_6.guest AS guest
- , subq_6.host AS host
- , subq_6.booking__listing AS booking__listing
- , subq_6.booking__guest AS booking__guest
- , subq_6.booking__host AS booking__host
- , subq_6.is_instant AS is_instant
- , subq_6.booking__is_instant AS booking__is_instant
- , subq_6.bookings AS bookings
- , subq_6.instant_bookings AS instant_bookings
- , subq_6.booking_value AS booking_value
- , subq_6.max_booking_value AS max_booking_value
- , subq_6.min_booking_value AS min_booking_value
- , subq_6.bookers AS bookers
- , subq_6.average_booking_value AS average_booking_value
- , subq_6.referred_bookings AS referred_bookings
- , subq_6.median_booking_value AS median_booking_value
- , subq_6.booking_value_p99 AS booking_value_p99
- , subq_6.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_6.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_6.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ subq_16.booking__ds__day AS booking__ds__day
+ , subq_15.ds__day AS ds__day
+ , subq_15.ds__week AS ds__week
+ , subq_15.ds__month AS ds__month
+ , subq_15.ds__quarter AS ds__quarter
+ , subq_15.ds__year AS ds__year
+ , subq_15.ds__extract_year AS ds__extract_year
+ , subq_15.ds__extract_quarter AS ds__extract_quarter
+ , subq_15.ds__extract_month AS ds__extract_month
+ , subq_15.ds__extract_day AS ds__extract_day
+ , subq_15.ds__extract_dow AS ds__extract_dow
+ , subq_15.ds__extract_doy AS ds__extract_doy
+ , subq_15.ds_partitioned__day AS ds_partitioned__day
+ , subq_15.ds_partitioned__week AS ds_partitioned__week
+ , subq_15.ds_partitioned__month AS ds_partitioned__month
+ , subq_15.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_15.ds_partitioned__year AS ds_partitioned__year
+ , subq_15.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_15.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_15.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_15.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_15.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_15.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_15.paid_at__day AS paid_at__day
+ , subq_15.paid_at__week AS paid_at__week
+ , subq_15.paid_at__month AS paid_at__month
+ , subq_15.paid_at__quarter AS paid_at__quarter
+ , subq_15.paid_at__year AS paid_at__year
+ , subq_15.paid_at__extract_year AS paid_at__extract_year
+ , subq_15.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_15.paid_at__extract_month AS paid_at__extract_month
+ , subq_15.paid_at__extract_day AS paid_at__extract_day
+ , subq_15.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_15.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_15.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_15.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_15.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_15.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_15.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_15.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_15.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_15.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_15.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_15.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_15.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_15.booking__paid_at__day AS booking__paid_at__day
+ , subq_15.booking__paid_at__week AS booking__paid_at__week
+ , subq_15.booking__paid_at__month AS booking__paid_at__month
+ , subq_15.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_15.booking__paid_at__year AS booking__paid_at__year
+ , subq_15.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_15.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_15.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_15.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_15.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_15.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_15.metric_time__day AS metric_time__day
+ , subq_15.metric_time__week AS metric_time__week
+ , subq_15.metric_time__month AS metric_time__month
+ , subq_15.metric_time__quarter AS metric_time__quarter
+ , subq_15.metric_time__year AS metric_time__year
+ , subq_15.metric_time__extract_year AS metric_time__extract_year
+ , subq_15.metric_time__extract_quarter AS metric_time__extract_quarter
+ , subq_15.metric_time__extract_month AS metric_time__extract_month
+ , subq_15.metric_time__extract_day AS metric_time__extract_day
+ , subq_15.metric_time__extract_dow AS metric_time__extract_dow
+ , subq_15.metric_time__extract_doy AS metric_time__extract_doy
+ , subq_15.listing AS listing
+ , subq_15.guest AS guest
+ , subq_15.host AS host
+ , subq_15.booking__listing AS booking__listing
+ , subq_15.booking__guest AS booking__guest
+ , subq_15.booking__host AS booking__host
+ , subq_15.is_instant AS is_instant
+ , subq_15.booking__is_instant AS booking__is_instant
+ , subq_15.bookings AS bookings
+ , subq_15.instant_bookings AS instant_bookings
+ , subq_15.booking_value AS booking_value
+ , subq_15.max_booking_value AS max_booking_value
+ , subq_15.min_booking_value AS min_booking_value
+ , subq_15.bookers AS bookers
+ , subq_15.average_booking_value AS average_booking_value
+ , subq_15.referred_bookings AS referred_bookings
+ , subq_15.median_booking_value AS median_booking_value
+ , subq_15.booking_value_p99 AS booking_value_p99
+ , subq_15.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_15.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_15.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_8.ds AS booking__ds__day
- FROM ***************************.mf_time_spine subq_8
- ) subq_7
+ subq_17.ds AS booking__ds__day
+ FROM ***************************.mf_time_spine subq_17
+ ) subq_16
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_5.ds__day
- , subq_5.ds__week
- , subq_5.ds__month
- , subq_5.ds__quarter
- , subq_5.ds__year
- , subq_5.ds__extract_year
- , subq_5.ds__extract_quarter
- , subq_5.ds__extract_month
- , subq_5.ds__extract_day
- , subq_5.ds__extract_dow
- , subq_5.ds__extract_doy
- , subq_5.ds_partitioned__day
- , subq_5.ds_partitioned__week
- , subq_5.ds_partitioned__month
- , subq_5.ds_partitioned__quarter
- , subq_5.ds_partitioned__year
- , subq_5.ds_partitioned__extract_year
- , subq_5.ds_partitioned__extract_quarter
- , subq_5.ds_partitioned__extract_month
- , subq_5.ds_partitioned__extract_day
- , subq_5.ds_partitioned__extract_dow
- , subq_5.ds_partitioned__extract_doy
- , subq_5.paid_at__day
- , subq_5.paid_at__week
- , subq_5.paid_at__month
- , subq_5.paid_at__quarter
- , subq_5.paid_at__year
- , subq_5.paid_at__extract_year
- , subq_5.paid_at__extract_quarter
- , subq_5.paid_at__extract_month
- , subq_5.paid_at__extract_day
- , subq_5.paid_at__extract_dow
- , subq_5.paid_at__extract_doy
- , subq_5.booking__ds__day
- , subq_5.booking__ds__week
- , subq_5.booking__ds__month
- , subq_5.booking__ds__quarter
- , subq_5.booking__ds__year
- , subq_5.booking__ds__extract_year
- , subq_5.booking__ds__extract_quarter
- , subq_5.booking__ds__extract_month
- , subq_5.booking__ds__extract_day
- , subq_5.booking__ds__extract_dow
- , subq_5.booking__ds__extract_doy
- , subq_5.booking__ds_partitioned__day
- , subq_5.booking__ds_partitioned__week
- , subq_5.booking__ds_partitioned__month
- , subq_5.booking__ds_partitioned__quarter
- , subq_5.booking__ds_partitioned__year
- , subq_5.booking__ds_partitioned__extract_year
- , subq_5.booking__ds_partitioned__extract_quarter
- , subq_5.booking__ds_partitioned__extract_month
- , subq_5.booking__ds_partitioned__extract_day
- , subq_5.booking__ds_partitioned__extract_dow
- , subq_5.booking__ds_partitioned__extract_doy
- , subq_5.booking__paid_at__day
- , subq_5.booking__paid_at__week
- , subq_5.booking__paid_at__month
- , subq_5.booking__paid_at__quarter
- , subq_5.booking__paid_at__year
- , subq_5.booking__paid_at__extract_year
- , subq_5.booking__paid_at__extract_quarter
- , subq_5.booking__paid_at__extract_month
- , subq_5.booking__paid_at__extract_day
- , subq_5.booking__paid_at__extract_dow
- , subq_5.booking__paid_at__extract_doy
- , subq_5.ds__day AS metric_time__day
- , subq_5.ds__week AS metric_time__week
- , subq_5.ds__month AS metric_time__month
- , subq_5.ds__quarter AS metric_time__quarter
- , subq_5.ds__year AS metric_time__year
- , subq_5.ds__extract_year AS metric_time__extract_year
- , subq_5.ds__extract_quarter AS metric_time__extract_quarter
- , subq_5.ds__extract_month AS metric_time__extract_month
- , subq_5.ds__extract_day AS metric_time__extract_day
- , subq_5.ds__extract_dow AS metric_time__extract_dow
- , subq_5.ds__extract_doy AS metric_time__extract_doy
- , subq_5.listing
- , subq_5.guest
- , subq_5.host
- , subq_5.booking__listing
- , subq_5.booking__guest
- , subq_5.booking__host
- , subq_5.is_instant
- , subq_5.booking__is_instant
- , subq_5.bookings
- , subq_5.instant_bookings
- , subq_5.booking_value
- , subq_5.max_booking_value
- , subq_5.min_booking_value
- , subq_5.bookers
- , subq_5.average_booking_value
- , subq_5.referred_bookings
- , subq_5.median_booking_value
- , subq_5.booking_value_p99
- , subq_5.discrete_booking_value_p99
- , subq_5.approximate_continuous_booking_value_p99
- , subq_5.approximate_discrete_booking_value_p99
+ subq_14.ds__day
+ , subq_14.ds__week
+ , subq_14.ds__month
+ , subq_14.ds__quarter
+ , subq_14.ds__year
+ , subq_14.ds__extract_year
+ , subq_14.ds__extract_quarter
+ , subq_14.ds__extract_month
+ , subq_14.ds__extract_day
+ , subq_14.ds__extract_dow
+ , subq_14.ds__extract_doy
+ , subq_14.ds_partitioned__day
+ , subq_14.ds_partitioned__week
+ , subq_14.ds_partitioned__month
+ , subq_14.ds_partitioned__quarter
+ , subq_14.ds_partitioned__year
+ , subq_14.ds_partitioned__extract_year
+ , subq_14.ds_partitioned__extract_quarter
+ , subq_14.ds_partitioned__extract_month
+ , subq_14.ds_partitioned__extract_day
+ , subq_14.ds_partitioned__extract_dow
+ , subq_14.ds_partitioned__extract_doy
+ , subq_14.paid_at__day
+ , subq_14.paid_at__week
+ , subq_14.paid_at__month
+ , subq_14.paid_at__quarter
+ , subq_14.paid_at__year
+ , subq_14.paid_at__extract_year
+ , subq_14.paid_at__extract_quarter
+ , subq_14.paid_at__extract_month
+ , subq_14.paid_at__extract_day
+ , subq_14.paid_at__extract_dow
+ , subq_14.paid_at__extract_doy
+ , subq_14.booking__ds__day
+ , subq_14.booking__ds__week
+ , subq_14.booking__ds__month
+ , subq_14.booking__ds__quarter
+ , subq_14.booking__ds__year
+ , subq_14.booking__ds__extract_year
+ , subq_14.booking__ds__extract_quarter
+ , subq_14.booking__ds__extract_month
+ , subq_14.booking__ds__extract_day
+ , subq_14.booking__ds__extract_dow
+ , subq_14.booking__ds__extract_doy
+ , subq_14.booking__ds_partitioned__day
+ , subq_14.booking__ds_partitioned__week
+ , subq_14.booking__ds_partitioned__month
+ , subq_14.booking__ds_partitioned__quarter
+ , subq_14.booking__ds_partitioned__year
+ , subq_14.booking__ds_partitioned__extract_year
+ , subq_14.booking__ds_partitioned__extract_quarter
+ , subq_14.booking__ds_partitioned__extract_month
+ , subq_14.booking__ds_partitioned__extract_day
+ , subq_14.booking__ds_partitioned__extract_dow
+ , subq_14.booking__ds_partitioned__extract_doy
+ , subq_14.booking__paid_at__day
+ , subq_14.booking__paid_at__week
+ , subq_14.booking__paid_at__month
+ , subq_14.booking__paid_at__quarter
+ , subq_14.booking__paid_at__year
+ , subq_14.booking__paid_at__extract_year
+ , subq_14.booking__paid_at__extract_quarter
+ , subq_14.booking__paid_at__extract_month
+ , subq_14.booking__paid_at__extract_day
+ , subq_14.booking__paid_at__extract_dow
+ , subq_14.booking__paid_at__extract_doy
+ , subq_14.ds__day AS metric_time__day
+ , subq_14.ds__week AS metric_time__week
+ , subq_14.ds__month AS metric_time__month
+ , subq_14.ds__quarter AS metric_time__quarter
+ , subq_14.ds__year AS metric_time__year
+ , subq_14.ds__extract_year AS metric_time__extract_year
+ , subq_14.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_14.ds__extract_month AS metric_time__extract_month
+ , subq_14.ds__extract_day AS metric_time__extract_day
+ , subq_14.ds__extract_dow AS metric_time__extract_dow
+ , subq_14.ds__extract_doy AS metric_time__extract_doy
+ , subq_14.listing
+ , subq_14.guest
+ , subq_14.host
+ , subq_14.booking__listing
+ , subq_14.booking__guest
+ , subq_14.booking__host
+ , subq_14.is_instant
+ , subq_14.booking__is_instant
+ , subq_14.bookings
+ , subq_14.instant_bookings
+ , subq_14.booking_value
+ , subq_14.max_booking_value
+ , subq_14.min_booking_value
+ , subq_14.bookers
+ , subq_14.average_booking_value
+ , subq_14.referred_bookings
+ , subq_14.median_booking_value
+ , subq_14.booking_value_p99
+ , subq_14.discrete_booking_value_p99
+ , subq_14.approximate_continuous_booking_value_p99
+ , subq_14.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_5
- ) subq_6
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_14
+ ) subq_15
ON
- DATE_TRUNC('month', subq_7.booking__ds__day) = subq_6.booking__ds__day
- ) subq_9
- ) subq_10
+ DATE_TRUNC('month', subq_16.booking__ds__day) = subq_15.booking__ds__day
+ ) subq_18
+ ) subq_19
GROUP BY
- subq_10.booking__ds__day
- ) subq_11
- ) subq_12
+ subq_19.booking__ds__day
+ ) subq_20
+ ) subq_21
ON
- subq_4.booking__ds__day = subq_12.booking__ds__day
+ subq_13.booking__ds__day = subq_21.booking__ds__day
GROUP BY
- COALESCE(subq_4.booking__ds__day, subq_12.booking__ds__day)
-) subq_13
+ COALESCE(subq_13.booking__ds__day, subq_21.booking__ds__day)
+) subq_22
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_offset_to_grain_with_agg_time_dim__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_offset_to_grain_with_agg_time_dim__plan0_optimized.sql
index 1b7dbc4725..9f6d4b5769 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_offset_to_grain_with_agg_time_dim__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_offset_to_grain_with_agg_time_dim__plan0_optimized.sql
@@ -5,9 +5,9 @@ SELECT
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_18.booking__ds__day, subq_26.booking__ds__day) AS booking__ds__day
- , MAX(subq_18.bookings) AS bookings
- , MAX(subq_26.bookings_at_start_of_month) AS bookings_at_start_of_month
+ COALESCE(subq_27.booking__ds__day, subq_35.booking__ds__day) AS booking__ds__day
+ , MAX(subq_27.bookings) AS bookings
+ , MAX(subq_35.bookings_at_start_of_month) AS bookings_at_start_of_month
FROM (
-- Aggregate Measures
-- Compute Metrics via Expressions
@@ -21,35 +21,35 @@ FROM (
SELECT
DATE_TRUNC('day', ds) AS booking__ds__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_16
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_25
GROUP BY
booking__ds__day
- ) subq_18
+ ) subq_27
FULL OUTER JOIN (
-- Join to Time Spine Dataset
-- Pass Only Elements: ['bookings', 'booking__ds__day']
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_22.ds AS booking__ds__day
- , SUM(subq_20.bookings) AS bookings_at_start_of_month
- FROM ***************************.mf_time_spine subq_22
+ subq_31.ds AS booking__ds__day
+ , SUM(subq_29.bookings) AS bookings_at_start_of_month
+ FROM ***************************.mf_time_spine subq_31
INNER JOIN (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
SELECT
DATE_TRUNC('day', ds) AS booking__ds__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_20
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_29
ON
- DATE_TRUNC('month', subq_22.ds) = subq_20.booking__ds__day
+ DATE_TRUNC('month', subq_31.ds) = subq_29.booking__ds__day
GROUP BY
- subq_22.ds
- ) subq_26
+ subq_31.ds
+ ) subq_35
ON
- subq_18.booking__ds__day = subq_26.booking__ds__day
+ subq_27.booking__ds__day = subq_35.booking__ds__day
GROUP BY
- COALESCE(subq_18.booking__ds__day, subq_26.booking__ds__day)
-) subq_27
+ COALESCE(subq_27.booking__ds__day, subq_35.booking__ds__day)
+) subq_36
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_offset_window_with_agg_time_dim__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_offset_window_with_agg_time_dim__plan0.sql
index 906ccac318..588ee03af1 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_offset_window_with_agg_time_dim__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_offset_window_with_agg_time_dim__plan0.sql
@@ -1,545 +1,545 @@
-- Compute Metrics via Expressions
SELECT
- subq_13.booking__ds__day
+ subq_22.booking__ds__day
, bookings - bookings_2_weeks_ago AS bookings_growth_2_weeks
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_4.booking__ds__day, subq_12.booking__ds__day) AS booking__ds__day
- , MAX(subq_4.bookings) AS bookings
- , MAX(subq_12.bookings_2_weeks_ago) AS bookings_2_weeks_ago
+ COALESCE(subq_13.booking__ds__day, subq_21.booking__ds__day) AS booking__ds__day
+ , MAX(subq_13.bookings) AS bookings
+ , MAX(subq_21.bookings_2_weeks_ago) AS bookings_2_weeks_ago
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_3.booking__ds__day
- , subq_3.bookings
+ subq_12.booking__ds__day
+ , subq_12.bookings
FROM (
-- Aggregate Measures
SELECT
- subq_2.booking__ds__day
- , SUM(subq_2.bookings) AS bookings
+ subq_11.booking__ds__day
+ , SUM(subq_11.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'booking__ds__day']
SELECT
- subq_1.booking__ds__day
- , subq_1.bookings
+ subq_10.booking__ds__day
+ , subq_10.bookings
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
- ) subq_2
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
GROUP BY
- subq_2.booking__ds__day
- ) subq_3
- ) subq_4
+ subq_11.booking__ds__day
+ ) subq_12
+ ) subq_13
FULL OUTER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_11.booking__ds__day
- , subq_11.bookings AS bookings_2_weeks_ago
+ subq_20.booking__ds__day
+ , subq_20.bookings AS bookings_2_weeks_ago
FROM (
-- Aggregate Measures
SELECT
- subq_10.booking__ds__day
- , SUM(subq_10.bookings) AS bookings
+ subq_19.booking__ds__day
+ , SUM(subq_19.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'booking__ds__day']
SELECT
- subq_9.booking__ds__day
- , subq_9.bookings
+ subq_18.booking__ds__day
+ , subq_18.bookings
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_7.booking__ds__day AS booking__ds__day
- , subq_6.ds__day AS ds__day
- , subq_6.ds__week AS ds__week
- , subq_6.ds__month AS ds__month
- , subq_6.ds__quarter AS ds__quarter
- , subq_6.ds__year AS ds__year
- , subq_6.ds__extract_year AS ds__extract_year
- , subq_6.ds__extract_quarter AS ds__extract_quarter
- , subq_6.ds__extract_month AS ds__extract_month
- , subq_6.ds__extract_day AS ds__extract_day
- , subq_6.ds__extract_dow AS ds__extract_dow
- , subq_6.ds__extract_doy AS ds__extract_doy
- , subq_6.ds_partitioned__day AS ds_partitioned__day
- , subq_6.ds_partitioned__week AS ds_partitioned__week
- , subq_6.ds_partitioned__month AS ds_partitioned__month
- , subq_6.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_6.ds_partitioned__year AS ds_partitioned__year
- , subq_6.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_6.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_6.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_6.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_6.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_6.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_6.paid_at__day AS paid_at__day
- , subq_6.paid_at__week AS paid_at__week
- , subq_6.paid_at__month AS paid_at__month
- , subq_6.paid_at__quarter AS paid_at__quarter
- , subq_6.paid_at__year AS paid_at__year
- , subq_6.paid_at__extract_year AS paid_at__extract_year
- , subq_6.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_6.paid_at__extract_month AS paid_at__extract_month
- , subq_6.paid_at__extract_day AS paid_at__extract_day
- , subq_6.paid_at__extract_dow AS paid_at__extract_dow
- , subq_6.paid_at__extract_doy AS paid_at__extract_doy
- , subq_6.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_6.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_6.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_6.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_6.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_6.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_6.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_6.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_6.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_6.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_6.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_6.booking__paid_at__day AS booking__paid_at__day
- , subq_6.booking__paid_at__week AS booking__paid_at__week
- , subq_6.booking__paid_at__month AS booking__paid_at__month
- , subq_6.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_6.booking__paid_at__year AS booking__paid_at__year
- , subq_6.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_6.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_6.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_6.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_6.metric_time__day AS metric_time__day
- , subq_6.metric_time__week AS metric_time__week
- , subq_6.metric_time__month AS metric_time__month
- , subq_6.metric_time__quarter AS metric_time__quarter
- , subq_6.metric_time__year AS metric_time__year
- , subq_6.metric_time__extract_year AS metric_time__extract_year
- , subq_6.metric_time__extract_quarter AS metric_time__extract_quarter
- , subq_6.metric_time__extract_month AS metric_time__extract_month
- , subq_6.metric_time__extract_day AS metric_time__extract_day
- , subq_6.metric_time__extract_dow AS metric_time__extract_dow
- , subq_6.metric_time__extract_doy AS metric_time__extract_doy
- , subq_6.listing AS listing
- , subq_6.guest AS guest
- , subq_6.host AS host
- , subq_6.booking__listing AS booking__listing
- , subq_6.booking__guest AS booking__guest
- , subq_6.booking__host AS booking__host
- , subq_6.is_instant AS is_instant
- , subq_6.booking__is_instant AS booking__is_instant
- , subq_6.bookings AS bookings
- , subq_6.instant_bookings AS instant_bookings
- , subq_6.booking_value AS booking_value
- , subq_6.max_booking_value AS max_booking_value
- , subq_6.min_booking_value AS min_booking_value
- , subq_6.bookers AS bookers
- , subq_6.average_booking_value AS average_booking_value
- , subq_6.referred_bookings AS referred_bookings
- , subq_6.median_booking_value AS median_booking_value
- , subq_6.booking_value_p99 AS booking_value_p99
- , subq_6.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_6.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_6.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ subq_16.booking__ds__day AS booking__ds__day
+ , subq_15.ds__day AS ds__day
+ , subq_15.ds__week AS ds__week
+ , subq_15.ds__month AS ds__month
+ , subq_15.ds__quarter AS ds__quarter
+ , subq_15.ds__year AS ds__year
+ , subq_15.ds__extract_year AS ds__extract_year
+ , subq_15.ds__extract_quarter AS ds__extract_quarter
+ , subq_15.ds__extract_month AS ds__extract_month
+ , subq_15.ds__extract_day AS ds__extract_day
+ , subq_15.ds__extract_dow AS ds__extract_dow
+ , subq_15.ds__extract_doy AS ds__extract_doy
+ , subq_15.ds_partitioned__day AS ds_partitioned__day
+ , subq_15.ds_partitioned__week AS ds_partitioned__week
+ , subq_15.ds_partitioned__month AS ds_partitioned__month
+ , subq_15.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_15.ds_partitioned__year AS ds_partitioned__year
+ , subq_15.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_15.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_15.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_15.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_15.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_15.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_15.paid_at__day AS paid_at__day
+ , subq_15.paid_at__week AS paid_at__week
+ , subq_15.paid_at__month AS paid_at__month
+ , subq_15.paid_at__quarter AS paid_at__quarter
+ , subq_15.paid_at__year AS paid_at__year
+ , subq_15.paid_at__extract_year AS paid_at__extract_year
+ , subq_15.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_15.paid_at__extract_month AS paid_at__extract_month
+ , subq_15.paid_at__extract_day AS paid_at__extract_day
+ , subq_15.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_15.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_15.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_15.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_15.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_15.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_15.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_15.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_15.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_15.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_15.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_15.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_15.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_15.booking__paid_at__day AS booking__paid_at__day
+ , subq_15.booking__paid_at__week AS booking__paid_at__week
+ , subq_15.booking__paid_at__month AS booking__paid_at__month
+ , subq_15.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_15.booking__paid_at__year AS booking__paid_at__year
+ , subq_15.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_15.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_15.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_15.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_15.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_15.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_15.metric_time__day AS metric_time__day
+ , subq_15.metric_time__week AS metric_time__week
+ , subq_15.metric_time__month AS metric_time__month
+ , subq_15.metric_time__quarter AS metric_time__quarter
+ , subq_15.metric_time__year AS metric_time__year
+ , subq_15.metric_time__extract_year AS metric_time__extract_year
+ , subq_15.metric_time__extract_quarter AS metric_time__extract_quarter
+ , subq_15.metric_time__extract_month AS metric_time__extract_month
+ , subq_15.metric_time__extract_day AS metric_time__extract_day
+ , subq_15.metric_time__extract_dow AS metric_time__extract_dow
+ , subq_15.metric_time__extract_doy AS metric_time__extract_doy
+ , subq_15.listing AS listing
+ , subq_15.guest AS guest
+ , subq_15.host AS host
+ , subq_15.booking__listing AS booking__listing
+ , subq_15.booking__guest AS booking__guest
+ , subq_15.booking__host AS booking__host
+ , subq_15.is_instant AS is_instant
+ , subq_15.booking__is_instant AS booking__is_instant
+ , subq_15.bookings AS bookings
+ , subq_15.instant_bookings AS instant_bookings
+ , subq_15.booking_value AS booking_value
+ , subq_15.max_booking_value AS max_booking_value
+ , subq_15.min_booking_value AS min_booking_value
+ , subq_15.bookers AS bookers
+ , subq_15.average_booking_value AS average_booking_value
+ , subq_15.referred_bookings AS referred_bookings
+ , subq_15.median_booking_value AS median_booking_value
+ , subq_15.booking_value_p99 AS booking_value_p99
+ , subq_15.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_15.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_15.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_8.ds AS booking__ds__day
- FROM ***************************.mf_time_spine subq_8
- ) subq_7
+ subq_17.ds AS booking__ds__day
+ FROM ***************************.mf_time_spine subq_17
+ ) subq_16
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_5.ds__day
- , subq_5.ds__week
- , subq_5.ds__month
- , subq_5.ds__quarter
- , subq_5.ds__year
- , subq_5.ds__extract_year
- , subq_5.ds__extract_quarter
- , subq_5.ds__extract_month
- , subq_5.ds__extract_day
- , subq_5.ds__extract_dow
- , subq_5.ds__extract_doy
- , subq_5.ds_partitioned__day
- , subq_5.ds_partitioned__week
- , subq_5.ds_partitioned__month
- , subq_5.ds_partitioned__quarter
- , subq_5.ds_partitioned__year
- , subq_5.ds_partitioned__extract_year
- , subq_5.ds_partitioned__extract_quarter
- , subq_5.ds_partitioned__extract_month
- , subq_5.ds_partitioned__extract_day
- , subq_5.ds_partitioned__extract_dow
- , subq_5.ds_partitioned__extract_doy
- , subq_5.paid_at__day
- , subq_5.paid_at__week
- , subq_5.paid_at__month
- , subq_5.paid_at__quarter
- , subq_5.paid_at__year
- , subq_5.paid_at__extract_year
- , subq_5.paid_at__extract_quarter
- , subq_5.paid_at__extract_month
- , subq_5.paid_at__extract_day
- , subq_5.paid_at__extract_dow
- , subq_5.paid_at__extract_doy
- , subq_5.booking__ds__day
- , subq_5.booking__ds__week
- , subq_5.booking__ds__month
- , subq_5.booking__ds__quarter
- , subq_5.booking__ds__year
- , subq_5.booking__ds__extract_year
- , subq_5.booking__ds__extract_quarter
- , subq_5.booking__ds__extract_month
- , subq_5.booking__ds__extract_day
- , subq_5.booking__ds__extract_dow
- , subq_5.booking__ds__extract_doy
- , subq_5.booking__ds_partitioned__day
- , subq_5.booking__ds_partitioned__week
- , subq_5.booking__ds_partitioned__month
- , subq_5.booking__ds_partitioned__quarter
- , subq_5.booking__ds_partitioned__year
- , subq_5.booking__ds_partitioned__extract_year
- , subq_5.booking__ds_partitioned__extract_quarter
- , subq_5.booking__ds_partitioned__extract_month
- , subq_5.booking__ds_partitioned__extract_day
- , subq_5.booking__ds_partitioned__extract_dow
- , subq_5.booking__ds_partitioned__extract_doy
- , subq_5.booking__paid_at__day
- , subq_5.booking__paid_at__week
- , subq_5.booking__paid_at__month
- , subq_5.booking__paid_at__quarter
- , subq_5.booking__paid_at__year
- , subq_5.booking__paid_at__extract_year
- , subq_5.booking__paid_at__extract_quarter
- , subq_5.booking__paid_at__extract_month
- , subq_5.booking__paid_at__extract_day
- , subq_5.booking__paid_at__extract_dow
- , subq_5.booking__paid_at__extract_doy
- , subq_5.ds__day AS metric_time__day
- , subq_5.ds__week AS metric_time__week
- , subq_5.ds__month AS metric_time__month
- , subq_5.ds__quarter AS metric_time__quarter
- , subq_5.ds__year AS metric_time__year
- , subq_5.ds__extract_year AS metric_time__extract_year
- , subq_5.ds__extract_quarter AS metric_time__extract_quarter
- , subq_5.ds__extract_month AS metric_time__extract_month
- , subq_5.ds__extract_day AS metric_time__extract_day
- , subq_5.ds__extract_dow AS metric_time__extract_dow
- , subq_5.ds__extract_doy AS metric_time__extract_doy
- , subq_5.listing
- , subq_5.guest
- , subq_5.host
- , subq_5.booking__listing
- , subq_5.booking__guest
- , subq_5.booking__host
- , subq_5.is_instant
- , subq_5.booking__is_instant
- , subq_5.bookings
- , subq_5.instant_bookings
- , subq_5.booking_value
- , subq_5.max_booking_value
- , subq_5.min_booking_value
- , subq_5.bookers
- , subq_5.average_booking_value
- , subq_5.referred_bookings
- , subq_5.median_booking_value
- , subq_5.booking_value_p99
- , subq_5.discrete_booking_value_p99
- , subq_5.approximate_continuous_booking_value_p99
- , subq_5.approximate_discrete_booking_value_p99
+ subq_14.ds__day
+ , subq_14.ds__week
+ , subq_14.ds__month
+ , subq_14.ds__quarter
+ , subq_14.ds__year
+ , subq_14.ds__extract_year
+ , subq_14.ds__extract_quarter
+ , subq_14.ds__extract_month
+ , subq_14.ds__extract_day
+ , subq_14.ds__extract_dow
+ , subq_14.ds__extract_doy
+ , subq_14.ds_partitioned__day
+ , subq_14.ds_partitioned__week
+ , subq_14.ds_partitioned__month
+ , subq_14.ds_partitioned__quarter
+ , subq_14.ds_partitioned__year
+ , subq_14.ds_partitioned__extract_year
+ , subq_14.ds_partitioned__extract_quarter
+ , subq_14.ds_partitioned__extract_month
+ , subq_14.ds_partitioned__extract_day
+ , subq_14.ds_partitioned__extract_dow
+ , subq_14.ds_partitioned__extract_doy
+ , subq_14.paid_at__day
+ , subq_14.paid_at__week
+ , subq_14.paid_at__month
+ , subq_14.paid_at__quarter
+ , subq_14.paid_at__year
+ , subq_14.paid_at__extract_year
+ , subq_14.paid_at__extract_quarter
+ , subq_14.paid_at__extract_month
+ , subq_14.paid_at__extract_day
+ , subq_14.paid_at__extract_dow
+ , subq_14.paid_at__extract_doy
+ , subq_14.booking__ds__day
+ , subq_14.booking__ds__week
+ , subq_14.booking__ds__month
+ , subq_14.booking__ds__quarter
+ , subq_14.booking__ds__year
+ , subq_14.booking__ds__extract_year
+ , subq_14.booking__ds__extract_quarter
+ , subq_14.booking__ds__extract_month
+ , subq_14.booking__ds__extract_day
+ , subq_14.booking__ds__extract_dow
+ , subq_14.booking__ds__extract_doy
+ , subq_14.booking__ds_partitioned__day
+ , subq_14.booking__ds_partitioned__week
+ , subq_14.booking__ds_partitioned__month
+ , subq_14.booking__ds_partitioned__quarter
+ , subq_14.booking__ds_partitioned__year
+ , subq_14.booking__ds_partitioned__extract_year
+ , subq_14.booking__ds_partitioned__extract_quarter
+ , subq_14.booking__ds_partitioned__extract_month
+ , subq_14.booking__ds_partitioned__extract_day
+ , subq_14.booking__ds_partitioned__extract_dow
+ , subq_14.booking__ds_partitioned__extract_doy
+ , subq_14.booking__paid_at__day
+ , subq_14.booking__paid_at__week
+ , subq_14.booking__paid_at__month
+ , subq_14.booking__paid_at__quarter
+ , subq_14.booking__paid_at__year
+ , subq_14.booking__paid_at__extract_year
+ , subq_14.booking__paid_at__extract_quarter
+ , subq_14.booking__paid_at__extract_month
+ , subq_14.booking__paid_at__extract_day
+ , subq_14.booking__paid_at__extract_dow
+ , subq_14.booking__paid_at__extract_doy
+ , subq_14.ds__day AS metric_time__day
+ , subq_14.ds__week AS metric_time__week
+ , subq_14.ds__month AS metric_time__month
+ , subq_14.ds__quarter AS metric_time__quarter
+ , subq_14.ds__year AS metric_time__year
+ , subq_14.ds__extract_year AS metric_time__extract_year
+ , subq_14.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_14.ds__extract_month AS metric_time__extract_month
+ , subq_14.ds__extract_day AS metric_time__extract_day
+ , subq_14.ds__extract_dow AS metric_time__extract_dow
+ , subq_14.ds__extract_doy AS metric_time__extract_doy
+ , subq_14.listing
+ , subq_14.guest
+ , subq_14.host
+ , subq_14.booking__listing
+ , subq_14.booking__guest
+ , subq_14.booking__host
+ , subq_14.is_instant
+ , subq_14.booking__is_instant
+ , subq_14.bookings
+ , subq_14.instant_bookings
+ , subq_14.booking_value
+ , subq_14.max_booking_value
+ , subq_14.min_booking_value
+ , subq_14.bookers
+ , subq_14.average_booking_value
+ , subq_14.referred_bookings
+ , subq_14.median_booking_value
+ , subq_14.booking_value_p99
+ , subq_14.discrete_booking_value_p99
+ , subq_14.approximate_continuous_booking_value_p99
+ , subq_14.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_5
- ) subq_6
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_14
+ ) subq_15
ON
- subq_7.booking__ds__day - MAKE_INTERVAL(days => 14) = subq_6.booking__ds__day
- ) subq_9
- ) subq_10
+ subq_16.booking__ds__day - MAKE_INTERVAL(days => 14) = subq_15.booking__ds__day
+ ) subq_18
+ ) subq_19
GROUP BY
- subq_10.booking__ds__day
- ) subq_11
- ) subq_12
+ subq_19.booking__ds__day
+ ) subq_20
+ ) subq_21
ON
- subq_4.booking__ds__day = subq_12.booking__ds__day
+ subq_13.booking__ds__day = subq_21.booking__ds__day
GROUP BY
- COALESCE(subq_4.booking__ds__day, subq_12.booking__ds__day)
-) subq_13
+ COALESCE(subq_13.booking__ds__day, subq_21.booking__ds__day)
+) subq_22
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_offset_window_with_agg_time_dim__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_offset_window_with_agg_time_dim__plan0_optimized.sql
index 3daea0d8e2..9230049ec8 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_offset_window_with_agg_time_dim__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_offset_window_with_agg_time_dim__plan0_optimized.sql
@@ -5,9 +5,9 @@ SELECT
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_18.booking__ds__day, subq_26.booking__ds__day) AS booking__ds__day
- , MAX(subq_18.bookings) AS bookings
- , MAX(subq_26.bookings_2_weeks_ago) AS bookings_2_weeks_ago
+ COALESCE(subq_27.booking__ds__day, subq_35.booking__ds__day) AS booking__ds__day
+ , MAX(subq_27.bookings) AS bookings
+ , MAX(subq_35.bookings_2_weeks_ago) AS bookings_2_weeks_ago
FROM (
-- Aggregate Measures
-- Compute Metrics via Expressions
@@ -21,35 +21,35 @@ FROM (
SELECT
DATE_TRUNC('day', ds) AS booking__ds__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_16
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_25
GROUP BY
booking__ds__day
- ) subq_18
+ ) subq_27
FULL OUTER JOIN (
-- Join to Time Spine Dataset
-- Pass Only Elements: ['bookings', 'booking__ds__day']
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_22.ds AS booking__ds__day
- , SUM(subq_20.bookings) AS bookings_2_weeks_ago
- FROM ***************************.mf_time_spine subq_22
+ subq_31.ds AS booking__ds__day
+ , SUM(subq_29.bookings) AS bookings_2_weeks_ago
+ FROM ***************************.mf_time_spine subq_31
INNER JOIN (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
SELECT
DATE_TRUNC('day', ds) AS booking__ds__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_20
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_29
ON
- subq_22.ds - MAKE_INTERVAL(days => 14) = subq_20.booking__ds__day
+ subq_31.ds - MAKE_INTERVAL(days => 14) = subq_29.booking__ds__day
GROUP BY
- subq_22.ds
- ) subq_26
+ subq_31.ds
+ ) subq_35
ON
- subq_18.booking__ds__day = subq_26.booking__ds__day
+ subq_27.booking__ds__day = subq_35.booking__ds__day
GROUP BY
- COALESCE(subq_18.booking__ds__day, subq_26.booking__ds__day)
-) subq_27
+ COALESCE(subq_27.booking__ds__day, subq_35.booking__ds__day)
+) subq_36
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_time_offset_metric_with_time_constraint__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_time_offset_metric_with_time_constraint__plan0.sql
index 4e00e95c17..4c79f89e04 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_time_offset_metric_with_time_constraint__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_time_offset_metric_with_time_constraint__plan0.sql
@@ -1,320 +1,320 @@
-- Compute Metrics via Expressions
SELECT
- subq_7.metric_time__day
+ subq_16.metric_time__day
, bookings_5_days_ago AS bookings_5_day_lag
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_6.metric_time__day
- , subq_6.bookings AS bookings_5_days_ago
+ subq_15.metric_time__day
+ , subq_15.bookings AS bookings_5_days_ago
FROM (
-- Aggregate Measures
SELECT
- subq_5.metric_time__day
- , SUM(subq_5.bookings) AS bookings
+ subq_14.metric_time__day
+ , SUM(subq_14.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__day']
SELECT
- subq_4.metric_time__day
- , subq_4.bookings
+ subq_13.metric_time__day
+ , subq_13.bookings
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_2.metric_time__day AS metric_time__day
- , subq_1.ds__day AS ds__day
- , subq_1.ds__week AS ds__week
- , subq_1.ds__month AS ds__month
- , subq_1.ds__quarter AS ds__quarter
- , subq_1.ds__year AS ds__year
- , subq_1.ds__extract_year AS ds__extract_year
- , subq_1.ds__extract_quarter AS ds__extract_quarter
- , subq_1.ds__extract_month AS ds__extract_month
- , subq_1.ds__extract_day AS ds__extract_day
- , subq_1.ds__extract_dow AS ds__extract_dow
- , subq_1.ds__extract_doy AS ds__extract_doy
- , subq_1.ds_partitioned__day AS ds_partitioned__day
- , subq_1.ds_partitioned__week AS ds_partitioned__week
- , subq_1.ds_partitioned__month AS ds_partitioned__month
- , subq_1.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_1.ds_partitioned__year AS ds_partitioned__year
- , subq_1.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_1.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_1.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_1.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_1.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_1.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_1.paid_at__day AS paid_at__day
- , subq_1.paid_at__week AS paid_at__week
- , subq_1.paid_at__month AS paid_at__month
- , subq_1.paid_at__quarter AS paid_at__quarter
- , subq_1.paid_at__year AS paid_at__year
- , subq_1.paid_at__extract_year AS paid_at__extract_year
- , subq_1.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_1.paid_at__extract_month AS paid_at__extract_month
- , subq_1.paid_at__extract_day AS paid_at__extract_day
- , subq_1.paid_at__extract_dow AS paid_at__extract_dow
- , subq_1.paid_at__extract_doy AS paid_at__extract_doy
- , subq_1.booking__ds__day AS booking__ds__day
- , subq_1.booking__ds__week AS booking__ds__week
- , subq_1.booking__ds__month AS booking__ds__month
- , subq_1.booking__ds__quarter AS booking__ds__quarter
- , subq_1.booking__ds__year AS booking__ds__year
- , subq_1.booking__ds__extract_year AS booking__ds__extract_year
- , subq_1.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_1.booking__ds__extract_month AS booking__ds__extract_month
- , subq_1.booking__ds__extract_day AS booking__ds__extract_day
- , subq_1.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_1.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_1.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_1.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_1.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_1.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_1.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_1.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_1.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_1.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_1.booking__paid_at__day AS booking__paid_at__day
- , subq_1.booking__paid_at__week AS booking__paid_at__week
- , subq_1.booking__paid_at__month AS booking__paid_at__month
- , subq_1.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_1.booking__paid_at__year AS booking__paid_at__year
- , subq_1.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_1.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_1.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_1.listing AS listing
- , subq_1.guest AS guest
- , subq_1.host AS host
- , subq_1.booking__listing AS booking__listing
- , subq_1.booking__guest AS booking__guest
- , subq_1.booking__host AS booking__host
- , subq_1.is_instant AS is_instant
- , subq_1.booking__is_instant AS booking__is_instant
- , subq_1.bookings AS bookings
- , subq_1.instant_bookings AS instant_bookings
- , subq_1.booking_value AS booking_value
- , subq_1.max_booking_value AS max_booking_value
- , subq_1.min_booking_value AS min_booking_value
- , subq_1.bookers AS bookers
- , subq_1.average_booking_value AS average_booking_value
- , subq_1.referred_bookings AS referred_bookings
- , subq_1.median_booking_value AS median_booking_value
- , subq_1.booking_value_p99 AS booking_value_p99
- , subq_1.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_1.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_1.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ subq_11.metric_time__day AS metric_time__day
+ , subq_10.ds__day AS ds__day
+ , subq_10.ds__week AS ds__week
+ , subq_10.ds__month AS ds__month
+ , subq_10.ds__quarter AS ds__quarter
+ , subq_10.ds__year AS ds__year
+ , subq_10.ds__extract_year AS ds__extract_year
+ , subq_10.ds__extract_quarter AS ds__extract_quarter
+ , subq_10.ds__extract_month AS ds__extract_month
+ , subq_10.ds__extract_day AS ds__extract_day
+ , subq_10.ds__extract_dow AS ds__extract_dow
+ , subq_10.ds__extract_doy AS ds__extract_doy
+ , subq_10.ds_partitioned__day AS ds_partitioned__day
+ , subq_10.ds_partitioned__week AS ds_partitioned__week
+ , subq_10.ds_partitioned__month AS ds_partitioned__month
+ , subq_10.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_10.ds_partitioned__year AS ds_partitioned__year
+ , subq_10.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_10.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_10.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_10.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_10.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_10.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_10.paid_at__day AS paid_at__day
+ , subq_10.paid_at__week AS paid_at__week
+ , subq_10.paid_at__month AS paid_at__month
+ , subq_10.paid_at__quarter AS paid_at__quarter
+ , subq_10.paid_at__year AS paid_at__year
+ , subq_10.paid_at__extract_year AS paid_at__extract_year
+ , subq_10.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_10.paid_at__extract_month AS paid_at__extract_month
+ , subq_10.paid_at__extract_day AS paid_at__extract_day
+ , subq_10.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_10.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_10.booking__ds__day AS booking__ds__day
+ , subq_10.booking__ds__week AS booking__ds__week
+ , subq_10.booking__ds__month AS booking__ds__month
+ , subq_10.booking__ds__quarter AS booking__ds__quarter
+ , subq_10.booking__ds__year AS booking__ds__year
+ , subq_10.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_10.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_10.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_10.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_10.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_10.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_10.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_10.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_10.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_10.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_10.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_10.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_10.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_10.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_10.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_10.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_10.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_10.booking__paid_at__day AS booking__paid_at__day
+ , subq_10.booking__paid_at__week AS booking__paid_at__week
+ , subq_10.booking__paid_at__month AS booking__paid_at__month
+ , subq_10.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_10.booking__paid_at__year AS booking__paid_at__year
+ , subq_10.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_10.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_10.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_10.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_10.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_10.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_10.listing AS listing
+ , subq_10.guest AS guest
+ , subq_10.host AS host
+ , subq_10.booking__listing AS booking__listing
+ , subq_10.booking__guest AS booking__guest
+ , subq_10.booking__host AS booking__host
+ , subq_10.is_instant AS is_instant
+ , subq_10.booking__is_instant AS booking__is_instant
+ , subq_10.bookings AS bookings
+ , subq_10.instant_bookings AS instant_bookings
+ , subq_10.booking_value AS booking_value
+ , subq_10.max_booking_value AS max_booking_value
+ , subq_10.min_booking_value AS min_booking_value
+ , subq_10.bookers AS bookers
+ , subq_10.average_booking_value AS average_booking_value
+ , subq_10.referred_bookings AS referred_bookings
+ , subq_10.median_booking_value AS median_booking_value
+ , subq_10.booking_value_p99 AS booking_value_p99
+ , subq_10.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_10.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_10.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_3.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_3
- WHERE subq_3.ds BETWEEN '2019-12-19' AND '2020-01-02'
- ) subq_2
+ subq_12.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_12
+ WHERE subq_12.ds BETWEEN '2019-12-19' AND '2020-01-02'
+ ) subq_11
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds) AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , EXTRACT(isodow FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds) AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , EXTRACT(isodow FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , EXTRACT(isodow FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
ON
- subq_2.metric_time__day - MAKE_INTERVAL(days => 5) = subq_1.metric_time__day
- ) subq_4
- ) subq_5
+ subq_11.metric_time__day - MAKE_INTERVAL(days => 5) = subq_10.metric_time__day
+ ) subq_13
+ ) subq_14
GROUP BY
- subq_5.metric_time__day
- ) subq_6
-) subq_7
+ subq_14.metric_time__day
+ ) subq_15
+) subq_16
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_time_offset_metric_with_time_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_time_offset_metric_with_time_constraint__plan0_optimized.sql
index c29d0d741b..22f3ca9760 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_time_offset_metric_with_time_constraint__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Postgres/test_time_offset_metric_with_time_constraint__plan0_optimized.sql
@@ -8,25 +8,25 @@ FROM (
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_10.metric_time__day AS metric_time__day
- , SUM(subq_9.bookings) AS bookings_5_days_ago
+ subq_19.metric_time__day AS metric_time__day
+ , SUM(subq_18.bookings) AS bookings_5_days_ago
FROM (
-- Time Spine
SELECT
ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_11
+ FROM ***************************.mf_time_spine subq_20
WHERE ds BETWEEN '2019-12-19' AND '2020-01-02'
- ) subq_10
+ ) subq_19
INNER JOIN (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
SELECT
DATE_TRUNC('day', ds) AS metric_time__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_9
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_18
ON
- subq_10.metric_time__day - MAKE_INTERVAL(days => 5) = subq_9.metric_time__day
+ subq_19.metric_time__day - MAKE_INTERVAL(days => 5) = subq_18.metric_time__day
GROUP BY
- subq_10.metric_time__day
-) subq_15
+ subq_19.metric_time__day
+) subq_24
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_time_offset_metric_with_time_constraint__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_time_offset_metric_with_time_constraint__plan0.sql
index 7f8a2e0812..d63b5acd64 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_time_offset_metric_with_time_constraint__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_time_offset_metric_with_time_constraint__plan0.sql
@@ -1,441 +1,441 @@
-- Compute Metrics via Expressions
SELECT
- subq_11.metric_time__day
+ subq_20.metric_time__day
, every_2_days_bookers_2_days_ago AS every_2_days_bookers_2_days_ago
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_10.metric_time__day
- , subq_10.bookers AS every_2_days_bookers_2_days_ago
+ subq_19.metric_time__day
+ , subq_19.bookers AS every_2_days_bookers_2_days_ago
FROM (
-- Aggregate Measures
SELECT
- subq_9.metric_time__day
- , COUNT(DISTINCT subq_9.bookers) AS bookers
+ subq_18.metric_time__day
+ , COUNT(DISTINCT subq_18.bookers) AS bookers
FROM (
-- Constrain Time Range to [2019-12-19T00:00:00, 2020-01-02T00:00:00]
SELECT
- subq_8.metric_time__day
- , subq_8.bookers
+ subq_17.metric_time__day
+ , subq_17.bookers
FROM (
-- Pass Only Elements: ['bookers', 'metric_time__day']
SELECT
- subq_7.metric_time__day
- , subq_7.bookers
+ subq_16.metric_time__day
+ , subq_16.bookers
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_5.metric_time__day AS metric_time__day
- , subq_4.ds__day AS ds__day
- , subq_4.ds__week AS ds__week
- , subq_4.ds__month AS ds__month
- , subq_4.ds__quarter AS ds__quarter
- , subq_4.ds__year AS ds__year
- , subq_4.ds__extract_year AS ds__extract_year
- , subq_4.ds__extract_quarter AS ds__extract_quarter
- , subq_4.ds__extract_month AS ds__extract_month
- , subq_4.ds__extract_day AS ds__extract_day
- , subq_4.ds__extract_dow AS ds__extract_dow
- , subq_4.ds__extract_doy AS ds__extract_doy
- , subq_4.ds_partitioned__day AS ds_partitioned__day
- , subq_4.ds_partitioned__week AS ds_partitioned__week
- , subq_4.ds_partitioned__month AS ds_partitioned__month
- , subq_4.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_4.ds_partitioned__year AS ds_partitioned__year
- , subq_4.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_4.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_4.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_4.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_4.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_4.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_4.paid_at__day AS paid_at__day
- , subq_4.paid_at__week AS paid_at__week
- , subq_4.paid_at__month AS paid_at__month
- , subq_4.paid_at__quarter AS paid_at__quarter
- , subq_4.paid_at__year AS paid_at__year
- , subq_4.paid_at__extract_year AS paid_at__extract_year
- , subq_4.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_4.paid_at__extract_month AS paid_at__extract_month
- , subq_4.paid_at__extract_day AS paid_at__extract_day
- , subq_4.paid_at__extract_dow AS paid_at__extract_dow
- , subq_4.paid_at__extract_doy AS paid_at__extract_doy
- , subq_4.booking__ds__day AS booking__ds__day
- , subq_4.booking__ds__week AS booking__ds__week
- , subq_4.booking__ds__month AS booking__ds__month
- , subq_4.booking__ds__quarter AS booking__ds__quarter
- , subq_4.booking__ds__year AS booking__ds__year
- , subq_4.booking__ds__extract_year AS booking__ds__extract_year
- , subq_4.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_4.booking__ds__extract_month AS booking__ds__extract_month
- , subq_4.booking__ds__extract_day AS booking__ds__extract_day
- , subq_4.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_4.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_4.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_4.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_4.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_4.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_4.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_4.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_4.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_4.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_4.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_4.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_4.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_4.booking__paid_at__day AS booking__paid_at__day
- , subq_4.booking__paid_at__week AS booking__paid_at__week
- , subq_4.booking__paid_at__month AS booking__paid_at__month
- , subq_4.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_4.booking__paid_at__year AS booking__paid_at__year
- , subq_4.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_4.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_4.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_4.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_4.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_4.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_4.listing AS listing
- , subq_4.guest AS guest
- , subq_4.host AS host
- , subq_4.booking__listing AS booking__listing
- , subq_4.booking__guest AS booking__guest
- , subq_4.booking__host AS booking__host
- , subq_4.is_instant AS is_instant
- , subq_4.booking__is_instant AS booking__is_instant
- , subq_4.bookings AS bookings
- , subq_4.instant_bookings AS instant_bookings
- , subq_4.booking_value AS booking_value
- , subq_4.max_booking_value AS max_booking_value
- , subq_4.min_booking_value AS min_booking_value
- , subq_4.bookers AS bookers
- , subq_4.average_booking_value AS average_booking_value
- , subq_4.referred_bookings AS referred_bookings
- , subq_4.median_booking_value AS median_booking_value
- , subq_4.booking_value_p99 AS booking_value_p99
- , subq_4.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_4.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_4.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ subq_14.metric_time__day AS metric_time__day
+ , subq_13.ds__day AS ds__day
+ , subq_13.ds__week AS ds__week
+ , subq_13.ds__month AS ds__month
+ , subq_13.ds__quarter AS ds__quarter
+ , subq_13.ds__year AS ds__year
+ , subq_13.ds__extract_year AS ds__extract_year
+ , subq_13.ds__extract_quarter AS ds__extract_quarter
+ , subq_13.ds__extract_month AS ds__extract_month
+ , subq_13.ds__extract_day AS ds__extract_day
+ , subq_13.ds__extract_dow AS ds__extract_dow
+ , subq_13.ds__extract_doy AS ds__extract_doy
+ , subq_13.ds_partitioned__day AS ds_partitioned__day
+ , subq_13.ds_partitioned__week AS ds_partitioned__week
+ , subq_13.ds_partitioned__month AS ds_partitioned__month
+ , subq_13.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_13.ds_partitioned__year AS ds_partitioned__year
+ , subq_13.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_13.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_13.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_13.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_13.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_13.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_13.paid_at__day AS paid_at__day
+ , subq_13.paid_at__week AS paid_at__week
+ , subq_13.paid_at__month AS paid_at__month
+ , subq_13.paid_at__quarter AS paid_at__quarter
+ , subq_13.paid_at__year AS paid_at__year
+ , subq_13.paid_at__extract_year AS paid_at__extract_year
+ , subq_13.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_13.paid_at__extract_month AS paid_at__extract_month
+ , subq_13.paid_at__extract_day AS paid_at__extract_day
+ , subq_13.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_13.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_13.booking__ds__day AS booking__ds__day
+ , subq_13.booking__ds__week AS booking__ds__week
+ , subq_13.booking__ds__month AS booking__ds__month
+ , subq_13.booking__ds__quarter AS booking__ds__quarter
+ , subq_13.booking__ds__year AS booking__ds__year
+ , subq_13.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_13.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_13.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_13.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_13.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_13.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_13.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_13.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_13.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_13.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_13.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_13.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_13.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_13.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_13.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_13.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_13.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_13.booking__paid_at__day AS booking__paid_at__day
+ , subq_13.booking__paid_at__week AS booking__paid_at__week
+ , subq_13.booking__paid_at__month AS booking__paid_at__month
+ , subq_13.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_13.booking__paid_at__year AS booking__paid_at__year
+ , subq_13.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_13.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_13.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_13.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_13.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_13.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_13.listing AS listing
+ , subq_13.guest AS guest
+ , subq_13.host AS host
+ , subq_13.booking__listing AS booking__listing
+ , subq_13.booking__guest AS booking__guest
+ , subq_13.booking__host AS booking__host
+ , subq_13.is_instant AS is_instant
+ , subq_13.booking__is_instant AS booking__is_instant
+ , subq_13.bookings AS bookings
+ , subq_13.instant_bookings AS instant_bookings
+ , subq_13.booking_value AS booking_value
+ , subq_13.max_booking_value AS max_booking_value
+ , subq_13.min_booking_value AS min_booking_value
+ , subq_13.bookers AS bookers
+ , subq_13.average_booking_value AS average_booking_value
+ , subq_13.referred_bookings AS referred_bookings
+ , subq_13.median_booking_value AS median_booking_value
+ , subq_13.booking_value_p99 AS booking_value_p99
+ , subq_13.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_13.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_13.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_6.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_6
- WHERE subq_6.ds BETWEEN '2019-12-19' AND '2020-01-02'
- ) subq_5
+ subq_15.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_15
+ WHERE subq_15.ds BETWEEN '2019-12-19' AND '2020-01-02'
+ ) subq_14
INNER JOIN (
-- Join Self Over Time Range
SELECT
- subq_2.metric_time__day AS metric_time__day
- , subq_1.ds__day AS ds__day
- , subq_1.ds__week AS ds__week
- , subq_1.ds__month AS ds__month
- , subq_1.ds__quarter AS ds__quarter
- , subq_1.ds__year AS ds__year
- , subq_1.ds__extract_year AS ds__extract_year
- , subq_1.ds__extract_quarter AS ds__extract_quarter
- , subq_1.ds__extract_month AS ds__extract_month
- , subq_1.ds__extract_day AS ds__extract_day
- , subq_1.ds__extract_dow AS ds__extract_dow
- , subq_1.ds__extract_doy AS ds__extract_doy
- , subq_1.ds_partitioned__day AS ds_partitioned__day
- , subq_1.ds_partitioned__week AS ds_partitioned__week
- , subq_1.ds_partitioned__month AS ds_partitioned__month
- , subq_1.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_1.ds_partitioned__year AS ds_partitioned__year
- , subq_1.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_1.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_1.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_1.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_1.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_1.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_1.paid_at__day AS paid_at__day
- , subq_1.paid_at__week AS paid_at__week
- , subq_1.paid_at__month AS paid_at__month
- , subq_1.paid_at__quarter AS paid_at__quarter
- , subq_1.paid_at__year AS paid_at__year
- , subq_1.paid_at__extract_year AS paid_at__extract_year
- , subq_1.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_1.paid_at__extract_month AS paid_at__extract_month
- , subq_1.paid_at__extract_day AS paid_at__extract_day
- , subq_1.paid_at__extract_dow AS paid_at__extract_dow
- , subq_1.paid_at__extract_doy AS paid_at__extract_doy
- , subq_1.booking__ds__day AS booking__ds__day
- , subq_1.booking__ds__week AS booking__ds__week
- , subq_1.booking__ds__month AS booking__ds__month
- , subq_1.booking__ds__quarter AS booking__ds__quarter
- , subq_1.booking__ds__year AS booking__ds__year
- , subq_1.booking__ds__extract_year AS booking__ds__extract_year
- , subq_1.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_1.booking__ds__extract_month AS booking__ds__extract_month
- , subq_1.booking__ds__extract_day AS booking__ds__extract_day
- , subq_1.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_1.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_1.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_1.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_1.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_1.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_1.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_1.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_1.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_1.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_1.booking__paid_at__day AS booking__paid_at__day
- , subq_1.booking__paid_at__week AS booking__paid_at__week
- , subq_1.booking__paid_at__month AS booking__paid_at__month
- , subq_1.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_1.booking__paid_at__year AS booking__paid_at__year
- , subq_1.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_1.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_1.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_1.metric_time__week AS metric_time__week
- , subq_1.metric_time__month AS metric_time__month
- , subq_1.metric_time__quarter AS metric_time__quarter
- , subq_1.metric_time__year AS metric_time__year
- , subq_1.metric_time__extract_year AS metric_time__extract_year
- , subq_1.metric_time__extract_quarter AS metric_time__extract_quarter
- , subq_1.metric_time__extract_month AS metric_time__extract_month
- , subq_1.metric_time__extract_day AS metric_time__extract_day
- , subq_1.metric_time__extract_dow AS metric_time__extract_dow
- , subq_1.metric_time__extract_doy AS metric_time__extract_doy
- , subq_1.listing AS listing
- , subq_1.guest AS guest
- , subq_1.host AS host
- , subq_1.booking__listing AS booking__listing
- , subq_1.booking__guest AS booking__guest
- , subq_1.booking__host AS booking__host
- , subq_1.is_instant AS is_instant
- , subq_1.booking__is_instant AS booking__is_instant
- , subq_1.bookings AS bookings
- , subq_1.instant_bookings AS instant_bookings
- , subq_1.booking_value AS booking_value
- , subq_1.max_booking_value AS max_booking_value
- , subq_1.min_booking_value AS min_booking_value
- , subq_1.bookers AS bookers
- , subq_1.average_booking_value AS average_booking_value
- , subq_1.referred_bookings AS referred_bookings
- , subq_1.median_booking_value AS median_booking_value
- , subq_1.booking_value_p99 AS booking_value_p99
- , subq_1.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_1.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_1.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ subq_11.metric_time__day AS metric_time__day
+ , subq_10.ds__day AS ds__day
+ , subq_10.ds__week AS ds__week
+ , subq_10.ds__month AS ds__month
+ , subq_10.ds__quarter AS ds__quarter
+ , subq_10.ds__year AS ds__year
+ , subq_10.ds__extract_year AS ds__extract_year
+ , subq_10.ds__extract_quarter AS ds__extract_quarter
+ , subq_10.ds__extract_month AS ds__extract_month
+ , subq_10.ds__extract_day AS ds__extract_day
+ , subq_10.ds__extract_dow AS ds__extract_dow
+ , subq_10.ds__extract_doy AS ds__extract_doy
+ , subq_10.ds_partitioned__day AS ds_partitioned__day
+ , subq_10.ds_partitioned__week AS ds_partitioned__week
+ , subq_10.ds_partitioned__month AS ds_partitioned__month
+ , subq_10.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_10.ds_partitioned__year AS ds_partitioned__year
+ , subq_10.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_10.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_10.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_10.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_10.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_10.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_10.paid_at__day AS paid_at__day
+ , subq_10.paid_at__week AS paid_at__week
+ , subq_10.paid_at__month AS paid_at__month
+ , subq_10.paid_at__quarter AS paid_at__quarter
+ , subq_10.paid_at__year AS paid_at__year
+ , subq_10.paid_at__extract_year AS paid_at__extract_year
+ , subq_10.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_10.paid_at__extract_month AS paid_at__extract_month
+ , subq_10.paid_at__extract_day AS paid_at__extract_day
+ , subq_10.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_10.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_10.booking__ds__day AS booking__ds__day
+ , subq_10.booking__ds__week AS booking__ds__week
+ , subq_10.booking__ds__month AS booking__ds__month
+ , subq_10.booking__ds__quarter AS booking__ds__quarter
+ , subq_10.booking__ds__year AS booking__ds__year
+ , subq_10.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_10.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_10.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_10.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_10.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_10.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_10.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_10.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_10.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_10.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_10.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_10.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_10.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_10.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_10.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_10.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_10.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_10.booking__paid_at__day AS booking__paid_at__day
+ , subq_10.booking__paid_at__week AS booking__paid_at__week
+ , subq_10.booking__paid_at__month AS booking__paid_at__month
+ , subq_10.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_10.booking__paid_at__year AS booking__paid_at__year
+ , subq_10.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_10.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_10.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_10.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_10.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_10.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_10.metric_time__week AS metric_time__week
+ , subq_10.metric_time__month AS metric_time__month
+ , subq_10.metric_time__quarter AS metric_time__quarter
+ , subq_10.metric_time__year AS metric_time__year
+ , subq_10.metric_time__extract_year AS metric_time__extract_year
+ , subq_10.metric_time__extract_quarter AS metric_time__extract_quarter
+ , subq_10.metric_time__extract_month AS metric_time__extract_month
+ , subq_10.metric_time__extract_day AS metric_time__extract_day
+ , subq_10.metric_time__extract_dow AS metric_time__extract_dow
+ , subq_10.metric_time__extract_doy AS metric_time__extract_doy
+ , subq_10.listing AS listing
+ , subq_10.guest AS guest
+ , subq_10.host AS host
+ , subq_10.booking__listing AS booking__listing
+ , subq_10.booking__guest AS booking__guest
+ , subq_10.booking__host AS booking__host
+ , subq_10.is_instant AS is_instant
+ , subq_10.booking__is_instant AS booking__is_instant
+ , subq_10.bookings AS bookings
+ , subq_10.instant_bookings AS instant_bookings
+ , subq_10.booking_value AS booking_value
+ , subq_10.max_booking_value AS max_booking_value
+ , subq_10.min_booking_value AS min_booking_value
+ , subq_10.bookers AS bookers
+ , subq_10.average_booking_value AS average_booking_value
+ , subq_10.referred_bookings AS referred_bookings
+ , subq_10.median_booking_value AS median_booking_value
+ , subq_10.booking_value_p99 AS booking_value_p99
+ , subq_10.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_10.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_10.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_3.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_3
- ) subq_2
+ subq_12.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_12
+ ) subq_11
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds) END AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) END AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.paid_at) END AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds) END AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) END AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.paid_at) END AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
ON
(
- subq_1.metric_time__day <= subq_2.metric_time__day
+ subq_10.metric_time__day <= subq_11.metric_time__day
) AND (
- subq_1.metric_time__day > DATEADD(day, -2, subq_2.metric_time__day)
+ subq_10.metric_time__day > DATEADD(day, -2, subq_11.metric_time__day)
)
- ) subq_4
+ ) subq_13
ON
- DATEADD(day, -2, subq_5.metric_time__day) = subq_4.metric_time__day
- ) subq_7
- ) subq_8
- WHERE subq_8.metric_time__day BETWEEN '2019-12-19' AND '2020-01-02'
- ) subq_9
+ DATEADD(day, -2, subq_14.metric_time__day) = subq_13.metric_time__day
+ ) subq_16
+ ) subq_17
+ WHERE subq_17.metric_time__day BETWEEN '2019-12-19' AND '2020-01-02'
+ ) subq_18
GROUP BY
- subq_9.metric_time__day
- ) subq_10
-) subq_11
+ subq_18.metric_time__day
+ ) subq_19
+) subq_20
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_time_offset_metric_with_time_constraint__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_time_offset_metric_with_time_constraint__plan0_optimized.sql
index d998382fb8..0f2d801995 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_time_offset_metric_with_time_constraint__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_cumulative_time_offset_metric_with_time_constraint__plan0_optimized.sql
@@ -9,33 +9,33 @@ FROM (
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_17.metric_time__day AS metric_time__day
- , COUNT(DISTINCT subq_16.bookers) AS every_2_days_bookers_2_days_ago
+ subq_26.metric_time__day AS metric_time__day
+ , COUNT(DISTINCT subq_25.bookers) AS every_2_days_bookers_2_days_ago
FROM (
-- Time Spine
SELECT
ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_18
+ FROM ***************************.mf_time_spine subq_27
WHERE ds BETWEEN '2019-12-19' AND '2020-01-02'
- ) subq_17
+ ) subq_26
INNER JOIN (
-- Join Self Over Time Range
SELECT
- subq_15.ds AS metric_time__day
- , bookings_source_src_28001.guest_id AS bookers
- FROM ***************************.mf_time_spine subq_15
+ subq_24.ds AS metric_time__day
+ , bookings_source_src_28000.guest_id AS bookers
+ FROM ***************************.mf_time_spine subq_24
INNER JOIN
- ***************************.fct_bookings bookings_source_src_28001
+ ***************************.fct_bookings bookings_source_src_28000
ON
(
- DATE_TRUNC('day', bookings_source_src_28001.ds) <= subq_15.ds
+ DATE_TRUNC('day', bookings_source_src_28000.ds) <= subq_24.ds
) AND (
- DATE_TRUNC('day', bookings_source_src_28001.ds) > DATEADD(day, -2, subq_15.ds)
+ DATE_TRUNC('day', bookings_source_src_28000.ds) > DATEADD(day, -2, subq_24.ds)
)
- ) subq_16
+ ) subq_25
ON
- DATEADD(day, -2, subq_17.metric_time__day) = subq_16.metric_time__day
- WHERE subq_17.metric_time__day BETWEEN '2019-12-19' AND '2020-01-02'
+ DATEADD(day, -2, subq_26.metric_time__day) = subq_25.metric_time__day
+ WHERE subq_26.metric_time__day BETWEEN '2019-12-19' AND '2020-01-02'
GROUP BY
- subq_17.metric_time__day
-) subq_23
+ subq_26.metric_time__day
+) subq_32
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric__plan0.sql
index 80cde693e4..787691532a 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric__plan0.sql
@@ -1,445 +1,445 @@
-- Compute Metrics via Expressions
SELECT
- subq_10.metric_time__day
+ subq_19.metric_time__day
, (bookings - ref_bookings) * 1.0 / bookings AS non_referred_bookings_pct
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_4.metric_time__day, subq_9.metric_time__day) AS metric_time__day
- , MAX(subq_4.ref_bookings) AS ref_bookings
- , MAX(subq_9.bookings) AS bookings
+ COALESCE(subq_13.metric_time__day, subq_18.metric_time__day) AS metric_time__day
+ , MAX(subq_13.ref_bookings) AS ref_bookings
+ , MAX(subq_18.bookings) AS bookings
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_3.metric_time__day
- , subq_3.referred_bookings AS ref_bookings
+ subq_12.metric_time__day
+ , subq_12.referred_bookings AS ref_bookings
FROM (
-- Aggregate Measures
SELECT
- subq_2.metric_time__day
- , SUM(subq_2.referred_bookings) AS referred_bookings
+ subq_11.metric_time__day
+ , SUM(subq_11.referred_bookings) AS referred_bookings
FROM (
-- Pass Only Elements: ['referred_bookings', 'metric_time__day']
SELECT
- subq_1.metric_time__day
- , subq_1.referred_bookings
+ subq_10.metric_time__day
+ , subq_10.referred_bookings
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
- ) subq_2
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds) END AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) END AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.paid_at) END AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds) END AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) END AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.paid_at) END AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
GROUP BY
- subq_2.metric_time__day
- ) subq_3
- ) subq_4
+ subq_11.metric_time__day
+ ) subq_12
+ ) subq_13
FULL OUTER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_8.metric_time__day
- , subq_8.bookings
+ subq_17.metric_time__day
+ , subq_17.bookings
FROM (
-- Aggregate Measures
SELECT
- subq_7.metric_time__day
- , SUM(subq_7.bookings) AS bookings
+ subq_16.metric_time__day
+ , SUM(subq_16.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__day']
SELECT
- subq_6.metric_time__day
- , subq_6.bookings
+ subq_15.metric_time__day
+ , subq_15.bookings
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_5.ds__day
- , subq_5.ds__week
- , subq_5.ds__month
- , subq_5.ds__quarter
- , subq_5.ds__year
- , subq_5.ds__extract_year
- , subq_5.ds__extract_quarter
- , subq_5.ds__extract_month
- , subq_5.ds__extract_day
- , subq_5.ds__extract_dow
- , subq_5.ds__extract_doy
- , subq_5.ds_partitioned__day
- , subq_5.ds_partitioned__week
- , subq_5.ds_partitioned__month
- , subq_5.ds_partitioned__quarter
- , subq_5.ds_partitioned__year
- , subq_5.ds_partitioned__extract_year
- , subq_5.ds_partitioned__extract_quarter
- , subq_5.ds_partitioned__extract_month
- , subq_5.ds_partitioned__extract_day
- , subq_5.ds_partitioned__extract_dow
- , subq_5.ds_partitioned__extract_doy
- , subq_5.paid_at__day
- , subq_5.paid_at__week
- , subq_5.paid_at__month
- , subq_5.paid_at__quarter
- , subq_5.paid_at__year
- , subq_5.paid_at__extract_year
- , subq_5.paid_at__extract_quarter
- , subq_5.paid_at__extract_month
- , subq_5.paid_at__extract_day
- , subq_5.paid_at__extract_dow
- , subq_5.paid_at__extract_doy
- , subq_5.booking__ds__day
- , subq_5.booking__ds__week
- , subq_5.booking__ds__month
- , subq_5.booking__ds__quarter
- , subq_5.booking__ds__year
- , subq_5.booking__ds__extract_year
- , subq_5.booking__ds__extract_quarter
- , subq_5.booking__ds__extract_month
- , subq_5.booking__ds__extract_day
- , subq_5.booking__ds__extract_dow
- , subq_5.booking__ds__extract_doy
- , subq_5.booking__ds_partitioned__day
- , subq_5.booking__ds_partitioned__week
- , subq_5.booking__ds_partitioned__month
- , subq_5.booking__ds_partitioned__quarter
- , subq_5.booking__ds_partitioned__year
- , subq_5.booking__ds_partitioned__extract_year
- , subq_5.booking__ds_partitioned__extract_quarter
- , subq_5.booking__ds_partitioned__extract_month
- , subq_5.booking__ds_partitioned__extract_day
- , subq_5.booking__ds_partitioned__extract_dow
- , subq_5.booking__ds_partitioned__extract_doy
- , subq_5.booking__paid_at__day
- , subq_5.booking__paid_at__week
- , subq_5.booking__paid_at__month
- , subq_5.booking__paid_at__quarter
- , subq_5.booking__paid_at__year
- , subq_5.booking__paid_at__extract_year
- , subq_5.booking__paid_at__extract_quarter
- , subq_5.booking__paid_at__extract_month
- , subq_5.booking__paid_at__extract_day
- , subq_5.booking__paid_at__extract_dow
- , subq_5.booking__paid_at__extract_doy
- , subq_5.ds__day AS metric_time__day
- , subq_5.ds__week AS metric_time__week
- , subq_5.ds__month AS metric_time__month
- , subq_5.ds__quarter AS metric_time__quarter
- , subq_5.ds__year AS metric_time__year
- , subq_5.ds__extract_year AS metric_time__extract_year
- , subq_5.ds__extract_quarter AS metric_time__extract_quarter
- , subq_5.ds__extract_month AS metric_time__extract_month
- , subq_5.ds__extract_day AS metric_time__extract_day
- , subq_5.ds__extract_dow AS metric_time__extract_dow
- , subq_5.ds__extract_doy AS metric_time__extract_doy
- , subq_5.listing
- , subq_5.guest
- , subq_5.host
- , subq_5.booking__listing
- , subq_5.booking__guest
- , subq_5.booking__host
- , subq_5.is_instant
- , subq_5.booking__is_instant
- , subq_5.bookings
- , subq_5.instant_bookings
- , subq_5.booking_value
- , subq_5.max_booking_value
- , subq_5.min_booking_value
- , subq_5.bookers
- , subq_5.average_booking_value
- , subq_5.referred_bookings
- , subq_5.median_booking_value
- , subq_5.booking_value_p99
- , subq_5.discrete_booking_value_p99
- , subq_5.approximate_continuous_booking_value_p99
- , subq_5.approximate_discrete_booking_value_p99
+ subq_14.ds__day
+ , subq_14.ds__week
+ , subq_14.ds__month
+ , subq_14.ds__quarter
+ , subq_14.ds__year
+ , subq_14.ds__extract_year
+ , subq_14.ds__extract_quarter
+ , subq_14.ds__extract_month
+ , subq_14.ds__extract_day
+ , subq_14.ds__extract_dow
+ , subq_14.ds__extract_doy
+ , subq_14.ds_partitioned__day
+ , subq_14.ds_partitioned__week
+ , subq_14.ds_partitioned__month
+ , subq_14.ds_partitioned__quarter
+ , subq_14.ds_partitioned__year
+ , subq_14.ds_partitioned__extract_year
+ , subq_14.ds_partitioned__extract_quarter
+ , subq_14.ds_partitioned__extract_month
+ , subq_14.ds_partitioned__extract_day
+ , subq_14.ds_partitioned__extract_dow
+ , subq_14.ds_partitioned__extract_doy
+ , subq_14.paid_at__day
+ , subq_14.paid_at__week
+ , subq_14.paid_at__month
+ , subq_14.paid_at__quarter
+ , subq_14.paid_at__year
+ , subq_14.paid_at__extract_year
+ , subq_14.paid_at__extract_quarter
+ , subq_14.paid_at__extract_month
+ , subq_14.paid_at__extract_day
+ , subq_14.paid_at__extract_dow
+ , subq_14.paid_at__extract_doy
+ , subq_14.booking__ds__day
+ , subq_14.booking__ds__week
+ , subq_14.booking__ds__month
+ , subq_14.booking__ds__quarter
+ , subq_14.booking__ds__year
+ , subq_14.booking__ds__extract_year
+ , subq_14.booking__ds__extract_quarter
+ , subq_14.booking__ds__extract_month
+ , subq_14.booking__ds__extract_day
+ , subq_14.booking__ds__extract_dow
+ , subq_14.booking__ds__extract_doy
+ , subq_14.booking__ds_partitioned__day
+ , subq_14.booking__ds_partitioned__week
+ , subq_14.booking__ds_partitioned__month
+ , subq_14.booking__ds_partitioned__quarter
+ , subq_14.booking__ds_partitioned__year
+ , subq_14.booking__ds_partitioned__extract_year
+ , subq_14.booking__ds_partitioned__extract_quarter
+ , subq_14.booking__ds_partitioned__extract_month
+ , subq_14.booking__ds_partitioned__extract_day
+ , subq_14.booking__ds_partitioned__extract_dow
+ , subq_14.booking__ds_partitioned__extract_doy
+ , subq_14.booking__paid_at__day
+ , subq_14.booking__paid_at__week
+ , subq_14.booking__paid_at__month
+ , subq_14.booking__paid_at__quarter
+ , subq_14.booking__paid_at__year
+ , subq_14.booking__paid_at__extract_year
+ , subq_14.booking__paid_at__extract_quarter
+ , subq_14.booking__paid_at__extract_month
+ , subq_14.booking__paid_at__extract_day
+ , subq_14.booking__paid_at__extract_dow
+ , subq_14.booking__paid_at__extract_doy
+ , subq_14.ds__day AS metric_time__day
+ , subq_14.ds__week AS metric_time__week
+ , subq_14.ds__month AS metric_time__month
+ , subq_14.ds__quarter AS metric_time__quarter
+ , subq_14.ds__year AS metric_time__year
+ , subq_14.ds__extract_year AS metric_time__extract_year
+ , subq_14.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_14.ds__extract_month AS metric_time__extract_month
+ , subq_14.ds__extract_day AS metric_time__extract_day
+ , subq_14.ds__extract_dow AS metric_time__extract_dow
+ , subq_14.ds__extract_doy AS metric_time__extract_doy
+ , subq_14.listing
+ , subq_14.guest
+ , subq_14.host
+ , subq_14.booking__listing
+ , subq_14.booking__guest
+ , subq_14.booking__host
+ , subq_14.is_instant
+ , subq_14.booking__is_instant
+ , subq_14.bookings
+ , subq_14.instant_bookings
+ , subq_14.booking_value
+ , subq_14.max_booking_value
+ , subq_14.min_booking_value
+ , subq_14.bookers
+ , subq_14.average_booking_value
+ , subq_14.referred_bookings
+ , subq_14.median_booking_value
+ , subq_14.booking_value_p99
+ , subq_14.discrete_booking_value_p99
+ , subq_14.approximate_continuous_booking_value_p99
+ , subq_14.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_5
- ) subq_6
- ) subq_7
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds) END AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) END AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.paid_at) END AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds) END AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) END AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.paid_at) END AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_14
+ ) subq_15
+ ) subq_16
GROUP BY
- subq_7.metric_time__day
- ) subq_8
- ) subq_9
+ subq_16.metric_time__day
+ ) subq_17
+ ) subq_18
ON
- subq_4.metric_time__day = subq_9.metric_time__day
+ subq_13.metric_time__day = subq_18.metric_time__day
GROUP BY
- COALESCE(subq_4.metric_time__day, subq_9.metric_time__day)
-) subq_10
+ COALESCE(subq_13.metric_time__day, subq_18.metric_time__day)
+) subq_19
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric__plan0_optimized.sql
index 23f7234c6e..1638560b4d 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric__plan0_optimized.sql
@@ -5,9 +5,9 @@ SELECT
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_15.metric_time__day, subq_20.metric_time__day) AS metric_time__day
- , MAX(subq_15.ref_bookings) AS ref_bookings
- , MAX(subq_20.bookings) AS bookings
+ COALESCE(subq_24.metric_time__day, subq_29.metric_time__day) AS metric_time__day
+ , MAX(subq_24.ref_bookings) AS ref_bookings
+ , MAX(subq_29.bookings) AS bookings
FROM (
-- Aggregate Measures
-- Compute Metrics via Expressions
@@ -21,11 +21,11 @@ FROM (
SELECT
DATE_TRUNC('day', ds) 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_28001
- ) subq_13
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_22
GROUP BY
metric_time__day
- ) subq_15
+ ) subq_24
FULL OUTER JOIN (
-- Aggregate Measures
-- Compute Metrics via Expressions
@@ -39,13 +39,13 @@ FROM (
SELECT
DATE_TRUNC('day', ds) AS metric_time__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_18
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_27
GROUP BY
metric_time__day
- ) subq_20
+ ) subq_29
ON
- subq_15.metric_time__day = subq_20.metric_time__day
+ subq_24.metric_time__day = subq_29.metric_time__day
GROUP BY
- COALESCE(subq_15.metric_time__day, subq_20.metric_time__day)
-) subq_21
+ COALESCE(subq_24.metric_time__day, subq_29.metric_time__day)
+) subq_30
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_month_dimension_and_offset_window__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_month_dimension_and_offset_window__plan0.sql
index 72735021e2..35be63856a 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_month_dimension_and_offset_window__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_month_dimension_and_offset_window__plan0.sql
@@ -1,73 +1,73 @@
-- Compute Metrics via Expressions
SELECT
- subq_7.metric_time__month
+ subq_9.metric_time__month
, bookings_last_month AS bookings_last_month
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_6.metric_time__month
- , subq_6.bookings_monthly AS bookings_last_month
+ subq_8.metric_time__month
+ , subq_8.bookings_monthly AS bookings_last_month
FROM (
-- Aggregate Measures
SELECT
- subq_5.metric_time__month
- , SUM(subq_5.bookings_monthly) AS bookings_monthly
+ subq_7.metric_time__month
+ , SUM(subq_7.bookings_monthly) AS bookings_monthly
FROM (
-- Pass Only Elements: ['bookings_monthly', 'metric_time__month']
SELECT
- subq_4.metric_time__month
- , subq_4.bookings_monthly
+ subq_6.metric_time__month
+ , subq_6.bookings_monthly
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_2.metric_time__month AS metric_time__month
- , subq_1.monthly_ds__month AS monthly_ds__month
- , subq_1.monthly_ds__quarter AS monthly_ds__quarter
- , subq_1.monthly_ds__year AS monthly_ds__year
- , subq_1.monthly_ds__extract_year AS monthly_ds__extract_year
- , subq_1.monthly_ds__extract_quarter AS monthly_ds__extract_quarter
- , subq_1.monthly_ds__extract_month AS monthly_ds__extract_month
- , subq_1.booking__monthly_ds__month AS booking__monthly_ds__month
- , subq_1.booking__monthly_ds__quarter AS booking__monthly_ds__quarter
- , subq_1.booking__monthly_ds__year AS booking__monthly_ds__year
- , subq_1.booking__monthly_ds__extract_year AS booking__monthly_ds__extract_year
- , subq_1.booking__monthly_ds__extract_quarter AS booking__monthly_ds__extract_quarter
- , subq_1.booking__monthly_ds__extract_month AS booking__monthly_ds__extract_month
- , subq_1.listing AS listing
- , subq_1.booking__listing AS booking__listing
- , subq_1.bookings_monthly AS bookings_monthly
+ subq_4.metric_time__month AS metric_time__month
+ , subq_3.monthly_ds__month AS monthly_ds__month
+ , subq_3.monthly_ds__quarter AS monthly_ds__quarter
+ , subq_3.monthly_ds__year AS monthly_ds__year
+ , subq_3.monthly_ds__extract_year AS monthly_ds__extract_year
+ , subq_3.monthly_ds__extract_quarter AS monthly_ds__extract_quarter
+ , subq_3.monthly_ds__extract_month AS monthly_ds__extract_month
+ , subq_3.booking__monthly_ds__month AS booking__monthly_ds__month
+ , subq_3.booking__monthly_ds__quarter AS booking__monthly_ds__quarter
+ , subq_3.booking__monthly_ds__year AS booking__monthly_ds__year
+ , subq_3.booking__monthly_ds__extract_year AS booking__monthly_ds__extract_year
+ , subq_3.booking__monthly_ds__extract_quarter AS booking__monthly_ds__extract_quarter
+ , subq_3.booking__monthly_ds__extract_month AS booking__monthly_ds__extract_month
+ , subq_3.listing AS listing
+ , subq_3.booking__listing AS booking__listing
+ , subq_3.bookings_monthly AS bookings_monthly
FROM (
-- Time Spine
SELECT
- DATE_TRUNC('month', subq_3.ds) AS metric_time__month
- FROM ***************************.mf_time_spine subq_3
+ DATE_TRUNC('month', subq_5.ds) AS metric_time__month
+ FROM ***************************.mf_time_spine subq_5
GROUP BY
- DATE_TRUNC('month', subq_3.ds)
- ) subq_2
+ DATE_TRUNC('month', subq_5.ds)
+ ) subq_4
INNER JOIN (
-- Metric Time Dimension 'monthly_ds'
SELECT
- subq_0.monthly_ds__month
- , subq_0.monthly_ds__quarter
- , subq_0.monthly_ds__year
- , subq_0.monthly_ds__extract_year
- , subq_0.monthly_ds__extract_quarter
- , subq_0.monthly_ds__extract_month
- , subq_0.booking__monthly_ds__month
- , subq_0.booking__monthly_ds__quarter
- , subq_0.booking__monthly_ds__year
- , subq_0.booking__monthly_ds__extract_year
- , subq_0.booking__monthly_ds__extract_quarter
- , subq_0.booking__monthly_ds__extract_month
- , subq_0.monthly_ds__month AS metric_time__month
- , subq_0.monthly_ds__quarter AS metric_time__quarter
- , subq_0.monthly_ds__year AS metric_time__year
- , subq_0.monthly_ds__extract_year AS metric_time__extract_year
- , subq_0.monthly_ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.monthly_ds__extract_month AS metric_time__extract_month
- , subq_0.listing
- , subq_0.booking__listing
- , subq_0.bookings_monthly
+ subq_2.monthly_ds__month
+ , subq_2.monthly_ds__quarter
+ , subq_2.monthly_ds__year
+ , subq_2.monthly_ds__extract_year
+ , subq_2.monthly_ds__extract_quarter
+ , subq_2.monthly_ds__extract_month
+ , subq_2.booking__monthly_ds__month
+ , subq_2.booking__monthly_ds__quarter
+ , subq_2.booking__monthly_ds__year
+ , subq_2.booking__monthly_ds__extract_year
+ , subq_2.booking__monthly_ds__extract_quarter
+ , subq_2.booking__monthly_ds__extract_month
+ , subq_2.monthly_ds__month AS metric_time__month
+ , subq_2.monthly_ds__quarter AS metric_time__quarter
+ , subq_2.monthly_ds__year AS metric_time__year
+ , subq_2.monthly_ds__extract_year AS metric_time__extract_year
+ , subq_2.monthly_ds__extract_quarter AS metric_time__extract_quarter
+ , subq_2.monthly_ds__extract_month AS metric_time__extract_month
+ , subq_2.listing
+ , subq_2.booking__listing
+ , subq_2.bookings_monthly
FROM (
-- Read Elements From Semantic Model 'bookings_monthly_source'
SELECT
@@ -87,13 +87,13 @@ FROM (
, bookings_monthly_source_src_16000.listing_id AS listing
, bookings_monthly_source_src_16000.listing_id AS booking__listing
FROM ***************************.fct_bookings_extended_monthly bookings_monthly_source_src_16000
- ) subq_0
- ) subq_1
+ ) subq_2
+ ) subq_3
ON
- DATEADD(month, -1, subq_2.metric_time__month) = subq_1.metric_time__month
- ) subq_4
- ) subq_5
+ DATEADD(month, -1, subq_4.metric_time__month) = subq_3.metric_time__month
+ ) subq_6
+ ) subq_7
GROUP BY
- subq_5.metric_time__month
- ) subq_6
-) subq_7
+ subq_7.metric_time__month
+ ) subq_8
+) subq_9
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_month_dimension_and_offset_window__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_month_dimension_and_offset_window__plan0_optimized.sql
index ccd562cfa6..75916f38d4 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_month_dimension_and_offset_window__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_month_dimension_and_offset_window__plan0_optimized.sql
@@ -8,20 +8,20 @@ FROM (
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_10.metric_time__month AS metric_time__month
+ subq_12.metric_time__month AS metric_time__month
, SUM(bookings_monthly_source_src_16000.bookings_monthly) AS bookings_last_month
FROM (
-- Time Spine
SELECT
DATE_TRUNC('month', ds) AS metric_time__month
- FROM ***************************.mf_time_spine subq_11
+ FROM ***************************.mf_time_spine subq_13
GROUP BY
DATE_TRUNC('month', ds)
- ) subq_10
+ ) subq_12
INNER JOIN
***************************.fct_bookings_extended_monthly bookings_monthly_source_src_16000
ON
- DATEADD(month, -1, subq_10.metric_time__month) = DATE_TRUNC('month', bookings_monthly_source_src_16000.ds)
+ DATEADD(month, -1, subq_12.metric_time__month) = DATE_TRUNC('month', bookings_monthly_source_src_16000.ds)
GROUP BY
- subq_10.metric_time__month
-) subq_15
+ subq_12.metric_time__month
+) subq_17
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_to_grain__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_to_grain__plan0.sql
index abe671054c..75c7999289 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_to_grain__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_to_grain__plan0.sql
@@ -1,545 +1,545 @@
-- Compute Metrics via Expressions
SELECT
- subq_13.metric_time__day
+ subq_22.metric_time__day
, bookings - bookings_at_start_of_month AS bookings_growth_since_start_of_month
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_4.metric_time__day, subq_12.metric_time__day) AS metric_time__day
- , MAX(subq_4.bookings) AS bookings
- , MAX(subq_12.bookings_at_start_of_month) AS bookings_at_start_of_month
+ COALESCE(subq_13.metric_time__day, subq_21.metric_time__day) AS metric_time__day
+ , MAX(subq_13.bookings) AS bookings
+ , MAX(subq_21.bookings_at_start_of_month) AS bookings_at_start_of_month
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_3.metric_time__day
- , subq_3.bookings
+ subq_12.metric_time__day
+ , subq_12.bookings
FROM (
-- Aggregate Measures
SELECT
- subq_2.metric_time__day
- , SUM(subq_2.bookings) AS bookings
+ subq_11.metric_time__day
+ , SUM(subq_11.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__day']
SELECT
- subq_1.metric_time__day
- , subq_1.bookings
+ subq_10.metric_time__day
+ , subq_10.bookings
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
- ) subq_2
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds) END AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) END AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.paid_at) END AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds) END AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) END AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.paid_at) END AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
GROUP BY
- subq_2.metric_time__day
- ) subq_3
- ) subq_4
+ subq_11.metric_time__day
+ ) subq_12
+ ) subq_13
FULL OUTER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_11.metric_time__day
- , subq_11.bookings AS bookings_at_start_of_month
+ subq_20.metric_time__day
+ , subq_20.bookings AS bookings_at_start_of_month
FROM (
-- Aggregate Measures
SELECT
- subq_10.metric_time__day
- , SUM(subq_10.bookings) AS bookings
+ subq_19.metric_time__day
+ , SUM(subq_19.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__day']
SELECT
- subq_9.metric_time__day
- , subq_9.bookings
+ subq_18.metric_time__day
+ , subq_18.bookings
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_7.metric_time__day AS metric_time__day
- , subq_6.ds__day AS ds__day
- , subq_6.ds__week AS ds__week
- , subq_6.ds__month AS ds__month
- , subq_6.ds__quarter AS ds__quarter
- , subq_6.ds__year AS ds__year
- , subq_6.ds__extract_year AS ds__extract_year
- , subq_6.ds__extract_quarter AS ds__extract_quarter
- , subq_6.ds__extract_month AS ds__extract_month
- , subq_6.ds__extract_day AS ds__extract_day
- , subq_6.ds__extract_dow AS ds__extract_dow
- , subq_6.ds__extract_doy AS ds__extract_doy
- , subq_6.ds_partitioned__day AS ds_partitioned__day
- , subq_6.ds_partitioned__week AS ds_partitioned__week
- , subq_6.ds_partitioned__month AS ds_partitioned__month
- , subq_6.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_6.ds_partitioned__year AS ds_partitioned__year
- , subq_6.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_6.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_6.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_6.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_6.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_6.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_6.paid_at__day AS paid_at__day
- , subq_6.paid_at__week AS paid_at__week
- , subq_6.paid_at__month AS paid_at__month
- , subq_6.paid_at__quarter AS paid_at__quarter
- , subq_6.paid_at__year AS paid_at__year
- , subq_6.paid_at__extract_year AS paid_at__extract_year
- , subq_6.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_6.paid_at__extract_month AS paid_at__extract_month
- , subq_6.paid_at__extract_day AS paid_at__extract_day
- , subq_6.paid_at__extract_dow AS paid_at__extract_dow
- , subq_6.paid_at__extract_doy AS paid_at__extract_doy
- , subq_6.booking__ds__day AS booking__ds__day
- , subq_6.booking__ds__week AS booking__ds__week
- , subq_6.booking__ds__month AS booking__ds__month
- , subq_6.booking__ds__quarter AS booking__ds__quarter
- , subq_6.booking__ds__year AS booking__ds__year
- , subq_6.booking__ds__extract_year AS booking__ds__extract_year
- , subq_6.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_6.booking__ds__extract_month AS booking__ds__extract_month
- , subq_6.booking__ds__extract_day AS booking__ds__extract_day
- , subq_6.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_6.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_6.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_6.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_6.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_6.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_6.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_6.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_6.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_6.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_6.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_6.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_6.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_6.booking__paid_at__day AS booking__paid_at__day
- , subq_6.booking__paid_at__week AS booking__paid_at__week
- , subq_6.booking__paid_at__month AS booking__paid_at__month
- , subq_6.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_6.booking__paid_at__year AS booking__paid_at__year
- , subq_6.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_6.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_6.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_6.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_6.listing AS listing
- , subq_6.guest AS guest
- , subq_6.host AS host
- , subq_6.booking__listing AS booking__listing
- , subq_6.booking__guest AS booking__guest
- , subq_6.booking__host AS booking__host
- , subq_6.is_instant AS is_instant
- , subq_6.booking__is_instant AS booking__is_instant
- , subq_6.bookings AS bookings
- , subq_6.instant_bookings AS instant_bookings
- , subq_6.booking_value AS booking_value
- , subq_6.max_booking_value AS max_booking_value
- , subq_6.min_booking_value AS min_booking_value
- , subq_6.bookers AS bookers
- , subq_6.average_booking_value AS average_booking_value
- , subq_6.referred_bookings AS referred_bookings
- , subq_6.median_booking_value AS median_booking_value
- , subq_6.booking_value_p99 AS booking_value_p99
- , subq_6.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_6.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_6.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ subq_16.metric_time__day AS metric_time__day
+ , subq_15.ds__day AS ds__day
+ , subq_15.ds__week AS ds__week
+ , subq_15.ds__month AS ds__month
+ , subq_15.ds__quarter AS ds__quarter
+ , subq_15.ds__year AS ds__year
+ , subq_15.ds__extract_year AS ds__extract_year
+ , subq_15.ds__extract_quarter AS ds__extract_quarter
+ , subq_15.ds__extract_month AS ds__extract_month
+ , subq_15.ds__extract_day AS ds__extract_day
+ , subq_15.ds__extract_dow AS ds__extract_dow
+ , subq_15.ds__extract_doy AS ds__extract_doy
+ , subq_15.ds_partitioned__day AS ds_partitioned__day
+ , subq_15.ds_partitioned__week AS ds_partitioned__week
+ , subq_15.ds_partitioned__month AS ds_partitioned__month
+ , subq_15.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_15.ds_partitioned__year AS ds_partitioned__year
+ , subq_15.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_15.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_15.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_15.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_15.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_15.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_15.paid_at__day AS paid_at__day
+ , subq_15.paid_at__week AS paid_at__week
+ , subq_15.paid_at__month AS paid_at__month
+ , subq_15.paid_at__quarter AS paid_at__quarter
+ , subq_15.paid_at__year AS paid_at__year
+ , subq_15.paid_at__extract_year AS paid_at__extract_year
+ , subq_15.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_15.paid_at__extract_month AS paid_at__extract_month
+ , subq_15.paid_at__extract_day AS paid_at__extract_day
+ , subq_15.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_15.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_15.booking__ds__day AS booking__ds__day
+ , subq_15.booking__ds__week AS booking__ds__week
+ , subq_15.booking__ds__month AS booking__ds__month
+ , subq_15.booking__ds__quarter AS booking__ds__quarter
+ , subq_15.booking__ds__year AS booking__ds__year
+ , subq_15.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_15.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_15.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_15.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_15.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_15.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_15.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_15.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_15.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_15.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_15.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_15.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_15.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_15.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_15.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_15.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_15.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_15.booking__paid_at__day AS booking__paid_at__day
+ , subq_15.booking__paid_at__week AS booking__paid_at__week
+ , subq_15.booking__paid_at__month AS booking__paid_at__month
+ , subq_15.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_15.booking__paid_at__year AS booking__paid_at__year
+ , subq_15.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_15.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_15.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_15.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_15.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_15.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_15.listing AS listing
+ , subq_15.guest AS guest
+ , subq_15.host AS host
+ , subq_15.booking__listing AS booking__listing
+ , subq_15.booking__guest AS booking__guest
+ , subq_15.booking__host AS booking__host
+ , subq_15.is_instant AS is_instant
+ , subq_15.booking__is_instant AS booking__is_instant
+ , subq_15.bookings AS bookings
+ , subq_15.instant_bookings AS instant_bookings
+ , subq_15.booking_value AS booking_value
+ , subq_15.max_booking_value AS max_booking_value
+ , subq_15.min_booking_value AS min_booking_value
+ , subq_15.bookers AS bookers
+ , subq_15.average_booking_value AS average_booking_value
+ , subq_15.referred_bookings AS referred_bookings
+ , subq_15.median_booking_value AS median_booking_value
+ , subq_15.booking_value_p99 AS booking_value_p99
+ , subq_15.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_15.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_15.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_8.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_8
- ) subq_7
+ subq_17.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_17
+ ) subq_16
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_5.ds__day
- , subq_5.ds__week
- , subq_5.ds__month
- , subq_5.ds__quarter
- , subq_5.ds__year
- , subq_5.ds__extract_year
- , subq_5.ds__extract_quarter
- , subq_5.ds__extract_month
- , subq_5.ds__extract_day
- , subq_5.ds__extract_dow
- , subq_5.ds__extract_doy
- , subq_5.ds_partitioned__day
- , subq_5.ds_partitioned__week
- , subq_5.ds_partitioned__month
- , subq_5.ds_partitioned__quarter
- , subq_5.ds_partitioned__year
- , subq_5.ds_partitioned__extract_year
- , subq_5.ds_partitioned__extract_quarter
- , subq_5.ds_partitioned__extract_month
- , subq_5.ds_partitioned__extract_day
- , subq_5.ds_partitioned__extract_dow
- , subq_5.ds_partitioned__extract_doy
- , subq_5.paid_at__day
- , subq_5.paid_at__week
- , subq_5.paid_at__month
- , subq_5.paid_at__quarter
- , subq_5.paid_at__year
- , subq_5.paid_at__extract_year
- , subq_5.paid_at__extract_quarter
- , subq_5.paid_at__extract_month
- , subq_5.paid_at__extract_day
- , subq_5.paid_at__extract_dow
- , subq_5.paid_at__extract_doy
- , subq_5.booking__ds__day
- , subq_5.booking__ds__week
- , subq_5.booking__ds__month
- , subq_5.booking__ds__quarter
- , subq_5.booking__ds__year
- , subq_5.booking__ds__extract_year
- , subq_5.booking__ds__extract_quarter
- , subq_5.booking__ds__extract_month
- , subq_5.booking__ds__extract_day
- , subq_5.booking__ds__extract_dow
- , subq_5.booking__ds__extract_doy
- , subq_5.booking__ds_partitioned__day
- , subq_5.booking__ds_partitioned__week
- , subq_5.booking__ds_partitioned__month
- , subq_5.booking__ds_partitioned__quarter
- , subq_5.booking__ds_partitioned__year
- , subq_5.booking__ds_partitioned__extract_year
- , subq_5.booking__ds_partitioned__extract_quarter
- , subq_5.booking__ds_partitioned__extract_month
- , subq_5.booking__ds_partitioned__extract_day
- , subq_5.booking__ds_partitioned__extract_dow
- , subq_5.booking__ds_partitioned__extract_doy
- , subq_5.booking__paid_at__day
- , subq_5.booking__paid_at__week
- , subq_5.booking__paid_at__month
- , subq_5.booking__paid_at__quarter
- , subq_5.booking__paid_at__year
- , subq_5.booking__paid_at__extract_year
- , subq_5.booking__paid_at__extract_quarter
- , subq_5.booking__paid_at__extract_month
- , subq_5.booking__paid_at__extract_day
- , subq_5.booking__paid_at__extract_dow
- , subq_5.booking__paid_at__extract_doy
- , subq_5.ds__day AS metric_time__day
- , subq_5.ds__week AS metric_time__week
- , subq_5.ds__month AS metric_time__month
- , subq_5.ds__quarter AS metric_time__quarter
- , subq_5.ds__year AS metric_time__year
- , subq_5.ds__extract_year AS metric_time__extract_year
- , subq_5.ds__extract_quarter AS metric_time__extract_quarter
- , subq_5.ds__extract_month AS metric_time__extract_month
- , subq_5.ds__extract_day AS metric_time__extract_day
- , subq_5.ds__extract_dow AS metric_time__extract_dow
- , subq_5.ds__extract_doy AS metric_time__extract_doy
- , subq_5.listing
- , subq_5.guest
- , subq_5.host
- , subq_5.booking__listing
- , subq_5.booking__guest
- , subq_5.booking__host
- , subq_5.is_instant
- , subq_5.booking__is_instant
- , subq_5.bookings
- , subq_5.instant_bookings
- , subq_5.booking_value
- , subq_5.max_booking_value
- , subq_5.min_booking_value
- , subq_5.bookers
- , subq_5.average_booking_value
- , subq_5.referred_bookings
- , subq_5.median_booking_value
- , subq_5.booking_value_p99
- , subq_5.discrete_booking_value_p99
- , subq_5.approximate_continuous_booking_value_p99
- , subq_5.approximate_discrete_booking_value_p99
+ subq_14.ds__day
+ , subq_14.ds__week
+ , subq_14.ds__month
+ , subq_14.ds__quarter
+ , subq_14.ds__year
+ , subq_14.ds__extract_year
+ , subq_14.ds__extract_quarter
+ , subq_14.ds__extract_month
+ , subq_14.ds__extract_day
+ , subq_14.ds__extract_dow
+ , subq_14.ds__extract_doy
+ , subq_14.ds_partitioned__day
+ , subq_14.ds_partitioned__week
+ , subq_14.ds_partitioned__month
+ , subq_14.ds_partitioned__quarter
+ , subq_14.ds_partitioned__year
+ , subq_14.ds_partitioned__extract_year
+ , subq_14.ds_partitioned__extract_quarter
+ , subq_14.ds_partitioned__extract_month
+ , subq_14.ds_partitioned__extract_day
+ , subq_14.ds_partitioned__extract_dow
+ , subq_14.ds_partitioned__extract_doy
+ , subq_14.paid_at__day
+ , subq_14.paid_at__week
+ , subq_14.paid_at__month
+ , subq_14.paid_at__quarter
+ , subq_14.paid_at__year
+ , subq_14.paid_at__extract_year
+ , subq_14.paid_at__extract_quarter
+ , subq_14.paid_at__extract_month
+ , subq_14.paid_at__extract_day
+ , subq_14.paid_at__extract_dow
+ , subq_14.paid_at__extract_doy
+ , subq_14.booking__ds__day
+ , subq_14.booking__ds__week
+ , subq_14.booking__ds__month
+ , subq_14.booking__ds__quarter
+ , subq_14.booking__ds__year
+ , subq_14.booking__ds__extract_year
+ , subq_14.booking__ds__extract_quarter
+ , subq_14.booking__ds__extract_month
+ , subq_14.booking__ds__extract_day
+ , subq_14.booking__ds__extract_dow
+ , subq_14.booking__ds__extract_doy
+ , subq_14.booking__ds_partitioned__day
+ , subq_14.booking__ds_partitioned__week
+ , subq_14.booking__ds_partitioned__month
+ , subq_14.booking__ds_partitioned__quarter
+ , subq_14.booking__ds_partitioned__year
+ , subq_14.booking__ds_partitioned__extract_year
+ , subq_14.booking__ds_partitioned__extract_quarter
+ , subq_14.booking__ds_partitioned__extract_month
+ , subq_14.booking__ds_partitioned__extract_day
+ , subq_14.booking__ds_partitioned__extract_dow
+ , subq_14.booking__ds_partitioned__extract_doy
+ , subq_14.booking__paid_at__day
+ , subq_14.booking__paid_at__week
+ , subq_14.booking__paid_at__month
+ , subq_14.booking__paid_at__quarter
+ , subq_14.booking__paid_at__year
+ , subq_14.booking__paid_at__extract_year
+ , subq_14.booking__paid_at__extract_quarter
+ , subq_14.booking__paid_at__extract_month
+ , subq_14.booking__paid_at__extract_day
+ , subq_14.booking__paid_at__extract_dow
+ , subq_14.booking__paid_at__extract_doy
+ , subq_14.ds__day AS metric_time__day
+ , subq_14.ds__week AS metric_time__week
+ , subq_14.ds__month AS metric_time__month
+ , subq_14.ds__quarter AS metric_time__quarter
+ , subq_14.ds__year AS metric_time__year
+ , subq_14.ds__extract_year AS metric_time__extract_year
+ , subq_14.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_14.ds__extract_month AS metric_time__extract_month
+ , subq_14.ds__extract_day AS metric_time__extract_day
+ , subq_14.ds__extract_dow AS metric_time__extract_dow
+ , subq_14.ds__extract_doy AS metric_time__extract_doy
+ , subq_14.listing
+ , subq_14.guest
+ , subq_14.host
+ , subq_14.booking__listing
+ , subq_14.booking__guest
+ , subq_14.booking__host
+ , subq_14.is_instant
+ , subq_14.booking__is_instant
+ , subq_14.bookings
+ , subq_14.instant_bookings
+ , subq_14.booking_value
+ , subq_14.max_booking_value
+ , subq_14.min_booking_value
+ , subq_14.bookers
+ , subq_14.average_booking_value
+ , subq_14.referred_bookings
+ , subq_14.median_booking_value
+ , subq_14.booking_value_p99
+ , subq_14.discrete_booking_value_p99
+ , subq_14.approximate_continuous_booking_value_p99
+ , subq_14.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_5
- ) subq_6
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds) END AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) END AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.paid_at) END AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds) END AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) END AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.paid_at) END AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_14
+ ) subq_15
ON
- DATE_TRUNC('month', subq_7.metric_time__day) = subq_6.metric_time__day
- ) subq_9
- ) subq_10
+ DATE_TRUNC('month', subq_16.metric_time__day) = subq_15.metric_time__day
+ ) subq_18
+ ) subq_19
GROUP BY
- subq_10.metric_time__day
- ) subq_11
- ) subq_12
+ subq_19.metric_time__day
+ ) subq_20
+ ) subq_21
ON
- subq_4.metric_time__day = subq_12.metric_time__day
+ subq_13.metric_time__day = subq_21.metric_time__day
GROUP BY
- COALESCE(subq_4.metric_time__day, subq_12.metric_time__day)
-) subq_13
+ COALESCE(subq_13.metric_time__day, subq_21.metric_time__day)
+) subq_22
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_to_grain__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_to_grain__plan0_optimized.sql
index 5138fe8ae6..2061be23cf 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_to_grain__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_to_grain__plan0_optimized.sql
@@ -5,9 +5,9 @@ SELECT
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_18.metric_time__day, subq_26.metric_time__day) AS metric_time__day
- , MAX(subq_18.bookings) AS bookings
- , MAX(subq_26.bookings_at_start_of_month) AS bookings_at_start_of_month
+ COALESCE(subq_27.metric_time__day, subq_35.metric_time__day) AS metric_time__day
+ , MAX(subq_27.bookings) AS bookings
+ , MAX(subq_35.bookings_at_start_of_month) AS bookings_at_start_of_month
FROM (
-- Aggregate Measures
-- Compute Metrics via Expressions
@@ -21,35 +21,35 @@ FROM (
SELECT
DATE_TRUNC('day', ds) AS metric_time__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_16
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_25
GROUP BY
metric_time__day
- ) subq_18
+ ) subq_27
FULL OUTER JOIN (
-- Join to Time Spine Dataset
-- Pass Only Elements: ['bookings', 'metric_time__day']
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_22.ds AS metric_time__day
- , SUM(subq_20.bookings) AS bookings_at_start_of_month
- FROM ***************************.mf_time_spine subq_22
+ subq_31.ds AS metric_time__day
+ , SUM(subq_29.bookings) AS bookings_at_start_of_month
+ FROM ***************************.mf_time_spine subq_31
INNER JOIN (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
SELECT
DATE_TRUNC('day', ds) AS metric_time__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_20
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_29
ON
- DATE_TRUNC('month', subq_22.ds) = subq_20.metric_time__day
+ DATE_TRUNC('month', subq_31.ds) = subq_29.metric_time__day
GROUP BY
- subq_22.ds
- ) subq_26
+ subq_31.ds
+ ) subq_35
ON
- subq_18.metric_time__day = subq_26.metric_time__day
+ subq_27.metric_time__day = subq_35.metric_time__day
GROUP BY
- COALESCE(subq_18.metric_time__day, subq_26.metric_time__day)
-) subq_27
+ COALESCE(subq_27.metric_time__day, subq_35.metric_time__day)
+) subq_36
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql
index 7657920261..ff45580a66 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_to_grain_and_granularity__plan0.sql
@@ -1,546 +1,546 @@
-- Compute Metrics via Expressions
SELECT
- subq_13.metric_time__week
+ subq_22.metric_time__week
, bookings - bookings_at_start_of_month AS bookings_growth_since_start_of_month
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_4.metric_time__week, subq_12.metric_time__week) AS metric_time__week
- , MAX(subq_4.bookings) AS bookings
- , MAX(subq_12.bookings_at_start_of_month) AS bookings_at_start_of_month
+ COALESCE(subq_13.metric_time__week, subq_21.metric_time__week) AS metric_time__week
+ , MAX(subq_13.bookings) AS bookings
+ , MAX(subq_21.bookings_at_start_of_month) AS bookings_at_start_of_month
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_3.metric_time__week
- , subq_3.bookings
+ subq_12.metric_time__week
+ , subq_12.bookings
FROM (
-- Aggregate Measures
SELECT
- subq_2.metric_time__week
- , SUM(subq_2.bookings) AS bookings
+ subq_11.metric_time__week
+ , SUM(subq_11.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__week']
SELECT
- subq_1.metric_time__week
- , subq_1.bookings
+ subq_10.metric_time__week
+ , subq_10.bookings
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
- ) subq_2
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds) END AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) END AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.paid_at) END AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds) END AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) END AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.paid_at) END AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
GROUP BY
- subq_2.metric_time__week
- ) subq_3
- ) subq_4
+ subq_11.metric_time__week
+ ) subq_12
+ ) subq_13
FULL OUTER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_11.metric_time__week
- , subq_11.bookings AS bookings_at_start_of_month
+ subq_20.metric_time__week
+ , subq_20.bookings AS bookings_at_start_of_month
FROM (
-- Aggregate Measures
SELECT
- subq_10.metric_time__week
- , SUM(subq_10.bookings) AS bookings
+ subq_19.metric_time__week
+ , SUM(subq_19.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__week']
SELECT
- subq_9.metric_time__week
- , subq_9.bookings
+ subq_18.metric_time__week
+ , subq_18.bookings
FROM (
-- Join to Time Spine Dataset
SELECT
- DATE_TRUNC('week', subq_7.metric_time__day) AS metric_time__week
- , subq_6.ds__day AS ds__day
- , subq_6.ds__week AS ds__week
- , subq_6.ds__month AS ds__month
- , subq_6.ds__quarter AS ds__quarter
- , subq_6.ds__year AS ds__year
- , subq_6.ds__extract_year AS ds__extract_year
- , subq_6.ds__extract_quarter AS ds__extract_quarter
- , subq_6.ds__extract_month AS ds__extract_month
- , subq_6.ds__extract_day AS ds__extract_day
- , subq_6.ds__extract_dow AS ds__extract_dow
- , subq_6.ds__extract_doy AS ds__extract_doy
- , subq_6.ds_partitioned__day AS ds_partitioned__day
- , subq_6.ds_partitioned__week AS ds_partitioned__week
- , subq_6.ds_partitioned__month AS ds_partitioned__month
- , subq_6.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_6.ds_partitioned__year AS ds_partitioned__year
- , subq_6.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_6.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_6.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_6.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_6.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_6.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_6.paid_at__day AS paid_at__day
- , subq_6.paid_at__week AS paid_at__week
- , subq_6.paid_at__month AS paid_at__month
- , subq_6.paid_at__quarter AS paid_at__quarter
- , subq_6.paid_at__year AS paid_at__year
- , subq_6.paid_at__extract_year AS paid_at__extract_year
- , subq_6.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_6.paid_at__extract_month AS paid_at__extract_month
- , subq_6.paid_at__extract_day AS paid_at__extract_day
- , subq_6.paid_at__extract_dow AS paid_at__extract_dow
- , subq_6.paid_at__extract_doy AS paid_at__extract_doy
- , subq_6.booking__ds__day AS booking__ds__day
- , subq_6.booking__ds__week AS booking__ds__week
- , subq_6.booking__ds__month AS booking__ds__month
- , subq_6.booking__ds__quarter AS booking__ds__quarter
- , subq_6.booking__ds__year AS booking__ds__year
- , subq_6.booking__ds__extract_year AS booking__ds__extract_year
- , subq_6.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_6.booking__ds__extract_month AS booking__ds__extract_month
- , subq_6.booking__ds__extract_day AS booking__ds__extract_day
- , subq_6.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_6.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_6.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_6.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_6.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_6.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_6.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_6.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_6.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_6.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_6.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_6.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_6.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_6.booking__paid_at__day AS booking__paid_at__day
- , subq_6.booking__paid_at__week AS booking__paid_at__week
- , subq_6.booking__paid_at__month AS booking__paid_at__month
- , subq_6.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_6.booking__paid_at__year AS booking__paid_at__year
- , subq_6.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_6.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_6.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_6.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_6.listing AS listing
- , subq_6.guest AS guest
- , subq_6.host AS host
- , subq_6.booking__listing AS booking__listing
- , subq_6.booking__guest AS booking__guest
- , subq_6.booking__host AS booking__host
- , subq_6.is_instant AS is_instant
- , subq_6.booking__is_instant AS booking__is_instant
- , subq_6.bookings AS bookings
- , subq_6.instant_bookings AS instant_bookings
- , subq_6.booking_value AS booking_value
- , subq_6.max_booking_value AS max_booking_value
- , subq_6.min_booking_value AS min_booking_value
- , subq_6.bookers AS bookers
- , subq_6.average_booking_value AS average_booking_value
- , subq_6.referred_bookings AS referred_bookings
- , subq_6.median_booking_value AS median_booking_value
- , subq_6.booking_value_p99 AS booking_value_p99
- , subq_6.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_6.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_6.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ DATE_TRUNC('week', subq_16.metric_time__day) AS metric_time__week
+ , subq_15.ds__day AS ds__day
+ , subq_15.ds__week AS ds__week
+ , subq_15.ds__month AS ds__month
+ , subq_15.ds__quarter AS ds__quarter
+ , subq_15.ds__year AS ds__year
+ , subq_15.ds__extract_year AS ds__extract_year
+ , subq_15.ds__extract_quarter AS ds__extract_quarter
+ , subq_15.ds__extract_month AS ds__extract_month
+ , subq_15.ds__extract_day AS ds__extract_day
+ , subq_15.ds__extract_dow AS ds__extract_dow
+ , subq_15.ds__extract_doy AS ds__extract_doy
+ , subq_15.ds_partitioned__day AS ds_partitioned__day
+ , subq_15.ds_partitioned__week AS ds_partitioned__week
+ , subq_15.ds_partitioned__month AS ds_partitioned__month
+ , subq_15.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_15.ds_partitioned__year AS ds_partitioned__year
+ , subq_15.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_15.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_15.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_15.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_15.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_15.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_15.paid_at__day AS paid_at__day
+ , subq_15.paid_at__week AS paid_at__week
+ , subq_15.paid_at__month AS paid_at__month
+ , subq_15.paid_at__quarter AS paid_at__quarter
+ , subq_15.paid_at__year AS paid_at__year
+ , subq_15.paid_at__extract_year AS paid_at__extract_year
+ , subq_15.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_15.paid_at__extract_month AS paid_at__extract_month
+ , subq_15.paid_at__extract_day AS paid_at__extract_day
+ , subq_15.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_15.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_15.booking__ds__day AS booking__ds__day
+ , subq_15.booking__ds__week AS booking__ds__week
+ , subq_15.booking__ds__month AS booking__ds__month
+ , subq_15.booking__ds__quarter AS booking__ds__quarter
+ , subq_15.booking__ds__year AS booking__ds__year
+ , subq_15.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_15.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_15.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_15.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_15.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_15.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_15.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_15.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_15.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_15.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_15.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_15.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_15.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_15.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_15.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_15.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_15.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_15.booking__paid_at__day AS booking__paid_at__day
+ , subq_15.booking__paid_at__week AS booking__paid_at__week
+ , subq_15.booking__paid_at__month AS booking__paid_at__month
+ , subq_15.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_15.booking__paid_at__year AS booking__paid_at__year
+ , subq_15.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_15.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_15.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_15.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_15.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_15.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_15.listing AS listing
+ , subq_15.guest AS guest
+ , subq_15.host AS host
+ , subq_15.booking__listing AS booking__listing
+ , subq_15.booking__guest AS booking__guest
+ , subq_15.booking__host AS booking__host
+ , subq_15.is_instant AS is_instant
+ , subq_15.booking__is_instant AS booking__is_instant
+ , subq_15.bookings AS bookings
+ , subq_15.instant_bookings AS instant_bookings
+ , subq_15.booking_value AS booking_value
+ , subq_15.max_booking_value AS max_booking_value
+ , subq_15.min_booking_value AS min_booking_value
+ , subq_15.bookers AS bookers
+ , subq_15.average_booking_value AS average_booking_value
+ , subq_15.referred_bookings AS referred_bookings
+ , subq_15.median_booking_value AS median_booking_value
+ , subq_15.booking_value_p99 AS booking_value_p99
+ , subq_15.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_15.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_15.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_8.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_8
- ) subq_7
+ subq_17.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_17
+ ) subq_16
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_5.ds__day
- , subq_5.ds__week
- , subq_5.ds__month
- , subq_5.ds__quarter
- , subq_5.ds__year
- , subq_5.ds__extract_year
- , subq_5.ds__extract_quarter
- , subq_5.ds__extract_month
- , subq_5.ds__extract_day
- , subq_5.ds__extract_dow
- , subq_5.ds__extract_doy
- , subq_5.ds_partitioned__day
- , subq_5.ds_partitioned__week
- , subq_5.ds_partitioned__month
- , subq_5.ds_partitioned__quarter
- , subq_5.ds_partitioned__year
- , subq_5.ds_partitioned__extract_year
- , subq_5.ds_partitioned__extract_quarter
- , subq_5.ds_partitioned__extract_month
- , subq_5.ds_partitioned__extract_day
- , subq_5.ds_partitioned__extract_dow
- , subq_5.ds_partitioned__extract_doy
- , subq_5.paid_at__day
- , subq_5.paid_at__week
- , subq_5.paid_at__month
- , subq_5.paid_at__quarter
- , subq_5.paid_at__year
- , subq_5.paid_at__extract_year
- , subq_5.paid_at__extract_quarter
- , subq_5.paid_at__extract_month
- , subq_5.paid_at__extract_day
- , subq_5.paid_at__extract_dow
- , subq_5.paid_at__extract_doy
- , subq_5.booking__ds__day
- , subq_5.booking__ds__week
- , subq_5.booking__ds__month
- , subq_5.booking__ds__quarter
- , subq_5.booking__ds__year
- , subq_5.booking__ds__extract_year
- , subq_5.booking__ds__extract_quarter
- , subq_5.booking__ds__extract_month
- , subq_5.booking__ds__extract_day
- , subq_5.booking__ds__extract_dow
- , subq_5.booking__ds__extract_doy
- , subq_5.booking__ds_partitioned__day
- , subq_5.booking__ds_partitioned__week
- , subq_5.booking__ds_partitioned__month
- , subq_5.booking__ds_partitioned__quarter
- , subq_5.booking__ds_partitioned__year
- , subq_5.booking__ds_partitioned__extract_year
- , subq_5.booking__ds_partitioned__extract_quarter
- , subq_5.booking__ds_partitioned__extract_month
- , subq_5.booking__ds_partitioned__extract_day
- , subq_5.booking__ds_partitioned__extract_dow
- , subq_5.booking__ds_partitioned__extract_doy
- , subq_5.booking__paid_at__day
- , subq_5.booking__paid_at__week
- , subq_5.booking__paid_at__month
- , subq_5.booking__paid_at__quarter
- , subq_5.booking__paid_at__year
- , subq_5.booking__paid_at__extract_year
- , subq_5.booking__paid_at__extract_quarter
- , subq_5.booking__paid_at__extract_month
- , subq_5.booking__paid_at__extract_day
- , subq_5.booking__paid_at__extract_dow
- , subq_5.booking__paid_at__extract_doy
- , subq_5.ds__day AS metric_time__day
- , subq_5.ds__week AS metric_time__week
- , subq_5.ds__month AS metric_time__month
- , subq_5.ds__quarter AS metric_time__quarter
- , subq_5.ds__year AS metric_time__year
- , subq_5.ds__extract_year AS metric_time__extract_year
- , subq_5.ds__extract_quarter AS metric_time__extract_quarter
- , subq_5.ds__extract_month AS metric_time__extract_month
- , subq_5.ds__extract_day AS metric_time__extract_day
- , subq_5.ds__extract_dow AS metric_time__extract_dow
- , subq_5.ds__extract_doy AS metric_time__extract_doy
- , subq_5.listing
- , subq_5.guest
- , subq_5.host
- , subq_5.booking__listing
- , subq_5.booking__guest
- , subq_5.booking__host
- , subq_5.is_instant
- , subq_5.booking__is_instant
- , subq_5.bookings
- , subq_5.instant_bookings
- , subq_5.booking_value
- , subq_5.max_booking_value
- , subq_5.min_booking_value
- , subq_5.bookers
- , subq_5.average_booking_value
- , subq_5.referred_bookings
- , subq_5.median_booking_value
- , subq_5.booking_value_p99
- , subq_5.discrete_booking_value_p99
- , subq_5.approximate_continuous_booking_value_p99
- , subq_5.approximate_discrete_booking_value_p99
+ subq_14.ds__day
+ , subq_14.ds__week
+ , subq_14.ds__month
+ , subq_14.ds__quarter
+ , subq_14.ds__year
+ , subq_14.ds__extract_year
+ , subq_14.ds__extract_quarter
+ , subq_14.ds__extract_month
+ , subq_14.ds__extract_day
+ , subq_14.ds__extract_dow
+ , subq_14.ds__extract_doy
+ , subq_14.ds_partitioned__day
+ , subq_14.ds_partitioned__week
+ , subq_14.ds_partitioned__month
+ , subq_14.ds_partitioned__quarter
+ , subq_14.ds_partitioned__year
+ , subq_14.ds_partitioned__extract_year
+ , subq_14.ds_partitioned__extract_quarter
+ , subq_14.ds_partitioned__extract_month
+ , subq_14.ds_partitioned__extract_day
+ , subq_14.ds_partitioned__extract_dow
+ , subq_14.ds_partitioned__extract_doy
+ , subq_14.paid_at__day
+ , subq_14.paid_at__week
+ , subq_14.paid_at__month
+ , subq_14.paid_at__quarter
+ , subq_14.paid_at__year
+ , subq_14.paid_at__extract_year
+ , subq_14.paid_at__extract_quarter
+ , subq_14.paid_at__extract_month
+ , subq_14.paid_at__extract_day
+ , subq_14.paid_at__extract_dow
+ , subq_14.paid_at__extract_doy
+ , subq_14.booking__ds__day
+ , subq_14.booking__ds__week
+ , subq_14.booking__ds__month
+ , subq_14.booking__ds__quarter
+ , subq_14.booking__ds__year
+ , subq_14.booking__ds__extract_year
+ , subq_14.booking__ds__extract_quarter
+ , subq_14.booking__ds__extract_month
+ , subq_14.booking__ds__extract_day
+ , subq_14.booking__ds__extract_dow
+ , subq_14.booking__ds__extract_doy
+ , subq_14.booking__ds_partitioned__day
+ , subq_14.booking__ds_partitioned__week
+ , subq_14.booking__ds_partitioned__month
+ , subq_14.booking__ds_partitioned__quarter
+ , subq_14.booking__ds_partitioned__year
+ , subq_14.booking__ds_partitioned__extract_year
+ , subq_14.booking__ds_partitioned__extract_quarter
+ , subq_14.booking__ds_partitioned__extract_month
+ , subq_14.booking__ds_partitioned__extract_day
+ , subq_14.booking__ds_partitioned__extract_dow
+ , subq_14.booking__ds_partitioned__extract_doy
+ , subq_14.booking__paid_at__day
+ , subq_14.booking__paid_at__week
+ , subq_14.booking__paid_at__month
+ , subq_14.booking__paid_at__quarter
+ , subq_14.booking__paid_at__year
+ , subq_14.booking__paid_at__extract_year
+ , subq_14.booking__paid_at__extract_quarter
+ , subq_14.booking__paid_at__extract_month
+ , subq_14.booking__paid_at__extract_day
+ , subq_14.booking__paid_at__extract_dow
+ , subq_14.booking__paid_at__extract_doy
+ , subq_14.ds__day AS metric_time__day
+ , subq_14.ds__week AS metric_time__week
+ , subq_14.ds__month AS metric_time__month
+ , subq_14.ds__quarter AS metric_time__quarter
+ , subq_14.ds__year AS metric_time__year
+ , subq_14.ds__extract_year AS metric_time__extract_year
+ , subq_14.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_14.ds__extract_month AS metric_time__extract_month
+ , subq_14.ds__extract_day AS metric_time__extract_day
+ , subq_14.ds__extract_dow AS metric_time__extract_dow
+ , subq_14.ds__extract_doy AS metric_time__extract_doy
+ , subq_14.listing
+ , subq_14.guest
+ , subq_14.host
+ , subq_14.booking__listing
+ , subq_14.booking__guest
+ , subq_14.booking__host
+ , subq_14.is_instant
+ , subq_14.booking__is_instant
+ , subq_14.bookings
+ , subq_14.instant_bookings
+ , subq_14.booking_value
+ , subq_14.max_booking_value
+ , subq_14.min_booking_value
+ , subq_14.bookers
+ , subq_14.average_booking_value
+ , subq_14.referred_bookings
+ , subq_14.median_booking_value
+ , subq_14.booking_value_p99
+ , subq_14.discrete_booking_value_p99
+ , subq_14.approximate_continuous_booking_value_p99
+ , subq_14.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_5
- ) subq_6
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds) END AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) END AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.paid_at) END AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds) END AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) END AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.paid_at) END AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_14
+ ) subq_15
ON
- DATE_TRUNC('month', subq_7.metric_time__day) = subq_6.metric_time__day
- WHERE DATE_TRUNC('week', subq_7.metric_time__day) = subq_7.metric_time__day
- ) subq_9
- ) subq_10
+ DATE_TRUNC('month', subq_16.metric_time__day) = subq_15.metric_time__day
+ WHERE DATE_TRUNC('week', subq_16.metric_time__day) = subq_16.metric_time__day
+ ) subq_18
+ ) subq_19
GROUP BY
- subq_10.metric_time__week
- ) subq_11
- ) subq_12
+ subq_19.metric_time__week
+ ) subq_20
+ ) subq_21
ON
- subq_4.metric_time__week = subq_12.metric_time__week
+ subq_13.metric_time__week = subq_21.metric_time__week
GROUP BY
- COALESCE(subq_4.metric_time__week, subq_12.metric_time__week)
-) subq_13
+ COALESCE(subq_13.metric_time__week, subq_21.metric_time__week)
+) subq_22
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_to_grain_and_granularity__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_to_grain_and_granularity__plan0_optimized.sql
index b9e4162413..65cf132abd 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_to_grain_and_granularity__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_to_grain_and_granularity__plan0_optimized.sql
@@ -5,9 +5,9 @@ SELECT
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_18.metric_time__week, subq_26.metric_time__week) AS metric_time__week
- , MAX(subq_18.bookings) AS bookings
- , MAX(subq_26.bookings_at_start_of_month) AS bookings_at_start_of_month
+ COALESCE(subq_27.metric_time__week, subq_35.metric_time__week) AS metric_time__week
+ , MAX(subq_27.bookings) AS bookings
+ , MAX(subq_35.bookings_at_start_of_month) AS bookings_at_start_of_month
FROM (
-- Aggregate Measures
-- Compute Metrics via Expressions
@@ -21,36 +21,36 @@ FROM (
SELECT
DATE_TRUNC('week', ds) AS metric_time__week
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_16
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_25
GROUP BY
metric_time__week
- ) subq_18
+ ) subq_27
FULL OUTER JOIN (
-- Join to Time Spine Dataset
-- Pass Only Elements: ['bookings', 'metric_time__week']
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- DATE_TRUNC('week', subq_22.ds) AS metric_time__week
- , SUM(subq_20.bookings) AS bookings_at_start_of_month
- FROM ***************************.mf_time_spine subq_22
+ DATE_TRUNC('week', subq_31.ds) AS metric_time__week
+ , SUM(subq_29.bookings) AS bookings_at_start_of_month
+ FROM ***************************.mf_time_spine subq_31
INNER JOIN (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
SELECT
DATE_TRUNC('day', ds) AS metric_time__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_20
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_29
ON
- DATE_TRUNC('month', subq_22.ds) = subq_20.metric_time__day
- WHERE DATE_TRUNC('week', subq_22.ds) = subq_22.ds
+ DATE_TRUNC('month', subq_31.ds) = subq_29.metric_time__day
+ WHERE DATE_TRUNC('week', subq_31.ds) = subq_31.ds
GROUP BY
- DATE_TRUNC('week', subq_22.ds)
- ) subq_26
+ DATE_TRUNC('week', subq_31.ds)
+ ) subq_35
ON
- subq_18.metric_time__week = subq_26.metric_time__week
+ subq_27.metric_time__week = subq_35.metric_time__week
GROUP BY
- COALESCE(subq_18.metric_time__week, subq_26.metric_time__week)
-) subq_27
+ COALESCE(subq_27.metric_time__week, subq_35.metric_time__week)
+) subq_36
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window__plan0.sql
index 5ff5134d8e..142f8ff9a1 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window__plan0.sql
@@ -1,545 +1,545 @@
-- Compute Metrics via Expressions
SELECT
- subq_13.metric_time__day
+ subq_22.metric_time__day
, bookings - bookings_2_weeks_ago AS bookings_growth_2_weeks
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_4.metric_time__day, subq_12.metric_time__day) AS metric_time__day
- , MAX(subq_4.bookings) AS bookings
- , MAX(subq_12.bookings_2_weeks_ago) AS bookings_2_weeks_ago
+ COALESCE(subq_13.metric_time__day, subq_21.metric_time__day) AS metric_time__day
+ , MAX(subq_13.bookings) AS bookings
+ , MAX(subq_21.bookings_2_weeks_ago) AS bookings_2_weeks_ago
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_3.metric_time__day
- , subq_3.bookings
+ subq_12.metric_time__day
+ , subq_12.bookings
FROM (
-- Aggregate Measures
SELECT
- subq_2.metric_time__day
- , SUM(subq_2.bookings) AS bookings
+ subq_11.metric_time__day
+ , SUM(subq_11.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__day']
SELECT
- subq_1.metric_time__day
- , subq_1.bookings
+ subq_10.metric_time__day
+ , subq_10.bookings
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
- ) subq_2
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds) END AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) END AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.paid_at) END AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds) END AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) END AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.paid_at) END AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
GROUP BY
- subq_2.metric_time__day
- ) subq_3
- ) subq_4
+ subq_11.metric_time__day
+ ) subq_12
+ ) subq_13
FULL OUTER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_11.metric_time__day
- , subq_11.bookings AS bookings_2_weeks_ago
+ subq_20.metric_time__day
+ , subq_20.bookings AS bookings_2_weeks_ago
FROM (
-- Aggregate Measures
SELECT
- subq_10.metric_time__day
- , SUM(subq_10.bookings) AS bookings
+ subq_19.metric_time__day
+ , SUM(subq_19.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__day']
SELECT
- subq_9.metric_time__day
- , subq_9.bookings
+ subq_18.metric_time__day
+ , subq_18.bookings
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_7.metric_time__day AS metric_time__day
- , subq_6.ds__day AS ds__day
- , subq_6.ds__week AS ds__week
- , subq_6.ds__month AS ds__month
- , subq_6.ds__quarter AS ds__quarter
- , subq_6.ds__year AS ds__year
- , subq_6.ds__extract_year AS ds__extract_year
- , subq_6.ds__extract_quarter AS ds__extract_quarter
- , subq_6.ds__extract_month AS ds__extract_month
- , subq_6.ds__extract_day AS ds__extract_day
- , subq_6.ds__extract_dow AS ds__extract_dow
- , subq_6.ds__extract_doy AS ds__extract_doy
- , subq_6.ds_partitioned__day AS ds_partitioned__day
- , subq_6.ds_partitioned__week AS ds_partitioned__week
- , subq_6.ds_partitioned__month AS ds_partitioned__month
- , subq_6.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_6.ds_partitioned__year AS ds_partitioned__year
- , subq_6.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_6.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_6.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_6.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_6.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_6.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_6.paid_at__day AS paid_at__day
- , subq_6.paid_at__week AS paid_at__week
- , subq_6.paid_at__month AS paid_at__month
- , subq_6.paid_at__quarter AS paid_at__quarter
- , subq_6.paid_at__year AS paid_at__year
- , subq_6.paid_at__extract_year AS paid_at__extract_year
- , subq_6.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_6.paid_at__extract_month AS paid_at__extract_month
- , subq_6.paid_at__extract_day AS paid_at__extract_day
- , subq_6.paid_at__extract_dow AS paid_at__extract_dow
- , subq_6.paid_at__extract_doy AS paid_at__extract_doy
- , subq_6.booking__ds__day AS booking__ds__day
- , subq_6.booking__ds__week AS booking__ds__week
- , subq_6.booking__ds__month AS booking__ds__month
- , subq_6.booking__ds__quarter AS booking__ds__quarter
- , subq_6.booking__ds__year AS booking__ds__year
- , subq_6.booking__ds__extract_year AS booking__ds__extract_year
- , subq_6.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_6.booking__ds__extract_month AS booking__ds__extract_month
- , subq_6.booking__ds__extract_day AS booking__ds__extract_day
- , subq_6.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_6.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_6.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_6.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_6.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_6.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_6.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_6.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_6.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_6.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_6.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_6.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_6.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_6.booking__paid_at__day AS booking__paid_at__day
- , subq_6.booking__paid_at__week AS booking__paid_at__week
- , subq_6.booking__paid_at__month AS booking__paid_at__month
- , subq_6.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_6.booking__paid_at__year AS booking__paid_at__year
- , subq_6.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_6.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_6.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_6.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_6.listing AS listing
- , subq_6.guest AS guest
- , subq_6.host AS host
- , subq_6.booking__listing AS booking__listing
- , subq_6.booking__guest AS booking__guest
- , subq_6.booking__host AS booking__host
- , subq_6.is_instant AS is_instant
- , subq_6.booking__is_instant AS booking__is_instant
- , subq_6.bookings AS bookings
- , subq_6.instant_bookings AS instant_bookings
- , subq_6.booking_value AS booking_value
- , subq_6.max_booking_value AS max_booking_value
- , subq_6.min_booking_value AS min_booking_value
- , subq_6.bookers AS bookers
- , subq_6.average_booking_value AS average_booking_value
- , subq_6.referred_bookings AS referred_bookings
- , subq_6.median_booking_value AS median_booking_value
- , subq_6.booking_value_p99 AS booking_value_p99
- , subq_6.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_6.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_6.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ subq_16.metric_time__day AS metric_time__day
+ , subq_15.ds__day AS ds__day
+ , subq_15.ds__week AS ds__week
+ , subq_15.ds__month AS ds__month
+ , subq_15.ds__quarter AS ds__quarter
+ , subq_15.ds__year AS ds__year
+ , subq_15.ds__extract_year AS ds__extract_year
+ , subq_15.ds__extract_quarter AS ds__extract_quarter
+ , subq_15.ds__extract_month AS ds__extract_month
+ , subq_15.ds__extract_day AS ds__extract_day
+ , subq_15.ds__extract_dow AS ds__extract_dow
+ , subq_15.ds__extract_doy AS ds__extract_doy
+ , subq_15.ds_partitioned__day AS ds_partitioned__day
+ , subq_15.ds_partitioned__week AS ds_partitioned__week
+ , subq_15.ds_partitioned__month AS ds_partitioned__month
+ , subq_15.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_15.ds_partitioned__year AS ds_partitioned__year
+ , subq_15.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_15.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_15.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_15.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_15.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_15.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_15.paid_at__day AS paid_at__day
+ , subq_15.paid_at__week AS paid_at__week
+ , subq_15.paid_at__month AS paid_at__month
+ , subq_15.paid_at__quarter AS paid_at__quarter
+ , subq_15.paid_at__year AS paid_at__year
+ , subq_15.paid_at__extract_year AS paid_at__extract_year
+ , subq_15.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_15.paid_at__extract_month AS paid_at__extract_month
+ , subq_15.paid_at__extract_day AS paid_at__extract_day
+ , subq_15.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_15.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_15.booking__ds__day AS booking__ds__day
+ , subq_15.booking__ds__week AS booking__ds__week
+ , subq_15.booking__ds__month AS booking__ds__month
+ , subq_15.booking__ds__quarter AS booking__ds__quarter
+ , subq_15.booking__ds__year AS booking__ds__year
+ , subq_15.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_15.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_15.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_15.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_15.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_15.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_15.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_15.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_15.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_15.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_15.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_15.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_15.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_15.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_15.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_15.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_15.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_15.booking__paid_at__day AS booking__paid_at__day
+ , subq_15.booking__paid_at__week AS booking__paid_at__week
+ , subq_15.booking__paid_at__month AS booking__paid_at__month
+ , subq_15.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_15.booking__paid_at__year AS booking__paid_at__year
+ , subq_15.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_15.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_15.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_15.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_15.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_15.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_15.listing AS listing
+ , subq_15.guest AS guest
+ , subq_15.host AS host
+ , subq_15.booking__listing AS booking__listing
+ , subq_15.booking__guest AS booking__guest
+ , subq_15.booking__host AS booking__host
+ , subq_15.is_instant AS is_instant
+ , subq_15.booking__is_instant AS booking__is_instant
+ , subq_15.bookings AS bookings
+ , subq_15.instant_bookings AS instant_bookings
+ , subq_15.booking_value AS booking_value
+ , subq_15.max_booking_value AS max_booking_value
+ , subq_15.min_booking_value AS min_booking_value
+ , subq_15.bookers AS bookers
+ , subq_15.average_booking_value AS average_booking_value
+ , subq_15.referred_bookings AS referred_bookings
+ , subq_15.median_booking_value AS median_booking_value
+ , subq_15.booking_value_p99 AS booking_value_p99
+ , subq_15.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_15.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_15.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_8.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_8
- ) subq_7
+ subq_17.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_17
+ ) subq_16
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_5.ds__day
- , subq_5.ds__week
- , subq_5.ds__month
- , subq_5.ds__quarter
- , subq_5.ds__year
- , subq_5.ds__extract_year
- , subq_5.ds__extract_quarter
- , subq_5.ds__extract_month
- , subq_5.ds__extract_day
- , subq_5.ds__extract_dow
- , subq_5.ds__extract_doy
- , subq_5.ds_partitioned__day
- , subq_5.ds_partitioned__week
- , subq_5.ds_partitioned__month
- , subq_5.ds_partitioned__quarter
- , subq_5.ds_partitioned__year
- , subq_5.ds_partitioned__extract_year
- , subq_5.ds_partitioned__extract_quarter
- , subq_5.ds_partitioned__extract_month
- , subq_5.ds_partitioned__extract_day
- , subq_5.ds_partitioned__extract_dow
- , subq_5.ds_partitioned__extract_doy
- , subq_5.paid_at__day
- , subq_5.paid_at__week
- , subq_5.paid_at__month
- , subq_5.paid_at__quarter
- , subq_5.paid_at__year
- , subq_5.paid_at__extract_year
- , subq_5.paid_at__extract_quarter
- , subq_5.paid_at__extract_month
- , subq_5.paid_at__extract_day
- , subq_5.paid_at__extract_dow
- , subq_5.paid_at__extract_doy
- , subq_5.booking__ds__day
- , subq_5.booking__ds__week
- , subq_5.booking__ds__month
- , subq_5.booking__ds__quarter
- , subq_5.booking__ds__year
- , subq_5.booking__ds__extract_year
- , subq_5.booking__ds__extract_quarter
- , subq_5.booking__ds__extract_month
- , subq_5.booking__ds__extract_day
- , subq_5.booking__ds__extract_dow
- , subq_5.booking__ds__extract_doy
- , subq_5.booking__ds_partitioned__day
- , subq_5.booking__ds_partitioned__week
- , subq_5.booking__ds_partitioned__month
- , subq_5.booking__ds_partitioned__quarter
- , subq_5.booking__ds_partitioned__year
- , subq_5.booking__ds_partitioned__extract_year
- , subq_5.booking__ds_partitioned__extract_quarter
- , subq_5.booking__ds_partitioned__extract_month
- , subq_5.booking__ds_partitioned__extract_day
- , subq_5.booking__ds_partitioned__extract_dow
- , subq_5.booking__ds_partitioned__extract_doy
- , subq_5.booking__paid_at__day
- , subq_5.booking__paid_at__week
- , subq_5.booking__paid_at__month
- , subq_5.booking__paid_at__quarter
- , subq_5.booking__paid_at__year
- , subq_5.booking__paid_at__extract_year
- , subq_5.booking__paid_at__extract_quarter
- , subq_5.booking__paid_at__extract_month
- , subq_5.booking__paid_at__extract_day
- , subq_5.booking__paid_at__extract_dow
- , subq_5.booking__paid_at__extract_doy
- , subq_5.ds__day AS metric_time__day
- , subq_5.ds__week AS metric_time__week
- , subq_5.ds__month AS metric_time__month
- , subq_5.ds__quarter AS metric_time__quarter
- , subq_5.ds__year AS metric_time__year
- , subq_5.ds__extract_year AS metric_time__extract_year
- , subq_5.ds__extract_quarter AS metric_time__extract_quarter
- , subq_5.ds__extract_month AS metric_time__extract_month
- , subq_5.ds__extract_day AS metric_time__extract_day
- , subq_5.ds__extract_dow AS metric_time__extract_dow
- , subq_5.ds__extract_doy AS metric_time__extract_doy
- , subq_5.listing
- , subq_5.guest
- , subq_5.host
- , subq_5.booking__listing
- , subq_5.booking__guest
- , subq_5.booking__host
- , subq_5.is_instant
- , subq_5.booking__is_instant
- , subq_5.bookings
- , subq_5.instant_bookings
- , subq_5.booking_value
- , subq_5.max_booking_value
- , subq_5.min_booking_value
- , subq_5.bookers
- , subq_5.average_booking_value
- , subq_5.referred_bookings
- , subq_5.median_booking_value
- , subq_5.booking_value_p99
- , subq_5.discrete_booking_value_p99
- , subq_5.approximate_continuous_booking_value_p99
- , subq_5.approximate_discrete_booking_value_p99
+ subq_14.ds__day
+ , subq_14.ds__week
+ , subq_14.ds__month
+ , subq_14.ds__quarter
+ , subq_14.ds__year
+ , subq_14.ds__extract_year
+ , subq_14.ds__extract_quarter
+ , subq_14.ds__extract_month
+ , subq_14.ds__extract_day
+ , subq_14.ds__extract_dow
+ , subq_14.ds__extract_doy
+ , subq_14.ds_partitioned__day
+ , subq_14.ds_partitioned__week
+ , subq_14.ds_partitioned__month
+ , subq_14.ds_partitioned__quarter
+ , subq_14.ds_partitioned__year
+ , subq_14.ds_partitioned__extract_year
+ , subq_14.ds_partitioned__extract_quarter
+ , subq_14.ds_partitioned__extract_month
+ , subq_14.ds_partitioned__extract_day
+ , subq_14.ds_partitioned__extract_dow
+ , subq_14.ds_partitioned__extract_doy
+ , subq_14.paid_at__day
+ , subq_14.paid_at__week
+ , subq_14.paid_at__month
+ , subq_14.paid_at__quarter
+ , subq_14.paid_at__year
+ , subq_14.paid_at__extract_year
+ , subq_14.paid_at__extract_quarter
+ , subq_14.paid_at__extract_month
+ , subq_14.paid_at__extract_day
+ , subq_14.paid_at__extract_dow
+ , subq_14.paid_at__extract_doy
+ , subq_14.booking__ds__day
+ , subq_14.booking__ds__week
+ , subq_14.booking__ds__month
+ , subq_14.booking__ds__quarter
+ , subq_14.booking__ds__year
+ , subq_14.booking__ds__extract_year
+ , subq_14.booking__ds__extract_quarter
+ , subq_14.booking__ds__extract_month
+ , subq_14.booking__ds__extract_day
+ , subq_14.booking__ds__extract_dow
+ , subq_14.booking__ds__extract_doy
+ , subq_14.booking__ds_partitioned__day
+ , subq_14.booking__ds_partitioned__week
+ , subq_14.booking__ds_partitioned__month
+ , subq_14.booking__ds_partitioned__quarter
+ , subq_14.booking__ds_partitioned__year
+ , subq_14.booking__ds_partitioned__extract_year
+ , subq_14.booking__ds_partitioned__extract_quarter
+ , subq_14.booking__ds_partitioned__extract_month
+ , subq_14.booking__ds_partitioned__extract_day
+ , subq_14.booking__ds_partitioned__extract_dow
+ , subq_14.booking__ds_partitioned__extract_doy
+ , subq_14.booking__paid_at__day
+ , subq_14.booking__paid_at__week
+ , subq_14.booking__paid_at__month
+ , subq_14.booking__paid_at__quarter
+ , subq_14.booking__paid_at__year
+ , subq_14.booking__paid_at__extract_year
+ , subq_14.booking__paid_at__extract_quarter
+ , subq_14.booking__paid_at__extract_month
+ , subq_14.booking__paid_at__extract_day
+ , subq_14.booking__paid_at__extract_dow
+ , subq_14.booking__paid_at__extract_doy
+ , subq_14.ds__day AS metric_time__day
+ , subq_14.ds__week AS metric_time__week
+ , subq_14.ds__month AS metric_time__month
+ , subq_14.ds__quarter AS metric_time__quarter
+ , subq_14.ds__year AS metric_time__year
+ , subq_14.ds__extract_year AS metric_time__extract_year
+ , subq_14.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_14.ds__extract_month AS metric_time__extract_month
+ , subq_14.ds__extract_day AS metric_time__extract_day
+ , subq_14.ds__extract_dow AS metric_time__extract_dow
+ , subq_14.ds__extract_doy AS metric_time__extract_doy
+ , subq_14.listing
+ , subq_14.guest
+ , subq_14.host
+ , subq_14.booking__listing
+ , subq_14.booking__guest
+ , subq_14.booking__host
+ , subq_14.is_instant
+ , subq_14.booking__is_instant
+ , subq_14.bookings
+ , subq_14.instant_bookings
+ , subq_14.booking_value
+ , subq_14.max_booking_value
+ , subq_14.min_booking_value
+ , subq_14.bookers
+ , subq_14.average_booking_value
+ , subq_14.referred_bookings
+ , subq_14.median_booking_value
+ , subq_14.booking_value_p99
+ , subq_14.discrete_booking_value_p99
+ , subq_14.approximate_continuous_booking_value_p99
+ , subq_14.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_5
- ) subq_6
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds) END AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) END AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.paid_at) END AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds) END AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) END AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.paid_at) END AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_14
+ ) subq_15
ON
- DATEADD(day, -14, subq_7.metric_time__day) = subq_6.metric_time__day
- ) subq_9
- ) subq_10
+ DATEADD(day, -14, subq_16.metric_time__day) = subq_15.metric_time__day
+ ) subq_18
+ ) subq_19
GROUP BY
- subq_10.metric_time__day
- ) subq_11
- ) subq_12
+ subq_19.metric_time__day
+ ) subq_20
+ ) subq_21
ON
- subq_4.metric_time__day = subq_12.metric_time__day
+ subq_13.metric_time__day = subq_21.metric_time__day
GROUP BY
- COALESCE(subq_4.metric_time__day, subq_12.metric_time__day)
-) subq_13
+ COALESCE(subq_13.metric_time__day, subq_21.metric_time__day)
+) subq_22
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window__plan0_optimized.sql
index 197f4d5430..ba542c8a14 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window__plan0_optimized.sql
@@ -5,9 +5,9 @@ SELECT
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_18.metric_time__day, subq_26.metric_time__day) AS metric_time__day
- , MAX(subq_18.bookings) AS bookings
- , MAX(subq_26.bookings_2_weeks_ago) AS bookings_2_weeks_ago
+ COALESCE(subq_27.metric_time__day, subq_35.metric_time__day) AS metric_time__day
+ , MAX(subq_27.bookings) AS bookings
+ , MAX(subq_35.bookings_2_weeks_ago) AS bookings_2_weeks_ago
FROM (
-- Aggregate Measures
-- Compute Metrics via Expressions
@@ -21,35 +21,35 @@ FROM (
SELECT
DATE_TRUNC('day', ds) AS metric_time__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_16
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_25
GROUP BY
metric_time__day
- ) subq_18
+ ) subq_27
FULL OUTER JOIN (
-- Join to Time Spine Dataset
-- Pass Only Elements: ['bookings', 'metric_time__day']
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_22.ds AS metric_time__day
- , SUM(subq_20.bookings) AS bookings_2_weeks_ago
- FROM ***************************.mf_time_spine subq_22
+ subq_31.ds AS metric_time__day
+ , SUM(subq_29.bookings) AS bookings_2_weeks_ago
+ FROM ***************************.mf_time_spine subq_31
INNER JOIN (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
SELECT
DATE_TRUNC('day', ds) AS metric_time__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_20
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_29
ON
- DATEADD(day, -14, subq_22.ds) = subq_20.metric_time__day
+ DATEADD(day, -14, subq_31.ds) = subq_29.metric_time__day
GROUP BY
- subq_22.ds
- ) subq_26
+ subq_31.ds
+ ) subq_35
ON
- subq_18.metric_time__day = subq_26.metric_time__day
+ subq_27.metric_time__day = subq_35.metric_time__day
GROUP BY
- COALESCE(subq_18.metric_time__day, subq_26.metric_time__day)
-) subq_27
+ COALESCE(subq_27.metric_time__day, subq_35.metric_time__day)
+) subq_36
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window_and_granularity__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window_and_granularity__plan0.sql
index 496cd41b91..b88129dbee 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window_and_granularity__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window_and_granularity__plan0.sql
@@ -1,545 +1,545 @@
-- Compute Metrics via Expressions
SELECT
- subq_13.metric_time__quarter
+ subq_22.metric_time__quarter
, bookings - bookings_2_weeks_ago AS bookings_growth_2_weeks
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_4.metric_time__quarter, subq_12.metric_time__quarter) AS metric_time__quarter
- , MAX(subq_4.bookings) AS bookings
- , MAX(subq_12.bookings_2_weeks_ago) AS bookings_2_weeks_ago
+ COALESCE(subq_13.metric_time__quarter, subq_21.metric_time__quarter) AS metric_time__quarter
+ , MAX(subq_13.bookings) AS bookings
+ , MAX(subq_21.bookings_2_weeks_ago) AS bookings_2_weeks_ago
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_3.metric_time__quarter
- , subq_3.bookings
+ subq_12.metric_time__quarter
+ , subq_12.bookings
FROM (
-- Aggregate Measures
SELECT
- subq_2.metric_time__quarter
- , SUM(subq_2.bookings) AS bookings
+ subq_11.metric_time__quarter
+ , SUM(subq_11.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__quarter']
SELECT
- subq_1.metric_time__quarter
- , subq_1.bookings
+ subq_10.metric_time__quarter
+ , subq_10.bookings
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
- ) subq_2
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds) END AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) END AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.paid_at) END AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds) END AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) END AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.paid_at) END AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
GROUP BY
- subq_2.metric_time__quarter
- ) subq_3
- ) subq_4
+ subq_11.metric_time__quarter
+ ) subq_12
+ ) subq_13
FULL OUTER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_11.metric_time__quarter
- , subq_11.bookings AS bookings_2_weeks_ago
+ subq_20.metric_time__quarter
+ , subq_20.bookings AS bookings_2_weeks_ago
FROM (
-- Aggregate Measures
SELECT
- subq_10.metric_time__quarter
- , SUM(subq_10.bookings) AS bookings
+ subq_19.metric_time__quarter
+ , SUM(subq_19.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__quarter']
SELECT
- subq_9.metric_time__quarter
- , subq_9.bookings
+ subq_18.metric_time__quarter
+ , subq_18.bookings
FROM (
-- Join to Time Spine Dataset
SELECT
- DATE_TRUNC('quarter', subq_7.metric_time__day) AS metric_time__quarter
- , subq_6.ds__day AS ds__day
- , subq_6.ds__week AS ds__week
- , subq_6.ds__month AS ds__month
- , subq_6.ds__quarter AS ds__quarter
- , subq_6.ds__year AS ds__year
- , subq_6.ds__extract_year AS ds__extract_year
- , subq_6.ds__extract_quarter AS ds__extract_quarter
- , subq_6.ds__extract_month AS ds__extract_month
- , subq_6.ds__extract_day AS ds__extract_day
- , subq_6.ds__extract_dow AS ds__extract_dow
- , subq_6.ds__extract_doy AS ds__extract_doy
- , subq_6.ds_partitioned__day AS ds_partitioned__day
- , subq_6.ds_partitioned__week AS ds_partitioned__week
- , subq_6.ds_partitioned__month AS ds_partitioned__month
- , subq_6.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_6.ds_partitioned__year AS ds_partitioned__year
- , subq_6.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_6.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_6.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_6.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_6.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_6.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_6.paid_at__day AS paid_at__day
- , subq_6.paid_at__week AS paid_at__week
- , subq_6.paid_at__month AS paid_at__month
- , subq_6.paid_at__quarter AS paid_at__quarter
- , subq_6.paid_at__year AS paid_at__year
- , subq_6.paid_at__extract_year AS paid_at__extract_year
- , subq_6.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_6.paid_at__extract_month AS paid_at__extract_month
- , subq_6.paid_at__extract_day AS paid_at__extract_day
- , subq_6.paid_at__extract_dow AS paid_at__extract_dow
- , subq_6.paid_at__extract_doy AS paid_at__extract_doy
- , subq_6.booking__ds__day AS booking__ds__day
- , subq_6.booking__ds__week AS booking__ds__week
- , subq_6.booking__ds__month AS booking__ds__month
- , subq_6.booking__ds__quarter AS booking__ds__quarter
- , subq_6.booking__ds__year AS booking__ds__year
- , subq_6.booking__ds__extract_year AS booking__ds__extract_year
- , subq_6.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_6.booking__ds__extract_month AS booking__ds__extract_month
- , subq_6.booking__ds__extract_day AS booking__ds__extract_day
- , subq_6.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_6.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_6.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_6.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_6.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_6.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_6.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_6.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_6.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_6.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_6.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_6.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_6.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_6.booking__paid_at__day AS booking__paid_at__day
- , subq_6.booking__paid_at__week AS booking__paid_at__week
- , subq_6.booking__paid_at__month AS booking__paid_at__month
- , subq_6.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_6.booking__paid_at__year AS booking__paid_at__year
- , subq_6.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_6.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_6.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_6.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_6.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_6.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_6.listing AS listing
- , subq_6.guest AS guest
- , subq_6.host AS host
- , subq_6.booking__listing AS booking__listing
- , subq_6.booking__guest AS booking__guest
- , subq_6.booking__host AS booking__host
- , subq_6.is_instant AS is_instant
- , subq_6.booking__is_instant AS booking__is_instant
- , subq_6.bookings AS bookings
- , subq_6.instant_bookings AS instant_bookings
- , subq_6.booking_value AS booking_value
- , subq_6.max_booking_value AS max_booking_value
- , subq_6.min_booking_value AS min_booking_value
- , subq_6.bookers AS bookers
- , subq_6.average_booking_value AS average_booking_value
- , subq_6.referred_bookings AS referred_bookings
- , subq_6.median_booking_value AS median_booking_value
- , subq_6.booking_value_p99 AS booking_value_p99
- , subq_6.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_6.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_6.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ DATE_TRUNC('quarter', subq_16.metric_time__day) AS metric_time__quarter
+ , subq_15.ds__day AS ds__day
+ , subq_15.ds__week AS ds__week
+ , subq_15.ds__month AS ds__month
+ , subq_15.ds__quarter AS ds__quarter
+ , subq_15.ds__year AS ds__year
+ , subq_15.ds__extract_year AS ds__extract_year
+ , subq_15.ds__extract_quarter AS ds__extract_quarter
+ , subq_15.ds__extract_month AS ds__extract_month
+ , subq_15.ds__extract_day AS ds__extract_day
+ , subq_15.ds__extract_dow AS ds__extract_dow
+ , subq_15.ds__extract_doy AS ds__extract_doy
+ , subq_15.ds_partitioned__day AS ds_partitioned__day
+ , subq_15.ds_partitioned__week AS ds_partitioned__week
+ , subq_15.ds_partitioned__month AS ds_partitioned__month
+ , subq_15.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_15.ds_partitioned__year AS ds_partitioned__year
+ , subq_15.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_15.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_15.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_15.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_15.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_15.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_15.paid_at__day AS paid_at__day
+ , subq_15.paid_at__week AS paid_at__week
+ , subq_15.paid_at__month AS paid_at__month
+ , subq_15.paid_at__quarter AS paid_at__quarter
+ , subq_15.paid_at__year AS paid_at__year
+ , subq_15.paid_at__extract_year AS paid_at__extract_year
+ , subq_15.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_15.paid_at__extract_month AS paid_at__extract_month
+ , subq_15.paid_at__extract_day AS paid_at__extract_day
+ , subq_15.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_15.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_15.booking__ds__day AS booking__ds__day
+ , subq_15.booking__ds__week AS booking__ds__week
+ , subq_15.booking__ds__month AS booking__ds__month
+ , subq_15.booking__ds__quarter AS booking__ds__quarter
+ , subq_15.booking__ds__year AS booking__ds__year
+ , subq_15.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_15.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_15.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_15.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_15.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_15.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_15.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_15.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_15.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_15.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_15.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_15.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_15.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_15.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_15.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_15.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_15.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_15.booking__paid_at__day AS booking__paid_at__day
+ , subq_15.booking__paid_at__week AS booking__paid_at__week
+ , subq_15.booking__paid_at__month AS booking__paid_at__month
+ , subq_15.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_15.booking__paid_at__year AS booking__paid_at__year
+ , subq_15.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_15.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_15.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_15.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_15.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_15.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_15.listing AS listing
+ , subq_15.guest AS guest
+ , subq_15.host AS host
+ , subq_15.booking__listing AS booking__listing
+ , subq_15.booking__guest AS booking__guest
+ , subq_15.booking__host AS booking__host
+ , subq_15.is_instant AS is_instant
+ , subq_15.booking__is_instant AS booking__is_instant
+ , subq_15.bookings AS bookings
+ , subq_15.instant_bookings AS instant_bookings
+ , subq_15.booking_value AS booking_value
+ , subq_15.max_booking_value AS max_booking_value
+ , subq_15.min_booking_value AS min_booking_value
+ , subq_15.bookers AS bookers
+ , subq_15.average_booking_value AS average_booking_value
+ , subq_15.referred_bookings AS referred_bookings
+ , subq_15.median_booking_value AS median_booking_value
+ , subq_15.booking_value_p99 AS booking_value_p99
+ , subq_15.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_15.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_15.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_8.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_8
- ) subq_7
+ subq_17.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_17
+ ) subq_16
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_5.ds__day
- , subq_5.ds__week
- , subq_5.ds__month
- , subq_5.ds__quarter
- , subq_5.ds__year
- , subq_5.ds__extract_year
- , subq_5.ds__extract_quarter
- , subq_5.ds__extract_month
- , subq_5.ds__extract_day
- , subq_5.ds__extract_dow
- , subq_5.ds__extract_doy
- , subq_5.ds_partitioned__day
- , subq_5.ds_partitioned__week
- , subq_5.ds_partitioned__month
- , subq_5.ds_partitioned__quarter
- , subq_5.ds_partitioned__year
- , subq_5.ds_partitioned__extract_year
- , subq_5.ds_partitioned__extract_quarter
- , subq_5.ds_partitioned__extract_month
- , subq_5.ds_partitioned__extract_day
- , subq_5.ds_partitioned__extract_dow
- , subq_5.ds_partitioned__extract_doy
- , subq_5.paid_at__day
- , subq_5.paid_at__week
- , subq_5.paid_at__month
- , subq_5.paid_at__quarter
- , subq_5.paid_at__year
- , subq_5.paid_at__extract_year
- , subq_5.paid_at__extract_quarter
- , subq_5.paid_at__extract_month
- , subq_5.paid_at__extract_day
- , subq_5.paid_at__extract_dow
- , subq_5.paid_at__extract_doy
- , subq_5.booking__ds__day
- , subq_5.booking__ds__week
- , subq_5.booking__ds__month
- , subq_5.booking__ds__quarter
- , subq_5.booking__ds__year
- , subq_5.booking__ds__extract_year
- , subq_5.booking__ds__extract_quarter
- , subq_5.booking__ds__extract_month
- , subq_5.booking__ds__extract_day
- , subq_5.booking__ds__extract_dow
- , subq_5.booking__ds__extract_doy
- , subq_5.booking__ds_partitioned__day
- , subq_5.booking__ds_partitioned__week
- , subq_5.booking__ds_partitioned__month
- , subq_5.booking__ds_partitioned__quarter
- , subq_5.booking__ds_partitioned__year
- , subq_5.booking__ds_partitioned__extract_year
- , subq_5.booking__ds_partitioned__extract_quarter
- , subq_5.booking__ds_partitioned__extract_month
- , subq_5.booking__ds_partitioned__extract_day
- , subq_5.booking__ds_partitioned__extract_dow
- , subq_5.booking__ds_partitioned__extract_doy
- , subq_5.booking__paid_at__day
- , subq_5.booking__paid_at__week
- , subq_5.booking__paid_at__month
- , subq_5.booking__paid_at__quarter
- , subq_5.booking__paid_at__year
- , subq_5.booking__paid_at__extract_year
- , subq_5.booking__paid_at__extract_quarter
- , subq_5.booking__paid_at__extract_month
- , subq_5.booking__paid_at__extract_day
- , subq_5.booking__paid_at__extract_dow
- , subq_5.booking__paid_at__extract_doy
- , subq_5.ds__day AS metric_time__day
- , subq_5.ds__week AS metric_time__week
- , subq_5.ds__month AS metric_time__month
- , subq_5.ds__quarter AS metric_time__quarter
- , subq_5.ds__year AS metric_time__year
- , subq_5.ds__extract_year AS metric_time__extract_year
- , subq_5.ds__extract_quarter AS metric_time__extract_quarter
- , subq_5.ds__extract_month AS metric_time__extract_month
- , subq_5.ds__extract_day AS metric_time__extract_day
- , subq_5.ds__extract_dow AS metric_time__extract_dow
- , subq_5.ds__extract_doy AS metric_time__extract_doy
- , subq_5.listing
- , subq_5.guest
- , subq_5.host
- , subq_5.booking__listing
- , subq_5.booking__guest
- , subq_5.booking__host
- , subq_5.is_instant
- , subq_5.booking__is_instant
- , subq_5.bookings
- , subq_5.instant_bookings
- , subq_5.booking_value
- , subq_5.max_booking_value
- , subq_5.min_booking_value
- , subq_5.bookers
- , subq_5.average_booking_value
- , subq_5.referred_bookings
- , subq_5.median_booking_value
- , subq_5.booking_value_p99
- , subq_5.discrete_booking_value_p99
- , subq_5.approximate_continuous_booking_value_p99
- , subq_5.approximate_discrete_booking_value_p99
+ subq_14.ds__day
+ , subq_14.ds__week
+ , subq_14.ds__month
+ , subq_14.ds__quarter
+ , subq_14.ds__year
+ , subq_14.ds__extract_year
+ , subq_14.ds__extract_quarter
+ , subq_14.ds__extract_month
+ , subq_14.ds__extract_day
+ , subq_14.ds__extract_dow
+ , subq_14.ds__extract_doy
+ , subq_14.ds_partitioned__day
+ , subq_14.ds_partitioned__week
+ , subq_14.ds_partitioned__month
+ , subq_14.ds_partitioned__quarter
+ , subq_14.ds_partitioned__year
+ , subq_14.ds_partitioned__extract_year
+ , subq_14.ds_partitioned__extract_quarter
+ , subq_14.ds_partitioned__extract_month
+ , subq_14.ds_partitioned__extract_day
+ , subq_14.ds_partitioned__extract_dow
+ , subq_14.ds_partitioned__extract_doy
+ , subq_14.paid_at__day
+ , subq_14.paid_at__week
+ , subq_14.paid_at__month
+ , subq_14.paid_at__quarter
+ , subq_14.paid_at__year
+ , subq_14.paid_at__extract_year
+ , subq_14.paid_at__extract_quarter
+ , subq_14.paid_at__extract_month
+ , subq_14.paid_at__extract_day
+ , subq_14.paid_at__extract_dow
+ , subq_14.paid_at__extract_doy
+ , subq_14.booking__ds__day
+ , subq_14.booking__ds__week
+ , subq_14.booking__ds__month
+ , subq_14.booking__ds__quarter
+ , subq_14.booking__ds__year
+ , subq_14.booking__ds__extract_year
+ , subq_14.booking__ds__extract_quarter
+ , subq_14.booking__ds__extract_month
+ , subq_14.booking__ds__extract_day
+ , subq_14.booking__ds__extract_dow
+ , subq_14.booking__ds__extract_doy
+ , subq_14.booking__ds_partitioned__day
+ , subq_14.booking__ds_partitioned__week
+ , subq_14.booking__ds_partitioned__month
+ , subq_14.booking__ds_partitioned__quarter
+ , subq_14.booking__ds_partitioned__year
+ , subq_14.booking__ds_partitioned__extract_year
+ , subq_14.booking__ds_partitioned__extract_quarter
+ , subq_14.booking__ds_partitioned__extract_month
+ , subq_14.booking__ds_partitioned__extract_day
+ , subq_14.booking__ds_partitioned__extract_dow
+ , subq_14.booking__ds_partitioned__extract_doy
+ , subq_14.booking__paid_at__day
+ , subq_14.booking__paid_at__week
+ , subq_14.booking__paid_at__month
+ , subq_14.booking__paid_at__quarter
+ , subq_14.booking__paid_at__year
+ , subq_14.booking__paid_at__extract_year
+ , subq_14.booking__paid_at__extract_quarter
+ , subq_14.booking__paid_at__extract_month
+ , subq_14.booking__paid_at__extract_day
+ , subq_14.booking__paid_at__extract_dow
+ , subq_14.booking__paid_at__extract_doy
+ , subq_14.ds__day AS metric_time__day
+ , subq_14.ds__week AS metric_time__week
+ , subq_14.ds__month AS metric_time__month
+ , subq_14.ds__quarter AS metric_time__quarter
+ , subq_14.ds__year AS metric_time__year
+ , subq_14.ds__extract_year AS metric_time__extract_year
+ , subq_14.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_14.ds__extract_month AS metric_time__extract_month
+ , subq_14.ds__extract_day AS metric_time__extract_day
+ , subq_14.ds__extract_dow AS metric_time__extract_dow
+ , subq_14.ds__extract_doy AS metric_time__extract_doy
+ , subq_14.listing
+ , subq_14.guest
+ , subq_14.host
+ , subq_14.booking__listing
+ , subq_14.booking__guest
+ , subq_14.booking__host
+ , subq_14.is_instant
+ , subq_14.booking__is_instant
+ , subq_14.bookings
+ , subq_14.instant_bookings
+ , subq_14.booking_value
+ , subq_14.max_booking_value
+ , subq_14.min_booking_value
+ , subq_14.bookers
+ , subq_14.average_booking_value
+ , subq_14.referred_bookings
+ , subq_14.median_booking_value
+ , subq_14.booking_value_p99
+ , subq_14.discrete_booking_value_p99
+ , subq_14.approximate_continuous_booking_value_p99
+ , subq_14.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_5
- ) subq_6
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds) END AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) END AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.paid_at) END AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds) END AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) END AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.paid_at) END AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_14
+ ) subq_15
ON
- DATEADD(day, -14, subq_7.metric_time__day) = subq_6.metric_time__day
- ) subq_9
- ) subq_10
+ DATEADD(day, -14, subq_16.metric_time__day) = subq_15.metric_time__day
+ ) subq_18
+ ) subq_19
GROUP BY
- subq_10.metric_time__quarter
- ) subq_11
- ) subq_12
+ subq_19.metric_time__quarter
+ ) subq_20
+ ) subq_21
ON
- subq_4.metric_time__quarter = subq_12.metric_time__quarter
+ subq_13.metric_time__quarter = subq_21.metric_time__quarter
GROUP BY
- COALESCE(subq_4.metric_time__quarter, subq_12.metric_time__quarter)
-) subq_13
+ COALESCE(subq_13.metric_time__quarter, subq_21.metric_time__quarter)
+) subq_22
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window_and_granularity__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window_and_granularity__plan0_optimized.sql
index 89f6dcf4d2..d31ffad9a6 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window_and_granularity__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window_and_granularity__plan0_optimized.sql
@@ -5,9 +5,9 @@ SELECT
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_18.metric_time__quarter, subq_26.metric_time__quarter) AS metric_time__quarter
- , MAX(subq_18.bookings) AS bookings
- , MAX(subq_26.bookings_2_weeks_ago) AS bookings_2_weeks_ago
+ COALESCE(subq_27.metric_time__quarter, subq_35.metric_time__quarter) AS metric_time__quarter
+ , MAX(subq_27.bookings) AS bookings
+ , MAX(subq_35.bookings_2_weeks_ago) AS bookings_2_weeks_ago
FROM (
-- Aggregate Measures
-- Compute Metrics via Expressions
@@ -21,35 +21,35 @@ FROM (
SELECT
DATE_TRUNC('quarter', ds) AS metric_time__quarter
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_16
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_25
GROUP BY
metric_time__quarter
- ) subq_18
+ ) subq_27
FULL OUTER JOIN (
-- Join to Time Spine Dataset
-- Pass Only Elements: ['bookings', 'metric_time__quarter']
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- DATE_TRUNC('quarter', subq_22.ds) AS metric_time__quarter
- , SUM(subq_20.bookings) AS bookings_2_weeks_ago
- FROM ***************************.mf_time_spine subq_22
+ DATE_TRUNC('quarter', subq_31.ds) AS metric_time__quarter
+ , SUM(subq_29.bookings) AS bookings_2_weeks_ago
+ FROM ***************************.mf_time_spine subq_31
INNER JOIN (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
SELECT
DATE_TRUNC('day', ds) AS metric_time__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_20
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_29
ON
- DATEADD(day, -14, subq_22.ds) = subq_20.metric_time__day
+ DATEADD(day, -14, subq_31.ds) = subq_29.metric_time__day
GROUP BY
- DATE_TRUNC('quarter', subq_22.ds)
- ) subq_26
+ DATE_TRUNC('quarter', subq_31.ds)
+ ) subq_35
ON
- subq_18.metric_time__quarter = subq_26.metric_time__quarter
+ subq_27.metric_time__quarter = subq_35.metric_time__quarter
GROUP BY
- COALESCE(subq_18.metric_time__quarter, subq_26.metric_time__quarter)
-) subq_27
+ COALESCE(subq_27.metric_time__quarter, subq_35.metric_time__quarter)
+) subq_36
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql
index 0be63111b8..ff4fa7f076 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window_and_offset_to_grain__plan0.sql
@@ -1,645 +1,645 @@
-- Compute Metrics via Expressions
SELECT
- subq_16.metric_time__day
+ subq_25.metric_time__day
, month_start_bookings - bookings_1_month_ago AS bookings_month_start_compared_to_1_month_prior
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_7.metric_time__day, subq_15.metric_time__day) AS metric_time__day
- , MAX(subq_7.month_start_bookings) AS month_start_bookings
- , MAX(subq_15.bookings_1_month_ago) AS bookings_1_month_ago
+ COALESCE(subq_16.metric_time__day, subq_24.metric_time__day) AS metric_time__day
+ , MAX(subq_16.month_start_bookings) AS month_start_bookings
+ , MAX(subq_24.bookings_1_month_ago) AS bookings_1_month_ago
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_6.metric_time__day
- , subq_6.bookings AS month_start_bookings
+ subq_15.metric_time__day
+ , subq_15.bookings AS month_start_bookings
FROM (
-- Aggregate Measures
SELECT
- subq_5.metric_time__day
- , SUM(subq_5.bookings) AS bookings
+ subq_14.metric_time__day
+ , SUM(subq_14.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__day']
SELECT
- subq_4.metric_time__day
- , subq_4.bookings
+ subq_13.metric_time__day
+ , subq_13.bookings
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_2.metric_time__day AS metric_time__day
- , subq_1.ds__day AS ds__day
- , subq_1.ds__week AS ds__week
- , subq_1.ds__month AS ds__month
- , subq_1.ds__quarter AS ds__quarter
- , subq_1.ds__year AS ds__year
- , subq_1.ds__extract_year AS ds__extract_year
- , subq_1.ds__extract_quarter AS ds__extract_quarter
- , subq_1.ds__extract_month AS ds__extract_month
- , subq_1.ds__extract_day AS ds__extract_day
- , subq_1.ds__extract_dow AS ds__extract_dow
- , subq_1.ds__extract_doy AS ds__extract_doy
- , subq_1.ds_partitioned__day AS ds_partitioned__day
- , subq_1.ds_partitioned__week AS ds_partitioned__week
- , subq_1.ds_partitioned__month AS ds_partitioned__month
- , subq_1.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_1.ds_partitioned__year AS ds_partitioned__year
- , subq_1.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_1.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_1.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_1.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_1.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_1.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_1.paid_at__day AS paid_at__day
- , subq_1.paid_at__week AS paid_at__week
- , subq_1.paid_at__month AS paid_at__month
- , subq_1.paid_at__quarter AS paid_at__quarter
- , subq_1.paid_at__year AS paid_at__year
- , subq_1.paid_at__extract_year AS paid_at__extract_year
- , subq_1.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_1.paid_at__extract_month AS paid_at__extract_month
- , subq_1.paid_at__extract_day AS paid_at__extract_day
- , subq_1.paid_at__extract_dow AS paid_at__extract_dow
- , subq_1.paid_at__extract_doy AS paid_at__extract_doy
- , subq_1.booking__ds__day AS booking__ds__day
- , subq_1.booking__ds__week AS booking__ds__week
- , subq_1.booking__ds__month AS booking__ds__month
- , subq_1.booking__ds__quarter AS booking__ds__quarter
- , subq_1.booking__ds__year AS booking__ds__year
- , subq_1.booking__ds__extract_year AS booking__ds__extract_year
- , subq_1.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_1.booking__ds__extract_month AS booking__ds__extract_month
- , subq_1.booking__ds__extract_day AS booking__ds__extract_day
- , subq_1.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_1.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_1.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_1.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_1.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_1.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_1.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_1.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_1.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_1.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_1.booking__paid_at__day AS booking__paid_at__day
- , subq_1.booking__paid_at__week AS booking__paid_at__week
- , subq_1.booking__paid_at__month AS booking__paid_at__month
- , subq_1.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_1.booking__paid_at__year AS booking__paid_at__year
- , subq_1.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_1.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_1.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_1.listing AS listing
- , subq_1.guest AS guest
- , subq_1.host AS host
- , subq_1.booking__listing AS booking__listing
- , subq_1.booking__guest AS booking__guest
- , subq_1.booking__host AS booking__host
- , subq_1.is_instant AS is_instant
- , subq_1.booking__is_instant AS booking__is_instant
- , subq_1.bookings AS bookings
- , subq_1.instant_bookings AS instant_bookings
- , subq_1.booking_value AS booking_value
- , subq_1.max_booking_value AS max_booking_value
- , subq_1.min_booking_value AS min_booking_value
- , subq_1.bookers AS bookers
- , subq_1.average_booking_value AS average_booking_value
- , subq_1.referred_bookings AS referred_bookings
- , subq_1.median_booking_value AS median_booking_value
- , subq_1.booking_value_p99 AS booking_value_p99
- , subq_1.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_1.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_1.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ subq_11.metric_time__day AS metric_time__day
+ , subq_10.ds__day AS ds__day
+ , subq_10.ds__week AS ds__week
+ , subq_10.ds__month AS ds__month
+ , subq_10.ds__quarter AS ds__quarter
+ , subq_10.ds__year AS ds__year
+ , subq_10.ds__extract_year AS ds__extract_year
+ , subq_10.ds__extract_quarter AS ds__extract_quarter
+ , subq_10.ds__extract_month AS ds__extract_month
+ , subq_10.ds__extract_day AS ds__extract_day
+ , subq_10.ds__extract_dow AS ds__extract_dow
+ , subq_10.ds__extract_doy AS ds__extract_doy
+ , subq_10.ds_partitioned__day AS ds_partitioned__day
+ , subq_10.ds_partitioned__week AS ds_partitioned__week
+ , subq_10.ds_partitioned__month AS ds_partitioned__month
+ , subq_10.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_10.ds_partitioned__year AS ds_partitioned__year
+ , subq_10.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_10.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_10.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_10.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_10.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_10.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_10.paid_at__day AS paid_at__day
+ , subq_10.paid_at__week AS paid_at__week
+ , subq_10.paid_at__month AS paid_at__month
+ , subq_10.paid_at__quarter AS paid_at__quarter
+ , subq_10.paid_at__year AS paid_at__year
+ , subq_10.paid_at__extract_year AS paid_at__extract_year
+ , subq_10.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_10.paid_at__extract_month AS paid_at__extract_month
+ , subq_10.paid_at__extract_day AS paid_at__extract_day
+ , subq_10.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_10.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_10.booking__ds__day AS booking__ds__day
+ , subq_10.booking__ds__week AS booking__ds__week
+ , subq_10.booking__ds__month AS booking__ds__month
+ , subq_10.booking__ds__quarter AS booking__ds__quarter
+ , subq_10.booking__ds__year AS booking__ds__year
+ , subq_10.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_10.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_10.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_10.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_10.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_10.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_10.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_10.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_10.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_10.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_10.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_10.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_10.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_10.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_10.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_10.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_10.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_10.booking__paid_at__day AS booking__paid_at__day
+ , subq_10.booking__paid_at__week AS booking__paid_at__week
+ , subq_10.booking__paid_at__month AS booking__paid_at__month
+ , subq_10.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_10.booking__paid_at__year AS booking__paid_at__year
+ , subq_10.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_10.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_10.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_10.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_10.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_10.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_10.listing AS listing
+ , subq_10.guest AS guest
+ , subq_10.host AS host
+ , subq_10.booking__listing AS booking__listing
+ , subq_10.booking__guest AS booking__guest
+ , subq_10.booking__host AS booking__host
+ , subq_10.is_instant AS is_instant
+ , subq_10.booking__is_instant AS booking__is_instant
+ , subq_10.bookings AS bookings
+ , subq_10.instant_bookings AS instant_bookings
+ , subq_10.booking_value AS booking_value
+ , subq_10.max_booking_value AS max_booking_value
+ , subq_10.min_booking_value AS min_booking_value
+ , subq_10.bookers AS bookers
+ , subq_10.average_booking_value AS average_booking_value
+ , subq_10.referred_bookings AS referred_bookings
+ , subq_10.median_booking_value AS median_booking_value
+ , subq_10.booking_value_p99 AS booking_value_p99
+ , subq_10.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_10.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_10.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_3.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_3
- ) subq_2
+ subq_12.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_12
+ ) subq_11
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds) END AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) END AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.paid_at) END AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds) END AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) END AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.paid_at) END AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
ON
- DATE_TRUNC('month', subq_2.metric_time__day) = subq_1.metric_time__day
- ) subq_4
- ) subq_5
+ DATE_TRUNC('month', subq_11.metric_time__day) = subq_10.metric_time__day
+ ) subq_13
+ ) subq_14
GROUP BY
- subq_5.metric_time__day
- ) subq_6
- ) subq_7
+ subq_14.metric_time__day
+ ) subq_15
+ ) subq_16
FULL OUTER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_14.metric_time__day
- , subq_14.bookings AS bookings_1_month_ago
+ subq_23.metric_time__day
+ , subq_23.bookings AS bookings_1_month_ago
FROM (
-- Aggregate Measures
SELECT
- subq_13.metric_time__day
- , SUM(subq_13.bookings) AS bookings
+ subq_22.metric_time__day
+ , SUM(subq_22.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__day']
SELECT
- subq_12.metric_time__day
- , subq_12.bookings
+ subq_21.metric_time__day
+ , subq_21.bookings
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_10.metric_time__day AS metric_time__day
- , subq_9.ds__day AS ds__day
- , subq_9.ds__week AS ds__week
- , subq_9.ds__month AS ds__month
- , subq_9.ds__quarter AS ds__quarter
- , subq_9.ds__year AS ds__year
- , subq_9.ds__extract_year AS ds__extract_year
- , subq_9.ds__extract_quarter AS ds__extract_quarter
- , subq_9.ds__extract_month AS ds__extract_month
- , subq_9.ds__extract_day AS ds__extract_day
- , subq_9.ds__extract_dow AS ds__extract_dow
- , subq_9.ds__extract_doy AS ds__extract_doy
- , subq_9.ds_partitioned__day AS ds_partitioned__day
- , subq_9.ds_partitioned__week AS ds_partitioned__week
- , subq_9.ds_partitioned__month AS ds_partitioned__month
- , subq_9.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_9.ds_partitioned__year AS ds_partitioned__year
- , subq_9.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_9.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_9.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_9.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_9.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_9.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_9.paid_at__day AS paid_at__day
- , subq_9.paid_at__week AS paid_at__week
- , subq_9.paid_at__month AS paid_at__month
- , subq_9.paid_at__quarter AS paid_at__quarter
- , subq_9.paid_at__year AS paid_at__year
- , subq_9.paid_at__extract_year AS paid_at__extract_year
- , subq_9.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_9.paid_at__extract_month AS paid_at__extract_month
- , subq_9.paid_at__extract_day AS paid_at__extract_day
- , subq_9.paid_at__extract_dow AS paid_at__extract_dow
- , subq_9.paid_at__extract_doy AS paid_at__extract_doy
- , subq_9.booking__ds__day AS booking__ds__day
- , subq_9.booking__ds__week AS booking__ds__week
- , subq_9.booking__ds__month AS booking__ds__month
- , subq_9.booking__ds__quarter AS booking__ds__quarter
- , subq_9.booking__ds__year AS booking__ds__year
- , subq_9.booking__ds__extract_year AS booking__ds__extract_year
- , subq_9.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_9.booking__ds__extract_month AS booking__ds__extract_month
- , subq_9.booking__ds__extract_day AS booking__ds__extract_day
- , subq_9.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_9.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_9.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_9.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_9.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_9.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_9.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_9.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_9.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_9.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_9.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_9.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_9.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_9.booking__paid_at__day AS booking__paid_at__day
- , subq_9.booking__paid_at__week AS booking__paid_at__week
- , subq_9.booking__paid_at__month AS booking__paid_at__month
- , subq_9.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_9.booking__paid_at__year AS booking__paid_at__year
- , subq_9.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_9.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_9.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_9.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_9.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_9.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_9.listing AS listing
- , subq_9.guest AS guest
- , subq_9.host AS host
- , subq_9.booking__listing AS booking__listing
- , subq_9.booking__guest AS booking__guest
- , subq_9.booking__host AS booking__host
- , subq_9.is_instant AS is_instant
- , subq_9.booking__is_instant AS booking__is_instant
- , subq_9.bookings AS bookings
- , subq_9.instant_bookings AS instant_bookings
- , subq_9.booking_value AS booking_value
- , subq_9.max_booking_value AS max_booking_value
- , subq_9.min_booking_value AS min_booking_value
- , subq_9.bookers AS bookers
- , subq_9.average_booking_value AS average_booking_value
- , subq_9.referred_bookings AS referred_bookings
- , subq_9.median_booking_value AS median_booking_value
- , subq_9.booking_value_p99 AS booking_value_p99
- , subq_9.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_9.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_9.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ subq_19.metric_time__day AS metric_time__day
+ , subq_18.ds__day AS ds__day
+ , subq_18.ds__week AS ds__week
+ , subq_18.ds__month AS ds__month
+ , subq_18.ds__quarter AS ds__quarter
+ , subq_18.ds__year AS ds__year
+ , subq_18.ds__extract_year AS ds__extract_year
+ , subq_18.ds__extract_quarter AS ds__extract_quarter
+ , subq_18.ds__extract_month AS ds__extract_month
+ , subq_18.ds__extract_day AS ds__extract_day
+ , subq_18.ds__extract_dow AS ds__extract_dow
+ , subq_18.ds__extract_doy AS ds__extract_doy
+ , subq_18.ds_partitioned__day AS ds_partitioned__day
+ , subq_18.ds_partitioned__week AS ds_partitioned__week
+ , subq_18.ds_partitioned__month AS ds_partitioned__month
+ , subq_18.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_18.ds_partitioned__year AS ds_partitioned__year
+ , subq_18.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_18.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_18.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_18.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_18.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_18.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_18.paid_at__day AS paid_at__day
+ , subq_18.paid_at__week AS paid_at__week
+ , subq_18.paid_at__month AS paid_at__month
+ , subq_18.paid_at__quarter AS paid_at__quarter
+ , subq_18.paid_at__year AS paid_at__year
+ , subq_18.paid_at__extract_year AS paid_at__extract_year
+ , subq_18.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_18.paid_at__extract_month AS paid_at__extract_month
+ , subq_18.paid_at__extract_day AS paid_at__extract_day
+ , subq_18.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_18.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_18.booking__ds__day AS booking__ds__day
+ , subq_18.booking__ds__week AS booking__ds__week
+ , subq_18.booking__ds__month AS booking__ds__month
+ , subq_18.booking__ds__quarter AS booking__ds__quarter
+ , subq_18.booking__ds__year AS booking__ds__year
+ , subq_18.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_18.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_18.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_18.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_18.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_18.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_18.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_18.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_18.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_18.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_18.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_18.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_18.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_18.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_18.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_18.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_18.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_18.booking__paid_at__day AS booking__paid_at__day
+ , subq_18.booking__paid_at__week AS booking__paid_at__week
+ , subq_18.booking__paid_at__month AS booking__paid_at__month
+ , subq_18.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_18.booking__paid_at__year AS booking__paid_at__year
+ , subq_18.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_18.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_18.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_18.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_18.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_18.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_18.listing AS listing
+ , subq_18.guest AS guest
+ , subq_18.host AS host
+ , subq_18.booking__listing AS booking__listing
+ , subq_18.booking__guest AS booking__guest
+ , subq_18.booking__host AS booking__host
+ , subq_18.is_instant AS is_instant
+ , subq_18.booking__is_instant AS booking__is_instant
+ , subq_18.bookings AS bookings
+ , subq_18.instant_bookings AS instant_bookings
+ , subq_18.booking_value AS booking_value
+ , subq_18.max_booking_value AS max_booking_value
+ , subq_18.min_booking_value AS min_booking_value
+ , subq_18.bookers AS bookers
+ , subq_18.average_booking_value AS average_booking_value
+ , subq_18.referred_bookings AS referred_bookings
+ , subq_18.median_booking_value AS median_booking_value
+ , subq_18.booking_value_p99 AS booking_value_p99
+ , subq_18.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_18.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_18.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_11.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_11
- ) subq_10
+ subq_20.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_20
+ ) subq_19
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_8.ds__day
- , subq_8.ds__week
- , subq_8.ds__month
- , subq_8.ds__quarter
- , subq_8.ds__year
- , subq_8.ds__extract_year
- , subq_8.ds__extract_quarter
- , subq_8.ds__extract_month
- , subq_8.ds__extract_day
- , subq_8.ds__extract_dow
- , subq_8.ds__extract_doy
- , subq_8.ds_partitioned__day
- , subq_8.ds_partitioned__week
- , subq_8.ds_partitioned__month
- , subq_8.ds_partitioned__quarter
- , subq_8.ds_partitioned__year
- , subq_8.ds_partitioned__extract_year
- , subq_8.ds_partitioned__extract_quarter
- , subq_8.ds_partitioned__extract_month
- , subq_8.ds_partitioned__extract_day
- , subq_8.ds_partitioned__extract_dow
- , subq_8.ds_partitioned__extract_doy
- , subq_8.paid_at__day
- , subq_8.paid_at__week
- , subq_8.paid_at__month
- , subq_8.paid_at__quarter
- , subq_8.paid_at__year
- , subq_8.paid_at__extract_year
- , subq_8.paid_at__extract_quarter
- , subq_8.paid_at__extract_month
- , subq_8.paid_at__extract_day
- , subq_8.paid_at__extract_dow
- , subq_8.paid_at__extract_doy
- , subq_8.booking__ds__day
- , subq_8.booking__ds__week
- , subq_8.booking__ds__month
- , subq_8.booking__ds__quarter
- , subq_8.booking__ds__year
- , subq_8.booking__ds__extract_year
- , subq_8.booking__ds__extract_quarter
- , subq_8.booking__ds__extract_month
- , subq_8.booking__ds__extract_day
- , subq_8.booking__ds__extract_dow
- , subq_8.booking__ds__extract_doy
- , subq_8.booking__ds_partitioned__day
- , subq_8.booking__ds_partitioned__week
- , subq_8.booking__ds_partitioned__month
- , subq_8.booking__ds_partitioned__quarter
- , subq_8.booking__ds_partitioned__year
- , subq_8.booking__ds_partitioned__extract_year
- , subq_8.booking__ds_partitioned__extract_quarter
- , subq_8.booking__ds_partitioned__extract_month
- , subq_8.booking__ds_partitioned__extract_day
- , subq_8.booking__ds_partitioned__extract_dow
- , subq_8.booking__ds_partitioned__extract_doy
- , subq_8.booking__paid_at__day
- , subq_8.booking__paid_at__week
- , subq_8.booking__paid_at__month
- , subq_8.booking__paid_at__quarter
- , subq_8.booking__paid_at__year
- , subq_8.booking__paid_at__extract_year
- , subq_8.booking__paid_at__extract_quarter
- , subq_8.booking__paid_at__extract_month
- , subq_8.booking__paid_at__extract_day
- , subq_8.booking__paid_at__extract_dow
- , subq_8.booking__paid_at__extract_doy
- , subq_8.ds__day AS metric_time__day
- , subq_8.ds__week AS metric_time__week
- , subq_8.ds__month AS metric_time__month
- , subq_8.ds__quarter AS metric_time__quarter
- , subq_8.ds__year AS metric_time__year
- , subq_8.ds__extract_year AS metric_time__extract_year
- , subq_8.ds__extract_quarter AS metric_time__extract_quarter
- , subq_8.ds__extract_month AS metric_time__extract_month
- , subq_8.ds__extract_day AS metric_time__extract_day
- , subq_8.ds__extract_dow AS metric_time__extract_dow
- , subq_8.ds__extract_doy AS metric_time__extract_doy
- , subq_8.listing
- , subq_8.guest
- , subq_8.host
- , subq_8.booking__listing
- , subq_8.booking__guest
- , subq_8.booking__host
- , subq_8.is_instant
- , subq_8.booking__is_instant
- , subq_8.bookings
- , subq_8.instant_bookings
- , subq_8.booking_value
- , subq_8.max_booking_value
- , subq_8.min_booking_value
- , subq_8.bookers
- , subq_8.average_booking_value
- , subq_8.referred_bookings
- , subq_8.median_booking_value
- , subq_8.booking_value_p99
- , subq_8.discrete_booking_value_p99
- , subq_8.approximate_continuous_booking_value_p99
- , subq_8.approximate_discrete_booking_value_p99
+ subq_17.ds__day
+ , subq_17.ds__week
+ , subq_17.ds__month
+ , subq_17.ds__quarter
+ , subq_17.ds__year
+ , subq_17.ds__extract_year
+ , subq_17.ds__extract_quarter
+ , subq_17.ds__extract_month
+ , subq_17.ds__extract_day
+ , subq_17.ds__extract_dow
+ , subq_17.ds__extract_doy
+ , subq_17.ds_partitioned__day
+ , subq_17.ds_partitioned__week
+ , subq_17.ds_partitioned__month
+ , subq_17.ds_partitioned__quarter
+ , subq_17.ds_partitioned__year
+ , subq_17.ds_partitioned__extract_year
+ , subq_17.ds_partitioned__extract_quarter
+ , subq_17.ds_partitioned__extract_month
+ , subq_17.ds_partitioned__extract_day
+ , subq_17.ds_partitioned__extract_dow
+ , subq_17.ds_partitioned__extract_doy
+ , subq_17.paid_at__day
+ , subq_17.paid_at__week
+ , subq_17.paid_at__month
+ , subq_17.paid_at__quarter
+ , subq_17.paid_at__year
+ , subq_17.paid_at__extract_year
+ , subq_17.paid_at__extract_quarter
+ , subq_17.paid_at__extract_month
+ , subq_17.paid_at__extract_day
+ , subq_17.paid_at__extract_dow
+ , subq_17.paid_at__extract_doy
+ , subq_17.booking__ds__day
+ , subq_17.booking__ds__week
+ , subq_17.booking__ds__month
+ , subq_17.booking__ds__quarter
+ , subq_17.booking__ds__year
+ , subq_17.booking__ds__extract_year
+ , subq_17.booking__ds__extract_quarter
+ , subq_17.booking__ds__extract_month
+ , subq_17.booking__ds__extract_day
+ , subq_17.booking__ds__extract_dow
+ , subq_17.booking__ds__extract_doy
+ , subq_17.booking__ds_partitioned__day
+ , subq_17.booking__ds_partitioned__week
+ , subq_17.booking__ds_partitioned__month
+ , subq_17.booking__ds_partitioned__quarter
+ , subq_17.booking__ds_partitioned__year
+ , subq_17.booking__ds_partitioned__extract_year
+ , subq_17.booking__ds_partitioned__extract_quarter
+ , subq_17.booking__ds_partitioned__extract_month
+ , subq_17.booking__ds_partitioned__extract_day
+ , subq_17.booking__ds_partitioned__extract_dow
+ , subq_17.booking__ds_partitioned__extract_doy
+ , subq_17.booking__paid_at__day
+ , subq_17.booking__paid_at__week
+ , subq_17.booking__paid_at__month
+ , subq_17.booking__paid_at__quarter
+ , subq_17.booking__paid_at__year
+ , subq_17.booking__paid_at__extract_year
+ , subq_17.booking__paid_at__extract_quarter
+ , subq_17.booking__paid_at__extract_month
+ , subq_17.booking__paid_at__extract_day
+ , subq_17.booking__paid_at__extract_dow
+ , subq_17.booking__paid_at__extract_doy
+ , subq_17.ds__day AS metric_time__day
+ , subq_17.ds__week AS metric_time__week
+ , subq_17.ds__month AS metric_time__month
+ , subq_17.ds__quarter AS metric_time__quarter
+ , subq_17.ds__year AS metric_time__year
+ , subq_17.ds__extract_year AS metric_time__extract_year
+ , subq_17.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_17.ds__extract_month AS metric_time__extract_month
+ , subq_17.ds__extract_day AS metric_time__extract_day
+ , subq_17.ds__extract_dow AS metric_time__extract_dow
+ , subq_17.ds__extract_doy AS metric_time__extract_doy
+ , subq_17.listing
+ , subq_17.guest
+ , subq_17.host
+ , subq_17.booking__listing
+ , subq_17.booking__guest
+ , subq_17.booking__host
+ , subq_17.is_instant
+ , subq_17.booking__is_instant
+ , subq_17.bookings
+ , subq_17.instant_bookings
+ , subq_17.booking_value
+ , subq_17.max_booking_value
+ , subq_17.min_booking_value
+ , subq_17.bookers
+ , subq_17.average_booking_value
+ , subq_17.referred_bookings
+ , subq_17.median_booking_value
+ , subq_17.booking_value_p99
+ , subq_17.discrete_booking_value_p99
+ , subq_17.approximate_continuous_booking_value_p99
+ , subq_17.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_8
- ) subq_9
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds) END AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) END AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.paid_at) END AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds) END AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) END AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.paid_at) END AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_17
+ ) subq_18
ON
- DATEADD(month, -1, subq_10.metric_time__day) = subq_9.metric_time__day
- ) subq_12
- ) subq_13
+ DATEADD(month, -1, subq_19.metric_time__day) = subq_18.metric_time__day
+ ) subq_21
+ ) subq_22
GROUP BY
- subq_13.metric_time__day
- ) subq_14
- ) subq_15
+ subq_22.metric_time__day
+ ) subq_23
+ ) subq_24
ON
- subq_7.metric_time__day = subq_15.metric_time__day
+ subq_16.metric_time__day = subq_24.metric_time__day
GROUP BY
- COALESCE(subq_7.metric_time__day, subq_15.metric_time__day)
-) subq_16
+ COALESCE(subq_16.metric_time__day, subq_24.metric_time__day)
+) subq_25
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window_and_offset_to_grain__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window_and_offset_to_grain__plan0_optimized.sql
index 1f8ce4023a..bedc1e94c6 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window_and_offset_to_grain__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window_and_offset_to_grain__plan0_optimized.sql
@@ -5,55 +5,55 @@ SELECT
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_24.metric_time__day, subq_32.metric_time__day) AS metric_time__day
- , MAX(subq_24.month_start_bookings) AS month_start_bookings
- , MAX(subq_32.bookings_1_month_ago) AS bookings_1_month_ago
+ COALESCE(subq_33.metric_time__day, subq_41.metric_time__day) AS metric_time__day
+ , MAX(subq_33.month_start_bookings) AS month_start_bookings
+ , MAX(subq_41.bookings_1_month_ago) AS bookings_1_month_ago
FROM (
-- Join to Time Spine Dataset
-- Pass Only Elements: ['bookings', 'metric_time__day']
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_20.ds AS metric_time__day
- , SUM(subq_18.bookings) AS month_start_bookings
- FROM ***************************.mf_time_spine subq_20
+ subq_29.ds AS metric_time__day
+ , SUM(subq_27.bookings) AS month_start_bookings
+ FROM ***************************.mf_time_spine subq_29
INNER JOIN (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
SELECT
DATE_TRUNC('day', ds) AS metric_time__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_18
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_27
ON
- DATE_TRUNC('month', subq_20.ds) = subq_18.metric_time__day
+ DATE_TRUNC('month', subq_29.ds) = subq_27.metric_time__day
GROUP BY
- subq_20.ds
- ) subq_24
+ subq_29.ds
+ ) subq_33
FULL OUTER JOIN (
-- Join to Time Spine Dataset
-- Pass Only Elements: ['bookings', 'metric_time__day']
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- subq_28.ds AS metric_time__day
- , SUM(subq_26.bookings) AS bookings_1_month_ago
- FROM ***************************.mf_time_spine subq_28
+ subq_37.ds AS metric_time__day
+ , SUM(subq_35.bookings) AS bookings_1_month_ago
+ FROM ***************************.mf_time_spine subq_37
INNER JOIN (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
SELECT
DATE_TRUNC('day', ds) AS metric_time__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_26
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_35
ON
- DATEADD(month, -1, subq_28.ds) = subq_26.metric_time__day
+ DATEADD(month, -1, subq_37.ds) = subq_35.metric_time__day
GROUP BY
- subq_28.ds
- ) subq_32
+ subq_37.ds
+ ) subq_41
ON
- subq_24.metric_time__day = subq_32.metric_time__day
+ subq_33.metric_time__day = subq_41.metric_time__day
GROUP BY
- COALESCE(subq_24.metric_time__day, subq_32.metric_time__day)
-) subq_33
+ COALESCE(subq_33.metric_time__day, subq_41.metric_time__day)
+) subq_42
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql
index 7b9d63c675..6e1e9f0f6b 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0.sql
@@ -1,646 +1,646 @@
-- Compute Metrics via Expressions
SELECT
- subq_16.metric_time__year
+ subq_25.metric_time__year
, month_start_bookings - bookings_1_month_ago AS bookings_month_start_compared_to_1_month_prior
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_7.metric_time__year, subq_15.metric_time__year) AS metric_time__year
- , MAX(subq_7.month_start_bookings) AS month_start_bookings
- , MAX(subq_15.bookings_1_month_ago) AS bookings_1_month_ago
+ COALESCE(subq_16.metric_time__year, subq_24.metric_time__year) AS metric_time__year
+ , MAX(subq_16.month_start_bookings) AS month_start_bookings
+ , MAX(subq_24.bookings_1_month_ago) AS bookings_1_month_ago
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_6.metric_time__year
- , subq_6.bookings AS month_start_bookings
+ subq_15.metric_time__year
+ , subq_15.bookings AS month_start_bookings
FROM (
-- Aggregate Measures
SELECT
- subq_5.metric_time__year
- , SUM(subq_5.bookings) AS bookings
+ subq_14.metric_time__year
+ , SUM(subq_14.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__year']
SELECT
- subq_4.metric_time__year
- , subq_4.bookings
+ subq_13.metric_time__year
+ , subq_13.bookings
FROM (
-- Join to Time Spine Dataset
SELECT
- DATE_TRUNC('year', subq_2.metric_time__day) AS metric_time__year
- , subq_1.ds__day AS ds__day
- , subq_1.ds__week AS ds__week
- , subq_1.ds__month AS ds__month
- , subq_1.ds__quarter AS ds__quarter
- , subq_1.ds__year AS ds__year
- , subq_1.ds__extract_year AS ds__extract_year
- , subq_1.ds__extract_quarter AS ds__extract_quarter
- , subq_1.ds__extract_month AS ds__extract_month
- , subq_1.ds__extract_day AS ds__extract_day
- , subq_1.ds__extract_dow AS ds__extract_dow
- , subq_1.ds__extract_doy AS ds__extract_doy
- , subq_1.ds_partitioned__day AS ds_partitioned__day
- , subq_1.ds_partitioned__week AS ds_partitioned__week
- , subq_1.ds_partitioned__month AS ds_partitioned__month
- , subq_1.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_1.ds_partitioned__year AS ds_partitioned__year
- , subq_1.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_1.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_1.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_1.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_1.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_1.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_1.paid_at__day AS paid_at__day
- , subq_1.paid_at__week AS paid_at__week
- , subq_1.paid_at__month AS paid_at__month
- , subq_1.paid_at__quarter AS paid_at__quarter
- , subq_1.paid_at__year AS paid_at__year
- , subq_1.paid_at__extract_year AS paid_at__extract_year
- , subq_1.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_1.paid_at__extract_month AS paid_at__extract_month
- , subq_1.paid_at__extract_day AS paid_at__extract_day
- , subq_1.paid_at__extract_dow AS paid_at__extract_dow
- , subq_1.paid_at__extract_doy AS paid_at__extract_doy
- , subq_1.booking__ds__day AS booking__ds__day
- , subq_1.booking__ds__week AS booking__ds__week
- , subq_1.booking__ds__month AS booking__ds__month
- , subq_1.booking__ds__quarter AS booking__ds__quarter
- , subq_1.booking__ds__year AS booking__ds__year
- , subq_1.booking__ds__extract_year AS booking__ds__extract_year
- , subq_1.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_1.booking__ds__extract_month AS booking__ds__extract_month
- , subq_1.booking__ds__extract_day AS booking__ds__extract_day
- , subq_1.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_1.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_1.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_1.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_1.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_1.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_1.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_1.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_1.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_1.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_1.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_1.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_1.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_1.booking__paid_at__day AS booking__paid_at__day
- , subq_1.booking__paid_at__week AS booking__paid_at__week
- , subq_1.booking__paid_at__month AS booking__paid_at__month
- , subq_1.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_1.booking__paid_at__year AS booking__paid_at__year
- , subq_1.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_1.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_1.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_1.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_1.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_1.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_1.listing AS listing
- , subq_1.guest AS guest
- , subq_1.host AS host
- , subq_1.booking__listing AS booking__listing
- , subq_1.booking__guest AS booking__guest
- , subq_1.booking__host AS booking__host
- , subq_1.is_instant AS is_instant
- , subq_1.booking__is_instant AS booking__is_instant
- , subq_1.bookings AS bookings
- , subq_1.instant_bookings AS instant_bookings
- , subq_1.booking_value AS booking_value
- , subq_1.max_booking_value AS max_booking_value
- , subq_1.min_booking_value AS min_booking_value
- , subq_1.bookers AS bookers
- , subq_1.average_booking_value AS average_booking_value
- , subq_1.referred_bookings AS referred_bookings
- , subq_1.median_booking_value AS median_booking_value
- , subq_1.booking_value_p99 AS booking_value_p99
- , subq_1.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_1.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_1.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ DATE_TRUNC('year', subq_11.metric_time__day) AS metric_time__year
+ , subq_10.ds__day AS ds__day
+ , subq_10.ds__week AS ds__week
+ , subq_10.ds__month AS ds__month
+ , subq_10.ds__quarter AS ds__quarter
+ , subq_10.ds__year AS ds__year
+ , subq_10.ds__extract_year AS ds__extract_year
+ , subq_10.ds__extract_quarter AS ds__extract_quarter
+ , subq_10.ds__extract_month AS ds__extract_month
+ , subq_10.ds__extract_day AS ds__extract_day
+ , subq_10.ds__extract_dow AS ds__extract_dow
+ , subq_10.ds__extract_doy AS ds__extract_doy
+ , subq_10.ds_partitioned__day AS ds_partitioned__day
+ , subq_10.ds_partitioned__week AS ds_partitioned__week
+ , subq_10.ds_partitioned__month AS ds_partitioned__month
+ , subq_10.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_10.ds_partitioned__year AS ds_partitioned__year
+ , subq_10.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_10.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_10.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_10.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_10.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_10.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_10.paid_at__day AS paid_at__day
+ , subq_10.paid_at__week AS paid_at__week
+ , subq_10.paid_at__month AS paid_at__month
+ , subq_10.paid_at__quarter AS paid_at__quarter
+ , subq_10.paid_at__year AS paid_at__year
+ , subq_10.paid_at__extract_year AS paid_at__extract_year
+ , subq_10.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_10.paid_at__extract_month AS paid_at__extract_month
+ , subq_10.paid_at__extract_day AS paid_at__extract_day
+ , subq_10.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_10.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_10.booking__ds__day AS booking__ds__day
+ , subq_10.booking__ds__week AS booking__ds__week
+ , subq_10.booking__ds__month AS booking__ds__month
+ , subq_10.booking__ds__quarter AS booking__ds__quarter
+ , subq_10.booking__ds__year AS booking__ds__year
+ , subq_10.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_10.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_10.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_10.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_10.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_10.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_10.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_10.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_10.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_10.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_10.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_10.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_10.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_10.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_10.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_10.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_10.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_10.booking__paid_at__day AS booking__paid_at__day
+ , subq_10.booking__paid_at__week AS booking__paid_at__week
+ , subq_10.booking__paid_at__month AS booking__paid_at__month
+ , subq_10.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_10.booking__paid_at__year AS booking__paid_at__year
+ , subq_10.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_10.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_10.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_10.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_10.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_10.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_10.listing AS listing
+ , subq_10.guest AS guest
+ , subq_10.host AS host
+ , subq_10.booking__listing AS booking__listing
+ , subq_10.booking__guest AS booking__guest
+ , subq_10.booking__host AS booking__host
+ , subq_10.is_instant AS is_instant
+ , subq_10.booking__is_instant AS booking__is_instant
+ , subq_10.bookings AS bookings
+ , subq_10.instant_bookings AS instant_bookings
+ , subq_10.booking_value AS booking_value
+ , subq_10.max_booking_value AS max_booking_value
+ , subq_10.min_booking_value AS min_booking_value
+ , subq_10.bookers AS bookers
+ , subq_10.average_booking_value AS average_booking_value
+ , subq_10.referred_bookings AS referred_bookings
+ , subq_10.median_booking_value AS median_booking_value
+ , subq_10.booking_value_p99 AS booking_value_p99
+ , subq_10.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_10.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_10.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_3.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_3
- ) subq_2
+ subq_12.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_12
+ ) subq_11
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds) END AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) END AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.paid_at) END AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds) END AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) END AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.paid_at) END AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
ON
- DATE_TRUNC('month', subq_2.metric_time__day) = subq_1.metric_time__day
- WHERE DATE_TRUNC('year', subq_2.metric_time__day) = subq_2.metric_time__day
- ) subq_4
- ) subq_5
+ DATE_TRUNC('month', subq_11.metric_time__day) = subq_10.metric_time__day
+ WHERE DATE_TRUNC('year', subq_11.metric_time__day) = subq_11.metric_time__day
+ ) subq_13
+ ) subq_14
GROUP BY
- subq_5.metric_time__year
- ) subq_6
- ) subq_7
+ subq_14.metric_time__year
+ ) subq_15
+ ) subq_16
FULL OUTER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_14.metric_time__year
- , subq_14.bookings AS bookings_1_month_ago
+ subq_23.metric_time__year
+ , subq_23.bookings AS bookings_1_month_ago
FROM (
-- Aggregate Measures
SELECT
- subq_13.metric_time__year
- , SUM(subq_13.bookings) AS bookings
+ subq_22.metric_time__year
+ , SUM(subq_22.bookings) AS bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__year']
SELECT
- subq_12.metric_time__year
- , subq_12.bookings
+ subq_21.metric_time__year
+ , subq_21.bookings
FROM (
-- Join to Time Spine Dataset
SELECT
- DATE_TRUNC('year', subq_10.metric_time__day) AS metric_time__year
- , subq_9.ds__day AS ds__day
- , subq_9.ds__week AS ds__week
- , subq_9.ds__month AS ds__month
- , subq_9.ds__quarter AS ds__quarter
- , subq_9.ds__year AS ds__year
- , subq_9.ds__extract_year AS ds__extract_year
- , subq_9.ds__extract_quarter AS ds__extract_quarter
- , subq_9.ds__extract_month AS ds__extract_month
- , subq_9.ds__extract_day AS ds__extract_day
- , subq_9.ds__extract_dow AS ds__extract_dow
- , subq_9.ds__extract_doy AS ds__extract_doy
- , subq_9.ds_partitioned__day AS ds_partitioned__day
- , subq_9.ds_partitioned__week AS ds_partitioned__week
- , subq_9.ds_partitioned__month AS ds_partitioned__month
- , subq_9.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_9.ds_partitioned__year AS ds_partitioned__year
- , subq_9.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_9.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_9.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_9.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_9.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_9.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_9.paid_at__day AS paid_at__day
- , subq_9.paid_at__week AS paid_at__week
- , subq_9.paid_at__month AS paid_at__month
- , subq_9.paid_at__quarter AS paid_at__quarter
- , subq_9.paid_at__year AS paid_at__year
- , subq_9.paid_at__extract_year AS paid_at__extract_year
- , subq_9.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_9.paid_at__extract_month AS paid_at__extract_month
- , subq_9.paid_at__extract_day AS paid_at__extract_day
- , subq_9.paid_at__extract_dow AS paid_at__extract_dow
- , subq_9.paid_at__extract_doy AS paid_at__extract_doy
- , subq_9.booking__ds__day AS booking__ds__day
- , subq_9.booking__ds__week AS booking__ds__week
- , subq_9.booking__ds__month AS booking__ds__month
- , subq_9.booking__ds__quarter AS booking__ds__quarter
- , subq_9.booking__ds__year AS booking__ds__year
- , subq_9.booking__ds__extract_year AS booking__ds__extract_year
- , subq_9.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_9.booking__ds__extract_month AS booking__ds__extract_month
- , subq_9.booking__ds__extract_day AS booking__ds__extract_day
- , subq_9.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_9.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_9.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_9.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_9.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_9.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_9.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_9.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_9.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_9.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_9.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_9.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_9.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_9.booking__paid_at__day AS booking__paid_at__day
- , subq_9.booking__paid_at__week AS booking__paid_at__week
- , subq_9.booking__paid_at__month AS booking__paid_at__month
- , subq_9.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_9.booking__paid_at__year AS booking__paid_at__year
- , subq_9.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_9.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_9.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_9.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_9.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_9.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_9.listing AS listing
- , subq_9.guest AS guest
- , subq_9.host AS host
- , subq_9.booking__listing AS booking__listing
- , subq_9.booking__guest AS booking__guest
- , subq_9.booking__host AS booking__host
- , subq_9.is_instant AS is_instant
- , subq_9.booking__is_instant AS booking__is_instant
- , subq_9.bookings AS bookings
- , subq_9.instant_bookings AS instant_bookings
- , subq_9.booking_value AS booking_value
- , subq_9.max_booking_value AS max_booking_value
- , subq_9.min_booking_value AS min_booking_value
- , subq_9.bookers AS bookers
- , subq_9.average_booking_value AS average_booking_value
- , subq_9.referred_bookings AS referred_bookings
- , subq_9.median_booking_value AS median_booking_value
- , subq_9.booking_value_p99 AS booking_value_p99
- , subq_9.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_9.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_9.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ DATE_TRUNC('year', subq_19.metric_time__day) AS metric_time__year
+ , subq_18.ds__day AS ds__day
+ , subq_18.ds__week AS ds__week
+ , subq_18.ds__month AS ds__month
+ , subq_18.ds__quarter AS ds__quarter
+ , subq_18.ds__year AS ds__year
+ , subq_18.ds__extract_year AS ds__extract_year
+ , subq_18.ds__extract_quarter AS ds__extract_quarter
+ , subq_18.ds__extract_month AS ds__extract_month
+ , subq_18.ds__extract_day AS ds__extract_day
+ , subq_18.ds__extract_dow AS ds__extract_dow
+ , subq_18.ds__extract_doy AS ds__extract_doy
+ , subq_18.ds_partitioned__day AS ds_partitioned__day
+ , subq_18.ds_partitioned__week AS ds_partitioned__week
+ , subq_18.ds_partitioned__month AS ds_partitioned__month
+ , subq_18.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_18.ds_partitioned__year AS ds_partitioned__year
+ , subq_18.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_18.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_18.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_18.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_18.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_18.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_18.paid_at__day AS paid_at__day
+ , subq_18.paid_at__week AS paid_at__week
+ , subq_18.paid_at__month AS paid_at__month
+ , subq_18.paid_at__quarter AS paid_at__quarter
+ , subq_18.paid_at__year AS paid_at__year
+ , subq_18.paid_at__extract_year AS paid_at__extract_year
+ , subq_18.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_18.paid_at__extract_month AS paid_at__extract_month
+ , subq_18.paid_at__extract_day AS paid_at__extract_day
+ , subq_18.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_18.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_18.booking__ds__day AS booking__ds__day
+ , subq_18.booking__ds__week AS booking__ds__week
+ , subq_18.booking__ds__month AS booking__ds__month
+ , subq_18.booking__ds__quarter AS booking__ds__quarter
+ , subq_18.booking__ds__year AS booking__ds__year
+ , subq_18.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_18.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_18.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_18.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_18.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_18.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_18.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_18.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_18.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_18.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_18.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_18.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_18.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_18.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_18.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_18.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_18.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_18.booking__paid_at__day AS booking__paid_at__day
+ , subq_18.booking__paid_at__week AS booking__paid_at__week
+ , subq_18.booking__paid_at__month AS booking__paid_at__month
+ , subq_18.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_18.booking__paid_at__year AS booking__paid_at__year
+ , subq_18.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_18.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_18.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_18.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_18.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_18.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_18.listing AS listing
+ , subq_18.guest AS guest
+ , subq_18.host AS host
+ , subq_18.booking__listing AS booking__listing
+ , subq_18.booking__guest AS booking__guest
+ , subq_18.booking__host AS booking__host
+ , subq_18.is_instant AS is_instant
+ , subq_18.booking__is_instant AS booking__is_instant
+ , subq_18.bookings AS bookings
+ , subq_18.instant_bookings AS instant_bookings
+ , subq_18.booking_value AS booking_value
+ , subq_18.max_booking_value AS max_booking_value
+ , subq_18.min_booking_value AS min_booking_value
+ , subq_18.bookers AS bookers
+ , subq_18.average_booking_value AS average_booking_value
+ , subq_18.referred_bookings AS referred_bookings
+ , subq_18.median_booking_value AS median_booking_value
+ , subq_18.booking_value_p99 AS booking_value_p99
+ , subq_18.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_18.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_18.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_11.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_11
- ) subq_10
+ subq_20.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_20
+ ) subq_19
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_8.ds__day
- , subq_8.ds__week
- , subq_8.ds__month
- , subq_8.ds__quarter
- , subq_8.ds__year
- , subq_8.ds__extract_year
- , subq_8.ds__extract_quarter
- , subq_8.ds__extract_month
- , subq_8.ds__extract_day
- , subq_8.ds__extract_dow
- , subq_8.ds__extract_doy
- , subq_8.ds_partitioned__day
- , subq_8.ds_partitioned__week
- , subq_8.ds_partitioned__month
- , subq_8.ds_partitioned__quarter
- , subq_8.ds_partitioned__year
- , subq_8.ds_partitioned__extract_year
- , subq_8.ds_partitioned__extract_quarter
- , subq_8.ds_partitioned__extract_month
- , subq_8.ds_partitioned__extract_day
- , subq_8.ds_partitioned__extract_dow
- , subq_8.ds_partitioned__extract_doy
- , subq_8.paid_at__day
- , subq_8.paid_at__week
- , subq_8.paid_at__month
- , subq_8.paid_at__quarter
- , subq_8.paid_at__year
- , subq_8.paid_at__extract_year
- , subq_8.paid_at__extract_quarter
- , subq_8.paid_at__extract_month
- , subq_8.paid_at__extract_day
- , subq_8.paid_at__extract_dow
- , subq_8.paid_at__extract_doy
- , subq_8.booking__ds__day
- , subq_8.booking__ds__week
- , subq_8.booking__ds__month
- , subq_8.booking__ds__quarter
- , subq_8.booking__ds__year
- , subq_8.booking__ds__extract_year
- , subq_8.booking__ds__extract_quarter
- , subq_8.booking__ds__extract_month
- , subq_8.booking__ds__extract_day
- , subq_8.booking__ds__extract_dow
- , subq_8.booking__ds__extract_doy
- , subq_8.booking__ds_partitioned__day
- , subq_8.booking__ds_partitioned__week
- , subq_8.booking__ds_partitioned__month
- , subq_8.booking__ds_partitioned__quarter
- , subq_8.booking__ds_partitioned__year
- , subq_8.booking__ds_partitioned__extract_year
- , subq_8.booking__ds_partitioned__extract_quarter
- , subq_8.booking__ds_partitioned__extract_month
- , subq_8.booking__ds_partitioned__extract_day
- , subq_8.booking__ds_partitioned__extract_dow
- , subq_8.booking__ds_partitioned__extract_doy
- , subq_8.booking__paid_at__day
- , subq_8.booking__paid_at__week
- , subq_8.booking__paid_at__month
- , subq_8.booking__paid_at__quarter
- , subq_8.booking__paid_at__year
- , subq_8.booking__paid_at__extract_year
- , subq_8.booking__paid_at__extract_quarter
- , subq_8.booking__paid_at__extract_month
- , subq_8.booking__paid_at__extract_day
- , subq_8.booking__paid_at__extract_dow
- , subq_8.booking__paid_at__extract_doy
- , subq_8.ds__day AS metric_time__day
- , subq_8.ds__week AS metric_time__week
- , subq_8.ds__month AS metric_time__month
- , subq_8.ds__quarter AS metric_time__quarter
- , subq_8.ds__year AS metric_time__year
- , subq_8.ds__extract_year AS metric_time__extract_year
- , subq_8.ds__extract_quarter AS metric_time__extract_quarter
- , subq_8.ds__extract_month AS metric_time__extract_month
- , subq_8.ds__extract_day AS metric_time__extract_day
- , subq_8.ds__extract_dow AS metric_time__extract_dow
- , subq_8.ds__extract_doy AS metric_time__extract_doy
- , subq_8.listing
- , subq_8.guest
- , subq_8.host
- , subq_8.booking__listing
- , subq_8.booking__guest
- , subq_8.booking__host
- , subq_8.is_instant
- , subq_8.booking__is_instant
- , subq_8.bookings
- , subq_8.instant_bookings
- , subq_8.booking_value
- , subq_8.max_booking_value
- , subq_8.min_booking_value
- , subq_8.bookers
- , subq_8.average_booking_value
- , subq_8.referred_bookings
- , subq_8.median_booking_value
- , subq_8.booking_value_p99
- , subq_8.discrete_booking_value_p99
- , subq_8.approximate_continuous_booking_value_p99
- , subq_8.approximate_discrete_booking_value_p99
+ subq_17.ds__day
+ , subq_17.ds__week
+ , subq_17.ds__month
+ , subq_17.ds__quarter
+ , subq_17.ds__year
+ , subq_17.ds__extract_year
+ , subq_17.ds__extract_quarter
+ , subq_17.ds__extract_month
+ , subq_17.ds__extract_day
+ , subq_17.ds__extract_dow
+ , subq_17.ds__extract_doy
+ , subq_17.ds_partitioned__day
+ , subq_17.ds_partitioned__week
+ , subq_17.ds_partitioned__month
+ , subq_17.ds_partitioned__quarter
+ , subq_17.ds_partitioned__year
+ , subq_17.ds_partitioned__extract_year
+ , subq_17.ds_partitioned__extract_quarter
+ , subq_17.ds_partitioned__extract_month
+ , subq_17.ds_partitioned__extract_day
+ , subq_17.ds_partitioned__extract_dow
+ , subq_17.ds_partitioned__extract_doy
+ , subq_17.paid_at__day
+ , subq_17.paid_at__week
+ , subq_17.paid_at__month
+ , subq_17.paid_at__quarter
+ , subq_17.paid_at__year
+ , subq_17.paid_at__extract_year
+ , subq_17.paid_at__extract_quarter
+ , subq_17.paid_at__extract_month
+ , subq_17.paid_at__extract_day
+ , subq_17.paid_at__extract_dow
+ , subq_17.paid_at__extract_doy
+ , subq_17.booking__ds__day
+ , subq_17.booking__ds__week
+ , subq_17.booking__ds__month
+ , subq_17.booking__ds__quarter
+ , subq_17.booking__ds__year
+ , subq_17.booking__ds__extract_year
+ , subq_17.booking__ds__extract_quarter
+ , subq_17.booking__ds__extract_month
+ , subq_17.booking__ds__extract_day
+ , subq_17.booking__ds__extract_dow
+ , subq_17.booking__ds__extract_doy
+ , subq_17.booking__ds_partitioned__day
+ , subq_17.booking__ds_partitioned__week
+ , subq_17.booking__ds_partitioned__month
+ , subq_17.booking__ds_partitioned__quarter
+ , subq_17.booking__ds_partitioned__year
+ , subq_17.booking__ds_partitioned__extract_year
+ , subq_17.booking__ds_partitioned__extract_quarter
+ , subq_17.booking__ds_partitioned__extract_month
+ , subq_17.booking__ds_partitioned__extract_day
+ , subq_17.booking__ds_partitioned__extract_dow
+ , subq_17.booking__ds_partitioned__extract_doy
+ , subq_17.booking__paid_at__day
+ , subq_17.booking__paid_at__week
+ , subq_17.booking__paid_at__month
+ , subq_17.booking__paid_at__quarter
+ , subq_17.booking__paid_at__year
+ , subq_17.booking__paid_at__extract_year
+ , subq_17.booking__paid_at__extract_quarter
+ , subq_17.booking__paid_at__extract_month
+ , subq_17.booking__paid_at__extract_day
+ , subq_17.booking__paid_at__extract_dow
+ , subq_17.booking__paid_at__extract_doy
+ , subq_17.ds__day AS metric_time__day
+ , subq_17.ds__week AS metric_time__week
+ , subq_17.ds__month AS metric_time__month
+ , subq_17.ds__quarter AS metric_time__quarter
+ , subq_17.ds__year AS metric_time__year
+ , subq_17.ds__extract_year AS metric_time__extract_year
+ , subq_17.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_17.ds__extract_month AS metric_time__extract_month
+ , subq_17.ds__extract_day AS metric_time__extract_day
+ , subq_17.ds__extract_dow AS metric_time__extract_dow
+ , subq_17.ds__extract_doy AS metric_time__extract_doy
+ , subq_17.listing
+ , subq_17.guest
+ , subq_17.host
+ , subq_17.booking__listing
+ , subq_17.booking__guest
+ , subq_17.booking__host
+ , subq_17.is_instant
+ , subq_17.booking__is_instant
+ , subq_17.bookings
+ , subq_17.instant_bookings
+ , subq_17.booking_value
+ , subq_17.max_booking_value
+ , subq_17.min_booking_value
+ , subq_17.bookers
+ , subq_17.average_booking_value
+ , subq_17.referred_bookings
+ , subq_17.median_booking_value
+ , subq_17.booking_value_p99
+ , subq_17.discrete_booking_value_p99
+ , subq_17.approximate_continuous_booking_value_p99
+ , subq_17.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_8
- ) subq_9
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds) END AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) END AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.paid_at) END AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds) END AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) END AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.paid_at) END AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_17
+ ) subq_18
ON
- DATEADD(month, -1, subq_10.metric_time__day) = subq_9.metric_time__day
- ) subq_12
- ) subq_13
+ DATEADD(month, -1, subq_19.metric_time__day) = subq_18.metric_time__day
+ ) subq_21
+ ) subq_22
GROUP BY
- subq_13.metric_time__year
- ) subq_14
- ) subq_15
+ subq_22.metric_time__year
+ ) subq_23
+ ) subq_24
ON
- subq_7.metric_time__year = subq_15.metric_time__year
+ subq_16.metric_time__year = subq_24.metric_time__year
GROUP BY
- COALESCE(subq_7.metric_time__year, subq_15.metric_time__year)
-) subq_16
+ COALESCE(subq_16.metric_time__year, subq_24.metric_time__year)
+) subq_25
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0_optimized.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0_optimized.sql
index 6df1bd72d2..3b62cf5d4b 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0_optimized.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window_and_offset_to_grain_and_granularity__plan0_optimized.sql
@@ -5,56 +5,56 @@ SELECT
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_24.metric_time__year, subq_32.metric_time__year) AS metric_time__year
- , MAX(subq_24.month_start_bookings) AS month_start_bookings
- , MAX(subq_32.bookings_1_month_ago) AS bookings_1_month_ago
+ COALESCE(subq_33.metric_time__year, subq_41.metric_time__year) AS metric_time__year
+ , MAX(subq_33.month_start_bookings) AS month_start_bookings
+ , MAX(subq_41.bookings_1_month_ago) AS bookings_1_month_ago
FROM (
-- Join to Time Spine Dataset
-- Pass Only Elements: ['bookings', 'metric_time__year']
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- DATE_TRUNC('year', subq_20.ds) AS metric_time__year
- , SUM(subq_18.bookings) AS month_start_bookings
- FROM ***************************.mf_time_spine subq_20
+ DATE_TRUNC('year', subq_29.ds) AS metric_time__year
+ , SUM(subq_27.bookings) AS month_start_bookings
+ FROM ***************************.mf_time_spine subq_29
INNER JOIN (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
SELECT
DATE_TRUNC('day', ds) AS metric_time__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_18
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_27
ON
- DATE_TRUNC('month', subq_20.ds) = subq_18.metric_time__day
- WHERE DATE_TRUNC('year', subq_20.ds) = subq_20.ds
+ DATE_TRUNC('month', subq_29.ds) = subq_27.metric_time__day
+ WHERE DATE_TRUNC('year', subq_29.ds) = subq_29.ds
GROUP BY
- DATE_TRUNC('year', subq_20.ds)
- ) subq_24
+ DATE_TRUNC('year', subq_29.ds)
+ ) subq_33
FULL OUTER JOIN (
-- Join to Time Spine Dataset
-- Pass Only Elements: ['bookings', 'metric_time__year']
-- Aggregate Measures
-- Compute Metrics via Expressions
SELECT
- DATE_TRUNC('year', subq_28.ds) AS metric_time__year
- , SUM(subq_26.bookings) AS bookings_1_month_ago
- FROM ***************************.mf_time_spine subq_28
+ DATE_TRUNC('year', subq_37.ds) AS metric_time__year
+ , SUM(subq_35.bookings) AS bookings_1_month_ago
+ FROM ***************************.mf_time_spine subq_37
INNER JOIN (
-- Read Elements From Semantic Model 'bookings_source'
-- Metric Time Dimension 'ds'
SELECT
DATE_TRUNC('day', ds) AS metric_time__day
, 1 AS bookings
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_26
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_35
ON
- DATEADD(month, -1, subq_28.ds) = subq_26.metric_time__day
+ DATEADD(month, -1, subq_37.ds) = subq_35.metric_time__day
GROUP BY
- DATE_TRUNC('year', subq_28.ds)
- ) subq_32
+ DATE_TRUNC('year', subq_37.ds)
+ ) subq_41
ON
- subq_24.metric_time__year = subq_32.metric_time__year
+ subq_33.metric_time__year = subq_41.metric_time__year
GROUP BY
- COALESCE(subq_24.metric_time__year, subq_32.metric_time__year)
-) subq_33
+ COALESCE(subq_33.metric_time__year, subq_41.metric_time__year)
+) subq_42
diff --git a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window_and_time_filter__plan0.sql b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window_and_time_filter__plan0.sql
index a1e9adacf4..1e2f38e545 100644
--- a/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window_and_time_filter__plan0.sql
+++ b/metricflow/test/snapshots/test_derived_metric_rendering.py/SqlQueryPlan/Redshift/test_derived_metric_with_offset_window_and_time_filter__plan0.sql
@@ -1,559 +1,559 @@
-- Compute Metrics via Expressions
SELECT
- subq_15.metric_time__day
+ subq_24.metric_time__day
, bookings - bookings_2_weeks_ago AS bookings_growth_2_weeks
FROM (
-- Combine Aggregated Outputs
SELECT
- COALESCE(subq_5.metric_time__day, subq_14.metric_time__day) AS metric_time__day
- , MAX(subq_5.bookings) AS bookings
- , MAX(subq_14.bookings_2_weeks_ago) AS bookings_2_weeks_ago
+ COALESCE(subq_14.metric_time__day, subq_23.metric_time__day) AS metric_time__day
+ , MAX(subq_14.bookings) AS bookings
+ , MAX(subq_23.bookings_2_weeks_ago) AS bookings_2_weeks_ago
FROM (
-- Compute Metrics via Expressions
SELECT
- subq_4.metric_time__day
- , subq_4.bookings
+ subq_13.metric_time__day
+ , subq_13.bookings
FROM (
-- Aggregate Measures
SELECT
- subq_3.metric_time__day
- , SUM(subq_3.bookings) AS bookings
+ subq_12.metric_time__day
+ , SUM(subq_12.bookings) AS bookings
FROM (
-- Constrain Output with WHERE
SELECT
- subq_2.metric_time__day
- , subq_2.bookings
+ subq_11.metric_time__day
+ , subq_11.bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__day']
SELECT
- subq_1.metric_time__day
- , subq_1.bookings
+ subq_10.metric_time__day
+ , subq_10.bookings
FROM (
-- Metric Time Dimension 'ds'
SELECT
- subq_0.ds__day
- , subq_0.ds__week
- , subq_0.ds__month
- , subq_0.ds__quarter
- , subq_0.ds__year
- , subq_0.ds__extract_year
- , subq_0.ds__extract_quarter
- , subq_0.ds__extract_month
- , subq_0.ds__extract_day
- , subq_0.ds__extract_dow
- , subq_0.ds__extract_doy
- , subq_0.ds_partitioned__day
- , subq_0.ds_partitioned__week
- , subq_0.ds_partitioned__month
- , subq_0.ds_partitioned__quarter
- , subq_0.ds_partitioned__year
- , subq_0.ds_partitioned__extract_year
- , subq_0.ds_partitioned__extract_quarter
- , subq_0.ds_partitioned__extract_month
- , subq_0.ds_partitioned__extract_day
- , subq_0.ds_partitioned__extract_dow
- , subq_0.ds_partitioned__extract_doy
- , subq_0.paid_at__day
- , subq_0.paid_at__week
- , subq_0.paid_at__month
- , subq_0.paid_at__quarter
- , subq_0.paid_at__year
- , subq_0.paid_at__extract_year
- , subq_0.paid_at__extract_quarter
- , subq_0.paid_at__extract_month
- , subq_0.paid_at__extract_day
- , subq_0.paid_at__extract_dow
- , subq_0.paid_at__extract_doy
- , subq_0.booking__ds__day
- , subq_0.booking__ds__week
- , subq_0.booking__ds__month
- , subq_0.booking__ds__quarter
- , subq_0.booking__ds__year
- , subq_0.booking__ds__extract_year
- , subq_0.booking__ds__extract_quarter
- , subq_0.booking__ds__extract_month
- , subq_0.booking__ds__extract_day
- , subq_0.booking__ds__extract_dow
- , subq_0.booking__ds__extract_doy
- , subq_0.booking__ds_partitioned__day
- , subq_0.booking__ds_partitioned__week
- , subq_0.booking__ds_partitioned__month
- , subq_0.booking__ds_partitioned__quarter
- , subq_0.booking__ds_partitioned__year
- , subq_0.booking__ds_partitioned__extract_year
- , subq_0.booking__ds_partitioned__extract_quarter
- , subq_0.booking__ds_partitioned__extract_month
- , subq_0.booking__ds_partitioned__extract_day
- , subq_0.booking__ds_partitioned__extract_dow
- , subq_0.booking__ds_partitioned__extract_doy
- , subq_0.booking__paid_at__day
- , subq_0.booking__paid_at__week
- , subq_0.booking__paid_at__month
- , subq_0.booking__paid_at__quarter
- , subq_0.booking__paid_at__year
- , subq_0.booking__paid_at__extract_year
- , subq_0.booking__paid_at__extract_quarter
- , subq_0.booking__paid_at__extract_month
- , subq_0.booking__paid_at__extract_day
- , subq_0.booking__paid_at__extract_dow
- , subq_0.booking__paid_at__extract_doy
- , subq_0.ds__day AS metric_time__day
- , subq_0.ds__week AS metric_time__week
- , subq_0.ds__month AS metric_time__month
- , subq_0.ds__quarter AS metric_time__quarter
- , subq_0.ds__year AS metric_time__year
- , subq_0.ds__extract_year AS metric_time__extract_year
- , subq_0.ds__extract_quarter AS metric_time__extract_quarter
- , subq_0.ds__extract_month AS metric_time__extract_month
- , subq_0.ds__extract_day AS metric_time__extract_day
- , subq_0.ds__extract_dow AS metric_time__extract_dow
- , subq_0.ds__extract_doy AS metric_time__extract_doy
- , subq_0.listing
- , subq_0.guest
- , subq_0.host
- , subq_0.booking__listing
- , subq_0.booking__guest
- , subq_0.booking__host
- , subq_0.is_instant
- , subq_0.booking__is_instant
- , subq_0.bookings
- , subq_0.instant_bookings
- , subq_0.booking_value
- , subq_0.max_booking_value
- , subq_0.min_booking_value
- , subq_0.bookers
- , subq_0.average_booking_value
- , subq_0.referred_bookings
- , subq_0.median_booking_value
- , subq_0.booking_value_p99
- , subq_0.discrete_booking_value_p99
- , subq_0.approximate_continuous_booking_value_p99
- , subq_0.approximate_discrete_booking_value_p99
+ subq_9.ds__day
+ , subq_9.ds__week
+ , subq_9.ds__month
+ , subq_9.ds__quarter
+ , subq_9.ds__year
+ , subq_9.ds__extract_year
+ , subq_9.ds__extract_quarter
+ , subq_9.ds__extract_month
+ , subq_9.ds__extract_day
+ , subq_9.ds__extract_dow
+ , subq_9.ds__extract_doy
+ , subq_9.ds_partitioned__day
+ , subq_9.ds_partitioned__week
+ , subq_9.ds_partitioned__month
+ , subq_9.ds_partitioned__quarter
+ , subq_9.ds_partitioned__year
+ , subq_9.ds_partitioned__extract_year
+ , subq_9.ds_partitioned__extract_quarter
+ , subq_9.ds_partitioned__extract_month
+ , subq_9.ds_partitioned__extract_day
+ , subq_9.ds_partitioned__extract_dow
+ , subq_9.ds_partitioned__extract_doy
+ , subq_9.paid_at__day
+ , subq_9.paid_at__week
+ , subq_9.paid_at__month
+ , subq_9.paid_at__quarter
+ , subq_9.paid_at__year
+ , subq_9.paid_at__extract_year
+ , subq_9.paid_at__extract_quarter
+ , subq_9.paid_at__extract_month
+ , subq_9.paid_at__extract_day
+ , subq_9.paid_at__extract_dow
+ , subq_9.paid_at__extract_doy
+ , subq_9.booking__ds__day
+ , subq_9.booking__ds__week
+ , subq_9.booking__ds__month
+ , subq_9.booking__ds__quarter
+ , subq_9.booking__ds__year
+ , subq_9.booking__ds__extract_year
+ , subq_9.booking__ds__extract_quarter
+ , subq_9.booking__ds__extract_month
+ , subq_9.booking__ds__extract_day
+ , subq_9.booking__ds__extract_dow
+ , subq_9.booking__ds__extract_doy
+ , subq_9.booking__ds_partitioned__day
+ , subq_9.booking__ds_partitioned__week
+ , subq_9.booking__ds_partitioned__month
+ , subq_9.booking__ds_partitioned__quarter
+ , subq_9.booking__ds_partitioned__year
+ , subq_9.booking__ds_partitioned__extract_year
+ , subq_9.booking__ds_partitioned__extract_quarter
+ , subq_9.booking__ds_partitioned__extract_month
+ , subq_9.booking__ds_partitioned__extract_day
+ , subq_9.booking__ds_partitioned__extract_dow
+ , subq_9.booking__ds_partitioned__extract_doy
+ , subq_9.booking__paid_at__day
+ , subq_9.booking__paid_at__week
+ , subq_9.booking__paid_at__month
+ , subq_9.booking__paid_at__quarter
+ , subq_9.booking__paid_at__year
+ , subq_9.booking__paid_at__extract_year
+ , subq_9.booking__paid_at__extract_quarter
+ , subq_9.booking__paid_at__extract_month
+ , subq_9.booking__paid_at__extract_day
+ , subq_9.booking__paid_at__extract_dow
+ , subq_9.booking__paid_at__extract_doy
+ , subq_9.ds__day AS metric_time__day
+ , subq_9.ds__week AS metric_time__week
+ , subq_9.ds__month AS metric_time__month
+ , subq_9.ds__quarter AS metric_time__quarter
+ , subq_9.ds__year AS metric_time__year
+ , subq_9.ds__extract_year AS metric_time__extract_year
+ , subq_9.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_9.ds__extract_month AS metric_time__extract_month
+ , subq_9.ds__extract_day AS metric_time__extract_day
+ , subq_9.ds__extract_dow AS metric_time__extract_dow
+ , subq_9.ds__extract_doy AS metric_time__extract_doy
+ , subq_9.listing
+ , subq_9.guest
+ , subq_9.host
+ , subq_9.booking__listing
+ , subq_9.booking__guest
+ , subq_9.booking__host
+ , subq_9.is_instant
+ , subq_9.booking__is_instant
+ , subq_9.bookings
+ , subq_9.instant_bookings
+ , subq_9.booking_value
+ , subq_9.max_booking_value
+ , subq_9.min_booking_value
+ , subq_9.bookers
+ , subq_9.average_booking_value
+ , subq_9.referred_bookings
+ , subq_9.median_booking_value
+ , subq_9.booking_value_p99
+ , subq_9.discrete_booking_value_p99
+ , subq_9.approximate_continuous_booking_value_p99
+ , subq_9.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_0
- ) subq_1
- ) subq_2
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds) END AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) END AS ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS paid_at__extract_day
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.paid_at) END AS paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS paid_at__extract_doy
+ , bookings_source_src_28000.is_instant AS booking__is_instant
+ , DATE_TRUNC('day', bookings_source_src_28000.ds) AS booking__ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS booking__ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS booking__ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS booking__ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds) END AS booking__ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS booking__ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) END AS booking__ds_partitioned__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds_partitioned) AS booking__ds_partitioned__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.paid_at) AS booking__paid_at__day
+ , DATE_TRUNC('week', bookings_source_src_28000.paid_at) AS booking__paid_at__week
+ , DATE_TRUNC('month', bookings_source_src_28000.paid_at) AS booking__paid_at__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.paid_at) AS booking__paid_at__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.paid_at) 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
+ , EXTRACT(day FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_day
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.paid_at) END AS booking__paid_at__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.paid_at) AS booking__paid_at__extract_doy
+ , bookings_source_src_28000.listing_id AS listing
+ , bookings_source_src_28000.guest_id AS guest
+ , bookings_source_src_28000.host_id AS host
+ , bookings_source_src_28000.listing_id AS booking__listing
+ , bookings_source_src_28000.guest_id AS booking__guest
+ , bookings_source_src_28000.host_id AS booking__host
+ FROM ***************************.fct_bookings bookings_source_src_28000
+ ) subq_9
+ ) subq_10
+ ) subq_11
WHERE metric_time__day = '2020-01-01' or metric_time__day = '2020-01-14'
- ) subq_3
+ ) subq_12
GROUP BY
- subq_3.metric_time__day
- ) subq_4
- ) subq_5
+ subq_12.metric_time__day
+ ) subq_13
+ ) subq_14
FULL OUTER JOIN (
-- Compute Metrics via Expressions
SELECT
- subq_13.metric_time__day
- , subq_13.bookings AS bookings_2_weeks_ago
+ subq_22.metric_time__day
+ , subq_22.bookings AS bookings_2_weeks_ago
FROM (
-- Aggregate Measures
SELECT
- subq_12.metric_time__day
- , SUM(subq_12.bookings) AS bookings
+ subq_21.metric_time__day
+ , SUM(subq_21.bookings) AS bookings
FROM (
-- Constrain Output with WHERE
SELECT
- subq_11.metric_time__day
- , subq_11.bookings
+ subq_20.metric_time__day
+ , subq_20.bookings
FROM (
-- Pass Only Elements: ['bookings', 'metric_time__day']
SELECT
- subq_10.metric_time__day
- , subq_10.bookings
+ subq_19.metric_time__day
+ , subq_19.bookings
FROM (
-- Join to Time Spine Dataset
SELECT
- subq_8.metric_time__day AS metric_time__day
- , subq_7.ds__day AS ds__day
- , subq_7.ds__week AS ds__week
- , subq_7.ds__month AS ds__month
- , subq_7.ds__quarter AS ds__quarter
- , subq_7.ds__year AS ds__year
- , subq_7.ds__extract_year AS ds__extract_year
- , subq_7.ds__extract_quarter AS ds__extract_quarter
- , subq_7.ds__extract_month AS ds__extract_month
- , subq_7.ds__extract_day AS ds__extract_day
- , subq_7.ds__extract_dow AS ds__extract_dow
- , subq_7.ds__extract_doy AS ds__extract_doy
- , subq_7.ds_partitioned__day AS ds_partitioned__day
- , subq_7.ds_partitioned__week AS ds_partitioned__week
- , subq_7.ds_partitioned__month AS ds_partitioned__month
- , subq_7.ds_partitioned__quarter AS ds_partitioned__quarter
- , subq_7.ds_partitioned__year AS ds_partitioned__year
- , subq_7.ds_partitioned__extract_year AS ds_partitioned__extract_year
- , subq_7.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
- , subq_7.ds_partitioned__extract_month AS ds_partitioned__extract_month
- , subq_7.ds_partitioned__extract_day AS ds_partitioned__extract_day
- , subq_7.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
- , subq_7.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
- , subq_7.paid_at__day AS paid_at__day
- , subq_7.paid_at__week AS paid_at__week
- , subq_7.paid_at__month AS paid_at__month
- , subq_7.paid_at__quarter AS paid_at__quarter
- , subq_7.paid_at__year AS paid_at__year
- , subq_7.paid_at__extract_year AS paid_at__extract_year
- , subq_7.paid_at__extract_quarter AS paid_at__extract_quarter
- , subq_7.paid_at__extract_month AS paid_at__extract_month
- , subq_7.paid_at__extract_day AS paid_at__extract_day
- , subq_7.paid_at__extract_dow AS paid_at__extract_dow
- , subq_7.paid_at__extract_doy AS paid_at__extract_doy
- , subq_7.booking__ds__day AS booking__ds__day
- , subq_7.booking__ds__week AS booking__ds__week
- , subq_7.booking__ds__month AS booking__ds__month
- , subq_7.booking__ds__quarter AS booking__ds__quarter
- , subq_7.booking__ds__year AS booking__ds__year
- , subq_7.booking__ds__extract_year AS booking__ds__extract_year
- , subq_7.booking__ds__extract_quarter AS booking__ds__extract_quarter
- , subq_7.booking__ds__extract_month AS booking__ds__extract_month
- , subq_7.booking__ds__extract_day AS booking__ds__extract_day
- , subq_7.booking__ds__extract_dow AS booking__ds__extract_dow
- , subq_7.booking__ds__extract_doy AS booking__ds__extract_doy
- , subq_7.booking__ds_partitioned__day AS booking__ds_partitioned__day
- , subq_7.booking__ds_partitioned__week AS booking__ds_partitioned__week
- , subq_7.booking__ds_partitioned__month AS booking__ds_partitioned__month
- , subq_7.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
- , subq_7.booking__ds_partitioned__year AS booking__ds_partitioned__year
- , subq_7.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
- , subq_7.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
- , subq_7.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
- , subq_7.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
- , subq_7.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
- , subq_7.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
- , subq_7.booking__paid_at__day AS booking__paid_at__day
- , subq_7.booking__paid_at__week AS booking__paid_at__week
- , subq_7.booking__paid_at__month AS booking__paid_at__month
- , subq_7.booking__paid_at__quarter AS booking__paid_at__quarter
- , subq_7.booking__paid_at__year AS booking__paid_at__year
- , subq_7.booking__paid_at__extract_year AS booking__paid_at__extract_year
- , subq_7.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
- , subq_7.booking__paid_at__extract_month AS booking__paid_at__extract_month
- , subq_7.booking__paid_at__extract_day AS booking__paid_at__extract_day
- , subq_7.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
- , subq_7.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
- , subq_7.listing AS listing
- , subq_7.guest AS guest
- , subq_7.host AS host
- , subq_7.booking__listing AS booking__listing
- , subq_7.booking__guest AS booking__guest
- , subq_7.booking__host AS booking__host
- , subq_7.is_instant AS is_instant
- , subq_7.booking__is_instant AS booking__is_instant
- , subq_7.bookings AS bookings
- , subq_7.instant_bookings AS instant_bookings
- , subq_7.booking_value AS booking_value
- , subq_7.max_booking_value AS max_booking_value
- , subq_7.min_booking_value AS min_booking_value
- , subq_7.bookers AS bookers
- , subq_7.average_booking_value AS average_booking_value
- , subq_7.referred_bookings AS referred_bookings
- , subq_7.median_booking_value AS median_booking_value
- , subq_7.booking_value_p99 AS booking_value_p99
- , subq_7.discrete_booking_value_p99 AS discrete_booking_value_p99
- , subq_7.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
- , subq_7.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
+ subq_17.metric_time__day AS metric_time__day
+ , subq_16.ds__day AS ds__day
+ , subq_16.ds__week AS ds__week
+ , subq_16.ds__month AS ds__month
+ , subq_16.ds__quarter AS ds__quarter
+ , subq_16.ds__year AS ds__year
+ , subq_16.ds__extract_year AS ds__extract_year
+ , subq_16.ds__extract_quarter AS ds__extract_quarter
+ , subq_16.ds__extract_month AS ds__extract_month
+ , subq_16.ds__extract_day AS ds__extract_day
+ , subq_16.ds__extract_dow AS ds__extract_dow
+ , subq_16.ds__extract_doy AS ds__extract_doy
+ , subq_16.ds_partitioned__day AS ds_partitioned__day
+ , subq_16.ds_partitioned__week AS ds_partitioned__week
+ , subq_16.ds_partitioned__month AS ds_partitioned__month
+ , subq_16.ds_partitioned__quarter AS ds_partitioned__quarter
+ , subq_16.ds_partitioned__year AS ds_partitioned__year
+ , subq_16.ds_partitioned__extract_year AS ds_partitioned__extract_year
+ , subq_16.ds_partitioned__extract_quarter AS ds_partitioned__extract_quarter
+ , subq_16.ds_partitioned__extract_month AS ds_partitioned__extract_month
+ , subq_16.ds_partitioned__extract_day AS ds_partitioned__extract_day
+ , subq_16.ds_partitioned__extract_dow AS ds_partitioned__extract_dow
+ , subq_16.ds_partitioned__extract_doy AS ds_partitioned__extract_doy
+ , subq_16.paid_at__day AS paid_at__day
+ , subq_16.paid_at__week AS paid_at__week
+ , subq_16.paid_at__month AS paid_at__month
+ , subq_16.paid_at__quarter AS paid_at__quarter
+ , subq_16.paid_at__year AS paid_at__year
+ , subq_16.paid_at__extract_year AS paid_at__extract_year
+ , subq_16.paid_at__extract_quarter AS paid_at__extract_quarter
+ , subq_16.paid_at__extract_month AS paid_at__extract_month
+ , subq_16.paid_at__extract_day AS paid_at__extract_day
+ , subq_16.paid_at__extract_dow AS paid_at__extract_dow
+ , subq_16.paid_at__extract_doy AS paid_at__extract_doy
+ , subq_16.booking__ds__day AS booking__ds__day
+ , subq_16.booking__ds__week AS booking__ds__week
+ , subq_16.booking__ds__month AS booking__ds__month
+ , subq_16.booking__ds__quarter AS booking__ds__quarter
+ , subq_16.booking__ds__year AS booking__ds__year
+ , subq_16.booking__ds__extract_year AS booking__ds__extract_year
+ , subq_16.booking__ds__extract_quarter AS booking__ds__extract_quarter
+ , subq_16.booking__ds__extract_month AS booking__ds__extract_month
+ , subq_16.booking__ds__extract_day AS booking__ds__extract_day
+ , subq_16.booking__ds__extract_dow AS booking__ds__extract_dow
+ , subq_16.booking__ds__extract_doy AS booking__ds__extract_doy
+ , subq_16.booking__ds_partitioned__day AS booking__ds_partitioned__day
+ , subq_16.booking__ds_partitioned__week AS booking__ds_partitioned__week
+ , subq_16.booking__ds_partitioned__month AS booking__ds_partitioned__month
+ , subq_16.booking__ds_partitioned__quarter AS booking__ds_partitioned__quarter
+ , subq_16.booking__ds_partitioned__year AS booking__ds_partitioned__year
+ , subq_16.booking__ds_partitioned__extract_year AS booking__ds_partitioned__extract_year
+ , subq_16.booking__ds_partitioned__extract_quarter AS booking__ds_partitioned__extract_quarter
+ , subq_16.booking__ds_partitioned__extract_month AS booking__ds_partitioned__extract_month
+ , subq_16.booking__ds_partitioned__extract_day AS booking__ds_partitioned__extract_day
+ , subq_16.booking__ds_partitioned__extract_dow AS booking__ds_partitioned__extract_dow
+ , subq_16.booking__ds_partitioned__extract_doy AS booking__ds_partitioned__extract_doy
+ , subq_16.booking__paid_at__day AS booking__paid_at__day
+ , subq_16.booking__paid_at__week AS booking__paid_at__week
+ , subq_16.booking__paid_at__month AS booking__paid_at__month
+ , subq_16.booking__paid_at__quarter AS booking__paid_at__quarter
+ , subq_16.booking__paid_at__year AS booking__paid_at__year
+ , subq_16.booking__paid_at__extract_year AS booking__paid_at__extract_year
+ , subq_16.booking__paid_at__extract_quarter AS booking__paid_at__extract_quarter
+ , subq_16.booking__paid_at__extract_month AS booking__paid_at__extract_month
+ , subq_16.booking__paid_at__extract_day AS booking__paid_at__extract_day
+ , subq_16.booking__paid_at__extract_dow AS booking__paid_at__extract_dow
+ , subq_16.booking__paid_at__extract_doy AS booking__paid_at__extract_doy
+ , subq_16.listing AS listing
+ , subq_16.guest AS guest
+ , subq_16.host AS host
+ , subq_16.booking__listing AS booking__listing
+ , subq_16.booking__guest AS booking__guest
+ , subq_16.booking__host AS booking__host
+ , subq_16.is_instant AS is_instant
+ , subq_16.booking__is_instant AS booking__is_instant
+ , subq_16.bookings AS bookings
+ , subq_16.instant_bookings AS instant_bookings
+ , subq_16.booking_value AS booking_value
+ , subq_16.max_booking_value AS max_booking_value
+ , subq_16.min_booking_value AS min_booking_value
+ , subq_16.bookers AS bookers
+ , subq_16.average_booking_value AS average_booking_value
+ , subq_16.referred_bookings AS referred_bookings
+ , subq_16.median_booking_value AS median_booking_value
+ , subq_16.booking_value_p99 AS booking_value_p99
+ , subq_16.discrete_booking_value_p99 AS discrete_booking_value_p99
+ , subq_16.approximate_continuous_booking_value_p99 AS approximate_continuous_booking_value_p99
+ , subq_16.approximate_discrete_booking_value_p99 AS approximate_discrete_booking_value_p99
FROM (
-- Time Spine
SELECT
- subq_9.ds AS metric_time__day
- FROM ***************************.mf_time_spine subq_9
- ) subq_8
+ subq_18.ds AS metric_time__day
+ FROM ***************************.mf_time_spine subq_18
+ ) subq_17
INNER JOIN (
-- Metric Time Dimension 'ds'
SELECT
- subq_6.ds__day
- , subq_6.ds__week
- , subq_6.ds__month
- , subq_6.ds__quarter
- , subq_6.ds__year
- , subq_6.ds__extract_year
- , subq_6.ds__extract_quarter
- , subq_6.ds__extract_month
- , subq_6.ds__extract_day
- , subq_6.ds__extract_dow
- , subq_6.ds__extract_doy
- , subq_6.ds_partitioned__day
- , subq_6.ds_partitioned__week
- , subq_6.ds_partitioned__month
- , subq_6.ds_partitioned__quarter
- , subq_6.ds_partitioned__year
- , subq_6.ds_partitioned__extract_year
- , subq_6.ds_partitioned__extract_quarter
- , subq_6.ds_partitioned__extract_month
- , subq_6.ds_partitioned__extract_day
- , subq_6.ds_partitioned__extract_dow
- , subq_6.ds_partitioned__extract_doy
- , subq_6.paid_at__day
- , subq_6.paid_at__week
- , subq_6.paid_at__month
- , subq_6.paid_at__quarter
- , subq_6.paid_at__year
- , subq_6.paid_at__extract_year
- , subq_6.paid_at__extract_quarter
- , subq_6.paid_at__extract_month
- , subq_6.paid_at__extract_day
- , subq_6.paid_at__extract_dow
- , subq_6.paid_at__extract_doy
- , subq_6.booking__ds__day
- , subq_6.booking__ds__week
- , subq_6.booking__ds__month
- , subq_6.booking__ds__quarter
- , subq_6.booking__ds__year
- , subq_6.booking__ds__extract_year
- , subq_6.booking__ds__extract_quarter
- , subq_6.booking__ds__extract_month
- , subq_6.booking__ds__extract_day
- , subq_6.booking__ds__extract_dow
- , subq_6.booking__ds__extract_doy
- , subq_6.booking__ds_partitioned__day
- , subq_6.booking__ds_partitioned__week
- , subq_6.booking__ds_partitioned__month
- , subq_6.booking__ds_partitioned__quarter
- , subq_6.booking__ds_partitioned__year
- , subq_6.booking__ds_partitioned__extract_year
- , subq_6.booking__ds_partitioned__extract_quarter
- , subq_6.booking__ds_partitioned__extract_month
- , subq_6.booking__ds_partitioned__extract_day
- , subq_6.booking__ds_partitioned__extract_dow
- , subq_6.booking__ds_partitioned__extract_doy
- , subq_6.booking__paid_at__day
- , subq_6.booking__paid_at__week
- , subq_6.booking__paid_at__month
- , subq_6.booking__paid_at__quarter
- , subq_6.booking__paid_at__year
- , subq_6.booking__paid_at__extract_year
- , subq_6.booking__paid_at__extract_quarter
- , subq_6.booking__paid_at__extract_month
- , subq_6.booking__paid_at__extract_day
- , subq_6.booking__paid_at__extract_dow
- , subq_6.booking__paid_at__extract_doy
- , subq_6.ds__day AS metric_time__day
- , subq_6.ds__week AS metric_time__week
- , subq_6.ds__month AS metric_time__month
- , subq_6.ds__quarter AS metric_time__quarter
- , subq_6.ds__year AS metric_time__year
- , subq_6.ds__extract_year AS metric_time__extract_year
- , subq_6.ds__extract_quarter AS metric_time__extract_quarter
- , subq_6.ds__extract_month AS metric_time__extract_month
- , subq_6.ds__extract_day AS metric_time__extract_day
- , subq_6.ds__extract_dow AS metric_time__extract_dow
- , subq_6.ds__extract_doy AS metric_time__extract_doy
- , subq_6.listing
- , subq_6.guest
- , subq_6.host
- , subq_6.booking__listing
- , subq_6.booking__guest
- , subq_6.booking__host
- , subq_6.is_instant
- , subq_6.booking__is_instant
- , subq_6.bookings
- , subq_6.instant_bookings
- , subq_6.booking_value
- , subq_6.max_booking_value
- , subq_6.min_booking_value
- , subq_6.bookers
- , subq_6.average_booking_value
- , subq_6.referred_bookings
- , subq_6.median_booking_value
- , subq_6.booking_value_p99
- , subq_6.discrete_booking_value_p99
- , subq_6.approximate_continuous_booking_value_p99
- , subq_6.approximate_discrete_booking_value_p99
+ subq_15.ds__day
+ , subq_15.ds__week
+ , subq_15.ds__month
+ , subq_15.ds__quarter
+ , subq_15.ds__year
+ , subq_15.ds__extract_year
+ , subq_15.ds__extract_quarter
+ , subq_15.ds__extract_month
+ , subq_15.ds__extract_day
+ , subq_15.ds__extract_dow
+ , subq_15.ds__extract_doy
+ , subq_15.ds_partitioned__day
+ , subq_15.ds_partitioned__week
+ , subq_15.ds_partitioned__month
+ , subq_15.ds_partitioned__quarter
+ , subq_15.ds_partitioned__year
+ , subq_15.ds_partitioned__extract_year
+ , subq_15.ds_partitioned__extract_quarter
+ , subq_15.ds_partitioned__extract_month
+ , subq_15.ds_partitioned__extract_day
+ , subq_15.ds_partitioned__extract_dow
+ , subq_15.ds_partitioned__extract_doy
+ , subq_15.paid_at__day
+ , subq_15.paid_at__week
+ , subq_15.paid_at__month
+ , subq_15.paid_at__quarter
+ , subq_15.paid_at__year
+ , subq_15.paid_at__extract_year
+ , subq_15.paid_at__extract_quarter
+ , subq_15.paid_at__extract_month
+ , subq_15.paid_at__extract_day
+ , subq_15.paid_at__extract_dow
+ , subq_15.paid_at__extract_doy
+ , subq_15.booking__ds__day
+ , subq_15.booking__ds__week
+ , subq_15.booking__ds__month
+ , subq_15.booking__ds__quarter
+ , subq_15.booking__ds__year
+ , subq_15.booking__ds__extract_year
+ , subq_15.booking__ds__extract_quarter
+ , subq_15.booking__ds__extract_month
+ , subq_15.booking__ds__extract_day
+ , subq_15.booking__ds__extract_dow
+ , subq_15.booking__ds__extract_doy
+ , subq_15.booking__ds_partitioned__day
+ , subq_15.booking__ds_partitioned__week
+ , subq_15.booking__ds_partitioned__month
+ , subq_15.booking__ds_partitioned__quarter
+ , subq_15.booking__ds_partitioned__year
+ , subq_15.booking__ds_partitioned__extract_year
+ , subq_15.booking__ds_partitioned__extract_quarter
+ , subq_15.booking__ds_partitioned__extract_month
+ , subq_15.booking__ds_partitioned__extract_day
+ , subq_15.booking__ds_partitioned__extract_dow
+ , subq_15.booking__ds_partitioned__extract_doy
+ , subq_15.booking__paid_at__day
+ , subq_15.booking__paid_at__week
+ , subq_15.booking__paid_at__month
+ , subq_15.booking__paid_at__quarter
+ , subq_15.booking__paid_at__year
+ , subq_15.booking__paid_at__extract_year
+ , subq_15.booking__paid_at__extract_quarter
+ , subq_15.booking__paid_at__extract_month
+ , subq_15.booking__paid_at__extract_day
+ , subq_15.booking__paid_at__extract_dow
+ , subq_15.booking__paid_at__extract_doy
+ , subq_15.ds__day AS metric_time__day
+ , subq_15.ds__week AS metric_time__week
+ , subq_15.ds__month AS metric_time__month
+ , subq_15.ds__quarter AS metric_time__quarter
+ , subq_15.ds__year AS metric_time__year
+ , subq_15.ds__extract_year AS metric_time__extract_year
+ , subq_15.ds__extract_quarter AS metric_time__extract_quarter
+ , subq_15.ds__extract_month AS metric_time__extract_month
+ , subq_15.ds__extract_day AS metric_time__extract_day
+ , subq_15.ds__extract_dow AS metric_time__extract_dow
+ , subq_15.ds__extract_doy AS metric_time__extract_doy
+ , subq_15.listing
+ , subq_15.guest
+ , subq_15.host
+ , subq_15.booking__listing
+ , subq_15.booking__guest
+ , subq_15.booking__host
+ , subq_15.is_instant
+ , subq_15.booking__is_instant
+ , subq_15.bookings
+ , subq_15.instant_bookings
+ , subq_15.booking_value
+ , subq_15.max_booking_value
+ , subq_15.min_booking_value
+ , subq_15.bookers
+ , subq_15.average_booking_value
+ , subq_15.referred_bookings
+ , subq_15.median_booking_value
+ , subq_15.booking_value_p99
+ , subq_15.discrete_booking_value_p99
+ , subq_15.approximate_continuous_booking_value_p99
+ , subq_15.approximate_discrete_booking_value_p99
FROM (
-- Read Elements From Semantic Model 'bookings_source'
SELECT
1 AS bookings
, CASE WHEN is_instant THEN 1 ELSE 0 END AS instant_bookings
- , bookings_source_src_28001.booking_value
- , bookings_source_src_28001.booking_value AS max_booking_value
- , bookings_source_src_28001.booking_value AS min_booking_value
- , bookings_source_src_28001.guest_id AS bookers
- , bookings_source_src_28001.booking_value AS average_booking_value
- , bookings_source_src_28001.booking_value AS booking_payments
+ , bookings_source_src_28000.booking_value
+ , bookings_source_src_28000.booking_value AS max_booking_value
+ , bookings_source_src_28000.booking_value AS min_booking_value
+ , bookings_source_src_28000.guest_id AS bookers
+ , bookings_source_src_28000.booking_value AS average_booking_value
+ , bookings_source_src_28000.booking_value AS booking_payments
, CASE WHEN referrer_id IS NOT NULL THEN 1 ELSE 0 END AS referred_bookings
- , bookings_source_src_28001.booking_value AS median_booking_value
- , bookings_source_src_28001.booking_value AS booking_value_p99
- , bookings_source_src_28001.booking_value AS discrete_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_continuous_booking_value_p99
- , bookings_source_src_28001.booking_value AS approximate_discrete_booking_value_p99
- , bookings_source_src_28001.is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS ds__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS paid_at__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS paid_at__extract_doy
- , bookings_source_src_28001.is_instant AS booking__is_instant
- , DATE_TRUNC('day', bookings_source_src_28001.ds) AS booking__ds__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds) AS booking__ds__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds) AS booking__ds__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds) AS booking__ds__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds) AS booking__ds__year
- , EXTRACT(year FROM bookings_source_src_28001.ds) AS booking__ds__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds) AS booking__ds__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds) AS booking__ds__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds) AS booking__ds__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds) END AS booking__ds__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds) AS booking__ds__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__day
- , DATE_TRUNC('week', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__week
- , DATE_TRUNC('month', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__year
- , EXTRACT(year FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.ds_partitioned) END AS booking__ds_partitioned__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.ds_partitioned) AS booking__ds_partitioned__extract_doy
- , DATE_TRUNC('day', bookings_source_src_28001.paid_at) AS booking__paid_at__day
- , DATE_TRUNC('week', bookings_source_src_28001.paid_at) AS booking__paid_at__week
- , DATE_TRUNC('month', bookings_source_src_28001.paid_at) AS booking__paid_at__month
- , DATE_TRUNC('quarter', bookings_source_src_28001.paid_at) AS booking__paid_at__quarter
- , DATE_TRUNC('year', bookings_source_src_28001.paid_at) AS booking__paid_at__year
- , EXTRACT(year FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_year
- , EXTRACT(quarter FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_quarter
- , EXTRACT(month FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_month
- , EXTRACT(day FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_day
- , CASE WHEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) = 0 THEN EXTRACT(dow FROM bookings_source_src_28001.paid_at) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28001.paid_at) END AS booking__paid_at__extract_dow
- , EXTRACT(doy FROM bookings_source_src_28001.paid_at) AS booking__paid_at__extract_doy
- , bookings_source_src_28001.listing_id AS listing
- , bookings_source_src_28001.guest_id AS guest
- , bookings_source_src_28001.host_id AS host
- , bookings_source_src_28001.listing_id AS booking__listing
- , bookings_source_src_28001.guest_id AS booking__guest
- , bookings_source_src_28001.host_id AS booking__host
- FROM ***************************.fct_bookings bookings_source_src_28001
- ) subq_6
- ) subq_7
+ , bookings_source_src_28000.booking_value AS median_booking_value
+ , bookings_source_src_28000.booking_value AS booking_value_p99
+ , bookings_source_src_28000.booking_value AS discrete_booking_value_p99
+ , 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('day', bookings_source_src_28000.ds) AS ds__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds) AS ds__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds) AS ds__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds) AS ds__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds) END AS ds__extract_dow
+ , EXTRACT(doy FROM bookings_source_src_28000.ds) AS ds__extract_doy
+ , DATE_TRUNC('day', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__day
+ , DATE_TRUNC('week', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__week
+ , DATE_TRUNC('month', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__month
+ , DATE_TRUNC('quarter', bookings_source_src_28000.ds_partitioned) AS ds_partitioned__quarter
+ , DATE_TRUNC('year', bookings_source_src_28000.ds_partitioned) 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
+ , CASE WHEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) = 0 THEN EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) + 7 ELSE EXTRACT(dow FROM bookings_source_src_28000.ds_partitioned) END AS ds_partitioned__extract_dow
+ , EXTRA